Skip to content

Commit

Permalink
Fix daemonset deletion in general stage
Browse files Browse the repository at this point in the history
Signed-off-by: Yilong Li <[email protected]>
  • Loading branch information
MondayCha committed Dec 16, 2024
1 parent 69e2c53 commit 6244628
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
113 changes: 113 additions & 0 deletions kustomize/stage/pod/general/pod-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ spec:
operator: 'DoesNotExist'
- key: '.status.podIP'
operator: 'DoesNotExist'
- key: '.metadata.ownerReferences.[].kind'
operator: 'NotIn'
values:
- 'DaemonSet'
weight: 1
weightFrom:
expressionFrom: '.metadata.annotations["pod-create.stage.kwok.x-k8s.io/weight"]'
Expand Down Expand Up @@ -105,3 +109,112 @@ spec:
hostIP: {{ NodeIPWith .spec.nodeName | Quote }}
podIP: {{ PodIPWith .spec.nodeName ( or .spec.hostNetwork false ) ( or .metadata.uid "" ) ( or .metadata.name "" ) ( or .metadata.namespace "" ) | Quote }}
phase: Pending
---
apiVersion: kwok.x-k8s.io/v1alpha1
kind: Stage
metadata:
name: pod-create-for-daemonset
spec:
resourceRef:
apiGroup: v1
kind: Pod
selector:
matchExpressions:
- key: '.metadata.deletionTimestamp'
operator: 'DoesNotExist'
- key: '.status.podIP'
operator: 'DoesNotExist'
- key: '.metadata.ownerReferences.[].kind'
operator: 'NotIn'
values:
- 'DaemonSet'
weight: 1
weightFrom:
expressionFrom: '.metadata.annotations["pod-create.stage.kwok.x-k8s.io/weight"]'
delay:
durationMilliseconds: 1000
durationFrom:
expressionFrom: '.metadata.annotations["pod-create.stage.kwok.x-k8s.io/delay"]'
jitterDurationMilliseconds: 5000
jitterDurationFrom:
expressionFrom: '.metadata.annotations["pod-create.stage.kwok.x-k8s.io/jitter-delay"]'
next:
event:
type: Normal
reason: Created
message: Created container
statusTemplate: |
{{ $now := Now }}
conditions:
{{ if .spec.initContainers }}
- lastProbeTime: null
lastTransitionTime: {{ $now | Quote }}
message: 'containers with incomplete status: [{{ range .spec.initContainers }} {{ .name }} {{ end }}]'
reason: ContainersNotInitialized
status: "False"
type: Initialized
{{ else }}
- lastProbeTime: null
lastTransitionTime: {{ $now | Quote }}
status: "True"
type: Initialized
{{ end }}
- lastProbeTime: null
lastTransitionTime: {{ $now | Quote }}
message: 'containers with unready status: [{{ range .spec.containers }} {{ .name }} {{ end }}]'
reason: ContainersNotReady
status: "False"
type: Ready
- lastProbeTime: null
lastTransitionTime: {{ $now | Quote }}
message: 'containers with unready status: [{{ range .spec.containers }} {{ .name }} {{ end }}]'
reason: ContainersNotReady
status: "False"
type: ContainersReady
{{ range .spec.readinessGates }}
- lastTransitionTime: {{ $now | Quote }}
status: "True"
type: {{ .conditionType | Quote }}
{{ end }}
{{ if .spec.initContainers }}
initContainerStatuses:
{{ range .spec.initContainers }}
- image: {{ .image | Quote }}
name: {{ .name | Quote }}
ready: false
restartCount: 0
started: false
state:
waiting:
reason: PodInitializing
{{ end }}
containerStatuses:
{{ range .spec.containers }}
- image: {{ .image | Quote }}
name: {{ .name | Quote }}
ready: false
restartCount: 0
started: false
state:
waiting:
reason: PodInitializing
{{ end }}
{{ else }}
containerStatuses:
{{ range .spec.containers }}
- image: {{ .image | Quote }}
name: {{ .name | Quote }}
ready: false
restartCount: 0
started: false
state:
waiting:
reason: ContainerCreating
{{ end }}
{{ end }}
hostIP: {{ NodeIPWith .spec.nodeName | Quote }}
podIP: {{ PodIPWith .spec.nodeName ( or .spec.hostNetwork false ) ( or .metadata.uid "" ) ( or .metadata.name "" ) ( or .metadata.namespace "" ) | Quote }}
phase: Pending
1 change: 1 addition & 0 deletions kustomize/stage/pod/general/pod-ready.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ spec:
startedAt: {{ $now | Quote }}
{{ end }}
phase: Running
startTime: {{ $now | Quote }}

0 comments on commit 6244628

Please sign in to comment.