diff --git a/docs/cycling/README.md b/docs/cycling/README.md index 600e6a3..0ad3ab2 100644 --- a/docs/cycling/README.md +++ b/docs/cycling/README.md @@ -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" diff --git a/pkg/k8s/pod.go b/pkg/k8s/pod.go index 7540235..79b0d82 100644 --- a/pkg/k8s/pod.go +++ b/pkg/k8s/pod.go @@ -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") @@ -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