mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Compare commits
6 Commits
650fa6a10e
...
cherry-pic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12f2252700 | ||
|
|
6f6a9a940b | ||
|
|
3ca67858f0 | ||
|
|
3f18c21c07 | ||
|
|
3ebcca66f3 | ||
|
|
d9196060c2 |
@@ -67,7 +67,7 @@ metadata:
|
||||
name: argocd-cmd-params-cm
|
||||
data:
|
||||
application.namespaces: app-team-one, app-team-two
|
||||
notificationscontroller.selfservice.enabled: true
|
||||
notificationscontroller.selfservice.enabled: "true"
|
||||
```
|
||||
|
||||
To use this feature, you can deploy configmap named `argocd-notifications-cm` and possibly a secret `argocd-notifications-secret` in the namespace where the Argo CD application lives.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
| Argo CD version | Kubernetes versions |
|
||||
|-----------------|---------------------|
|
||||
| 2.7 | v1.26, v1.25, v1.24, v1.23 |
|
||||
| 2.6 | v1.24, v1.23, v1.22 |
|
||||
| 2.5 | v1.24, v1.23, v1.22 |
|
||||
|
||||
| 2.10 | v1.28, v1.27, v1.26, v1.25 |
|
||||
| 2.9 | v1.28, v1.27, v1.26, v1.25 |
|
||||
| 2.8 | v1.27, v1.26, v1.25, v1.24 |
|
||||
|
||||
@@ -56,7 +56,13 @@ Application.
|
||||
Add the following entry in the argocd-cmd-params-cm configmap:
|
||||
|
||||
```
|
||||
controller.diff.server.side: "true"
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: argocd-cmd-params-cm
|
||||
data:
|
||||
controller.diff.server.side: "true"
|
||||
...
|
||||
```
|
||||
|
||||
Note: It is necessary to restart the `argocd-application-controller`
|
||||
|
||||
@@ -36,3 +36,11 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
|
||||
@@ -5,7 +5,7 @@ kind: Kustomization
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: latest
|
||||
newTag: v2.10.0-rc1
|
||||
resources:
|
||||
- ./application-controller
|
||||
- ./dex
|
||||
|
||||
@@ -20582,6 +20582,14 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
@@ -21018,7 +21026,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.scm.providers
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -21342,7 +21350,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -21394,7 +21402,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -21649,7 +21657,7 @@ spec:
|
||||
key: controller.diff.server.side
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -12,4 +12,4 @@ resources:
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: latest
|
||||
newTag: v2.10.0-rc1
|
||||
|
||||
@@ -12,7 +12,7 @@ patches:
|
||||
images:
|
||||
- name: quay.io/argoproj/argocd
|
||||
newName: quay.io/argoproj/argocd
|
||||
newTag: latest
|
||||
newTag: v2.10.0-rc1
|
||||
resources:
|
||||
- ../../base/application-controller
|
||||
- ../../base/applicationset-controller
|
||||
|
||||
@@ -20618,6 +20618,14 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
@@ -22275,7 +22283,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.scm.providers
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -22398,7 +22406,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -22480,7 +22488,7 @@ spec:
|
||||
key: notificationscontroller.selfservice.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -22835,7 +22843,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -22887,7 +22895,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -23200,7 +23208,7 @@ spec:
|
||||
key: server.k8sclient.retry.base.backoff
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -23482,7 +23490,7 @@ spec:
|
||||
key: controller.diff.server.side
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -109,6 +109,14 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
@@ -1660,7 +1668,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.scm.providers
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -1783,7 +1791,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -1865,7 +1873,7 @@ spec:
|
||||
key: notificationscontroller.selfservice.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -2220,7 +2228,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -2272,7 +2280,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -2585,7 +2593,7 @@ spec:
|
||||
key: server.k8sclient.retry.base.backoff
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -2867,7 +2875,7 @@ spec:
|
||||
key: controller.diff.server.side
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -20609,6 +20609,14 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
@@ -21370,7 +21378,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.scm.providers
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -21493,7 +21501,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -21575,7 +21583,7 @@ spec:
|
||||
key: notificationscontroller.selfservice.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -21881,7 +21889,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -21933,7 +21941,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -22244,7 +22252,7 @@ spec:
|
||||
key: server.k8sclient.retry.base.backoff
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -22526,7 +22534,7 @@ spec:
|
||||
key: controller.diff.server.side
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -100,6 +100,14 @@ rules:
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
@@ -755,7 +763,7 @@ spec:
|
||||
key: applicationsetcontroller.enable.scm.providers
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-applicationset-controller
|
||||
ports:
|
||||
@@ -878,7 +886,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /shared/argocd-dex
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: copyutil
|
||||
securityContext:
|
||||
@@ -960,7 +968,7 @@ spec:
|
||||
key: notificationscontroller.selfservice.enabled
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
@@ -1266,7 +1274,7 @@ spec:
|
||||
value: /helm-working-dir
|
||||
- name: HELM_DATA_HOME
|
||||
value: /helm-working-dir
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -1318,7 +1326,7 @@ spec:
|
||||
- -n
|
||||
- /usr/local/bin/argocd
|
||||
- /var/run/argocd/argocd-cmp-server
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
name: copyutil
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -1629,7 +1637,7 @@ spec:
|
||||
key: server.k8sclient.retry.base.backoff
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
@@ -1911,7 +1919,7 @@ spec:
|
||||
key: controller.diff.server.side
|
||||
name: argocd-cmd-params-cm
|
||||
optional: true
|
||||
image: quay.io/argoproj/argocd:latest
|
||||
image: quay.io/argoproj/argocd:v2.10.0-rc1
|
||||
imagePullPolicy: Always
|
||||
name: argocd-application-controller
|
||||
ports:
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
hs = { status = "Progressing", message = "AdvancedCronJobs has active jobs" }
|
||||
-- Extract lastScheduleTime and convert to time objects
|
||||
lastScheduleTime = nil
|
||||
|
||||
if obj.status.lastScheduleTime ~= nil then
|
||||
local year, month, day, hour, min, sec = string.match(obj.status.lastScheduleTime, "(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)Z")
|
||||
lastScheduleTime = os.time({year=year, month=month, day=day, hour=hour, min=min, sec=sec})
|
||||
end
|
||||
|
||||
|
||||
if lastScheduleTime == nil and obj.spec.paused == true then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "AdvancedCronJob is Paused"
|
||||
return hs
|
||||
end
|
||||
|
||||
-- AdvancedCronJobs are progressing if they have any object in the "active" state
|
||||
if obj.status.active ~= nil and #obj.status.active > 0 then
|
||||
hs.status = "Progressing"
|
||||
hs.message = "AdvancedCronJobs has active jobs"
|
||||
return hs
|
||||
end
|
||||
-- AdvancedCronJobs are Degraded if they don't have lastScheduleTime
|
||||
if lastScheduleTime == nil then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "AdvancedCronJobs has not run successfully"
|
||||
return hs
|
||||
end
|
||||
-- AdvancedCronJobs are healthy if they have lastScheduleTime
|
||||
if lastScheduleTime ~= nil then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "AdvancedCronJobs has run successfully"
|
||||
return hs
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: AdvancedCronJobs has run successfully
|
||||
inputPath: testdata/lastScheduleTime.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: AdvancedCronJobs has not run successfully
|
||||
inputPath: testdata/notScheduled.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: AdvancedCronJobs has active jobs
|
||||
inputPath: testdata/activeJobs.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: AdvancedCronJob is Paused
|
||||
inputPath: testdata/suspended.yaml
|
||||
30
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/activeJobs.yaml
vendored
Normal file
30
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/activeJobs.yaml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: AdvancedCronJob
|
||||
metadata:
|
||||
name: acj-test
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
template:
|
||||
broadcastJobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 30
|
||||
|
||||
status:
|
||||
active:
|
||||
- apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: BroadcastJob
|
||||
name: acj-test-1694882400
|
||||
namespace: default
|
||||
resourceVersion: '4012'
|
||||
uid: 2b08a429-a43b-4382-8e5d-3db0c72b5b13
|
||||
lastScheduleTime: '2023-09-16T16:40:00Z'
|
||||
type: BroadcastJob
|
||||
23
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/lastScheduleTime.yaml
vendored
Normal file
23
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/lastScheduleTime.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: AdvancedCronJob
|
||||
metadata:
|
||||
name: acj-test
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
template:
|
||||
broadcastJobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 30
|
||||
|
||||
status:
|
||||
lastScheduleTime: "2023-09-16T16:29:00Z"
|
||||
type: BroadcastJob
|
||||
22
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/notScheduled.yaml
vendored
Normal file
22
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/notScheduled.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: AdvancedCronJob
|
||||
metadata:
|
||||
name: acj-test
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
template:
|
||||
broadcastJobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 30
|
||||
|
||||
status:
|
||||
lastScheduleTime: null
|
||||
23
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/suspended.yaml
vendored
Normal file
23
resource_customizations/apps.kruise.io/AdvancedCronJob/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: AdvancedCronJob
|
||||
metadata:
|
||||
name: acj-test
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
template:
|
||||
broadcastJobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 30
|
||||
paused: true
|
||||
|
||||
status:
|
||||
type: BroadcastJob
|
||||
@@ -0,0 +1,32 @@
|
||||
hs={ status= "Progressing", message= "BroadcastJob is still running" }
|
||||
|
||||
if obj.status ~= nil then
|
||||
|
||||
-- BroadcastJob are healthy if desired number and succeeded number is equal
|
||||
if obj.status.desired == obj.status.succeeded and obj.status.phase == "completed" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "BroadcastJob is completed successfully"
|
||||
return hs
|
||||
end
|
||||
-- BroadcastJob are progressing if active is not equal to 0
|
||||
if obj.status.active ~= 0 and obj.status.phase == "running" then
|
||||
hs.status = "Progressing"
|
||||
hs.message = "BroadcastJob is still running"
|
||||
return hs
|
||||
end
|
||||
-- BroadcastJob are progressing if failed is not equal to 0
|
||||
if obj.status.failed ~= 0 and obj.status.phase == "failed" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "BroadcastJob failed"
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status.phase == "paused" and obj.spec.paused == true then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "BroadcastJob is Paused"
|
||||
return hs
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "BroadcastJob is completed successfully"
|
||||
inputPath: testdata/succeeded.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "BroadcastJob failed"
|
||||
inputPath: testdata/failed.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "BroadcastJob is still running"
|
||||
inputPath: testdata/running.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "BroadcastJob is Paused"
|
||||
inputPath: testdata/suspended.yaml
|
||||
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/failed.yaml
vendored
Normal file
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/failed.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: BroadcastJob
|
||||
metadata:
|
||||
name: failed-job
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: guestbook
|
||||
image: openkruise/guestbook:v3
|
||||
command: ["exit", "1"] # a dummy command to fail
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 60 # the job will be deleted after 60 seconds
|
||||
|
||||
status:
|
||||
active: 0
|
||||
completionTime: '2023-09-17T14:31:38Z'
|
||||
conditions:
|
||||
- lastProbeTime: '2023-09-17T14:31:38Z'
|
||||
lastTransitionTime: '2023-09-17T14:31:38Z'
|
||||
message: failure policy is FailurePolicyTypeFailFast and failed pod is found
|
||||
reason: Failed
|
||||
status: 'True'
|
||||
type: Failed
|
||||
desired: 1
|
||||
failed: 1
|
||||
phase: failed
|
||||
startTime: '2023-09-17T14:31:32Z'
|
||||
succeeded: 0
|
||||
22
resource_customizations/apps.kruise.io/BroadcastJob/testdata/running.yaml
vendored
Normal file
22
resource_customizations/apps.kruise.io/BroadcastJob/testdata/running.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: BroadcastJob
|
||||
metadata:
|
||||
name: download-image
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: guestbook
|
||||
image: openkruise/guestbook:v3
|
||||
command: ["echo", "started"] # a dummy command to do nothing
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 60 # the job will be deleted after 60 seconds
|
||||
status:
|
||||
active: 1
|
||||
desired: 1
|
||||
failed: 0
|
||||
phase: running
|
||||
startTime: '2023-09-17T14:43:30Z'
|
||||
succeeded: 0
|
||||
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/succeeded.yaml
vendored
Normal file
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/succeeded.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: BroadcastJob
|
||||
metadata:
|
||||
name: download-image
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: guestbook
|
||||
image: openkruise/guestbook:v3
|
||||
command: ["echo", "started"] # a dummy command to do nothing
|
||||
restartPolicy: Never
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 60 # the job will be deleted after 60 seconds
|
||||
status:
|
||||
active: 0
|
||||
completionTime: '2023-09-17T14:35:14Z'
|
||||
conditions:
|
||||
- lastProbeTime: '2023-09-17T14:35:14Z'
|
||||
lastTransitionTime: '2023-09-17T14:35:14Z'
|
||||
message: Job completed, 1 pods succeeded, 0 pods failed
|
||||
reason: Complete
|
||||
status: 'True'
|
||||
type: Complete
|
||||
desired: 1
|
||||
failed: 0
|
||||
phase: completed
|
||||
startTime: '2023-09-17T14:35:07Z'
|
||||
succeeded: 1
|
||||
|
||||
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/suspended.yaml
vendored
Normal file
31
resource_customizations/apps.kruise.io/BroadcastJob/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: BroadcastJob
|
||||
metadata:
|
||||
name: download-image
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: guestbook
|
||||
image: openkruise/guestbook:v3
|
||||
command: ["echo", "started"] # a dummy command to do nothing
|
||||
restartPolicy: Never
|
||||
paused: true
|
||||
completionPolicy:
|
||||
type: Always
|
||||
ttlSecondsAfterFinished: 60 # the job will be deleted after 60 seconds
|
||||
status:
|
||||
active: 0
|
||||
completionTime: '2023-09-17T14:35:14Z'
|
||||
conditions:
|
||||
- lastProbeTime: '2023-09-17T14:35:14Z'
|
||||
lastTransitionTime: '2023-09-17T14:35:14Z'
|
||||
message: Job completed, 1 pods succeeded, 0 pods failed
|
||||
reason: Complete
|
||||
status: 'True'
|
||||
type: Complete
|
||||
desired: 1
|
||||
failed: 0
|
||||
phase: paused
|
||||
startTime: '2023-09-17T14:35:07Z'
|
||||
succeeded: 0
|
||||
33
resource_customizations/apps.kruise.io/CloneSet/health.lua
Normal file
33
resource_customizations/apps.kruise.io/CloneSet/health.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
hs={ status = "Progressing", message = "Waiting for initialization" }
|
||||
|
||||
if obj.status ~= nil then
|
||||
|
||||
if obj.metadata.generation == obj.status.observedGeneration then
|
||||
|
||||
if obj.spec.updateStrategy.paused == true or not obj.status.updatedAvailableReplicas then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Cloneset is paused"
|
||||
return hs
|
||||
elseif obj.spec.updateStrategy.partition ~= 0 and obj.metadata.generation > 1 then
|
||||
if obj.status.updatedReplicas >= obj.status.expectedUpdatedReplicas then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Cloneset needs manual intervention"
|
||||
return hs
|
||||
end
|
||||
|
||||
elseif obj.status.updatedAvailableReplicas == obj.status.replicas then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "All Cloneset workloads are ready and updated"
|
||||
return hs
|
||||
|
||||
else
|
||||
if obj.status.updatedAvailableReplicas ~= obj.status.replicas then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "Some replicas are not ready or available"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,21 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "All Cloneset workloads are ready and updated"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "Some replicas are not ready or available"
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Waiting for initialization"
|
||||
inputPath: testdata/unknown.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Cloneset is paused"
|
||||
inputpath: testdata/suspended.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Cloneset needs manual intervention"
|
||||
inputpath: testdata/partition_suspended.yaml
|
||||
35
resource_customizations/apps.kruise.io/CloneSet/testdata/degraded.yaml
vendored
Normal file
35
resource_customizations/apps.kruise.io/CloneSet/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
metadata:
|
||||
name: cloneset-test
|
||||
namespace: kruise
|
||||
generation: 1
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
paused: false
|
||||
|
||||
status:
|
||||
observedGeneration: 1
|
||||
replicas: 2
|
||||
updatedReadyReplicas: 1
|
||||
updatedAvailableReplicas: 1
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'True'
|
||||
type: FailedScale
|
||||
36
resource_customizations/apps.kruise.io/CloneSet/testdata/healthy.yaml
vendored
Normal file
36
resource_customizations/apps.kruise.io/CloneSet/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
metadata:
|
||||
name: cloneset-test
|
||||
namespace: kruise
|
||||
generation: 1
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
paused: false
|
||||
|
||||
|
||||
status:
|
||||
observedGeneration: 1
|
||||
replicas: 2
|
||||
updatedReadyReplicas: 2
|
||||
updatedAvailableReplicas: 2
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'True'
|
||||
type: FailedScale
|
||||
31
resource_customizations/apps.kruise.io/CloneSet/testdata/partition_suspended.yaml
vendored
Normal file
31
resource_customizations/apps.kruise.io/CloneSet/testdata/partition_suspended.yaml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
metadata:
|
||||
name: cloneset-test
|
||||
namespace: kruise
|
||||
generation: 2
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 5
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
partition: 3
|
||||
|
||||
status:
|
||||
observedGeneration: 2
|
||||
replicas: 5
|
||||
expectedUpdatedReplicas: 2
|
||||
updatedReadyReplicas: 1
|
||||
updatedAvailableReplicas: 1
|
||||
updatedReplicas: 3
|
||||
35
resource_customizations/apps.kruise.io/CloneSet/testdata/suspended.yaml
vendored
Normal file
35
resource_customizations/apps.kruise.io/CloneSet/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
metadata:
|
||||
name: cloneset-test
|
||||
namespace: kruise
|
||||
generation: 2
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
paused: true
|
||||
|
||||
status:
|
||||
observedGeneration: 2
|
||||
replicas: 2
|
||||
updatedReadyReplicas: 2
|
||||
updatedAvailableReplicas: 2
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'True'
|
||||
type: FailedScale
|
||||
5
resource_customizations/apps.kruise.io/CloneSet/testdata/unknown.yaml
vendored
Normal file
5
resource_customizations/apps.kruise.io/CloneSet/testdata/unknown.yaml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: CloneSet
|
||||
metadata:
|
||||
name: cloneset-test
|
||||
namespace: kruise
|
||||
35
resource_customizations/apps.kruise.io/DaemonSet/health.lua
Normal file
35
resource_customizations/apps.kruise.io/DaemonSet/health.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
hs={ status = "Progressing", message = "Waiting for initialization" }
|
||||
|
||||
if obj.status ~= nil then
|
||||
|
||||
if obj.metadata.generation == obj.status.observedGeneration then
|
||||
|
||||
if obj.spec.updateStrategy.rollingUpdate.paused == true or not obj.status.updatedNumberScheduled then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Daemonset is paused"
|
||||
return hs
|
||||
elseif obj.spec.updateStrategy.rollingUpdate.partition ~= 0 and obj.metadata.generation > 1 then
|
||||
if obj.status.updatedNumberScheduled > (obj.status.desiredNumberScheduled - obj.spec.updateStrategy.rollingUpdate.partition) then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Daemonset needs manual intervention"
|
||||
return hs
|
||||
end
|
||||
|
||||
elseif (obj.status.updatedNumberScheduled == obj.status.desiredNumberScheduled) and (obj.status.numberAvailable == obj.status.desiredNumberScheduled) then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "All Daemonset workloads are ready and updated"
|
||||
return hs
|
||||
|
||||
else
|
||||
if (obj.status.updatedNumberScheduled == obj.status.desiredNumberScheduled) and (obj.status.numberUnavailable == obj.status.desiredNumberScheduled) then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "Some pods are not ready or available"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,21 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "All Daemonset workloads are ready and updated"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "Some pods are not ready or available"
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Waiting for initialization"
|
||||
inputPath: testdata/unknown.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Daemonset is paused"
|
||||
inputPath: testdata/suspended.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Daemonset needs manual intervention"
|
||||
inputPath: testdata/partition_suspended.yaml
|
||||
34
resource_customizations/apps.kruise.io/DaemonSet/testdata/degraded.yaml
vendored
Normal file
34
resource_customizations/apps.kruise.io/DaemonSet/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: daemonset-test
|
||||
namespace: kruise
|
||||
generation: 1
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
partition: 0
|
||||
paused: false
|
||||
|
||||
status:
|
||||
currentNumberScheduled: 1
|
||||
daemonSetHash: 5dffcdfcd7
|
||||
desiredNumberScheduled: 1
|
||||
numberUnavailable: 1
|
||||
numberMisscheduled: 0
|
||||
numberReady: 0
|
||||
observedGeneration: 1
|
||||
updatedNumberScheduled: 1
|
||||
34
resource_customizations/apps.kruise.io/DaemonSet/testdata/healthy.yaml
vendored
Normal file
34
resource_customizations/apps.kruise.io/DaemonSet/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: daemonset-test
|
||||
namespace: kruise
|
||||
generation: 1
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
partition: 0
|
||||
paused: false
|
||||
|
||||
status:
|
||||
currentNumberScheduled: 1
|
||||
daemonSetHash: 5dffcdfcd7
|
||||
desiredNumberScheduled: 1
|
||||
numberAvailable: 1
|
||||
numberMisscheduled: 0
|
||||
numberReady: 1
|
||||
observedGeneration: 1
|
||||
updatedNumberScheduled: 1
|
||||
33
resource_customizations/apps.kruise.io/DaemonSet/testdata/partition_suspended.yaml
vendored
Normal file
33
resource_customizations/apps.kruise.io/DaemonSet/testdata/partition_suspended.yaml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: daemonset-test
|
||||
namespace: kruise
|
||||
generation: 6
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
partition: 4
|
||||
|
||||
status:
|
||||
currentNumberScheduled: 1
|
||||
daemonSetHash: 5f8cdcdc65
|
||||
desiredNumberScheduled: 10
|
||||
numberAvailable: 10
|
||||
numberMisscheduled: 0
|
||||
numberReady: 10
|
||||
observedGeneration: 6
|
||||
updatedNumberScheduled: 7
|
||||
33
resource_customizations/apps.kruise.io/DaemonSet/testdata/suspended.yaml
vendored
Normal file
33
resource_customizations/apps.kruise.io/DaemonSet/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: daemonset-test
|
||||
namespace: kruise
|
||||
generation: 1
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
paused: true
|
||||
|
||||
status:
|
||||
currentNumberScheduled: 1
|
||||
daemonSetHash: 5dffcdfcd7
|
||||
desiredNumberScheduled: 1
|
||||
numberAvailable: 1
|
||||
numberMisscheduled: 0
|
||||
numberReady: 1
|
||||
observedGeneration: 1
|
||||
updatedNumberScheduled: 1
|
||||
5
resource_customizations/apps.kruise.io/DaemonSet/testdata/unknown.yaml
vendored
Normal file
5
resource_customizations/apps.kruise.io/DaemonSet/testdata/unknown.yaml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: apps.kruise.io/v1alpha1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: daemonset-test
|
||||
namespace: kruise
|
||||
@@ -0,0 +1,35 @@
|
||||
hs={ status = "Progressing", message = "Waiting for initialization" }
|
||||
|
||||
if obj.status ~= nil then
|
||||
|
||||
if obj.metadata.generation == obj.status.observedGeneration then
|
||||
|
||||
if obj.spec.updateStrategy.rollingUpdate.paused == true or not obj.status.updatedAvailableReplicas then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Statefulset is paused"
|
||||
return hs
|
||||
elseif obj.spec.updateStrategy.rollingUpdate.partition ~= 0 and obj.metadata.generation > 1 then
|
||||
if obj.status.updatedReplicas > (obj.status.replicas - obj.spec.updateStrategy.rollingUpdate.partition) then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Statefulset needs manual intervention"
|
||||
return hs
|
||||
end
|
||||
|
||||
elseif obj.status.updatedAvailableReplicas == obj.status.replicas then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "All Statefulset workloads are ready and updated"
|
||||
return hs
|
||||
|
||||
else
|
||||
if obj.status.updatedAvailableReplicas ~= obj.status.replicas then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "Some replicas are not ready or available"
|
||||
return hs
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,21 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "All Statefulset workloads are ready and updated"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "Some replicas are not ready or available"
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Waiting for initialization"
|
||||
inputPath: testdata/unknown.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Statefulset is paused"
|
||||
inputPath: testdata/suspended.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Statefulset needs manual intervention"
|
||||
inputPath: testdata/partition_suspended.yaml
|
||||
42
resource_customizations/apps.kruise.io/StatefulSet/testdata/degraded.yaml
vendored
Normal file
42
resource_customizations/apps.kruise.io/StatefulSet/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
apiVersion: apps.kruise.io/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: statefulset-test
|
||||
namespace: kruise
|
||||
generation: 5
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
minReadySeconds: 0
|
||||
paused: false
|
||||
partition: 0
|
||||
podUpdatePolicy: ReCreate
|
||||
type: RollingUpdate
|
||||
|
||||
status:
|
||||
observedGeneration: 5
|
||||
replicas: 2
|
||||
updatedAvailableReplicas: 1
|
||||
updatedReadyReplicas: 1
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'True'
|
||||
type: FailedCreatePod
|
||||
|
||||
41
resource_customizations/apps.kruise.io/StatefulSet/testdata/healthy.yaml
vendored
Normal file
41
resource_customizations/apps.kruise.io/StatefulSet/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
apiVersion: apps.kruise.io/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: statefulset-test
|
||||
namespace: kruise
|
||||
generation: 2
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
minReadySeconds: 0
|
||||
paused: false
|
||||
partition: 0
|
||||
podUpdatePolicy: ReCreate
|
||||
type: RollingUpdate
|
||||
|
||||
status:
|
||||
observedGeneration: 2
|
||||
replicas: 2
|
||||
updatedAvailableReplicas: 2
|
||||
updatedReadyReplicas: 2
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'False'
|
||||
type: FailedCreatePod
|
||||
36
resource_customizations/apps.kruise.io/StatefulSet/testdata/partition_suspended.yaml
vendored
Normal file
36
resource_customizations/apps.kruise.io/StatefulSet/testdata/partition_suspended.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: apps.kruise.io/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: statefulset-test
|
||||
namespace: kruise
|
||||
generation: 3
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:mainline
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
partition: 4
|
||||
|
||||
status:
|
||||
availableReplicas: 10
|
||||
currentReplicas: 4
|
||||
currentRevision: statefulset-test-d4d4fb5bd
|
||||
labelSelector: app=sample
|
||||
observedGeneration: 3
|
||||
readyReplicas: 10
|
||||
replicas: 10
|
||||
updateRevision: statefulset-test-56dfb978d4
|
||||
updatedAvailableReplicas: 7
|
||||
updatedReadyReplicas: 7
|
||||
updatedReplicas: 7
|
||||
36
resource_customizations/apps.kruise.io/StatefulSet/testdata/suspended.yaml
vendored
Normal file
36
resource_customizations/apps.kruise.io/StatefulSet/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
apiVersion: apps.kruise.io/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: statefulset-test
|
||||
namespace: kruise
|
||||
generation: 2
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sample
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sample
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
updateStrategy:
|
||||
rollingUpdate:
|
||||
paused: true
|
||||
|
||||
status:
|
||||
observedGeneration: 2
|
||||
replicas: 2
|
||||
updatedAvailableReplicas: 2
|
||||
updatedReadyReplicas: 2
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-09-21T22:35:31Z"
|
||||
message: Deployment has minimum availability.
|
||||
reason: MinimumReplicasAvailable
|
||||
status: 'False'
|
||||
type: FailedCreatePod
|
||||
5
resource_customizations/apps.kruise.io/StatefulSet/testdata/unknown.yaml
vendored
Normal file
5
resource_customizations/apps.kruise.io/StatefulSet/testdata/unknown.yaml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: apps.kruise.io/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: statefulset-test
|
||||
namespace: kruise
|
||||
@@ -0,0 +1,31 @@
|
||||
hs={ status = "Progressing", message = "Rollout is still progressing" }
|
||||
|
||||
if obj.metadata.generation == obj.status.observedGeneration then
|
||||
|
||||
if obj.status.canaryStatus.currentStepState == "StepUpgrade" and obj.status.phase == "Progressing" then
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Rollout is still progressing"
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status.canaryStatus.currentStepState == "StepPaused" and obj.status.phase == "Progressing" then
|
||||
hs.status = "Suspended"
|
||||
hs.message = "Rollout is Paused need manual intervention"
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status.canaryStatus.currentStepState == "Completed" and obj.status.phase == "Healthy" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "Rollout is Completed"
|
||||
return hs
|
||||
end
|
||||
|
||||
if obj.status.canaryStatus.currentStepState == "StepPaused" and (obj.status.phase == "Terminating" or obj.status.phase == "Disabled") then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "Rollout is Disabled or Terminating"
|
||||
return hs
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: "Rollout is Completed"
|
||||
inputPath: testdata/healthy.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: "Rollout is Disabled or Terminating"
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: "Rollout is still progressing"
|
||||
inputPath: testdata/progressing.yaml
|
||||
- healthStatus:
|
||||
status: Suspended
|
||||
message: "Rollout is Paused need manual intervention"
|
||||
inputPath: testdata/suspended.yaml
|
||||
50
resource_customizations/rollouts.kruise.io/Rollout/testdata/degraded.yaml
vendored
Normal file
50
resource_customizations/rollouts.kruise.io/Rollout/testdata/degraded.yaml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
apiVersion: rollouts.kruise.io/v1alpha1
|
||||
kind: Rollout
|
||||
metadata:
|
||||
name: rollouts-demo
|
||||
namespace: default
|
||||
annotations:
|
||||
rollouts.kruise.io/rolling-style: partition
|
||||
generation: 5
|
||||
spec:
|
||||
objectRef:
|
||||
workloadRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: workload-demo
|
||||
strategy:
|
||||
canary:
|
||||
steps:
|
||||
- replicas: 1
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 50%
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 100%
|
||||
|
||||
status:
|
||||
canaryStatus:
|
||||
canaryReadyReplicas: 1
|
||||
canaryReplicas: 1
|
||||
canaryRevision: 76fd76f75b
|
||||
currentStepIndex: 1
|
||||
currentStepState: StepPaused
|
||||
lastUpdateTime: '2023-09-23T11:44:39Z'
|
||||
message: BatchRelease is at state Ready, rollout-id , step 1
|
||||
observedWorkloadGeneration: 7
|
||||
podTemplateHash: 76fd76f75b
|
||||
rolloutHash: 77cxd69w47b7bwddwv2w7vxvb4xxdbwcx9x289vw69w788w4w6z4x8dd4vbz2zbw
|
||||
stableRevision: 6bfdfb5bfb
|
||||
conditions:
|
||||
- lastTransitionTime: '2023-09-23T11:44:09Z'
|
||||
lastUpdateTime: '2023-09-23T11:44:09Z'
|
||||
message: Rollout is in Progressing
|
||||
reason: InRolling
|
||||
status: 'True'
|
||||
type: Progressing
|
||||
message: >-
|
||||
Rollout is in step(1/3), and you need manually confirm to enter the next
|
||||
step
|
||||
observedGeneration: 5
|
||||
phase: Disabled
|
||||
56
resource_customizations/rollouts.kruise.io/Rollout/testdata/healthy.yaml
vendored
Normal file
56
resource_customizations/rollouts.kruise.io/Rollout/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
apiVersion: rollouts.kruise.io/v1alpha1
|
||||
kind: Rollout
|
||||
metadata:
|
||||
name: rollouts-demo
|
||||
namespace: default
|
||||
annotations:
|
||||
rollouts.kruise.io/rolling-style: partition
|
||||
generation: 7
|
||||
spec:
|
||||
objectRef:
|
||||
workloadRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: workload-demo
|
||||
strategy:
|
||||
canary:
|
||||
steps:
|
||||
- replicas: 1
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 50%
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 100%
|
||||
|
||||
status:
|
||||
canaryStatus:
|
||||
canaryReadyReplicas: 10
|
||||
canaryReplicas: 10
|
||||
canaryRevision: 76fd76f75b
|
||||
currentStepIndex: 3
|
||||
currentStepState: Completed
|
||||
lastUpdateTime: '2023-09-23T11:48:58Z'
|
||||
message: BatchRelease is at state Ready, rollout-id , step 3
|
||||
observedWorkloadGeneration: 22
|
||||
podTemplateHash: 76fd76f75b
|
||||
rolloutHash: 77cxd69w47b7bwddwv2w7vxvb4xxdbwcx9x289vw69w788w4w6z4x8dd4vbz2zbw
|
||||
stableRevision: 6bfdfb5bfb
|
||||
conditions:
|
||||
- lastTransitionTime: '2023-09-23T11:44:09Z'
|
||||
lastUpdateTime: '2023-09-23T11:44:09Z'
|
||||
message: Rollout progressing has been completed
|
||||
reason: Completed
|
||||
status: 'False'
|
||||
type: Progressing
|
||||
- lastTransitionTime: '2023-09-23T11:49:01Z'
|
||||
lastUpdateTime: '2023-09-23T11:49:01Z'
|
||||
message: ''
|
||||
reason: ''
|
||||
status: 'True'
|
||||
type: Succeeded
|
||||
message: Rollout progressing has been completed
|
||||
observedGeneration: 7
|
||||
phase: Healthy
|
||||
|
||||
|
||||
48
resource_customizations/rollouts.kruise.io/Rollout/testdata/progressing.yaml
vendored
Normal file
48
resource_customizations/rollouts.kruise.io/Rollout/testdata/progressing.yaml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
apiVersion: rollouts.kruise.io/v1alpha1
|
||||
kind: Rollout
|
||||
metadata:
|
||||
name: rollouts-demo
|
||||
namespace: default
|
||||
annotations:
|
||||
rollouts.kruise.io/rolling-style: partition
|
||||
generation: 5
|
||||
spec:
|
||||
objectRef:
|
||||
workloadRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: workload-demo
|
||||
strategy:
|
||||
canary:
|
||||
steps:
|
||||
- replicas: 1
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 50%
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 100%
|
||||
|
||||
status:
|
||||
canaryStatus:
|
||||
canaryReadyReplicas: 0
|
||||
canaryReplicas: 1
|
||||
canaryRevision: 76fd76f75b
|
||||
currentStepIndex: 1
|
||||
currentStepState: StepUpgrade
|
||||
lastUpdateTime: '2023-09-23T11:44:12Z'
|
||||
message: BatchRelease is at state Verifying, rollout-id , step 1
|
||||
observedWorkloadGeneration: 6
|
||||
podTemplateHash: 76fd76f75b
|
||||
rolloutHash: 77cxd69w47b7bwddwv2w7vxvb4xxdbwcx9x289vw69w788w4w6z4x8dd4vbz2zbw
|
||||
stableRevision: 6bfdfb5bfb
|
||||
conditions:
|
||||
- lastTransitionTime: '2023-09-23T11:44:09Z'
|
||||
lastUpdateTime: '2023-09-23T11:44:09Z'
|
||||
message: Rollout is in Progressing
|
||||
reason: InRolling
|
||||
status: 'True'
|
||||
type: Progressing
|
||||
message: Rollout is in step(1/3), and upgrade workload to new version
|
||||
observedGeneration: 5
|
||||
phase: Progressing
|
||||
50
resource_customizations/rollouts.kruise.io/Rollout/testdata/suspended.yaml
vendored
Normal file
50
resource_customizations/rollouts.kruise.io/Rollout/testdata/suspended.yaml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
apiVersion: rollouts.kruise.io/v1alpha1
|
||||
kind: Rollout
|
||||
metadata:
|
||||
name: rollouts-demo
|
||||
namespace: default
|
||||
annotations:
|
||||
rollouts.kruise.io/rolling-style: partition
|
||||
generation: 5
|
||||
spec:
|
||||
objectRef:
|
||||
workloadRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: workload-demo
|
||||
strategy:
|
||||
canary:
|
||||
steps:
|
||||
- replicas: 1
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 50%
|
||||
pause:
|
||||
duration: 0
|
||||
- replicas: 100%
|
||||
|
||||
status:
|
||||
canaryStatus:
|
||||
canaryReadyReplicas: 1
|
||||
canaryReplicas: 1
|
||||
canaryRevision: 76fd76f75b
|
||||
currentStepIndex: 1
|
||||
currentStepState: StepPaused
|
||||
lastUpdateTime: '2023-09-23T11:44:39Z'
|
||||
message: BatchRelease is at state Ready, rollout-id , step 1
|
||||
observedWorkloadGeneration: 7
|
||||
podTemplateHash: 76fd76f75b
|
||||
rolloutHash: 77cxd69w47b7bwddwv2w7vxvb4xxdbwcx9x289vw69w788w4w6z4x8dd4vbz2zbw
|
||||
stableRevision: 6bfdfb5bfb
|
||||
conditions:
|
||||
- lastTransitionTime: '2023-09-23T11:44:09Z'
|
||||
lastUpdateTime: '2023-09-23T11:44:09Z'
|
||||
message: Rollout is in Progressing
|
||||
reason: InRolling
|
||||
status: 'True'
|
||||
type: Progressing
|
||||
message: >-
|
||||
Rollout is in step(1/3), and you need manually confirm to enter the next
|
||||
step
|
||||
observedGeneration: 5
|
||||
phase: Progressing
|
||||
@@ -149,9 +149,9 @@ export const PodsLogsViewer = (props: PodLogsProps) => {
|
||||
const logsContent = (width: number, height: number, isWrapped: boolean) => (
|
||||
<div ref={logsContainerRef} onScroll={handleScroll} style={{width, height, overflow: 'scroll'}}>
|
||||
{logs.map((log, lineNum) => (
|
||||
<pre key={lineNum} style={{whiteSpace: isWrapped ? 'normal' : 'pre'}} className='noscroll'>
|
||||
<div key={lineNum} style={{whiteSpace: isWrapped ? 'normal' : 'pre', lineHeight: '16px'}} className='noscroll'>
|
||||
<Ansi>{renderLog(log, lineNum)}</Ansi>
|
||||
</pre>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user