From b61004695b4979727e933a0d530092851a1c3349 Mon Sep 17 00:00:00 2001 From: Blake Devcich Date: Tue, 13 Feb 2024 12:50:46 -0600 Subject: [PATCH] NnfDataMovementManager: Add UpdateStrategy to support parallel rolling updates The NNF DMM manages the nnf-dm-worker DaemonSet, which is reponsible for the nnf-dm-worker pods. Adding UpdateStrategy to the NnfDataMovementManagerSpec ensures admins can configure the update strategy for those pods. This allows for a non-sequential update when rolling out new worker pods. Signed-off-by: Blake Devcich --- api/v1alpha1/nnf_datamovementmanager_types.go | 5 ++ api/v1alpha1/zz_generated.deepcopy.go | 1 + ....cray.hpe.com_nnfdatamovementmanagers.yaml | 64 +++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/api/v1alpha1/nnf_datamovementmanager_types.go b/api/v1alpha1/nnf_datamovementmanager_types.go index 091a033f0..db0dc96a4 100644 --- a/api/v1alpha1/nnf_datamovementmanager_types.go +++ b/api/v1alpha1/nnf_datamovementmanager_types.go @@ -20,6 +20,7 @@ package v1alpha1 import ( + appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -50,6 +51,10 @@ type NnfDataMovementManagerSpec struct { // manages the per node data movement operations. Template corev1.PodTemplateSpec `json:"template"` + // UpdateStrategy defines the UpdateStrategy that is used for the basis of the worker Daemon Set + // that manages the per node data movement operations. + UpdateStrategy appsv1.DaemonSetUpdateStrategy `json:"updateStrategy"` + // Host Path defines the directory location of shared mounts on an individual worker node. HostPath string `json:"hostPath"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 96f3c58ad..4f0fce8cd 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -429,6 +429,7 @@ func (in *NnfDataMovementManagerSpec) DeepCopyInto(out *NnfDataMovementManagerSp *out = *in in.Selector.DeepCopyInto(&out.Selector) in.Template.DeepCopyInto(&out.Template) + in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NnfDataMovementManagerSpec. diff --git a/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml b/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml index ce62f1932..823ed564f 100644 --- a/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml +++ b/config/crd/bases/nnf.cray.hpe.com_nnfdatamovementmanagers.yaml @@ -7626,11 +7626,75 @@ spec: - containers type: object type: object + updateStrategy: + description: UpdateStrategy defines the UpdateStrategy that is used + for the basis of the worker Daemon Set that manages the per node + data movement operations. + properties: + rollingUpdate: + description: 'Rolling update config params. Present only if type + = "RollingUpdate". --- TODO: Update this to follow our convention + for oneOf, whatever we decide it to be. Same as Deployment `strategy.rollingUpdate`. + See https://github.com/kubernetes/kubernetes/issues/35345' + properties: + maxSurge: + anyOf: + - type: integer + - type: string + description: 'The maximum number of nodes with an existing + available DaemonSet pod that can have an updated DaemonSet + pod during during an update. Value can be an absolute number + (ex: 5) or a percentage of desired pods (ex: 10%). This + can not be 0 if MaxUnavailable is 0. Absolute number is + calculated from percentage by rounding up to a minimum of + 1. Default value is 0. Example: when this is set to 30%, + at most 30% of the total number of nodes that should be + running the daemon pod (i.e. status.desiredNumberScheduled) + can have their a new pod created before the old pod is marked + as deleted. The update starts by launching new pods on 30% + of nodes. Once an updated pod is available (Ready for at + least minReadySeconds) the old DaemonSet pod on that node + is marked deleted. If the old pod becomes unavailable for + any reason (Ready transitions to false, is evicted, or is + drained) an updated pod is immediatedly created on that + node without considering surge limits. Allowing surge implies + the possibility that the resources consumed by the daemonset + on any given node can double if the readiness check fails, + and so resource intensive daemonsets should take into account + that they may cause evictions during disruption.' + x-kubernetes-int-or-string: true + maxUnavailable: + anyOf: + - type: integer + - type: string + description: 'The maximum number of DaemonSet pods that can + be unavailable during the update. Value can be an absolute + number (ex: 5) or a percentage of total number of DaemonSet + pods at the start of the update (ex: 10%). Absolute number + is calculated from percentage by rounding up. This cannot + be 0 if MaxSurge is 0 Default value is 1. Example: when + this is set to 30%, at most 30% of the total number of nodes + that should be running the daemon pod (i.e. status.desiredNumberScheduled) + can have their pods stopped for an update at any given time. + The update starts by stopping at most 30% of those DaemonSet + pods and then brings up new DaemonSet pods in their place. + Once the new pods are available, it then proceeds onto other + DaemonSet pods, thus ensuring that at least 70% of original + number of DaemonSet pods are available at all times during + the update.' + x-kubernetes-int-or-string: true + type: object + type: + description: Type of daemon set update. Can be "RollingUpdate" + or "OnDelete". Default is RollingUpdate. + type: string + type: object required: - hostPath - mountPath - selector - template + - updateStrategy type: object status: description: NnfDataMovementManagerStatus defines the observed state of