From fa35beba2afee89104a93390b83580271ad67933 Mon Sep 17 00:00:00 2001 From: adrianc Date: Tue, 20 Aug 2024 14:30:33 +0300 Subject: [PATCH] Update NodeMaintenance API - remove un-needed protobuf markers - remove unsupported strategic merge related markes as they are not supported for CRDs [1] - add new field in spec: AdditionalRequestors to be used to allow multiple entities to share the same NodeMaintenance object. [1] https://github.com/kubernetes/kubectl/issues/1280 Signed-off-by: adrianc --- api/v1alpha1/nodemaintenance_types.go | 11 ++++++++--- .../maintenance.nvidia.com_nodemaintenances.yaml | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/api/v1alpha1/nodemaintenance_types.go b/api/v1alpha1/nodemaintenance_types.go index 3ba0872..80ba280 100644 --- a/api/v1alpha1/nodemaintenance_types.go +++ b/api/v1alpha1/nodemaintenance_types.go @@ -66,6 +66,13 @@ type NodeMaintenanceSpec struct { // +kubebuilder:validation:MinLength=2 RequestorID string `json:"requestorID"` + // AdditionalRequestors is a set of additional requestor IDs which are using the same NodeMaintenance + // request. addition or removal of requiestor IDs to this list MUST be made with update operation (and retry on failure) + // which will replace the entire list. + // +kubebuilder:validation:Optional + // +listType=set + AdditionalRequestors []string `json:"additionalRequestors,omitempty"` + // NodeName is The name of the node that maintenance operation will be performed on // creation fails if node obj does not exist (webhook) NodeName string `json:"nodeName"` @@ -143,11 +150,9 @@ type PodEvictionFiterEntry struct { type NodeMaintenanceStatus struct { // Conditions represents observations of NodeMaintenance current state // +kubebuilder:validation:Optional - // +patchMergeKey=type - // +patchStrategy=merge // +listType=map // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchMergeKey:"type" patchStrategy:"merge" protobuf:"bytes,1,rep,name=conditions"` + Conditions []metav1.Condition `json:"conditions,omitempty"` // WaitForCompletion is the list of namespaced named pods that we wait to complete WaitForCompletion []string `json:"waitForCompletion,omitempty"` diff --git a/config/crd/bases/maintenance.nvidia.com_nodemaintenances.yaml b/config/crd/bases/maintenance.nvidia.com_nodemaintenances.yaml index 15247ca..75a1b0e 100644 --- a/config/crd/bases/maintenance.nvidia.com_nodemaintenances.yaml +++ b/config/crd/bases/maintenance.nvidia.com_nodemaintenances.yaml @@ -52,6 +52,15 @@ spec: spec: description: NodeMaintenanceSpec defines the desired state of NodeMaintenance properties: + additionalRequestors: + description: |- + AdditionalRequestors is a set of additional requestor IDs which are using the same NodeMaintenance + request. addition or removal of requiestor IDs to this list MUST be made with update operation (and retry on failure) + which will replace the entire list. + items: + type: string + type: array + x-kubernetes-list-type: set cordon: default: true description: Cordon if set, marks node as unschedulable during maintenance