From 49c10c9595c3d447854fe328ee4ce2b7e4f1670e Mon Sep 17 00:00:00 2001 From: michaelawyu Date: Wed, 11 Dec 2024 09:00:42 +0800 Subject: [PATCH] Minor fixes --- .../v1beta1/clusterresourceplacement_types.go | 28 +++++++++++++++++-- ...etes-fleet.io_clusterresourcebindings.yaml | 23 +++++++++++++-- ...es-fleet.io_clusterresourceplacements.yaml | 23 +++++++++++++-- ...etes-fleet.io_clusterstagedupdateruns.yaml | 23 +++++++++++++-- .../placement.kubernetes-fleet.io_works.yaml | 23 +++++++++++++-- 5 files changed, 109 insertions(+), 11 deletions(-) diff --git a/apis/placement/v1beta1/clusterresourceplacement_types.go b/apis/placement/v1beta1/clusterresourceplacement_types.go index 60581b3c8..1643753ba 100644 --- a/apis/placement/v1beta1/clusterresourceplacement_types.go +++ b/apis/placement/v1beta1/clusterresourceplacement_types.go @@ -540,6 +540,14 @@ type ApplyStrategy struct { // // Use ComparisonOption setting to control how the difference is calculated. // + // ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume + // ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over + // the resource). See the comments on the WhenToTakeOver field for more information. + // ReportDiff apply strategy, however, will function regardless of Fleet's ownership + // status. One may set up a CRP with the ReportDiff strategy and the Never takeover option, + // and this will turn Fleet into a detection tool that reports only configuration differences + // but do not touch any resources on the member cluster side. + // // For a comparison between the different strategies and usage examples, refer to the // Fleet documentation. // @@ -605,16 +613,24 @@ type ApplyStrategy struct { // If appropriate, you may also delete the object from the member cluster; Fleet will recreate // it using the hub cluster manifest. // - // * Never: with this action, Fleet will not apply the hub cluster manifests to the member - // clusters if there are corresponding pre-existing resources. + // * Never: with this action, Fleet will not apply a hub cluster manifest to the member + // clusters if there is a corresponding pre-existing resource. However, if a manifest + // has never been applied yet; or it has a corresponding resource which Fleet has assumed + // ownership, apply op will still be executed. // // This is the safest option; one will have to remove the pre-existing resources (so that // Fleet can re-create them) or switch to a different // WhenToTakeOver option before Fleet starts processing the corresponding hub cluster // manifests. // + // If you prefer Fleet stop processing all manifests, use this option along with the + // ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing + // on the member cluster side but still report configuration differences between the + // hub cluster and member clusters. Fleet will not give up ownership + // that it has already assumed though. + // // +kubebuilder:default=Always - // +kubebuilder:validation:Enum=Always;IfNoDiff + // +kubebuilder:validation:Enum=Always;IfNoDiff;Never // +kubebuilder:validation:Optional WhenToTakeOver WhenToTakeOverType `json:"whenToTakeOver,omitempty"` } @@ -714,6 +730,12 @@ const ( // Note that this will not stop Fleet from processing other manifests in the same placement // that do not concern the takeover process (e.g., the manifests that have not been created // yet, or that are already under the management of Fleet). + // + // If you would like Fleet to stop processing manifests all together and do not assume + // ownership on any pre-existing resources, use this option along with the ReportDiff + // apply strategy type. This setup would instruct Fleet to touch nothing on the member + // cluster side but still report configuration differences between the hub cluster + // and member clusters. Fleet will not give up ownership that it has already assumed, though. WhenToTakeOverTypeNever WhenToTakeOverType = "Never" ) diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourcebindings.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourcebindings.yaml index 070882366..07ccc748f 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourcebindings.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourcebindings.yaml @@ -545,6 +545,15 @@ spec: Use ComparisonOption setting to control how the difference is calculated. + ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume + ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over + the resource). See the comments on the WhenToTakeOver field for more information. + ReportDiff apply strategy, however, will function regardless of Fleet's ownership + status. One may set up a CRP with the ReportDiff strategy and the Never takeover option, + and this will turn Fleet into a detection tool that reports only configuration differences + but do not touch any resources on the member cluster side. + + For a comparison between the different strategies and usage examples, refer to the Fleet documentation. enum: @@ -660,17 +669,27 @@ spec: it using the hub cluster manifest. - * Never: with this action, Fleet will not apply the hub cluster manifests to the member - clusters if there are corresponding pre-existing resources. + * Never: with this action, Fleet will not apply a hub cluster manifest to the member + clusters if there is a corresponding pre-existing resource. However, if a manifest + has never been applied yet; or it has a corresponding resource which Fleet has assumed + ownership, apply op will still be executed. This is the safest option; one will have to remove the pre-existing resources (so that Fleet can re-create them) or switch to a different WhenToTakeOver option before Fleet starts processing the corresponding hub cluster manifests. + + + If you prefer Fleet stop processing all manifests, use this option along with the + ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing + on the member cluster side but still report configuration differences between the + hub cluster and member clusters. Fleet will not give up ownership + that it has already assumed though. enum: - Always - IfNoDiff + - Never type: string type: object clusterDecision: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml index ac4b89e4b..3bdca95ca 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml @@ -1873,6 +1873,15 @@ spec: Use ComparisonOption setting to control how the difference is calculated. + ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume + ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over + the resource). See the comments on the WhenToTakeOver field for more information. + ReportDiff apply strategy, however, will function regardless of Fleet's ownership + status. One may set up a CRP with the ReportDiff strategy and the Never takeover option, + and this will turn Fleet into a detection tool that reports only configuration differences + but do not touch any resources on the member cluster side. + + For a comparison between the different strategies and usage examples, refer to the Fleet documentation. enum: @@ -1988,17 +1997,27 @@ spec: it using the hub cluster manifest. - * Never: with this action, Fleet will not apply the hub cluster manifests to the member - clusters if there are corresponding pre-existing resources. + * Never: with this action, Fleet will not apply a hub cluster manifest to the member + clusters if there is a corresponding pre-existing resource. However, if a manifest + has never been applied yet; or it has a corresponding resource which Fleet has assumed + ownership, apply op will still be executed. This is the safest option; one will have to remove the pre-existing resources (so that Fleet can re-create them) or switch to a different WhenToTakeOver option before Fleet starts processing the corresponding hub cluster manifests. + + + If you prefer Fleet stop processing all manifests, use this option along with the + ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing + on the member cluster side but still report configuration differences between the + hub cluster and member clusters. Fleet will not give up ownership + that it has already assumed though. enum: - Always - IfNoDiff + - Never type: string type: object rollingUpdate: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml index 0ddea22b3..f52084ea5 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterstagedupdateruns.yaml @@ -204,6 +204,15 @@ spec: Use ComparisonOption setting to control how the difference is calculated. + ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume + ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over + the resource). See the comments on the WhenToTakeOver field for more information. + ReportDiff apply strategy, however, will function regardless of Fleet's ownership + status. One may set up a CRP with the ReportDiff strategy and the Never takeover option, + and this will turn Fleet into a detection tool that reports only configuration differences + but do not touch any resources on the member cluster side. + + For a comparison between the different strategies and usage examples, refer to the Fleet documentation. enum: @@ -319,17 +328,27 @@ spec: it using the hub cluster manifest. - * Never: with this action, Fleet will not apply the hub cluster manifests to the member - clusters if there are corresponding pre-existing resources. + * Never: with this action, Fleet will not apply a hub cluster manifest to the member + clusters if there is a corresponding pre-existing resource. However, if a manifest + has never been applied yet; or it has a corresponding resource which Fleet has assumed + ownership, apply op will still be executed. This is the safest option; one will have to remove the pre-existing resources (so that Fleet can re-create them) or switch to a different WhenToTakeOver option before Fleet starts processing the corresponding hub cluster manifests. + + + If you prefer Fleet stop processing all manifests, use this option along with the + ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing + on the member cluster side but still report configuration differences between the + hub cluster and member clusters. Fleet will not give up ownership + that it has already assumed though. enum: - Always - IfNoDiff + - Never type: string type: object conditions: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_works.yaml b/config/crd/bases/placement.kubernetes-fleet.io_works.yaml index c819523e3..4aab8a4fb 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_works.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_works.yaml @@ -453,6 +453,15 @@ spec: Use ComparisonOption setting to control how the difference is calculated. + ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume + ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over + the resource). See the comments on the WhenToTakeOver field for more information. + ReportDiff apply strategy, however, will function regardless of Fleet's ownership + status. One may set up a CRP with the ReportDiff strategy and the Never takeover option, + and this will turn Fleet into a detection tool that reports only configuration differences + but do not touch any resources on the member cluster side. + + For a comparison between the different strategies and usage examples, refer to the Fleet documentation. enum: @@ -568,17 +577,27 @@ spec: it using the hub cluster manifest. - * Never: with this action, Fleet will not apply the hub cluster manifests to the member - clusters if there are corresponding pre-existing resources. + * Never: with this action, Fleet will not apply a hub cluster manifest to the member + clusters if there is a corresponding pre-existing resource. However, if a manifest + has never been applied yet; or it has a corresponding resource which Fleet has assumed + ownership, apply op will still be executed. This is the safest option; one will have to remove the pre-existing resources (so that Fleet can re-create them) or switch to a different WhenToTakeOver option before Fleet starts processing the corresponding hub cluster manifests. + + + If you prefer Fleet stop processing all manifests, use this option along with the + ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing + on the member cluster side but still report configuration differences between the + hub cluster and member clusters. Fleet will not give up ownership + that it has already assumed though. enum: - Always - IfNoDiff + - Never type: string type: object workload: