Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentportella committed Aug 26, 2024
1 parent 87dda47 commit b83e6ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
5 changes: 5 additions & 0 deletions docs/cycling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ spec:
- "node-name-A"
- "node-name-B"

# Optional section - collection of validation options to define stricter or more lenient validation during cycling.
validationOptions:
# Optional field - Skip node names defined in the CNR that do not match any existing nodes in the Kubernetes API.
skipMissingNamedNodes: true|false

cycleNodeSettings:
# Method can be "Wait" or "Drain", defaults to "Drain" if not provided
# "Wait" will wait for pods with the "cyclops.atlassian.com/do-not-disrupt=true"
Expand Down
15 changes: 5 additions & 10 deletions pkg/k8s/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
)

const (
podConditionTypeForUnhealthy = v1.PodReady
doNotDisruptAnnotation = "cyclops.atlassian.com/do-not-disrupt"
podConditionTypeForUnhealthy = v1.PodReady
doNotDisruptAnnotation = "cyclops.atlassian.com/do-not-disrupt"
doNotDisruptAnnotationRequredValue = "true"
)

var log = logf.Log.WithName("k8s.pod.go")
Expand Down Expand Up @@ -93,15 +94,9 @@ func PodIsDaemonSet(pod *v1.Pod) bool {
// a node.
func PodCannotBeDisrupted(pod *v1.Pod) bool {
for annotationName, annotationValue := range pod.ObjectMeta.Annotations {
if annotationName != doNotDisruptAnnotation {
continue
}

if annotationValue != "true" {
continue
if annotationName == doNotDisruptAnnotation && annotationValue == doNotDisruptAnnotationRequredValue {
return true
}

return true
}

return false
Expand Down

0 comments on commit b83e6ef

Please sign in to comment.