From eed22bbe982fd5424129f0f81d7892b617fae5f8 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Thu, 23 May 2024 16:24:53 +0800 Subject: [PATCH] ReadOnly type in work Signed-off-by: Jian Qiu --- ...on.open-cluster-management.io_addontemplates.crd.yaml | 9 ++++++--- ...ork.open-cluster-management.io_manifestworks.crd.yaml | 9 ++++++--- work/v1/types.go | 8 +++++++- work/v1/zz_generated.swagger_doc_generated.go | 2 +- ...luster-management.io_manifestworkreplicasets.crd.yaml | 9 ++++++--- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml b/addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml index 6a063e773..4c5685151 100644 --- a/addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml +++ b/addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml @@ -269,13 +269,16 @@ spec: means do not update resource based on current manifest. ServerSideApply type means to update resource using server side apply with work-controller as the field - manager. If there is conflict, the related Applied - condition of manifest will be in the status of False - with the reason of ApplyConflict. + manager. ReadOnly type means the agent will only check + the existence of the resource based on its metadata. + If there is conflict, the related Applied condition + of manifest will be in the status of False with the + reason of ApplyConflict. enum: - Update - CreateOnly - ServerSideApply + - ReadOnly type: string required: - type diff --git a/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml b/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml index c3b0133ec..4d6aaf20f 100644 --- a/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml +++ b/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml @@ -251,13 +251,16 @@ spec: by an update call. CreateOnly type means do not update resource based on current manifest. ServerSideApply type means to update resource using server side apply with - work-controller as the field manager. If there is conflict, - the related Applied condition of manifest will be in the - status of False with the reason of ApplyConflict. + work-controller as the field manager. ReadOnly type means + the agent will only check the existence of the resource + based on its metadata. If there is conflict, the related + Applied condition of manifest will be in the status of + False with the reason of ApplyConflict. enum: - Update - CreateOnly - ServerSideApply + - ReadOnly type: string required: - type diff --git a/work/v1/types.go b/work/v1/types.go index 39b8ec2b2..0234110e9 100644 --- a/work/v1/types.go +++ b/work/v1/types.go @@ -160,10 +160,11 @@ type UpdateStrategy struct { // Update type means to update resource by an update call. // CreateOnly type means do not update resource based on current manifest. // ServerSideApply type means to update resource using server side apply with work-controller as the field manager. + // ReadOnly type means the agent will only check the existence of the resource based on its metadata. // If there is conflict, the related Applied condition of manifest will be in the status of False with the // reason of ApplyConflict. // +kubebuilder:default=Update - // +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply + // +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply;ReadOnly // +kubebuilder:validation:Required // +required Type UpdateStrategyType `json:"type,omitempty"` @@ -189,6 +190,11 @@ const ( // If there is conflict, the related Applied condition of manifest will be in the status of False with the // reason of ApplyConflict. This type allows another controller on the spoke to control certain field of the resource. UpdateStrategyTypeServerSideApply UpdateStrategyType = "ServerSideApply" + + // UpdateStrategyTypeReadOnly type means only check the existence of the resource based on the resource's metadata. + // If the statusFeedBackRules are set, the feedbackResult will also be returned. + // The resource will not be removed when the type is ReadOnly, and only resource metadata is required. + UpdateStrategyTypeReadOnly UpdateStrategyType = "ReadOnly" ) type ServerSideApplyConfig struct { diff --git a/work/v1/zz_generated.swagger_doc_generated.go b/work/v1/zz_generated.swagger_doc_generated.go index 8689d32f8..adb4e4364 100644 --- a/work/v1/zz_generated.swagger_doc_generated.go +++ b/work/v1/zz_generated.swagger_doc_generated.go @@ -287,7 +287,7 @@ func (StatusFeedbackResult) SwaggerDoc() map[string]string { var map_UpdateStrategy = map[string]string{ "": "UpdateStrategy defines the strategy to update this manifest", - "type": "type defines the strategy to update this manifest, default value is Update. Update type means to update resource by an update call. CreateOnly type means do not update resource based on current manifest. ServerSideApply type means to update resource using server side apply with work-controller as the field manager. If there is conflict, the related Applied condition of manifest will be in the status of False with the reason of ApplyConflict.", + "type": "type defines the strategy to update this manifest, default value is Update. Update type means to update resource by an update call. CreateOnly type means do not update resource based on current manifest. ServerSideApply type means to update resource using server side apply with work-controller as the field manager. ReadOnly type means the agent will only check the existence of the resource based on its metadata. If there is conflict, the related Applied condition of manifest will be in the status of False with the reason of ApplyConflict.", "serverSideApply": "serverSideApply defines the configuration for server side apply. It is honored only when type of updateStrategy is ServerSideApply", } diff --git a/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml b/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml index f0d86d922..df94f93f3 100644 --- a/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml +++ b/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml @@ -282,13 +282,16 @@ spec: means do not update resource based on current manifest. ServerSideApply type means to update resource using server side apply with work-controller as the field - manager. If there is conflict, the related Applied - condition of manifest will be in the status of False - with the reason of ApplyConflict. + manager. ReadOnly type means the agent will only check + the existence of the resource based on its metadata. + If there is conflict, the related Applied condition + of manifest will be in the status of False with the + reason of ApplyConflict. enum: - Update - CreateOnly - ServerSideApply + - ReadOnly type: string required: - type