@@ -535,8 +535,19 @@ type ApplyStrategy struct {
535535 // differences. No actual apply ops would be executed, and resources will be left alone as they
536536 // are on the member clusters.
537537 //
538+ // If configuration differences are found on a resource, Fleet will consider this as an apply
539+ // error, which might block rollout depending on the specified rollout strategy.
540+ //
538541 // Use ComparisonOption setting to control how the difference is calculated.
539542 //
543+ // ClientSideApply and ServerSideApply apply strategies only work when Fleet can assume
544+ // ownership of a resource (e.g., the resource is created by Fleet, or Fleet has taken over
545+ // the resource). See the comments on the WhenToTakeOver field for more information.
546+ // ReportDiff apply strategy, however, will function regardless of Fleet's ownership
547+ // status. One may set up a CRP with the ReportDiff strategy and the Never takeover option,
548+ // and this will turn Fleet into a detection tool that reports only configuration differences
549+ // but do not touch any resources on the member cluster side.
550+ //
540551 // For a comparison between the different strategies and usage examples, refer to the
541552 // Fleet documentation.
542553 //
@@ -545,10 +556,14 @@ type ApplyStrategy struct {
545556 // +kubebuilder:validation:Optional
546557 Type ApplyStrategyType `json:"type,omitempty"`
547558
548- // AllowCoOwnership defines whether to apply the resource if it already exists in the target cluster and is not
549- // solely owned by fleet (i.e., metadata.ownerReferences contains only fleet custom resources).
550- // If true, apply the resource and add fleet as a co-owner.
551- // If false, leave the resource unchanged and fail the apply.
559+ // AllowCoOwnership controls whether co-ownership between Fleet and other agents are allowed
560+ // on a Fleet-managed resource. If set to false, Fleet will refuse to apply manifests to
561+ // a resource that has been owned by one or more non-Fleet agents.
562+ //
563+ // Note that Fleet does not support the case where one resource is being placed multiple
564+ // times by different CRPs on the same member cluster. An apply error will be returned if
565+ // Fleet finds that a resource has been owned by another placement attempt by Fleet, even
566+ // with the AllowCoOwnership setting set to true.
552567 AllowCoOwnership bool `json:"allowCoOwnership,omitempty"`
553568
554569 // ServerSideApplyConfig defines the configuration for server side apply. It is honored only when type is ServerSideApply.
@@ -571,8 +586,9 @@ type ApplyStrategy struct {
571586 //
572587 // * IfNoDiff: with this action, Fleet will apply the hub cluster manifests to the member
573588 // clusters if (and only if) pre-existing resources look the same as the hub cluster manifests.
589+ //
574590 // This is a safer option as pre-existing resources that are inconsistent with the hub cluster
575- // manifests will not be overwritten; in fact, Fleet will ignore them until the inconsistencies
591+ // manifests will not be overwritten; Fleet will ignore them until the inconsistencies
576592 // are resolved properly: any change you make to the hub cluster manifests would not be
577593 // applied, and if you delete the manifests or even the ClusterResourcePlacement itself
578594 // from the hub cluster, these pre-existing resources would not be taken away.
@@ -597,8 +613,24 @@ type ApplyStrategy struct {
597613 // If appropriate, you may also delete the object from the member cluster; Fleet will recreate
598614 // it using the hub cluster manifest.
599615 //
616+ // * Never: with this action, Fleet will not apply a hub cluster manifest to the member
617+ // clusters if there is a corresponding pre-existing resource. However, if a manifest
618+ // has never been applied yet; or it has a corresponding resource which Fleet has assumed
619+ // ownership, apply op will still be executed.
620+ //
621+ // This is the safest option; one will have to remove the pre-existing resources (so that
622+ // Fleet can re-create them) or switch to a different
623+ // WhenToTakeOver option before Fleet starts processing the corresponding hub cluster
624+ // manifests.
625+ //
626+ // If you prefer Fleet stop processing all manifests, use this option along with the
627+ // ReportDiff apply strategy type. This setup would instruct Fleet to touch nothing
628+ // on the member cluster side but still report configuration differences between the
629+ // hub cluster and member clusters. Fleet will not give up ownership
630+ // that it has already assumed though.
631+ //
600632 // +kubebuilder:default=Always
601- // +kubebuilder:validation:Enum=Always;IfNoDiff
633+ // +kubebuilder:validation:Enum=Always;IfNoDiff;Never
602634 // +kubebuilder:validation:Optional
603635 WhenToTakeOver WhenToTakeOverType `json:"whenToTakeOver,omitempty"`
604636}
@@ -676,14 +708,35 @@ type ServerSideApplyConfig struct {
676708type WhenToTakeOverType string
677709
678710const (
679- // WhenToTakeOverTypeIfNoDiff will apply manifests from the hub cluster only if there is no difference
680- // between the current resource snapshot version on the hub cluster and the existing
681- // resources on the member cluster. Otherwise, we will report the difference.
711+ // WhenToTakeOverTypeIfNoDiff instructs Fleet to apply a manifest with a corresponding
712+ // pre-existing resource on a member cluster if and only if the pre-existing resource
713+ // looks the same as the manifest. Should there be any inconsistency, Fleet will skip
714+ // the apply op; no change will be made on the resource and Fleet will not claim
715+ // ownership on it.
716+ //
717+ // Note that this will not stop Fleet from processing other manifests in the same
718+ // placement that do not concern the takeover process (e.g., the manifests that have
719+ // not been created yet, or that are already under the management of Fleet).
682720 WhenToTakeOverTypeIfNoDiff WhenToTakeOverType = "IfNoDiff"
683721
684- // WhenToTakeOverTypeAlways will always apply the resource to the member cluster regardless
685- // if there are differences between the resource on the hub cluster and the existing resources on the member cluster.
722+ // WhenToTakeOverTypeAlways instructs Fleet to always apply manifests to a member cluster,
723+ // even if there are some corresponding pre-existing resources. Some fields on these
724+ // resources might be overwritten, and Fleet will claim ownership on them.
686725 WhenToTakeOverTypeAlways WhenToTakeOverType = "Always"
726+
727+ // WhenToTakeOverTypeNever instructs Fleet to never apply a manifest to a member cluster
728+ // if there is a corresponding pre-existing resource.
729+ //
730+ // Note that this will not stop Fleet from processing other manifests in the same placement
731+ // that do not concern the takeover process (e.g., the manifests that have not been created
732+ // yet, or that are already under the management of Fleet).
733+ //
734+ // If you would like Fleet to stop processing manifests all together and do not assume
735+ // ownership on any pre-existing resources, use this option along with the ReportDiff
736+ // apply strategy type. This setup would instruct Fleet to touch nothing on the member
737+ // cluster side but still report configuration differences between the hub cluster
738+ // and member clusters. Fleet will not give up ownership that it has already assumed, though.
739+ WhenToTakeOverTypeNever WhenToTakeOverType = "Never"
687740)
688741
689742// +enum
@@ -978,8 +1031,11 @@ type DiffedResourcePlacement struct {
9781031
9791032 // TargetClusterObservedGeneration is the generation of the resource on the target cluster
9801033 // that contains the configuration differences.
981- // +kubebuilder:validation:Required
982- TargetClusterObservedGeneration int64 `json:"targetClusterObservedGeneration"`
1034+ //
1035+ // This might be nil if the resource has not been created yet on the target cluster.
1036+ //
1037+ // +kubebuilder:validation:Optional
1038+ TargetClusterObservedGeneration * int64 `json:"targetClusterObservedGeneration"`
9831039
9841040 // FirstDiffedObservedTime is the first time the resource on the target cluster is
9851041 // observed to have configuration differences.
0 commit comments