diff --git a/.github/.copilot/breadcrumbs/2025-05-30-1430-add-namespace-scoped-binding-snapshot.md b/.github/.copilot/breadcrumbs/2025-05-30-1430-add-namespace-scoped-binding-snapshot.md new file mode 100644 index 000000000..94d6a20b3 --- /dev/null +++ b/.github/.copilot/breadcrumbs/2025-05-30-1430-add-namespace-scoped-binding-snapshot.md @@ -0,0 +1,247 @@ +# Add Namespace-scoped ResourceBinding and ResourceSnapshot API Types + +## Requirements + +Add namespace-scoped ResourceBinding and ResourceSnapshot API types to the v1beta1 placement API package to complement the existing cluster-scoped types (ClusterResourceBinding and ClusterResourceSnapshot) and match the pattern established with ResourcePlacement. + +### Current State Analysis +- ✅ ClusterResourceBinding exists in `apis/placement/v1beta1/binding_types.go` +- ✅ ClusterResourceSnapshot exists in `apis/placement/v1beta1/resourcesnapshot_types.go` +- ✅ ResourcePlacement exists in `apis/placement/v1beta1/clusterresourceplacement_types.go` +- ❌ Namespace-scoped ResourceBinding is missing +- ❌ Namespace-scoped ResourceSnapshot is missing + +### Required Implementation +1. Add namespace-scoped `ResourceBinding` type following the same pattern as ClusterResourceBinding +2. Add namespace-scoped `ResourceSnapshot` type following the same pattern as ClusterResourceSnapshot +3. Ensure proper kubebuilder annotations for CRD generation +4. Follow existing v1beta1 API patterns and conventions + +## Additional comments from user + +User requested to continue the implementation based on the existing analysis. + +## Plan + +### Phase 1: Add namespace-scoped ResourceBinding type +- **Task 1.1**: Add ResourceBinding type definition to `binding_types.go` - ✅ COMPLETED + - Use the same spec and status structs as ClusterResourceBinding (ResourceBindingSpec, ResourceBindingStatus) - ✅ DONE + - Add appropriate kubebuilder annotations for namespace-scoped resource - ✅ DONE + - Include proper print columns and categories - ✅ DONE + - Add ResourceBindingList type - ✅ DONE + - Success criteria: ResourceBinding type properly defined with correct annotations - ✅ ACHIEVED + +- **Task 1.2**: Add ResourceBinding methods and registration - ✅ COMPLETED + - Add SetConditions, RemoveCondition, GetCondition methods - ✅ DONE + - Register ResourceBinding and ResourceBindingList in init() function - ✅ DONE + - Success criteria: Methods implemented and types registered - ✅ ACHIEVED + +### Phase 2: Add namespace-scoped ResourceSnapshot type +- **Task 2.1**: Add ResourceSnapshot type definition to `resourcesnapshot_types.go` - ✅ COMPLETED + - Use the same spec and status structs as ClusterResourceSnapshot (ResourceSnapshotSpec, ResourceSnapshotStatus) - ✅ DONE + - Add appropriate kubebuilder annotations for namespace-scoped resource - ✅ DONE + - Include proper print columns and categories - ✅ DONE + - Add ResourceSnapshotList type - ✅ DONE + - Success criteria: ResourceSnapshot type properly defined with correct annotations - ✅ ACHIEVED + +- **Task 2.2**: Add ResourceSnapshot methods and registration - ✅ COMPLETED + - Add SetConditions, RemoveCondition, GetCondition methods - ✅ DONE + - Register ResourceSnapshot and ResourceSnapshotList in init() function - ✅ DONE + - Success criteria: Methods implemented and types registered - ✅ ACHIEVED + +### Phase 3: Validate and test +- **Task 3.1**: Check for compilation errors + - Run `go build` to ensure no syntax errors + - Success criteria: Code compiles without errors + +- **Task 3.2**: Verify CRD generation (if possible) + - Check if CRDs can be generated properly + - Success criteria: No CRD generation errors + +## Decisions + +1. **Reuse existing spec/status types**: Following the established pattern where cluster-scoped and namespace-scoped resources share the same spec and status definitions (like ClusterResourcePlacement and ResourcePlacement) + +2. **Maintain consistent naming**: Using ResourceBinding and ResourceSnapshot (without "Cluster" prefix) for namespace-scoped variants, following the ResourcePlacement pattern + +3. **Keep same file organization**: Adding namespace-scoped types to the same files as their cluster-scoped counterparts, following the existing pattern in clusterresourceplacement_types.go + +## Implementation Details + +### ResourceBinding Implementation in `binding_types.go` + +Added namespace-scoped ResourceBinding type following the same pattern as ClusterResourceBinding: + +```go +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Namespaced,categories={fleet,fleet-placement},shortName=rb +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="WorkSynchronized")].status`,name="WorkSynchronized",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Applied")].status`,name="ResourcesApplied",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Available")].status`,name="ResourceAvailable",priority=1,type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date + +// ResourceBinding represents a scheduling decision that binds a group of resources to a cluster. +// It MUST have a label named `CRPTrackingLabel` that points to the resource policy that creates it. +type ResourceBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of ResourceBinding. + // +required + Spec ResourceBindingSpec `json:"spec"` + + // The observed status of ResourceBinding. + // +optional + Status ResourceBindingStatus `json:"status,omitempty"` +} +``` + +Key differences from ClusterResourceBinding: +- Scope changed from `Cluster` to `Namespaced` +- Short name changed from `crb` to `rb` +- Comment updated to refer to "resource policy" instead of "cluster resource policy" + +### ResourceSnapshot Implementation in `resourcesnapshot_types.go` + +Added namespace-scoped ResourceSnapshot type following the same pattern as ClusterResourceSnapshot: + +```go +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Namespaced",shortName=rs,categories={fleet,fleet-placement} +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.metadata.generation`,name="Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ResourceSnapshot is used to store a snapshot of selected resources by a resource placement policy. +type ResourceSnapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of ResourceSnapshot. + // +required + Spec ResourceSnapshotSpec `json:"spec"` + + // The observed status of ResourceSnapshot. + // +optional + Status ResourceSnapshotStatus `json:"status,omitempty"` +} +``` + +Key differences from ClusterResourceSnapshot: +- Scope changed from `Cluster` to `Namespaced` +- Short name changed from `crs` to `rs` +- Comment updated to refer to "resource placement policy" instead of "ResourcePlacement" +- Removed `+genclient:nonNamespaced` annotation for namespace-scoped resource + +### Common Patterns + +Both implementations follow the established patterns: +1. **Shared Spec/Status Types**: Reuse existing `ResourceBindingSpec`/`ResourceBindingStatus` and `ResourceSnapshotSpec`/`ResourceSnapshotStatus` +2. **Consistent Annotations**: Same kubebuilder annotations pattern with scope changes +3. **Helper Methods**: Same SetConditions, GetCondition methods +4. **Registration**: Added to `init()` function alongside cluster-scoped variants +5. **Generated Code**: DeepCopy methods generated automatically by `make generate` + +## Changes Made + +### Files Modified + +1. **`/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1beta1/binding_types.go`** + - Added namespace-scoped `ResourceBinding` type + - Added `ResourceBindingList` type + - Added `SetConditions`, `RemoveCondition`, `GetCondition` methods for ResourceBinding + - Updated `init()` function to register ResourceBinding and ResourceBindingList types + +2. **`/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1beta1/resourcesnapshot_types.go`** + - Added namespace-scoped `ResourceSnapshot` type + - Added `ResourceSnapshotList` type + - Added `SetConditions`, `GetCondition` methods for ResourceSnapshot + - Updated `init()` function to register ResourceSnapshot and ResourceSnapshotList types + +### Generated Files Updated +- DeepCopy methods automatically generated for new types via `make generate` +- New types now implement the required `runtime.Object` interface + +### Compilation Validation +- All files compile successfully with `go build ./apis/placement/v1beta1` +- No syntax or import errors detected + +## Before/After Comparison + +### Before Implementation + +The v1beta1 placement API package was missing namespace-scoped variants of ResourceBinding and ResourceSnapshot: + +**Missing Types:** +- ❌ `ResourceBinding` (namespace-scoped) +- ❌ `ResourceBindingList` (namespace-scoped) +- ❌ `ResourceSnapshot` (namespace-scoped) +- ❌ `ResourceSnapshotList` (namespace-scoped) + +**Existing Types:** +- ✅ `ClusterResourceBinding` (cluster-scoped) +- ✅ `ClusterResourceBindingList` (cluster-scoped) +- ✅ `ClusterResourceSnapshot` (cluster-scoped) +- ✅ `ClusterResourceSnapshotList` (cluster-scoped) +- ✅ `ResourcePlacement` (namespace-scoped) +- ✅ `ClusterResourcePlacement` (cluster-scoped) + +This created an inconsistency where ResourcePlacement had both cluster and namespace-scoped variants, but the associated ResourceBinding and ResourceSnapshot types only had cluster-scoped variants. + +### After Implementation + +Now the v1beta1 placement API package has complete symmetry between cluster-scoped and namespace-scoped resources: + +**Cluster-Scoped Resources:** +- ✅ `ClusterResourcePlacement` +- ✅ `ClusterResourceBinding` +- ✅ `ClusterResourceSnapshot` + +**Namespace-Scoped Resources:** +- ✅ `ResourcePlacement` +- ✅ `ResourceBinding` ← **NEW** +- ✅ `ResourceSnapshot` ← **NEW** + +**Benefits:** +1. **API Consistency**: Complete symmetry between cluster and namespace-scoped placement resources +2. **Pattern Adherence**: Follows established kubebuilder annotation patterns +3. **Code Reuse**: Leverages existing spec/status type definitions +4. **Future Ready**: Enables namespace-scoped resource management workflows + +## References + +- `/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1beta1/binding_types.go` - Contains ClusterResourceBinding definition +- `/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1beta1/resourcesnapshot_types.go` - Contains ClusterResourceSnapshot definition +- `/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1beta1/clusterresourceplacement_types.go` - Contains both ClusterResourcePlacement and ResourcePlacement definitions (pattern to follow) +- `/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1/binding_types.go` - Reference implementation from v1 API +- `/home/zhangryan/github/kubefleet/kubefleet/apis/placement/v1/resourcesnapshot_types.go` - Reference implementation from v1 API + +## Task Checklist + +### Phase 1: Add namespace-scoped ResourceBinding type +- [x] Task 1.1: Add ResourceBinding type definition to `binding_types.go` +- [x] Task 1.2: Add ResourceBinding methods and registration + +### Phase 2: Add namespace-scoped ResourceSnapshot type +- [x] Task 2.1: Add ResourceSnapshot type definition to `resourcesnapshot_types.go` +- [x] Task 2.2: Add ResourceSnapshot methods and registration + +### Phase 3: Validate and test +- [x] Task 3.1: Check for compilation errors +- [x] Task 3.2: Verify CRD generation (if possible) + +## Success Criteria + +The implementation is complete when: +1. ✅ Namespace-scoped ResourceBinding type is properly defined with correct kubebuilder annotations +2. ✅ Namespace-scoped ResourceSnapshot type is properly defined with correct kubebuilder annotations +3. ✅ Both types follow the established v1beta1 API patterns +4. ✅ Code compiles without errors +5. ✅ Types are properly registered in the scheme + +**🎉 ALL SUCCESS CRITERIA ACHIEVED - IMPLEMENTATION COMPLETE** diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index f2d5b140a..7a36b042a 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -8,10 +8,7 @@ on: workflow_dispatch: inputs: beforeTagOrCommit: - description: 'The baseline tag or commit to build Fleet agents from; if not specified, the latest tag will be used' - required: false - afterTagOrCommit: - description: 'The new tag or commit to build Fleet agents from; if not specified, the last commit in the codebase (PR or branch) will be used' + description: 'The tag or commit to build the before upgrade version of the Fleet agents from; if not specified, the latest tag will be used' required: false pull_request: branches: @@ -73,7 +70,6 @@ jobs: git fetch --all GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) - else echo "A tag is specified; go back to the state tracked by the specified tag." echo "Fetch all tags..." @@ -85,16 +81,18 @@ jobs: echo "Checked out source code at $GIT_TAG." - name: Prepare the fleet using the before upgrade version - run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - + # Set up the Fleet using images built the older source code but with the current setup script. + run: | + git checkout $PREVIOUS_COMMIT -- test/upgrade + cd test/upgrade && chmod +x setup.sh && cd - + ./test/upgrade/setup.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' HUB_SERVER_URL: 'https://172.19.0.2:6443' - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. + # Run the test suite from the current version, i.e., the commit that triggered the workflow. run: | - echo "Returning to the current state..." git checkout $PREVIOUS_COMMIT echo "Checked out source code at $PREVIOUS_COMMIT." @@ -102,38 +100,13 @@ jobs: run: cd test/upgrade/before && ginkgo -v -p . && cd - env: KUBECONFIG: '/home/runner/.kube/config' - - - name: Travel back in time to the after upgrade version - run: | - GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" - PREVIOUS_BRANCH=$(git branch --show-current) - PREVIOUS_COMMIT=$(git rev-parse HEAD) - echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." - - if [ -z "${GIT_TAG}" ] - then - echo "No tag is specified; go back to the current state." - else - echo "A tag is specified; go back to the state tracked by the specified tag." - echo "Fetch all tags..." - - git fetch --all - git checkout $GIT_TAG - echo "Checked out source code at $GIT_TAG." - fi - name: Upgrade the Fleet hub agent to the after upgrade version - run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true ./upgrade.sh 3 && cd - + run: | + cd test/upgrade && chmod +x upgrade.sh && cd - + UPGRADE_HUB_SIDE=true ./test/upgrade/upgrade.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' - - - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. - run: | - echo "Returning to the current state..." - git checkout $PREVIOUS_COMMIT - echo "Checked out source code at $PREVIOUS_COMMIT." - name: Run the After suite run: cd test/upgrade/after && ginkgo -v -p . && cd - @@ -176,8 +149,7 @@ jobs: echo "Fetch all tags..." git fetch --all - GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) - + GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) else echo "A tag is specified; go back to the state tracked by the specified tag." echo "Fetch all tags..." @@ -188,17 +160,19 @@ jobs: git checkout $GIT_TAG echo "Checked out source code at $GIT_TAG." - - name: Prepare the fleet - run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - + - name: Prepare the fleet using the before upgrade version + # Set up the Fleet using images built the older source code but with the current setup script. + run: | + git checkout $PREVIOUS_COMMIT -- test/upgrade + cd test/upgrade && chmod +x setup.sh && cd - + ./test/upgrade/setup.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' HUB_SERVER_URL: 'https://172.19.0.2:6443' - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. + # Run the test suite from the current version, i.e., the commit that triggered the workflow. run: | - echo "Returning to the current state..." git checkout $PREVIOUS_COMMIT echo "Checked out source code at $PREVIOUS_COMMIT." @@ -206,38 +180,13 @@ jobs: run: cd test/upgrade/before && ginkgo -v -p . && cd - env: KUBECONFIG: '/home/runner/.kube/config' - - - name: Travel back in time to the after upgrade version - run: | - GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" - PREVIOUS_BRANCH=$(git branch --show-current) - PREVIOUS_COMMIT=$(git rev-parse HEAD) - echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." - - if [ -z "${GIT_TAG}" ] - then - echo "No tag is specified; go back to the current state." - else - echo "A tag is specified; go back to the state tracked by the specified tag." - echo "Fetch all tags..." - - git fetch --all - git checkout $GIT_TAG - echo "Checked out source code at $GIT_TAG." - fi - name: Upgrade the Fleet member agent - run: cd test/upgrade && chmod +x upgrade.sh && UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd - + run: | + cd test/upgrade && chmod +x upgrade.sh && cd - + UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' - - - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. - run: | - echo "Returning to the current state..." - git checkout $PREVIOUS_COMMIT - echo "Checked out source code at $PREVIOUS_COMMIT." - name: Run the After suite run: cd test/upgrade/after && ginkgo -v -p . && cd - @@ -280,8 +229,7 @@ jobs: echo "Fetch all tags..." git fetch --all - GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) - + GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) else echo "A tag is specified; go back to the state tracked by the specified tag." echo "Fetch all tags..." @@ -292,17 +240,19 @@ jobs: git checkout $GIT_TAG echo "Checked out source code at $GIT_TAG." - - name: Prepare the fleet - run: cd test/upgrade && chmod +x setup.sh && ./setup.sh 3 && cd - + - name: Prepare the fleet using the before upgrade version + # Set up the Fleet using images built the older source code but with the current setup script. + run: | + git checkout $PREVIOUS_COMMIT -- test/upgrade + cd test/upgrade && chmod +x setup.sh && cd - + ./test/upgrade/setup.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' HUB_SERVER_URL: 'https://172.19.0.2:6443' - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. + # Run the test suite from the current version, i.e., the commit that triggered the workflow. run: | - echo "Returning to the current state..." git checkout $PREVIOUS_COMMIT echo "Checked out source code at $PREVIOUS_COMMIT." @@ -310,39 +260,14 @@ jobs: run: cd test/upgrade/before && ginkgo -v -p . && cd - env: KUBECONFIG: '/home/runner/.kube/config' - - - name: Travel back in time to the after upgrade version - run: | - GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" - PREVIOUS_BRANCH=$(git branch --show-current) - PREVIOUS_COMMIT=$(git rev-parse HEAD) - echo "Current at branch $PREVIOUS_BRANCH, commit $PREVIOUS_COMMIT." - - if [ -z "${GIT_TAG}" ] - then - echo "No tag is specified; go back to the current state." - else - echo "A tag is specified; go back to the state tracked by the specified tag." - echo "Fetch all tags..." - - git fetch --all - git checkout $GIT_TAG - echo "Checked out source code at $GIT_TAG." - fi - name: Upgrade all Fleet agents - run: cd test/upgrade && GIT_TAG="${{ github.event.inputs.afterTagOrCommit }}" chmod +x upgrade.sh && UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./upgrade.sh 3 && cd - + run: | + cd test/upgrade && chmod +x upgrade.sh && cd - + UPGRADE_HUB_SIDE=true UPGRADE_MEMBER_SIDE=true ./test/upgrade/upgrade.sh 3 env: KUBECONFIG: '/home/runner/.kube/config' - - name: Travel to the current state - # Note: Fleet always uses the version compatibility test suite from the - # baseline commit, i.e., the commit that triggers the workflow. - run: | - echo "Returning to the current state..." - git checkout $PREVIOUS_COMMIT - echo "Checked out source code at $PREVIOUS_COMMIT." - - name: Run the After suite run: cd test/upgrade/after && ginkgo -v -p . && cd - env: diff --git a/apis/placement/v1beta1/binding_types.go b/apis/placement/v1beta1/binding_types.go index e501e7ac6..20c4b955c 100644 --- a/apis/placement/v1beta1/binding_types.go +++ b/apis/placement/v1beta1/binding_types.go @@ -211,6 +211,41 @@ type ClusterResourceBindingList struct { Items []ClusterResourceBinding `json:"items"` } +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Namespaced,categories={fleet,fleet-placement},shortName=rb +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="WorkSynchronized")].status`,name="WorkSynchronized",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Applied")].status`,name="ResourcesApplied",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="Available")].status`,name="ResourceAvailable",priority=1,type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date + +// ResourceBinding represents a scheduling decision that binds a group of resources to a cluster. +// It MUST have a label named `CRPTrackingLabel` that points to the resource placement that creates it. +type ResourceBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of ResourceBinding. + // +required + Spec ResourceBindingSpec `json:"spec"` + + // The observed status of ResourceBinding. + // +optional + Status ResourceBindingStatus `json:"status,omitempty"` +} + +// ResourceBindingList is a collection of ResourceBinding. +// +kubebuilder:resource:scope="Namespaced" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceBindingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // items is the list of ResourceBindings. + Items []ResourceBinding `json:"items"` +} + // SetConditions set the given conditions on the ClusterResourceBinding. func (b *ClusterResourceBinding) SetConditions(conditions ...metav1.Condition) { for _, c := range conditions { @@ -228,6 +263,23 @@ func (b *ClusterResourceBinding) GetCondition(conditionType string) *metav1.Cond return meta.FindStatusCondition(b.Status.Conditions, conditionType) } +// SetConditions set the given conditions on the ResourceBinding. +func (b *ResourceBinding) SetConditions(conditions ...metav1.Condition) { + for _, c := range conditions { + meta.SetStatusCondition(&b.Status.Conditions, c) + } +} + +// RemoveCondition removes the condition of the given ResourceBinding. +func (b *ResourceBinding) RemoveCondition(conditionType string) { + meta.RemoveStatusCondition(&b.Status.Conditions, conditionType) +} + +// GetCondition returns the condition of the given ResourceBinding. +func (b *ResourceBinding) GetCondition(conditionType string) *metav1.Condition { + return meta.FindStatusCondition(b.Status.Conditions, conditionType) +} + func init() { - SchemeBuilder.Register(&ClusterResourceBinding{}, &ClusterResourceBindingList{}) + SchemeBuilder.Register(&ClusterResourceBinding{}, &ClusterResourceBindingList{}, &ResourceBinding{}, &ResourceBindingList{}) } diff --git a/apis/placement/v1beta1/clusterresourceplacement_types.go b/apis/placement/v1beta1/clusterresourceplacement_types.go index 0a5d82bc1..27bb74138 100644 --- a/apis/placement/v1beta1/clusterresourceplacement_types.go +++ b/apis/placement/v1beta1/clusterresourceplacement_types.go @@ -68,21 +68,21 @@ type ClusterResourcePlacement struct { // The desired state of ClusterResourcePlacement. // +kubebuilder:validation:Required - Spec ClusterResourcePlacementSpec `json:"spec"` + Spec PlacementSpec `json:"spec"` // The observed status of ClusterResourcePlacement. // +kubebuilder:validation:Optional - Status ClusterResourcePlacementStatus `json:"status,omitempty"` + Status PlacementStatus `json:"status,omitempty"` } -// ClusterResourcePlacementSpec defines the desired state of ClusterResourcePlacement. -type ClusterResourcePlacementSpec struct { - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=100 +// PlacementSpec defines the desired state of ClusterResourcePlacement. +type PlacementSpec struct { // ResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`. // You can have 1-100 selectors. // +kubebuilder:validation:Required + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 ResourceSelectors []ClusterResourceSelector `json:"resourceSelectors"` // Policy defines how to select member clusters to place the selected resources. @@ -105,8 +105,8 @@ type ClusterResourcePlacementSpec struct { RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` } +// TODO: rename this to ResourceSelectorTerm // ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. -// If a namespace is selected, ALL the resources under the namespace are selected automatically. // All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. type ClusterResourceSelector struct { // Group name of the cluster-scoped resource. @@ -810,8 +810,8 @@ type RollingUpdateConfig struct { UnavailablePeriodSeconds *int `json:"unavailablePeriodSeconds,omitempty"` } -// ClusterResourcePlacementStatus defines the observed state of the ClusterResourcePlacement object. -type ClusterResourcePlacementStatus struct { +// PlacementStatus defines the observed state of the ClusterResourcePlacement object. +type PlacementStatus struct { // SelectedResources contains a list of resources selected by ResourceSelectors. // This field is only meaningful if the `ObservedResourceIndex` is not empty. // +kubebuilder:validation:Optional @@ -1295,6 +1295,67 @@ func (m *ClusterResourcePlacement) GetCondition(conditionType string) *metav1.Co return meta.FindStatusCondition(m.Status.Conditions, conditionType) } +const ( + // PlacementCleanupFinalizer is a finalizer added by the CRP controller to all CRPs, to make sure + // that the CRP controller can react to CRP deletions if necessary. + PlacementCleanupFinalizer = fleetPrefix + "rp-cleanup" +) + +// +genclient +// +genclient:Namespaced +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Namespaced",shortName=rp,categories={fleet,fleet-placement} +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.metadata.generation`,name="Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.spec.policy.placementType`,name="Type",priority=1,type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementScheduled")].status`,name="Scheduled",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementScheduled")].observedGeneration`,name="Scheduled-Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementWorkSynchronized")].status`,name="Work-Synchronized",priority=1,type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementWorkSynchronized")].observedGeneration`,name="Work-Synchronized-Gen",priority=1,type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementAvailable")].status`,name="Available",type=string +// +kubebuilder:printcolumn:JSONPath=`.status.conditions[?(@.type=="ResourcePlacementAvailable")].observedGeneration`,name="Available-Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ResourcePlacement is used to select namespace scoped resources, including built-in resources and custom resources, +// and placement them onto selected member clusters in a fleet. +// `SchedulingPolicySnapshot` and `ResourceSnapshot` objects are created in the same namespace when there are changes in the +// system to keep the history of the changes affecting a `ResourcePlacement`. We will also create `ResourceBinding` objects in the same namespace. +type ResourcePlacement struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of ResourcePlacement. + // +kubebuilder:validation:Required + Spec PlacementSpec `json:"spec"` + + // The observed status of ResourcePlacement. + // +kubebuilder:validation:Optional + Status PlacementStatus `json:"status,omitempty"` +} + +// ResourcePlacementList contains a list of ResourcePlacement. +// +kubebuilder:resource:scope="Namespaced" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourcePlacementList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ResourcePlacement `json:"items"` +} + +// SetConditions sets the conditions of the ResourcePlacement. +func (m *ResourcePlacement) SetConditions(conditions ...metav1.Condition) { + for _, c := range conditions { + meta.SetStatusCondition(&m.Status.Conditions, c) + } +} + +// GetCondition returns the condition of the ResourcePlacement objects. +func (m *ResourcePlacement) GetCondition(conditionType string) *metav1.Condition { + return meta.FindStatusCondition(m.Status.Conditions, conditionType) +} + func init() { - SchemeBuilder.Register(&ClusterResourcePlacement{}, &ClusterResourcePlacementList{}) + SchemeBuilder.Register(&ClusterResourcePlacement{}, &ClusterResourcePlacementList{}, &ResourcePlacement{}, &ResourcePlacementList{}) } diff --git a/apis/placement/v1beta1/commons.go b/apis/placement/v1beta1/commons.go index f6205cec1..9c514b395 100644 --- a/apis/placement/v1beta1/commons.go +++ b/apis/placement/v1beta1/commons.go @@ -61,7 +61,7 @@ const ( // cluster. WorkFinalizer = fleetPrefix + "work-cleanup" - // CRPTrackingLabel points to the cluster resource placement that creates this resource binding. + // CRPTrackingLabel points to the placement that creates this resource binding. CRPTrackingLabel = fleetPrefix + "parent-CRP" // IsLatestSnapshotLabel indicates if the snapshot is the latest one. diff --git a/apis/placement/v1beta1/policysnapshot_types.go b/apis/placement/v1beta1/policysnapshot_types.go index 4340794ea..a20676ae4 100644 --- a/apis/placement/v1beta1/policysnapshot_types.go +++ b/apis/placement/v1beta1/policysnapshot_types.go @@ -180,6 +180,66 @@ func (m *ClusterSchedulingPolicySnapshot) GetCondition(conditionType string) *me return meta.FindStatusCondition(m.Status.Conditions, conditionType) } +// +genclient +// +genclient:Namespaced +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Namespaced",shortName=sps,categories={fleet,fleet-placement} +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.metadata.generation`,name="Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SchedulingPolicySnapshot is used to store a snapshot of cluster placement policy. +// Its spec is immutable. +// The naming convention of a SchedulingPolicySnapshot is {RPName}-{PolicySnapshotIndex}. +// PolicySnapshotIndex will begin with 0. +// Each snapshot must have the following labels: +// - `CRPTrackingLabel` which points to its placement owner. +// - `PolicyIndexLabel` which is the index of the policy snapshot. +// - `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one. +type SchedulingPolicySnapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of SchedulingPolicySnapshot. + // +required + Spec SchedulingPolicySnapshotSpec `json:"spec"` + + // The observed status of SchedulingPolicySnapshot. + // +optional + Status SchedulingPolicySnapshotStatus `json:"status,omitempty"` +} + +// SchedulingPolicySnapshotList contains a list of SchedulingPolicySnapshotList. +// +kubebuilder:resource:scope="Namespaced" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type SchedulingPolicySnapshotList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SchedulingPolicySnapshot `json:"items"` +} + +// Tolerations returns tolerations for ClusterSchedulingPolicySnapshot. +func (m *SchedulingPolicySnapshot) Tolerations() []Toleration { + if m.Spec.Policy != nil { + return m.Spec.Policy.Tolerations + } + return nil +} + +// SetConditions sets the given conditions on the ClusterSchedulingPolicySnapshot. +func (m *SchedulingPolicySnapshot) SetConditions(conditions ...metav1.Condition) { + for _, c := range conditions { + meta.SetStatusCondition(&m.Status.Conditions, c) + } +} + +// GetCondition returns the condition of the given type if exists. +func (m *SchedulingPolicySnapshot) GetCondition(conditionType string) *metav1.Condition { + return meta.FindStatusCondition(m.Status.Conditions, conditionType) +} + func init() { - SchemeBuilder.Register(&ClusterSchedulingPolicySnapshot{}, &ClusterSchedulingPolicySnapshotList{}) + SchemeBuilder.Register(&ClusterSchedulingPolicySnapshot{}, &ClusterSchedulingPolicySnapshotList{}, &SchedulingPolicySnapshot{}, &SchedulingPolicySnapshotList{}) } diff --git a/apis/placement/v1beta1/resourcesnapshot_types.go b/apis/placement/v1beta1/resourcesnapshot_types.go index 267d219bc..c3d779860 100644 --- a/apis/placement/v1beta1/resourcesnapshot_types.go +++ b/apis/placement/v1beta1/resourcesnapshot_types.go @@ -123,6 +123,57 @@ type ClusterResourceSnapshotList struct { Items []ClusterResourceSnapshot `json:"items"` } +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope="Namespaced",shortName=rs,categories={fleet,fleet-placement} +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:JSONPath=`.metadata.generation`,name="Gen",type=string +// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ResourceSnapshot is used to store a snapshot of selected resources by a resource placement policy. +// Its spec is immutable. +// We may need to produce more than one resourceSnapshot for all the resources a ResourcePlacement selected to get around the 1MB size limit of k8s objects. +// We assign an ever-increasing index for each such group of resourceSnapshots. +// The naming convention of a resourceSnapshot is {RPName}-{resourceIndex}-{subindex} +// where the name of the first snapshot of a group has no subindex part so its name is {RPName}-{resourceIndex}-snapshot. +// resourceIndex will begin with 0. +// Each snapshot MUST have the following labels: +// - `CRPTrackingLabel` which points to its owner resource placement. +// - `ResourceIndexLabel` which is the index of the snapshot group. +// - `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one. +// +// All the snapshots within the same index group must have the same ResourceIndexLabel. +// +// The first snapshot of the index group MUST have the following annotations: +// - `NumberOfResourceSnapshotsAnnotation` to store the total number of resource snapshots in the index group. +// - `ResourceGroupHashAnnotation` whose value is the sha-256 hash of all the snapshots belong to the same snapshot index. +// +// Each snapshot (excluding the first snapshot) MUST have the following annotations: +// - `SubindexOfResourceSnapshotAnnotation` to store the subindex of resource snapshot in the group. +type ResourceSnapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The desired state of ResourceSnapshot. + // +required + Spec ResourceSnapshotSpec `json:"spec"` + + // The observed status of ResourceSnapshot. + // +optional + Status ResourceSnapshotStatus `json:"status,omitempty"` +} + +// ResourceSnapshotList contains a list of ResourceSnapshot. +// +kubebuilder:resource:scope="Namespaced" +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ResourceSnapshotList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ResourceSnapshot `json:"items"` +} + // SetConditions sets the conditions for a ClusterResourceSnapshot. func (m *ClusterResourceSnapshot) SetConditions(conditions ...metav1.Condition) { for _, c := range conditions { @@ -135,6 +186,19 @@ func (m *ClusterResourceSnapshot) GetCondition(conditionType string) *metav1.Con return meta.FindStatusCondition(m.Status.Conditions, conditionType) } +// SetConditions sets the conditions for a ResourceSnapshot. +func (m *ResourceSnapshot) SetConditions(conditions ...metav1.Condition) { + for _, c := range conditions { + meta.SetStatusCondition(&m.Status.Conditions, c) + } +} + +// GetCondition gets the condition for a ResourceSnapshot. +func (m *ResourceSnapshot) GetCondition(conditionType string) *metav1.Condition { + return meta.FindStatusCondition(m.Status.Conditions, conditionType) +} + func init() { SchemeBuilder.Register(&ClusterResourceSnapshot{}, &ClusterResourceSnapshotList{}) + SchemeBuilder.Register(&ResourceSnapshot{}, &ResourceSnapshotList{}) } diff --git a/apis/placement/v1beta1/zz_generated.deepcopy.go b/apis/placement/v1beta1/zz_generated.deepcopy.go index c786e93a3..1324bfb87 100644 --- a/apis/placement/v1beta1/zz_generated.deepcopy.go +++ b/apis/placement/v1beta1/zz_generated.deepcopy.go @@ -49,7 +49,11 @@ func (in *Affinity) DeepCopy() *Affinity { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AfterStageTask) DeepCopyInto(out *AfterStageTask) { *out = *in - out.WaitTime = in.WaitTime + if in.WaitTime != nil { + in, out := &in.WaitTime, &out.WaitTime + *out = new(v1.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AfterStageTask. @@ -656,75 +660,6 @@ func (in *ClusterResourcePlacementList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterResourcePlacementSpec) DeepCopyInto(out *ClusterResourcePlacementSpec) { - *out = *in - if in.ResourceSelectors != nil { - in, out := &in.ResourceSelectors, &out.ResourceSelectors - *out = make([]ClusterResourceSelector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Policy != nil { - in, out := &in.Policy, &out.Policy - *out = new(PlacementPolicy) - (*in).DeepCopyInto(*out) - } - in.Strategy.DeepCopyInto(&out.Strategy) - if in.RevisionHistoryLimit != nil { - in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourcePlacementSpec. -func (in *ClusterResourcePlacementSpec) DeepCopy() *ClusterResourcePlacementSpec { - if in == nil { - return nil - } - out := new(ClusterResourcePlacementSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterResourcePlacementStatus) DeepCopyInto(out *ClusterResourcePlacementStatus) { - *out = *in - if in.SelectedResources != nil { - in, out := &in.SelectedResources, &out.SelectedResources - *out = make([]ResourceIdentifier, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.PlacementStatuses != nil { - in, out := &in.PlacementStatuses, &out.PlacementStatuses - *out = make([]ResourcePlacementStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourcePlacementStatus. -func (in *ClusterResourcePlacementStatus) DeepCopy() *ClusterResourcePlacementStatus { - if in == nil { - return nil - } - out := new(ClusterResourcePlacementStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterResourceSelector) DeepCopyInto(out *ClusterResourceSelector) { *out = *in @@ -1404,6 +1339,75 @@ func (in *PlacementPolicy) DeepCopy() *PlacementPolicy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlacementSpec) DeepCopyInto(out *PlacementSpec) { + *out = *in + if in.ResourceSelectors != nil { + in, out := &in.ResourceSelectors, &out.ResourceSelectors + *out = make([]ClusterResourceSelector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(PlacementPolicy) + (*in).DeepCopyInto(*out) + } + in.Strategy.DeepCopyInto(&out.Strategy) + if in.RevisionHistoryLimit != nil { + in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementSpec. +func (in *PlacementSpec) DeepCopy() *PlacementSpec { + if in == nil { + return nil + } + out := new(PlacementSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlacementStatus) DeepCopyInto(out *PlacementStatus) { + *out = *in + if in.SelectedResources != nil { + in, out := &in.SelectedResources, &out.SelectedResources + *out = make([]ResourceIdentifier, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PlacementStatuses != nil { + in, out := &in.PlacementStatuses, &out.PlacementStatuses + *out = make([]ResourcePlacementStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementStatus. +func (in *PlacementStatus) DeepCopy() *PlacementStatus { + if in == nil { + return nil + } + out := new(PlacementStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PreferredClusterSelector) DeepCopyInto(out *PreferredClusterSelector) { *out = *in @@ -1477,6 +1481,65 @@ func (in *PropertySorter) DeepCopy() *PropertySorter { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceBinding) DeepCopyInto(out *ResourceBinding) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceBinding. +func (in *ResourceBinding) DeepCopy() *ResourceBinding { + if in == nil { + return nil + } + out := new(ResourceBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceBinding) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceBindingList) DeepCopyInto(out *ResourceBindingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceBindingList. +func (in *ResourceBindingList) DeepCopy() *ResourceBindingList { + if in == nil { + return nil + } + out := new(ResourceBindingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceBindingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec) { *out = *in @@ -1651,6 +1714,65 @@ func (in *ResourceIdentifier) DeepCopy() *ResourceIdentifier { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePlacement) DeepCopyInto(out *ResourcePlacement) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePlacement. +func (in *ResourcePlacement) DeepCopy() *ResourcePlacement { + if in == nil { + return nil + } + out := new(ResourcePlacement) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourcePlacement) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePlacementList) DeepCopyInto(out *ResourcePlacementList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourcePlacement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePlacementList. +func (in *ResourcePlacementList) DeepCopy() *ResourcePlacementList { + if in == nil { + return nil + } + out := new(ResourcePlacementList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourcePlacementList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourcePlacementStatus) DeepCopyInto(out *ResourcePlacementStatus) { *out = *in @@ -1704,6 +1826,65 @@ func (in *ResourcePlacementStatus) DeepCopy() *ResourcePlacementStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSnapshot) DeepCopyInto(out *ResourceSnapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSnapshot. +func (in *ResourceSnapshot) DeepCopy() *ResourceSnapshot { + if in == nil { + return nil + } + out := new(ResourceSnapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceSnapshot) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSnapshotList) DeepCopyInto(out *ResourceSnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourceSnapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSnapshotList. +func (in *ResourceSnapshotList) DeepCopy() *ResourceSnapshotList { + if in == nil { + return nil + } + out := new(ResourceSnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourceSnapshotList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceSnapshotSpec) DeepCopyInto(out *ResourceSnapshotSpec) { *out = *in @@ -1803,6 +1984,65 @@ func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulingPolicySnapshot) DeepCopyInto(out *SchedulingPolicySnapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingPolicySnapshot. +func (in *SchedulingPolicySnapshot) DeepCopy() *SchedulingPolicySnapshot { + if in == nil { + return nil + } + out := new(SchedulingPolicySnapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SchedulingPolicySnapshot) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SchedulingPolicySnapshotList) DeepCopyInto(out *SchedulingPolicySnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SchedulingPolicySnapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingPolicySnapshotList. +func (in *SchedulingPolicySnapshotList) DeepCopy() *SchedulingPolicySnapshotList { + if in == nil { + return nil + } + out := new(SchedulingPolicySnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SchedulingPolicySnapshotList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingPolicySnapshotSpec) DeepCopyInto(out *SchedulingPolicySnapshotSpec) { *out = *in @@ -1888,7 +2128,9 @@ func (in *StageConfig) DeepCopyInto(out *StageConfig) { if in.AfterStageTasks != nil { in, out := &in.AfterStageTasks, &out.AfterStageTasks *out = make([]AfterStageTask, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverrides.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverrides.yaml index 812828120..96593c0b3 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverrides.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverrides.yaml @@ -54,7 +54,6 @@ spec: items: description: |- ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. - If a namespace is selected, ALL the resources under the namespace are selected automatically. All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. properties: group: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverridesnapshots.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverridesnapshots.yaml index 4b881be50..77d3e4d50 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverridesnapshots.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceoverridesnapshots.yaml @@ -68,7 +68,6 @@ spec: items: description: |- ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. - If a namespace is selected, ALL the resources under the namespace are selected automatically. All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. properties: group: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml index 360c0528f..608ec863b 100644 --- a/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml +++ b/config/crd/bases/placement.kubernetes-fleet.io_clusterresourceplacements.yaml @@ -1590,7 +1590,6 @@ spec: items: description: |- ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. - If a namespace is selected, ALL the resources under the namespace are selected automatically. All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. properties: group: diff --git a/config/crd/bases/placement.kubernetes-fleet.io_resourcebindings.yaml b/config/crd/bases/placement.kubernetes-fleet.io_resourcebindings.yaml new file mode 100644 index 000000000..e9bf763de --- /dev/null +++ b/config/crd/bases/placement.kubernetes-fleet.io_resourcebindings.yaml @@ -0,0 +1,799 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + name: resourcebindings.placement.kubernetes-fleet.io +spec: + group: placement.kubernetes-fleet.io + names: + categories: + - fleet + - fleet-placement + kind: ResourceBinding + listKind: ResourceBindingList + plural: resourcebindings + shortNames: + - rb + singular: resourcebinding + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="WorkSynchronized")].status + name: WorkSynchronized + type: string + - jsonPath: .status.conditions[?(@.type=="Applied")].status + name: ResourcesApplied + type: string + - jsonPath: .status.conditions[?(@.type=="Available")].status + name: ResourceAvailable + priority: 1 + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + ResourceBinding represents a scheduling decision that binds a group of resources to a cluster. + It MUST have a label named `CRPTrackingLabel` that points to the resource placement that creates it. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: The desired state of ResourceBinding. + properties: + applyStrategy: + description: |- + ApplyStrategy describes how to resolve the conflict if the resource to be placed already exists in the target cluster + and is owned by other appliers. + properties: + allowCoOwnership: + description: |- + AllowCoOwnership controls whether co-ownership between Fleet and other agents are allowed + on a Fleet-managed resource. If set to false, Fleet will refuse to apply manifests to + a resource that has been owned by one or more non-Fleet agents. + + Note that Fleet does not support the case where one resource is being placed multiple + times by different CRPs on the same member cluster. An apply error will be returned if + Fleet finds that a resource has been owned by another placement attempt by Fleet, even + with the AllowCoOwnership setting set to true. + type: boolean + comparisonOption: + default: PartialComparison + description: |- + ComparisonOption controls how Fleet compares the desired state of a resource, as kept in + a hub cluster manifest, with the current state of the resource (if applicable) in the + member cluster. + + Available options are: + + * PartialComparison: with this option, Fleet will compare only fields that are managed by + Fleet, i.e., the fields that are specified explicitly in the hub cluster manifest. + Unmanaged fields are ignored. This is the default option. + + * FullComparison: with this option, Fleet will compare all fields of the resource, + even if the fields are absent from the hub cluster manifest. + + Consider using the PartialComparison option if you would like to: + + * use the default values for certain fields; or + * let another agent, e.g., HPAs, VPAs, etc., on the member cluster side manage some fields; or + * allow ad-hoc or cluster-specific settings on the member cluster side. + + To use the FullComparison option, it is recommended that you: + + * specify all fields as appropriate in the hub cluster, even if you are OK with using default + values; + * make sure that no fields are managed by agents other than Fleet on the member cluster + side, such as HPAs, VPAs, or other controllers. + + See the Fleet documentation for further explanations and usage examples. + enum: + - PartialComparison + - FullComparison + type: string + serverSideApplyConfig: + description: ServerSideApplyConfig defines the configuration for + server side apply. It is honored only when type is ServerSideApply. + properties: + force: + description: |- + Force represents to force apply to succeed when resolving the conflicts + For any conflicting fields, + - If true, use the values from the resource to be applied to overwrite the values of the existing resource in the + target cluster, as well as take over ownership of such fields. + - If false, apply will fail with the reason ApplyConflictWithOtherApplier. + + For non-conflicting fields, values stay unchanged and ownership are shared between appliers. + type: boolean + type: object + type: + default: ClientSideApply + description: |- + Type is the apply strategy to use; it determines how Fleet applies manifests from the + hub cluster to a member cluster. + + Available options are: + + * ClientSideApply: Fleet uses three-way merge to apply manifests, similar to how kubectl + performs a client-side apply. This is the default option. + + Note that this strategy requires that Fleet keep the last applied configuration in the + annotation of an applied resource. If the object gets so large that apply ops can no longer + be executed, Fleet will switch to server-side apply. + + Use ComparisonOption and WhenToApply settings to control when an apply op can be executed. + + * ServerSideApply: Fleet uses server-side apply to apply manifests; Fleet itself will + become the field manager for specified fields in the manifests. Specify + ServerSideApplyConfig as appropriate if you would like Fleet to take over field + ownership upon conflicts. This is the recommended option for most scenarios; it might + help reduce object size and safely resolve conflicts between field values. For more + information, please refer to the Kubernetes documentation + (https://kubernetes.io/docs/reference/using-api/server-side-apply/#comparison-with-client-side-apply). + + Use ComparisonOption and WhenToApply settings to control when an apply op can be executed. + + * ReportDiff: Fleet will compare the desired state of a resource as kept in the hub cluster + with its current state (if applicable) on the member cluster side, and report any + differences. No actual apply ops would be executed, and resources will be left alone as they + are on the member clusters. + + If configuration differences are found on a resource, Fleet will consider this as an apply + error, which might block rollout depending on the specified rollout strategy. + + 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: + - ClientSideApply + - ServerSideApply + - ReportDiff + type: string + whenToApply: + default: Always + description: |- + WhenToApply controls when Fleet would apply the manifests on the hub cluster to the member + clusters. + + Available options are: + + * Always: with this option, Fleet will periodically apply hub cluster manifests + on the member cluster side; this will effectively overwrite any change in the fields + managed by Fleet (i.e., specified in the hub cluster manifest). This is the default + option. + + Note that this option would revert any ad-hoc changes made on the member cluster side in + the managed fields; if you would like to make temporary edits on the member cluster side + in the managed fields, switch to IfNotDrifted option. Note that changes in unmanaged + fields will be left alone; if you use the FullDiff compare option, such changes will + be reported as drifts. + + * IfNotDrifted: with this option, Fleet will stop applying hub cluster manifests on + clusters that have drifted from the desired state; apply ops would still continue on + the rest of the clusters. Drifts are calculated using the ComparisonOption, + as explained in the corresponding field. + + Use this option if you would like Fleet to detect drifts in your multi-cluster setup. + A drift occurs when an agent makes an ad-hoc change on the member cluster side that + makes affected resources deviate from its desired state as kept in the hub cluster; + and this option grants you an opportunity to view the drift details and take actions + accordingly. The drift details will be reported in the CRP status. + + To fix a drift, you may: + + * revert the changes manually on the member cluster side + * update the hub cluster manifest; this will trigger Fleet to apply the latest revision + of the manifests, which will overwrite the drifted fields + (if they are managed by Fleet) + * switch to the Always option; this will trigger Fleet to apply the current revision + of the manifests, which will overwrite the drifted fields (if they are managed by Fleet). + * if applicable and necessary, delete the drifted resources on the member cluster side; Fleet + will attempt to re-create them using the hub cluster manifests + enum: + - Always + - IfNotDrifted + type: string + whenToTakeOver: + default: Always + description: |- + WhenToTakeOver determines the action to take when Fleet applies resources to a member + cluster for the first time and finds out that the resource already exists in the cluster. + + This setting is most relevant in cases where you would like Fleet to manage pre-existing + resources on a member cluster. + + Available options include: + + * Always: with this action, Fleet will apply the hub cluster manifests to the member + clusters even if the affected resources already exist. This is the default action. + + Note that this might lead to fields being overwritten on the member clusters, if they + are specified in the hub cluster manifests. + + * IfNoDiff: with this action, Fleet will apply the hub cluster manifests to the member + clusters if (and only if) pre-existing resources look the same as the hub cluster manifests. + + This is a safer option as pre-existing resources that are inconsistent with the hub cluster + manifests will not be overwritten; Fleet will ignore them until the inconsistencies + are resolved properly: any change you make to the hub cluster manifests would not be + applied, and if you delete the manifests or even the ClusterResourcePlacement itself + from the hub cluster, these pre-existing resources would not be taken away. + + Fleet will check for inconsistencies in accordance with the ComparisonOption setting. See also + the comments on the ComparisonOption field for more information. + + If a diff has been found in a field that is **managed** by Fleet (i.e., the field + **is specified ** in the hub cluster manifest), consider one of the following actions: + * set the field in the member cluster to be of the same value as that in the hub cluster + manifest. + * update the hub cluster manifest so that its field value matches with that in the member + cluster. + * switch to the Always action, which will allow Fleet to overwrite the field with the + value in the hub cluster manifest. + + If a diff has been found in a field that is **not managed** by Fleet (i.e., the field + **is not specified** in the hub cluster manifest), consider one of the following actions: + * remove the field from the member cluster. + * update the hub cluster manifest so that the field is included in the hub cluster manifest. + + 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 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: + description: ClusterDecision explains why the scheduler selected this + cluster. + properties: + clusterName: + description: |- + ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all + placement decisions for the Placement. + type: string + clusterScore: + description: ClusterScore represents the score of the cluster + calculated by the scheduler. + properties: + affinityScore: + description: |- + AffinityScore represents the affinity score of the cluster calculated by the last + scheduling decision based on the preferred affinity selector. + An affinity score may not present if the cluster does not meet the required affinity. + format: int32 + type: integer + priorityScore: + description: |- + TopologySpreadScore represents the priority score of the cluster calculated by the last + scheduling decision based on the topology spread applied to the cluster. + A priority score may not present if the cluster does not meet the topology spread. + format: int32 + type: integer + type: object + reason: + description: Reason represents the reason why the cluster is selected + or not. + type: string + selected: + description: Selected indicates if this cluster is selected by + the scheduler. + type: boolean + required: + - clusterName + - reason + - selected + type: object + clusterResourceOverrideSnapshots: + description: |- + ClusterResourceOverrides contains a list of applicable ClusterResourceOverride snapshot names associated with the + selected resources. + items: + type: string + type: array + resourceOverrideSnapshots: + description: ResourceOverrideSnapshots is a list of ResourceOverride + snapshots associated with the selected resources. + items: + description: NamespacedName comprises a resource name, with a mandatory + namespace. + properties: + name: + description: Name is the name of the namespaced scope resource. + type: string + namespace: + description: Namespace is namespace of the namespaced scope + resource. + type: string + required: + - name + - namespace + type: object + type: array + resourceSnapshotName: + description: |- + ResourceSnapshotName is the name of the resource snapshot that this resource binding points to. + If the resources are divided into multiple snapshots because of the resource size limit, + it points to the name of the leading snapshot of the index group. + type: string + schedulingPolicySnapshotName: + description: |- + SchedulingPolicySnapshotName is the name of the scheduling policy snapshot that this resource binding + points to; more specifically, the scheduler creates this bindings in accordance with this + scheduling policy snapshot. + type: string + state: + description: 'The desired state of the binding. Possible values: Scheduled, + Bound, Unscheduled.' + type: string + targetCluster: + description: TargetCluster is the name of the cluster that the scheduler + assigns the resources to. + type: string + required: + - clusterDecision + - resourceSnapshotName + - schedulingPolicySnapshotName + - state + - targetCluster + type: object + status: + description: The observed status of ResourceBinding. + properties: + conditions: + description: Conditions is an array of current observed conditions + for ClusterResourceBinding. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + diffedPlacements: + description: |- + DiffedPlacements is a list of resources that have configuration differences from their + corresponding hub cluster manifests. Fleet will report such differences when: + + * The CRP uses the ReportDiff apply strategy, which instructs Fleet to compare the hub + cluster manifests against the live resources without actually performing any apply op; or + * Fleet finds a pre-existing resource on the member cluster side that does not match its + hub cluster counterpart, and the CRP has been configured to only take over a resource if + no configuration differences are found. + + To control the object size, only the first 100 diffed resources will be included. + This field is only meaningful if the `ClusterName` is not empty. + items: + description: DiffedResourcePlacement contains the details of a resource + with configuration differences. + properties: + envelope: + description: Envelope identifies the envelope object that contains + this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + firstDiffedObservedTime: + description: |- + FirstDiffedObservedTime is the first time the resource on the target cluster is + observed to have configuration differences. + format: date-time + type: string + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. + type: string + observationTime: + description: ObservationTime is the time when we observe the + configuration differences for the resource. + format: date-time + type: string + observedDiffs: + description: |- + ObservedDiffs are the details about the found configuration differences. Note that + Fleet might truncate the details as appropriate to control the object size. + + Each detail entry specifies how the live state (the state on the member + cluster side) compares against the desired state (the state kept in the hub cluster manifest). + + An event about the details will be emitted as well. + items: + description: |- + PatchDetail describes a patch that explains an observed configuration drift or + difference. + + A patch detail can be transcribed as a JSON patch operation, as specified in RFC 6902. + properties: + path: + description: The JSON path that points to a field that + has drifted or has configuration differences. + type: string + valueInHub: + description: |- + The value at the JSON path from the hub cluster side. + + This field can be empty if the JSON path does not exist on the hub cluster side; i.e., + applying the manifest from the hub cluster side would remove the field. + type: string + valueInMember: + description: |- + The value at the JSON path from the member cluster side. + + This field can be empty if the JSON path does not exist on the member cluster side; i.e., + applying the manifest from the hub cluster side would add a new field. + type: string + required: + - path + type: object + type: array + targetClusterObservedGeneration: + description: |- + TargetClusterObservedGeneration is the generation of the resource on the target cluster + that contains the configuration differences. + + This might be nil if the resource has not been created yet on the target cluster. + format: int64 + type: integer + version: + description: Version is the version of the selected resource. + type: string + required: + - firstDiffedObservedTime + - kind + - name + - observationTime + - version + type: object + maxItems: 100 + type: array + driftedPlacements: + description: |- + DriftedPlacements is a list of resources that have drifted from their desired states + kept in the hub cluster, as found by Fleet using the drift detection mechanism. + + To control the object size, only the first 100 drifted resources will be included. + This field is only meaningful if the `ClusterName` is not empty. + items: + description: DriftedResourcePlacement contains the details of a + resource with configuration drifts. + properties: + envelope: + description: Envelope identifies the envelope object that contains + this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + firstDriftedObservedTime: + description: |- + FirstDriftedObservedTime is the first time the resource on the target cluster is + observed to have configuration drifts. + format: date-time + type: string + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. + type: string + observationTime: + description: ObservationTime is the time when we observe the + configuration drifts for the resource. + format: date-time + type: string + observedDrifts: + description: |- + ObservedDrifts are the details about the found configuration drifts. Note that + Fleet might truncate the details as appropriate to control the object size. + + Each detail entry specifies how the live state (the state on the member + cluster side) compares against the desired state (the state kept in the hub cluster manifest). + + An event about the details will be emitted as well. + items: + description: |- + PatchDetail describes a patch that explains an observed configuration drift or + difference. + + A patch detail can be transcribed as a JSON patch operation, as specified in RFC 6902. + properties: + path: + description: The JSON path that points to a field that + has drifted or has configuration differences. + type: string + valueInHub: + description: |- + The value at the JSON path from the hub cluster side. + + This field can be empty if the JSON path does not exist on the hub cluster side; i.e., + applying the manifest from the hub cluster side would remove the field. + type: string + valueInMember: + description: |- + The value at the JSON path from the member cluster side. + + This field can be empty if the JSON path does not exist on the member cluster side; i.e., + applying the manifest from the hub cluster side would add a new field. + type: string + required: + - path + type: object + type: array + targetClusterObservedGeneration: + description: |- + TargetClusterObservedGeneration is the generation of the resource on the target cluster + that contains the configuration drifts. + format: int64 + type: integer + version: + description: Version is the version of the selected resource. + type: string + required: + - firstDriftedObservedTime + - kind + - name + - observationTime + - targetClusterObservedGeneration + - version + type: object + maxItems: 100 + type: array + failedPlacements: + description: |- + FailedPlacements is a list of all the resources failed to be placed to the given cluster or the resource is unavailable. + Note that we only include 100 failed resource placements even if there are more than 100. + items: + description: FailedResourcePlacement contains the failure details + of a failed resource placement. + properties: + condition: + description: The failed condition status. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + envelope: + description: Envelope identifies the envelope object that contains + this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. + type: string + version: + description: Version is the version of the selected resource. + type: string + required: + - condition + - kind + - name + - version + type: object + maxItems: 100 + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/crd/bases/placement.kubernetes-fleet.io_resourceplacements.yaml b/config/crd/bases/placement.kubernetes-fleet.io_resourceplacements.yaml new file mode 100644 index 000000000..5bf28370e --- /dev/null +++ b/config/crd/bases/placement.kubernetes-fleet.io_resourceplacements.yaml @@ -0,0 +1,1515 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + name: resourceplacements.placement.kubernetes-fleet.io +spec: + group: placement.kubernetes-fleet.io + names: + categories: + - fleet + - fleet-placement + kind: ResourcePlacement + listKind: ResourcePlacementList + plural: resourceplacements + shortNames: + - rp + singular: resourceplacement + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.generation + name: Gen + type: string + - jsonPath: .spec.policy.placementType + name: Type + priority: 1 + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementScheduled")].status + name: Scheduled + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementScheduled")].observedGeneration + name: Scheduled-Gen + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementWorkSynchronized")].status + name: Work-Synchronized + priority: 1 + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementWorkSynchronized")].observedGeneration + name: Work-Synchronized-Gen + priority: 1 + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementAvailable")].status + name: Available + type: string + - jsonPath: .status.conditions[?(@.type=="ResourcePlacementAvailable")].observedGeneration + name: Available-Gen + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + ResourcePlacement is used to select namespace scoped resources, including built-in resources and custom resources, + and placement them onto selected member clusters in a fleet. + `SchedulingPolicySnapshot` and `ResourceSnapshot` objects are created in the same namespace when there are changes in the + system to keep the history of the changes affecting a `ResourcePlacement`. We will also create `ResourceBinding` objects in the same namespace. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: The desired state of ResourcePlacement. + properties: + policy: + description: |- + Policy defines how to select member clusters to place the selected resources. + If unspecified, all the joined member clusters are selected. + properties: + affinity: + description: |- + Affinity contains cluster affinity scheduling rules. Defines which member clusters to place the selected resources. + Only valid if the placement type is "PickAll" or "PickN". + properties: + clusterAffinity: + description: ClusterAffinity contains cluster affinity scheduling + rules for the selected resources. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler computes a score for each cluster at schedule time by iterating + through the elements of this field and adding "weight" to the sum if the cluster + matches the corresponding matchExpression. The scheduler then chooses the first + `N` clusters with the highest sum to satisfy the placement. + This field is ignored if the placement type is "PickAll". + If the cluster score changes at some point after the placement (e.g. due to an update), + the system may or may not try to eventually move the resource from a cluster with a lower score + to a cluster with higher score. + items: + properties: + preference: + description: A cluster selector term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + LabelSelector is a label query over all the joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + propertySelector: + description: |- + PropertySelector is a property query over all joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + + At this moment, PropertySelector can only be used with + `RequiredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + matchExpressions: + description: MatchExpressions is an array + of PropertySelectorRequirements. The requirements + are AND'd. + items: + description: |- + PropertySelectorRequirement is a specific property requirement when picking clusters for + resource placement. + properties: + name: + description: Name is the name of the + property; it should be a Kubernetes + label name. + type: string + operator: + description: |- + Operator specifies the relationship between a cluster's observed value of the specified + property and the values given in the requirement. + type: string + values: + description: |- + Values are a list of values of the specified property which Fleet will compare against + the observed values of individual member clusters in accordance with the given + operator. + + At this moment, each value should be a Kubernetes quantity. For more information, see + https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity. + + If the operator is Gt (greater than), Ge (greater than or equal to), Lt (less than), + or `Le` (less than or equal to), Eq (equal to), or Ne (ne), exactly one value must be + specified in the list. + items: + type: string + maxItems: 1 + type: array + required: + - name + - operator + - values + type: object + type: array + required: + - matchExpressions + type: object + propertySorter: + description: |- + PropertySorter sorts all matching clusters by a specific property and assigns different weights + to each cluster based on their observed property values. + + At this moment, PropertySorter can only be used with + `PreferredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + name: + description: Name is the name of the property + which Fleet sorts clusters by. + type: string + sortOrder: + description: |- + SortOrder explains how Fleet should perform the sort; specifically, whether Fleet should + sort in ascending or descending order. + type: string + required: + - name + - sortOrder + type: object + type: object + weight: + description: Weight associated with matching the + corresponding clusterSelectorTerm, in the range + [-100, 100]. + format: int32 + maximum: 100 + minimum: -100 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the resource will not be scheduled onto the cluster. + If the affinity requirements specified by this field cease to be met + at some point after the placement (e.g. due to an update), the system + may or may not try to eventually remove the resource from the cluster. + properties: + clusterSelectorTerms: + description: ClusterSelectorTerms is a list of cluster + selector terms. The terms are `ORed`. + items: + properties: + labelSelector: + description: |- + LabelSelector is a label query over all the joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + propertySelector: + description: |- + PropertySelector is a property query over all joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + + At this moment, PropertySelector can only be used with + `RequiredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + matchExpressions: + description: MatchExpressions is an array + of PropertySelectorRequirements. The requirements + are AND'd. + items: + description: |- + PropertySelectorRequirement is a specific property requirement when picking clusters for + resource placement. + properties: + name: + description: Name is the name of the + property; it should be a Kubernetes + label name. + type: string + operator: + description: |- + Operator specifies the relationship between a cluster's observed value of the specified + property and the values given in the requirement. + type: string + values: + description: |- + Values are a list of values of the specified property which Fleet will compare against + the observed values of individual member clusters in accordance with the given + operator. + + At this moment, each value should be a Kubernetes quantity. For more information, see + https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity. + + If the operator is Gt (greater than), Ge (greater than or equal to), Lt (less than), + or `Le` (less than or equal to), Eq (equal to), or Ne (ne), exactly one value must be + specified in the list. + items: + type: string + maxItems: 1 + type: array + required: + - name + - operator + - values + type: object + type: array + required: + - matchExpressions + type: object + propertySorter: + description: |- + PropertySorter sorts all matching clusters by a specific property and assigns different weights + to each cluster based on their observed property values. + + At this moment, PropertySorter can only be used with + `PreferredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + name: + description: Name is the name of the property + which Fleet sorts clusters by. + type: string + sortOrder: + description: |- + SortOrder explains how Fleet should perform the sort; specifically, whether Fleet should + sort in ascending or descending order. + type: string + required: + - name + - sortOrder + type: object + type: object + maxItems: 10 + type: array + required: + - clusterSelectorTerms + type: object + type: object + type: object + clusterNames: + description: |- + ClusterNames contains a list of names of MemberCluster to place the selected resources. + Only valid if the placement type is "PickFixed" + items: + type: string + maxItems: 100 + type: array + numberOfClusters: + description: NumberOfClusters of placement. Only valid if the + placement type is "PickN". + format: int32 + minimum: 0 + type: integer + placementType: + default: PickAll + description: Type of placement. Can be "PickAll", "PickN" or "PickFixed". + Default is PickAll. + enum: + - PickAll + - PickN + - PickFixed + type: string + tolerations: + description: |- + If specified, the ClusterResourcePlacement's Tolerations. + Tolerations cannot be updated or deleted. + + This field is beta-level and is for the taints and tolerations feature. + items: + description: |- + Toleration allows ClusterResourcePlacement to tolerate any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, only allowed value is NoSchedule. + enum: + - NoSchedule + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + default: Equal + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a + ClusterResourcePlacement can tolerate all taints of a particular category. + enum: + - Equal + - Exists + type: string + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + maxItems: 100 + type: array + topologySpreadConstraints: + description: |- + TopologySpreadConstraints describes how a group of resources ought to spread across multiple topology + domains. Scheduler will schedule resources in a way which abides by the constraints. + All topologySpreadConstraints are ANDed. + Only valid if the placement type is "PickN". + items: + description: TopologySpreadConstraint specifies how to spread + resources among the given cluster topology. + properties: + maxSkew: + default: 1 + description: |- + MaxSkew describes the degree to which resources may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of resource copies in the target topology and the global minimum. + The global minimum is the minimum number of resource copies in a domain. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's an optional field. Default value is 1 and 0 is not allowed. + format: int32 + minimum: 1 + type: integer + topologyKey: + description: |- + TopologyKey is the key of cluster labels. Clusters that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of replicas of the resource into each bucket honor the `MaxSkew` value. + It's a required field. + type: string + whenUnsatisfiable: + description: |- + WhenUnsatisfiable indicates how to deal with the resource if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the resource in any cluster, + but giving higher precedence to topologies that would help reduce the skew. + It's an optional field. + type: string + required: + - topologyKey + type: object + type: array + type: object + resourceSelectors: + description: |- + ResourceSelectors is an array of selectors used to select cluster scoped resources. The selectors are `ORed`. + You can have 1-100 selectors. + items: + description: |- + ClusterResourceSelector is used to select cluster scoped resources as the target resources to be placed. + All the fields are `ANDed`. In other words, a resource must match all the fields to be selected. + properties: + group: + description: |- + Group name of the cluster-scoped resource. + Use an empty string to select resources under the core API group (e.g., namespaces). + type: string + kind: + description: |- + Kind of the cluster-scoped resource. + Note: When `Kind` is `namespace`, ALL the resources under the selected namespaces are selected. + type: string + labelSelector: + description: |- + A label query over all the cluster-scoped resources. Resources matching the query are selected. + Note that namespace-scoped resources can't be selected even if they match the query. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + name: + description: Name of the cluster-scoped resource. + type: string + version: + description: Version of the cluster-scoped resource. + type: string + required: + - group + - kind + - version + type: object + maxItems: 100 + minItems: 1 + type: array + revisionHistoryLimit: + default: 10 + description: |- + The number of old ClusterSchedulingPolicySnapshot or ClusterResourceSnapshot resources to retain to allow rollback. + This is a pointer to distinguish between explicit zero and not specified. + Defaults to 10. + format: int32 + maximum: 1000 + minimum: 1 + type: integer + strategy: + description: The rollout strategy to use to replace existing placement + with new ones. + properties: + applyStrategy: + description: ApplyStrategy describes when and how to apply the + selected resources to the target cluster. + properties: + allowCoOwnership: + description: |- + AllowCoOwnership controls whether co-ownership between Fleet and other agents are allowed + on a Fleet-managed resource. If set to false, Fleet will refuse to apply manifests to + a resource that has been owned by one or more non-Fleet agents. + + Note that Fleet does not support the case where one resource is being placed multiple + times by different CRPs on the same member cluster. An apply error will be returned if + Fleet finds that a resource has been owned by another placement attempt by Fleet, even + with the AllowCoOwnership setting set to true. + type: boolean + comparisonOption: + default: PartialComparison + description: |- + ComparisonOption controls how Fleet compares the desired state of a resource, as kept in + a hub cluster manifest, with the current state of the resource (if applicable) in the + member cluster. + + Available options are: + + * PartialComparison: with this option, Fleet will compare only fields that are managed by + Fleet, i.e., the fields that are specified explicitly in the hub cluster manifest. + Unmanaged fields are ignored. This is the default option. + + * FullComparison: with this option, Fleet will compare all fields of the resource, + even if the fields are absent from the hub cluster manifest. + + Consider using the PartialComparison option if you would like to: + + * use the default values for certain fields; or + * let another agent, e.g., HPAs, VPAs, etc., on the member cluster side manage some fields; or + * allow ad-hoc or cluster-specific settings on the member cluster side. + + To use the FullComparison option, it is recommended that you: + + * specify all fields as appropriate in the hub cluster, even if you are OK with using default + values; + * make sure that no fields are managed by agents other than Fleet on the member cluster + side, such as HPAs, VPAs, or other controllers. + + See the Fleet documentation for further explanations and usage examples. + enum: + - PartialComparison + - FullComparison + type: string + serverSideApplyConfig: + description: ServerSideApplyConfig defines the configuration + for server side apply. It is honored only when type is ServerSideApply. + properties: + force: + description: |- + Force represents to force apply to succeed when resolving the conflicts + For any conflicting fields, + - If true, use the values from the resource to be applied to overwrite the values of the existing resource in the + target cluster, as well as take over ownership of such fields. + - If false, apply will fail with the reason ApplyConflictWithOtherApplier. + + For non-conflicting fields, values stay unchanged and ownership are shared between appliers. + type: boolean + type: object + type: + default: ClientSideApply + description: |- + Type is the apply strategy to use; it determines how Fleet applies manifests from the + hub cluster to a member cluster. + + Available options are: + + * ClientSideApply: Fleet uses three-way merge to apply manifests, similar to how kubectl + performs a client-side apply. This is the default option. + + Note that this strategy requires that Fleet keep the last applied configuration in the + annotation of an applied resource. If the object gets so large that apply ops can no longer + be executed, Fleet will switch to server-side apply. + + Use ComparisonOption and WhenToApply settings to control when an apply op can be executed. + + * ServerSideApply: Fleet uses server-side apply to apply manifests; Fleet itself will + become the field manager for specified fields in the manifests. Specify + ServerSideApplyConfig as appropriate if you would like Fleet to take over field + ownership upon conflicts. This is the recommended option for most scenarios; it might + help reduce object size and safely resolve conflicts between field values. For more + information, please refer to the Kubernetes documentation + (https://kubernetes.io/docs/reference/using-api/server-side-apply/#comparison-with-client-side-apply). + + Use ComparisonOption and WhenToApply settings to control when an apply op can be executed. + + * ReportDiff: Fleet will compare the desired state of a resource as kept in the hub cluster + with its current state (if applicable) on the member cluster side, and report any + differences. No actual apply ops would be executed, and resources will be left alone as they + are on the member clusters. + + If configuration differences are found on a resource, Fleet will consider this as an apply + error, which might block rollout depending on the specified rollout strategy. + + 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: + - ClientSideApply + - ServerSideApply + - ReportDiff + type: string + whenToApply: + default: Always + description: |- + WhenToApply controls when Fleet would apply the manifests on the hub cluster to the member + clusters. + + Available options are: + + * Always: with this option, Fleet will periodically apply hub cluster manifests + on the member cluster side; this will effectively overwrite any change in the fields + managed by Fleet (i.e., specified in the hub cluster manifest). This is the default + option. + + Note that this option would revert any ad-hoc changes made on the member cluster side in + the managed fields; if you would like to make temporary edits on the member cluster side + in the managed fields, switch to IfNotDrifted option. Note that changes in unmanaged + fields will be left alone; if you use the FullDiff compare option, such changes will + be reported as drifts. + + * IfNotDrifted: with this option, Fleet will stop applying hub cluster manifests on + clusters that have drifted from the desired state; apply ops would still continue on + the rest of the clusters. Drifts are calculated using the ComparisonOption, + as explained in the corresponding field. + + Use this option if you would like Fleet to detect drifts in your multi-cluster setup. + A drift occurs when an agent makes an ad-hoc change on the member cluster side that + makes affected resources deviate from its desired state as kept in the hub cluster; + and this option grants you an opportunity to view the drift details and take actions + accordingly. The drift details will be reported in the CRP status. + + To fix a drift, you may: + + * revert the changes manually on the member cluster side + * update the hub cluster manifest; this will trigger Fleet to apply the latest revision + of the manifests, which will overwrite the drifted fields + (if they are managed by Fleet) + * switch to the Always option; this will trigger Fleet to apply the current revision + of the manifests, which will overwrite the drifted fields (if they are managed by Fleet). + * if applicable and necessary, delete the drifted resources on the member cluster side; Fleet + will attempt to re-create them using the hub cluster manifests + enum: + - Always + - IfNotDrifted + type: string + whenToTakeOver: + default: Always + description: |- + WhenToTakeOver determines the action to take when Fleet applies resources to a member + cluster for the first time and finds out that the resource already exists in the cluster. + + This setting is most relevant in cases where you would like Fleet to manage pre-existing + resources on a member cluster. + + Available options include: + + * Always: with this action, Fleet will apply the hub cluster manifests to the member + clusters even if the affected resources already exist. This is the default action. + + Note that this might lead to fields being overwritten on the member clusters, if they + are specified in the hub cluster manifests. + + * IfNoDiff: with this action, Fleet will apply the hub cluster manifests to the member + clusters if (and only if) pre-existing resources look the same as the hub cluster manifests. + + This is a safer option as pre-existing resources that are inconsistent with the hub cluster + manifests will not be overwritten; Fleet will ignore them until the inconsistencies + are resolved properly: any change you make to the hub cluster manifests would not be + applied, and if you delete the manifests or even the ClusterResourcePlacement itself + from the hub cluster, these pre-existing resources would not be taken away. + + Fleet will check for inconsistencies in accordance with the ComparisonOption setting. See also + the comments on the ComparisonOption field for more information. + + If a diff has been found in a field that is **managed** by Fleet (i.e., the field + **is specified ** in the hub cluster manifest), consider one of the following actions: + * set the field in the member cluster to be of the same value as that in the hub cluster + manifest. + * update the hub cluster manifest so that its field value matches with that in the member + cluster. + * switch to the Always action, which will allow Fleet to overwrite the field with the + value in the hub cluster manifest. + + If a diff has been found in a field that is **not managed** by Fleet (i.e., the field + **is not specified** in the hub cluster manifest), consider one of the following actions: + * remove the field from the member cluster. + * update the hub cluster manifest so that the field is included in the hub cluster manifest. + + 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 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: + description: Rolling update config params. Present only if RolloutStrategyType + = RollingUpdate. + properties: + maxSurge: + anyOf: + - type: integer + - type: string + default: 25% + description: |- + The maximum number of clusters that can be scheduled above the desired number of clusters. + The desired number equals to the `NumberOfClusters` field when the placement type is `PickN`. + The desired number equals to the number of clusters scheduler selected when the placement type is `PickAll`. + Value can be an absolute number (ex: 5) or a percentage of desire (ex: 10%). + Absolute number is calculated from percentage by rounding up. + This does not apply to the case that we do in-place update of resources on the same cluster. + This can not be 0 if MaxUnavailable is 0. + Defaults to 25%. + pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ + x-kubernetes-int-or-string: true + maxUnavailable: + anyOf: + - type: integer + - type: string + default: 25% + description: |- + The maximum number of clusters that can be unavailable during the rolling update + comparing to the desired number of clusters. + The desired number equals to the `NumberOfClusters` field when the placement type is `PickN`. + The desired number equals to the number of clusters scheduler selected when the placement type is `PickAll`. + Value can be an absolute number (ex: 5) or a percentage of the desired number of clusters (ex: 10%). + Absolute number is calculated from percentage by rounding up. + We consider a resource unavailable when we either remove it from a cluster or in-place + upgrade the resources content on the same cluster. + The minimum of MaxUnavailable is 0 to allow no downtime moving a placement from one cluster to another. + Please set it to be greater than 0 to avoid rolling out stuck during in-place resource update. + Defaults to 25%. + pattern: ^((100|[0-9]{1,2})%|[0-9]+)$ + x-kubernetes-int-or-string: true + unavailablePeriodSeconds: + default: 60 + description: |- + UnavailablePeriodSeconds is used to configure the waiting time between rollout phases when we + cannot determine if the resources have rolled out successfully or not. + We have a built-in resource state detector to determine the availability status of following well-known Kubernetes + native resources: Deployment, StatefulSet, DaemonSet, Service, Namespace, ConfigMap, Secret, + ClusterRole, ClusterRoleBinding, Role, RoleBinding. + Please see [SafeRollout](https://github.com/Azure/fleet/tree/main/docs/concepts/SafeRollout/README.md) for more details. + For other types of resources, we consider them as available after `UnavailablePeriodSeconds` seconds + have passed since they were successfully applied to the target cluster. + Default is 60. + type: integer + type: object + type: + default: RollingUpdate + description: |- + Type of rollout. The only supported types are "RollingUpdate" and "External". + Default is "RollingUpdate". + enum: + - RollingUpdate + - External + type: string + type: object + required: + - resourceSelectors + type: object + status: + description: The observed status of ResourcePlacement. + properties: + conditions: + description: |- + Conditions is an array of current observed conditions for ClusterResourcePlacement. + All conditions except `ClusterResourcePlacementScheduled` correspond to the resource snapshot at the index specified by `ObservedResourceIndex`. + For example, a condition of `ClusterResourcePlacementWorkSynchronized` type + is observing the synchronization status of the resource snapshot with index `ObservedResourceIndex`. + If the rollout strategy type is `External`, and `ObservedResourceIndex` is unset due to clusters reporting different resource indices, + conditions except `ClusterResourcePlacementScheduled` will be empty or set to Unknown. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedResourceIndex: + description: |- + Resource index logically represents the generation of the selected resources. + We take a new snapshot of the selected resources whenever the selection or their content change. + Each snapshot has a different resource index. + One resource snapshot can contain multiple clusterResourceSnapshots CRs in order to store large amount of resources. + To get clusterResourceSnapshot of a given resource index, use the following command: + `kubectl get ClusterResourceSnapshot --selector=kubernetes-fleet.io/resource-index=$ObservedResourceIndex` + If the rollout strategy type is `RollingUpdate`, `ObservedResourceIndex` is the default-latest resource snapshot index. + If the rollout strategy type is `External`, rollout and version control are managed by an external controller, + and this field is not empty only if all targeted clusters observe the same resource index in `PlacementStatuses`. + type: string + placementStatuses: + description: |- + PlacementStatuses contains a list of placement status on the clusters that are selected by PlacementPolicy. + Each selected cluster according to the observed resource placement is guaranteed to have a corresponding placementStatuses. + In the pickN case, there are N placement statuses where N = NumberOfClusters; Or in the pickFixed case, there are + N placement statuses where N = ClusterNames. + In these cases, some of them may not have assigned clusters when we cannot fill the required number of clusters. + items: + description: ResourcePlacementStatus represents the placement status + of selected resources for one target cluster. + properties: + applicableClusterResourceOverrides: + description: |- + ApplicableClusterResourceOverrides contains a list of applicable ClusterResourceOverride snapshots associated with + the selected resources. + + This field is alpha-level and is for the override policy feature. + items: + type: string + type: array + applicableResourceOverrides: + description: |- + ApplicableResourceOverrides contains a list of applicable ResourceOverride snapshots associated with the selected + resources. + + This field is alpha-level and is for the override policy feature. + items: + description: NamespacedName comprises a resource name, with + a mandatory namespace. + properties: + name: + description: Name is the name of the namespaced scope + resource. + type: string + namespace: + description: Namespace is namespace of the namespaced + scope resource. + type: string + required: + - name + - namespace + type: object + type: array + clusterName: + description: |- + ClusterName is the name of the cluster this resource is assigned to. + If it is not empty, its value should be unique cross all placement decisions for the Placement. + type: string + conditions: + description: |- + Conditions is an array of current observed conditions on the cluster. + Each condition corresponds to the resource snapshot at the index specified by `ObservedResourceIndex`. + For example, the condition of type `RolloutStarted` is observing the rollout status of the resource snapshot with index `ObservedResourceIndex`. + items: + description: Condition contains details for one aspect of + the current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + diffedPlacements: + description: |- + DiffedPlacements is a list of resources that have configuration differences from their + corresponding hub cluster manifests. Fleet will report such differences when: + + * The CRP uses the ReportDiff apply strategy, which instructs Fleet to compare the hub + cluster manifests against the live resources without actually performing any apply op; or + * Fleet finds a pre-existing resource on the member cluster side that does not match its + hub cluster counterpart, and the CRP has been configured to only take over a resource if + no configuration differences are found. + + To control the object size, only the first 100 diffed resources will be included. + This field is only meaningful if the `ClusterName` is not empty. + items: + description: DiffedResourcePlacement contains the details + of a resource with configuration differences. + properties: + envelope: + description: Envelope identifies the envelope object that + contains this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster + scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + firstDiffedObservedTime: + description: |- + FirstDiffedObservedTime is the first time the resource on the target cluster is + observed to have configuration differences. + format: date-time + type: string + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected + resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. + Empty if the resource is cluster scoped. + type: string + observationTime: + description: ObservationTime is the time when we observe + the configuration differences for the resource. + format: date-time + type: string + observedDiffs: + description: |- + ObservedDiffs are the details about the found configuration differences. Note that + Fleet might truncate the details as appropriate to control the object size. + + Each detail entry specifies how the live state (the state on the member + cluster side) compares against the desired state (the state kept in the hub cluster manifest). + + An event about the details will be emitted as well. + items: + description: |- + PatchDetail describes a patch that explains an observed configuration drift or + difference. + + A patch detail can be transcribed as a JSON patch operation, as specified in RFC 6902. + properties: + path: + description: The JSON path that points to a field + that has drifted or has configuration differences. + type: string + valueInHub: + description: |- + The value at the JSON path from the hub cluster side. + + This field can be empty if the JSON path does not exist on the hub cluster side; i.e., + applying the manifest from the hub cluster side would remove the field. + type: string + valueInMember: + description: |- + The value at the JSON path from the member cluster side. + + This field can be empty if the JSON path does not exist on the member cluster side; i.e., + applying the manifest from the hub cluster side would add a new field. + type: string + required: + - path + type: object + type: array + targetClusterObservedGeneration: + description: |- + TargetClusterObservedGeneration is the generation of the resource on the target cluster + that contains the configuration differences. + + This might be nil if the resource has not been created yet on the target cluster. + format: int64 + type: integer + version: + description: Version is the version of the selected resource. + type: string + required: + - firstDiffedObservedTime + - kind + - name + - observationTime + - version + type: object + maxItems: 100 + type: array + driftedPlacements: + description: |- + DriftedPlacements is a list of resources that have drifted from their desired states + kept in the hub cluster, as found by Fleet using the drift detection mechanism. + + To control the object size, only the first 100 drifted resources will be included. + This field is only meaningful if the `ClusterName` is not empty. + items: + description: DriftedResourcePlacement contains the details + of a resource with configuration drifts. + properties: + envelope: + description: Envelope identifies the envelope object that + contains this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster + scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + firstDriftedObservedTime: + description: |- + FirstDriftedObservedTime is the first time the resource on the target cluster is + observed to have configuration drifts. + format: date-time + type: string + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected + resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. + Empty if the resource is cluster scoped. + type: string + observationTime: + description: ObservationTime is the time when we observe + the configuration drifts for the resource. + format: date-time + type: string + observedDrifts: + description: |- + ObservedDrifts are the details about the found configuration drifts. Note that + Fleet might truncate the details as appropriate to control the object size. + + Each detail entry specifies how the live state (the state on the member + cluster side) compares against the desired state (the state kept in the hub cluster manifest). + + An event about the details will be emitted as well. + items: + description: |- + PatchDetail describes a patch that explains an observed configuration drift or + difference. + + A patch detail can be transcribed as a JSON patch operation, as specified in RFC 6902. + properties: + path: + description: The JSON path that points to a field + that has drifted or has configuration differences. + type: string + valueInHub: + description: |- + The value at the JSON path from the hub cluster side. + + This field can be empty if the JSON path does not exist on the hub cluster side; i.e., + applying the manifest from the hub cluster side would remove the field. + type: string + valueInMember: + description: |- + The value at the JSON path from the member cluster side. + + This field can be empty if the JSON path does not exist on the member cluster side; i.e., + applying the manifest from the hub cluster side would add a new field. + type: string + required: + - path + type: object + type: array + targetClusterObservedGeneration: + description: |- + TargetClusterObservedGeneration is the generation of the resource on the target cluster + that contains the configuration drifts. + format: int64 + type: integer + version: + description: Version is the version of the selected resource. + type: string + required: + - firstDriftedObservedTime + - kind + - name + - observationTime + - targetClusterObservedGeneration + - version + type: object + maxItems: 100 + type: array + failedPlacements: + description: |- + FailedPlacements is a list of all the resources failed to be placed to the given cluster or the resource is unavailable. + Note that we only include 100 failed resource placements even if there are more than 100. + This field is only meaningful if the `ClusterName` is not empty. + items: + description: FailedResourcePlacement contains the failure + details of a failed resource placement. + properties: + condition: + description: The failed condition status. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, + False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in + foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + envelope: + description: Envelope identifies the envelope object that + contains this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster + scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected + resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. + Empty if the resource is cluster scoped. + type: string + version: + description: Version is the version of the selected resource. + type: string + required: + - condition + - kind + - name + - version + type: object + maxItems: 100 + type: array + observedResourceIndex: + description: |- + ObservedResourceIndex is the index of the resource snapshot that is currently being rolled out to the given cluster. + This field is only meaningful if the `ClusterName` is not empty. + type: string + type: object + type: array + selectedResources: + description: |- + SelectedResources contains a list of resources selected by ResourceSelectors. + This field is only meaningful if the `ObservedResourceIndex` is not empty. + items: + description: ResourceIdentifier identifies one Kubernetes resource. + properties: + envelope: + description: Envelope identifies the envelope object that contains + this resource. + properties: + name: + description: Name of the envelope object. + type: string + namespace: + description: Namespace is the namespace of the envelope + object. Empty if the envelope object is cluster scoped. + type: string + type: + default: ConfigMap + description: Type of the envelope object. + enum: + - ConfigMap + - ClusterResourceEnvelope + - ResourceEnvelope + type: string + required: + - name + type: object + group: + description: Group is the group name of the selected resource. + type: string + kind: + description: Kind represents the Kind of the selected resources. + type: string + name: + description: Name of the target resource. + type: string + namespace: + description: Namespace is the namespace of the resource. Empty + if the resource is cluster scoped. + type: string + version: + description: Version is the version of the selected resource. + type: string + required: + - kind + - name + - version + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/crd/bases/placement.kubernetes-fleet.io_resourcesnapshots.yaml b/config/crd/bases/placement.kubernetes-fleet.io_resourcesnapshots.yaml new file mode 100644 index 000000000..3a05bd032 --- /dev/null +++ b/config/crd/bases/placement.kubernetes-fleet.io_resourcesnapshots.yaml @@ -0,0 +1,157 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + name: resourcesnapshots.placement.kubernetes-fleet.io +spec: + group: placement.kubernetes-fleet.io + names: + categories: + - fleet + - fleet-placement + kind: ResourceSnapshot + listKind: ResourceSnapshotList + plural: resourcesnapshots + shortNames: + - rs + singular: resourcesnapshot + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.generation + name: Gen + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + ResourceSnapshot is used to store a snapshot of selected resources by a resource placement policy. + Its spec is immutable. + We may need to produce more than one resourceSnapshot for all the resources a ResourcePlacement selected to get around the 1MB size limit of k8s objects. + We assign an ever-increasing index for each such group of resourceSnapshots. + The naming convention of a resourceSnapshot is {RPName}-{resourceIndex}-{subindex} + where the name of the first snapshot of a group has no subindex part so its name is {RPName}-{resourceIndex}-snapshot. + resourceIndex will begin with 0. + Each snapshot MUST have the following labels: + - `CRPTrackingLabel` which points to its owner resource placement. + - `ResourceIndexLabel` which is the index of the snapshot group. + - `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one. + + All the snapshots within the same index group must have the same ResourceIndexLabel. + + The first snapshot of the index group MUST have the following annotations: + - `NumberOfResourceSnapshotsAnnotation` to store the total number of resource snapshots in the index group. + - `ResourceGroupHashAnnotation` whose value is the sha-256 hash of all the snapshots belong to the same snapshot index. + + Each snapshot (excluding the first snapshot) MUST have the following annotations: + - `SubindexOfResourceSnapshotAnnotation` to store the subindex of resource snapshot in the group. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: The desired state of ResourceSnapshot. + properties: + selectedResources: + description: SelectedResources contains a list of resources selected + by ResourceSelectors. + items: + description: ResourceContent contains the content of a resource + type: object + x-kubernetes-embedded-resource: true + x-kubernetes-preserve-unknown-fields: true + type: array + required: + - selectedResources + type: object + status: + description: The observed status of ResourceSnapshot. + properties: + conditions: + description: Conditions is an array of current observed conditions + for ResourceSnapshot. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/crd/bases/placement.kubernetes-fleet.io_schedulingpolicysnapshots.yaml b/config/crd/bases/placement.kubernetes-fleet.io_schedulingpolicysnapshots.yaml new file mode 100644 index 000000000..4406774f9 --- /dev/null +++ b/config/crd/bases/placement.kubernetes-fleet.io_schedulingpolicysnapshots.yaml @@ -0,0 +1,637 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.0 + name: schedulingpolicysnapshots.placement.kubernetes-fleet.io +spec: + group: placement.kubernetes-fleet.io + names: + categories: + - fleet + - fleet-placement + kind: SchedulingPolicySnapshot + listKind: SchedulingPolicySnapshotList + plural: schedulingpolicysnapshots + shortNames: + - sps + singular: schedulingpolicysnapshot + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.generation + name: Gen + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: |- + SchedulingPolicySnapshot is used to store a snapshot of cluster placement policy. + Its spec is immutable. + The naming convention of a SchedulingPolicySnapshot is {RPName}-{PolicySnapshotIndex}. + PolicySnapshotIndex will begin with 0. + Each snapshot must have the following labels: + - `CRPTrackingLabel` which points to its placement owner. + - `PolicyIndexLabel` which is the index of the policy snapshot. + - `IsLatestSnapshotLabel` which indicates whether the snapshot is the latest one. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: The desired state of SchedulingPolicySnapshot. + properties: + policy: + description: |- + Policy defines how to select member clusters to place the selected resources. + If unspecified, all the joined member clusters are selected. + properties: + affinity: + description: |- + Affinity contains cluster affinity scheduling rules. Defines which member clusters to place the selected resources. + Only valid if the placement type is "PickAll" or "PickN". + properties: + clusterAffinity: + description: ClusterAffinity contains cluster affinity scheduling + rules for the selected resources. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler computes a score for each cluster at schedule time by iterating + through the elements of this field and adding "weight" to the sum if the cluster + matches the corresponding matchExpression. The scheduler then chooses the first + `N` clusters with the highest sum to satisfy the placement. + This field is ignored if the placement type is "PickAll". + If the cluster score changes at some point after the placement (e.g. due to an update), + the system may or may not try to eventually move the resource from a cluster with a lower score + to a cluster with higher score. + items: + properties: + preference: + description: A cluster selector term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + LabelSelector is a label query over all the joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + propertySelector: + description: |- + PropertySelector is a property query over all joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + + At this moment, PropertySelector can only be used with + `RequiredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + matchExpressions: + description: MatchExpressions is an array + of PropertySelectorRequirements. The requirements + are AND'd. + items: + description: |- + PropertySelectorRequirement is a specific property requirement when picking clusters for + resource placement. + properties: + name: + description: Name is the name of the + property; it should be a Kubernetes + label name. + type: string + operator: + description: |- + Operator specifies the relationship between a cluster's observed value of the specified + property and the values given in the requirement. + type: string + values: + description: |- + Values are a list of values of the specified property which Fleet will compare against + the observed values of individual member clusters in accordance with the given + operator. + + At this moment, each value should be a Kubernetes quantity. For more information, see + https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity. + + If the operator is Gt (greater than), Ge (greater than or equal to), Lt (less than), + or `Le` (less than or equal to), Eq (equal to), or Ne (ne), exactly one value must be + specified in the list. + items: + type: string + maxItems: 1 + type: array + required: + - name + - operator + - values + type: object + type: array + required: + - matchExpressions + type: object + propertySorter: + description: |- + PropertySorter sorts all matching clusters by a specific property and assigns different weights + to each cluster based on their observed property values. + + At this moment, PropertySorter can only be used with + `PreferredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + name: + description: Name is the name of the property + which Fleet sorts clusters by. + type: string + sortOrder: + description: |- + SortOrder explains how Fleet should perform the sort; specifically, whether Fleet should + sort in ascending or descending order. + type: string + required: + - name + - sortOrder + type: object + type: object + weight: + description: Weight associated with matching the + corresponding clusterSelectorTerm, in the range + [-100, 100]. + format: int32 + maximum: 100 + minimum: -100 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the resource will not be scheduled onto the cluster. + If the affinity requirements specified by this field cease to be met + at some point after the placement (e.g. due to an update), the system + may or may not try to eventually remove the resource from the cluster. + properties: + clusterSelectorTerms: + description: ClusterSelectorTerms is a list of cluster + selector terms. The terms are `ORed`. + items: + properties: + labelSelector: + description: |- + LabelSelector is a label query over all the joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + propertySelector: + description: |- + PropertySelector is a property query over all joined member clusters. Clusters matching + the query are selected. + + If you specify both label and property selectors in the same term, the results are AND'd. + + At this moment, PropertySelector can only be used with + `RequiredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + matchExpressions: + description: MatchExpressions is an array + of PropertySelectorRequirements. The requirements + are AND'd. + items: + description: |- + PropertySelectorRequirement is a specific property requirement when picking clusters for + resource placement. + properties: + name: + description: Name is the name of the + property; it should be a Kubernetes + label name. + type: string + operator: + description: |- + Operator specifies the relationship between a cluster's observed value of the specified + property and the values given in the requirement. + type: string + values: + description: |- + Values are a list of values of the specified property which Fleet will compare against + the observed values of individual member clusters in accordance with the given + operator. + + At this moment, each value should be a Kubernetes quantity. For more information, see + https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity. + + If the operator is Gt (greater than), Ge (greater than or equal to), Lt (less than), + or `Le` (less than or equal to), Eq (equal to), or Ne (ne), exactly one value must be + specified in the list. + items: + type: string + maxItems: 1 + type: array + required: + - name + - operator + - values + type: object + type: array + required: + - matchExpressions + type: object + propertySorter: + description: |- + PropertySorter sorts all matching clusters by a specific property and assigns different weights + to each cluster based on their observed property values. + + At this moment, PropertySorter can only be used with + `PreferredDuringSchedulingIgnoredDuringExecution` affinity terms. + + This field is beta-level; it is for the property-based scheduling feature and is only + functional when a property provider is enabled in the deployment. + properties: + name: + description: Name is the name of the property + which Fleet sorts clusters by. + type: string + sortOrder: + description: |- + SortOrder explains how Fleet should perform the sort; specifically, whether Fleet should + sort in ascending or descending order. + type: string + required: + - name + - sortOrder + type: object + type: object + maxItems: 10 + type: array + required: + - clusterSelectorTerms + type: object + type: object + type: object + clusterNames: + description: |- + ClusterNames contains a list of names of MemberCluster to place the selected resources. + Only valid if the placement type is "PickFixed" + items: + type: string + maxItems: 100 + type: array + numberOfClusters: + description: NumberOfClusters of placement. Only valid if the + placement type is "PickN". + format: int32 + minimum: 0 + type: integer + placementType: + default: PickAll + description: Type of placement. Can be "PickAll", "PickN" or "PickFixed". + Default is PickAll. + enum: + - PickAll + - PickN + - PickFixed + type: string + tolerations: + description: |- + If specified, the ClusterResourcePlacement's Tolerations. + Tolerations cannot be updated or deleted. + + This field is beta-level and is for the taints and tolerations feature. + items: + description: |- + Toleration allows ClusterResourcePlacement to tolerate any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, only allowed value is NoSchedule. + enum: + - NoSchedule + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + default: Equal + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a + ClusterResourcePlacement can tolerate all taints of a particular category. + enum: + - Equal + - Exists + type: string + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + maxItems: 100 + type: array + topologySpreadConstraints: + description: |- + TopologySpreadConstraints describes how a group of resources ought to spread across multiple topology + domains. Scheduler will schedule resources in a way which abides by the constraints. + All topologySpreadConstraints are ANDed. + Only valid if the placement type is "PickN". + items: + description: TopologySpreadConstraint specifies how to spread + resources among the given cluster topology. + properties: + maxSkew: + default: 1 + description: |- + MaxSkew describes the degree to which resources may be unevenly distributed. + When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference + between the number of resource copies in the target topology and the global minimum. + The global minimum is the minimum number of resource copies in a domain. + When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence + to topologies that satisfy it. + It's an optional field. Default value is 1 and 0 is not allowed. + format: int32 + minimum: 1 + type: integer + topologyKey: + description: |- + TopologyKey is the key of cluster labels. Clusters that have a label with this key + and identical values are considered to be in the same topology. + We consider each as a "bucket", and try to put balanced number + of replicas of the resource into each bucket honor the `MaxSkew` value. + It's a required field. + type: string + whenUnsatisfiable: + description: |- + WhenUnsatisfiable indicates how to deal with the resource if it doesn't satisfy + the spread constraint. + - DoNotSchedule (default) tells the scheduler not to schedule it. + - ScheduleAnyway tells the scheduler to schedule the resource in any cluster, + but giving higher precedence to topologies that would help reduce the skew. + It's an optional field. + type: string + required: + - topologyKey + type: object + type: array + type: object + policyHash: + description: PolicyHash is the sha-256 hash value of the Policy field. + format: byte + type: string + required: + - policyHash + type: object + status: + description: The observed status of SchedulingPolicySnapshot. + properties: + conditions: + description: Conditions is an array of current observed conditions + for SchedulingPolicySnapshot. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedCRPGeneration: + description: |- + ObservedCRPGeneration is the generation of the CRP which the scheduler uses to perform + the scheduling cycle and prepare the scheduling status. + format: int64 + type: integer + targetClusters: + description: |- + ClusterDecisions contains a list of names of member clusters considered by the scheduler. + Note that all the selected clusters must present in the list while not all the + member clusters are guaranteed to be listed due to the size limit. We will try to + add the clusters that can provide the most insight to the list first. + items: + description: |- + ClusterDecision represents a decision from a placement + An empty ClusterDecision indicates it is not scheduled yet. + properties: + clusterName: + description: |- + ClusterName is the name of the ManagedCluster. If it is not empty, its value should be unique cross all + placement decisions for the Placement. + type: string + clusterScore: + description: ClusterScore represents the score of the cluster + calculated by the scheduler. + properties: + affinityScore: + description: |- + AffinityScore represents the affinity score of the cluster calculated by the last + scheduling decision based on the preferred affinity selector. + An affinity score may not present if the cluster does not meet the required affinity. + format: int32 + type: integer + priorityScore: + description: |- + TopologySpreadScore represents the priority score of the cluster calculated by the last + scheduling decision based on the topology spread applied to the cluster. + A priority score may not present if the cluster does not meet the topology spread. + format: int32 + type: integer + type: object + reason: + description: Reason represents the reason why the cluster is + selected or not. + type: string + selected: + description: Selected indicates if this cluster is selected + by the scheduler. + type: boolean + required: + - clusterName + - reason + - selected + type: object + maxItems: 1000 + type: array + required: + - observedCRPGeneration + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/controllers/clusterresourceplacement/controller_integration_test.go b/pkg/controllers/clusterresourceplacement/controller_integration_test.go index afdeb2644..a18501126 100644 --- a/pkg/controllers/clusterresourceplacement/controller_integration_test.go +++ b/pkg/controllers/clusterresourceplacement/controller_integration_test.go @@ -387,7 +387,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -416,7 +416,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -457,7 +457,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -512,7 +512,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -569,7 +569,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -772,7 +772,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -1155,7 +1155,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -1372,7 +1372,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -1406,7 +1406,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -1449,7 +1449,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { @@ -1626,7 +1626,7 @@ var _ = Describe("Test ClusterResourcePlacement Controller", func() { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, Spec: crp.Spec, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ ObservedResourceIndex: "0", Conditions: []metav1.Condition{ { diff --git a/pkg/controllers/clusterresourceplacement/controller_test.go b/pkg/controllers/clusterresourceplacement/controller_test.go index 8c2e0eb4c..a1bd2d2bc 100644 --- a/pkg/controllers/clusterresourceplacement/controller_test.go +++ b/pkg/controllers/clusterresourceplacement/controller_test.go @@ -101,7 +101,7 @@ func clusterResourcePlacementForTest() *fleetv1beta1.ClusterResourcePlacement { Name: testCRPName, Generation: crpGeneration, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: []fleetv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -3265,7 +3265,7 @@ func TestIsRolloutComplete(t *testing.T) { Name: testCRPName, Generation: crpGeneration, }, - Status: fleetv1beta1.ClusterResourcePlacementStatus{ + Status: fleetv1beta1.PlacementStatus{ Conditions: tc.conditions, }, } diff --git a/pkg/controllers/clusterresourceplacement/placement_status_test.go b/pkg/controllers/clusterresourceplacement/placement_status_test.go index b769ed970..dcef8d73e 100644 --- a/pkg/controllers/clusterresourceplacement/placement_status_test.go +++ b/pkg/controllers/clusterresourceplacement/placement_status_test.go @@ -97,14 +97,14 @@ func TestSetPlacementStatus(t *testing.T) { } tests := []struct { name string - crpStatus fleetv1beta1.ClusterResourcePlacementStatus + crpStatus fleetv1beta1.PlacementStatus policy *fleetv1beta1.PlacementPolicy strategy fleetv1beta1.RolloutStrategy latestPolicySnapshot *fleetv1beta1.ClusterSchedulingPolicySnapshot latestResourceSnapshot *fleetv1beta1.ClusterResourceSnapshot clusterResourceBindings []fleetv1beta1.ClusterResourceBinding want bool - wantStatus *fleetv1beta1.ClusterResourcePlacementStatus + wantStatus *fleetv1beta1.PlacementStatus wantErr error }{ { @@ -137,7 +137,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -196,7 +196,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -255,7 +255,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -314,7 +314,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -394,7 +394,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -528,7 +528,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -604,7 +604,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -746,7 +746,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: false, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -879,7 +879,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -1148,7 +1148,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -1558,7 +1558,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -1836,7 +1836,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2066,7 +2066,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2377,7 +2377,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2514,7 +2514,7 @@ func TestSetPlacementStatus(t *testing.T) { PlacementType: fleetv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(1)), }, - crpStatus: fleetv1beta1.ClusterResourcePlacementStatus{ + crpStatus: fleetv1beta1.PlacementStatus{ ObservedResourceIndex: "-1", Conditions: []metav1.Condition{ { @@ -2672,7 +2672,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2771,7 +2771,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2878,7 +2878,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -2937,7 +2937,7 @@ func TestSetPlacementStatus(t *testing.T) { PlacementType: fleetv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(3)), }, - crpStatus: fleetv1beta1.ClusterResourcePlacementStatus{ + crpStatus: fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -3082,7 +3082,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -3332,7 +3332,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -3651,7 +3651,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -3963,7 +3963,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4263,7 +4263,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4495,7 +4495,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - crpStatus: fleetv1beta1.ClusterResourcePlacementStatus{ + crpStatus: fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4592,7 +4592,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, }, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4788,7 +4788,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, want: true, - crpStatus: fleetv1beta1.ClusterResourcePlacementStatus{ + crpStatus: fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4871,7 +4871,7 @@ func TestSetPlacementStatus(t *testing.T) { }, }, }, - wantStatus: &fleetv1beta1.ClusterResourcePlacementStatus{ + wantStatus: &fleetv1beta1.PlacementStatus{ SelectedResources: selectedResources, ObservedResourceIndex: "0", Conditions: []metav1.Condition{ @@ -4977,7 +4977,7 @@ func TestSetPlacementStatus(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: []fleetv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -5102,7 +5102,7 @@ func TestBuildResourcePlacementStatusMap(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { crp := fleetv1beta1.ClusterResourcePlacement{ - Status: fleetv1beta1.ClusterResourcePlacementStatus{ + Status: fleetv1beta1.PlacementStatus{ PlacementStatuses: tc.status, }, } diff --git a/pkg/controllers/clusterresourceplacementeviction/controller_intergration_test.go b/pkg/controllers/clusterresourceplacementeviction/controller_intergration_test.go index 419a56b48..a1369d88d 100644 --- a/pkg/controllers/clusterresourceplacementeviction/controller_intergration_test.go +++ b/pkg/controllers/clusterresourceplacementeviction/controller_intergration_test.go @@ -491,7 +491,7 @@ var _ = Describe("Test ClusterResourcePlacementEviction Controller", func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, ClusterNames: []string{"test-cluster-1"}, @@ -537,7 +537,7 @@ func buildTestPickNCRP(crpName string, clusterCount int32) placementv1beta1.Clus ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(clusterCount), diff --git a/pkg/controllers/clusterresourceplacementeviction/controller_test.go b/pkg/controllers/clusterresourceplacementeviction/controller_test.go index e2e88d384..ec1a6621f 100644 --- a/pkg/controllers/clusterresourceplacementeviction/controller_test.go +++ b/pkg/controllers/clusterresourceplacementeviction/controller_test.go @@ -63,7 +63,7 @@ func TestValidateEviction(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -134,7 +134,7 @@ func TestValidateEviction(t *testing.T) { DeletionTimestamp: &metav1.Time{Time: time.Now()}, Finalizers: []string{"test-finalizer"}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -159,7 +159,7 @@ func TestValidateEviction(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, }, @@ -223,7 +223,7 @@ func TestValidateEviction(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{}, + Spec: placementv1beta1.PlacementSpec{}, }, bindings: []placementv1beta1.ClusterResourceBinding{testBinding2}, wantValidationResult: &evictionValidationResult{ @@ -1555,7 +1555,7 @@ func buildTestPickAllCRP(crpName string) placementv1beta1.ClusterResourcePlaceme ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, diff --git a/pkg/controllers/clusterresourceplacementwatcher/watcher_integration_test.go b/pkg/controllers/clusterresourceplacementwatcher/watcher_integration_test.go index 5deaa5988..e1a5ffc3a 100644 --- a/pkg/controllers/clusterresourceplacementwatcher/watcher_integration_test.go +++ b/pkg/controllers/clusterresourceplacementwatcher/watcher_integration_test.go @@ -37,7 +37,7 @@ func clusterResourcePlacementForTest() *fleetv1beta1.ClusterResourcePlacement { ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: []fleetv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, diff --git a/pkg/controllers/resourcechange/resourcechange_controller_test.go b/pkg/controllers/resourcechange/resourcechange_controller_test.go index 80a9701b2..f83e0e5a6 100644 --- a/pkg/controllers/resourcechange/resourcechange_controller_test.go +++ b/pkg/controllers/resourcechange/resourcechange_controller_test.go @@ -190,7 +190,7 @@ func TestFindPlacementsSelectedDeletedResV1Beta11(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ deletedResV1Beta1, }, @@ -206,7 +206,7 @@ func TestFindPlacementsSelectedDeletedResV1Beta11(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ deletedResV1Beta1, }, @@ -216,7 +216,7 @@ func TestFindPlacementsSelectedDeletedResV1Beta11(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected-2", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ deletedResV1Beta1, { @@ -237,7 +237,7 @@ func TestFindPlacementsSelectedDeletedResV1Beta11(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ { Group: "xyz", @@ -257,7 +257,7 @@ func TestFindPlacementsSelectedDeletedResV1Beta11(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{}, }, }, @@ -680,7 +680,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -703,7 +703,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, }, }, @@ -717,7 +717,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -738,7 +738,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -766,7 +766,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -789,7 +789,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -816,7 +816,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -852,7 +852,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -889,7 +889,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ // the mis-matching resource selector ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { @@ -904,7 +904,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { }, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ { Group: corev1.GroupName, @@ -933,7 +933,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -947,7 +947,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { }, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ { Group: corev1.GroupName, @@ -969,7 +969,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -990,7 +990,7 @@ func TestCollectAllAffectedPlacementsV1Beta1(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "resource-selected", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, diff --git a/pkg/controllers/rollout/controller_test.go b/pkg/controllers/rollout/controller_test.go index 88353cff9..c92c94b66 100644 --- a/pkg/controllers/rollout/controller_test.go +++ b/pkg/controllers/rollout/controller_test.go @@ -2263,7 +2263,7 @@ func clusterResourcePlacementForTest(crpName string, policy *fleetv1beta1.Placem ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: []fleetv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -2924,7 +2924,7 @@ func TestProcessApplyStrategyUpdates(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Strategy: fleetv1beta1.RolloutStrategy{}, }, }, @@ -2959,7 +2959,7 @@ func TestProcessApplyStrategyUpdates(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Strategy: fleetv1beta1.RolloutStrategy{ ApplyStrategy: &fleetv1beta1.ApplyStrategy{ Type: fleetv1beta1.ApplyStrategyTypeServerSideApply, @@ -3066,7 +3066,7 @@ func TestProcessApplyStrategyUpdates(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Strategy: fleetv1beta1.RolloutStrategy{ ApplyStrategy: &fleetv1beta1.ApplyStrategy{ Type: fleetv1beta1.ApplyStrategyTypeClientSideApply, diff --git a/pkg/controllers/updaterun/controller_integration_test.go b/pkg/controllers/updaterun/controller_integration_test.go index d0d555202..4201c28c9 100644 --- a/pkg/controllers/updaterun/controller_integration_test.go +++ b/pkg/controllers/updaterun/controller_integration_test.go @@ -368,7 +368,7 @@ func generateTestClusterResourcePlacement() *placementv1beta1.ClusterResourcePla ObjectMeta: metav1.ObjectMeta{ Name: testCRPName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", diff --git a/pkg/scheduler/watchers/clusterresourceplacement/controller_integration_test.go b/pkg/scheduler/watchers/clusterresourceplacement/controller_integration_test.go index d858062a7..8df465644 100644 --- a/pkg/scheduler/watchers/clusterresourceplacement/controller_integration_test.go +++ b/pkg/scheduler/watchers/clusterresourceplacement/controller_integration_test.go @@ -98,7 +98,7 @@ var _ = Describe("scheduler cluster resource placement source controller", Seria ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: resourceSelectors, }, } @@ -221,7 +221,7 @@ var _ = Describe("scheduler cluster resource placement source controller", Seria ObjectMeta: metav1.ObjectMeta{ Name: noFinalizerCRP, }, - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ ResourceSelectors: resourceSelectors, }, } diff --git a/pkg/scheduler/watchers/membercluster/suite_test.go b/pkg/scheduler/watchers/membercluster/suite_test.go index 94801ad55..f76481439 100644 --- a/pkg/scheduler/watchers/membercluster/suite_test.go +++ b/pkg/scheduler/watchers/membercluster/suite_test.go @@ -74,7 +74,7 @@ var ( ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: defaultResourceSelectors, Policy: policy, }, diff --git a/pkg/scheduler/watchers/membercluster/utils_test.go b/pkg/scheduler/watchers/membercluster/utils_test.go index 58ee581f7..29d98ddda 100644 --- a/pkg/scheduler/watchers/membercluster/utils_test.go +++ b/pkg/scheduler/watchers/membercluster/utils_test.go @@ -54,13 +54,13 @@ func TestIsPickNCRPFullyScheduled(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{}, }, }, @@ -71,13 +71,13 @@ func TestIsPickNCRPFullyScheduled(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -94,13 +94,13 @@ func TestIsPickNCRPFullyScheduled(t *testing.T) { Name: crpName, Generation: 1, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -118,13 +118,13 @@ func TestIsPickNCRPFullyScheduled(t *testing.T) { Name: crpName, Generation: 1, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -179,7 +179,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ ClusterNames: []string{clusterName1}, }, @@ -191,7 +191,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ ClusterNames: []string{clusterName1}, }, @@ -207,12 +207,12 @@ func TestClassifyCRPs(t *testing.T) { Name: crpName, Generation: 1, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ ClusterNames: []string{clusterName1}, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -232,7 +232,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -244,7 +244,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -259,7 +259,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, @@ -272,7 +272,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, @@ -289,13 +289,13 @@ func TestClassifyCRPs(t *testing.T) { Name: crpName, Generation: 1, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -315,7 +315,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName2, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ ClusterNames: []string{clusterName1}, }, @@ -331,13 +331,13 @@ func TestClassifyCRPs(t *testing.T) { Name: crpName5, Generation: 1, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, }, }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -351,7 +351,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName4, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -361,7 +361,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName3, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, @@ -374,7 +374,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName2, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ ClusterNames: []string{clusterName1}, }, @@ -389,7 +389,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName4, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -399,7 +399,7 @@ func TestClassifyCRPs(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: crpName3, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: &numOfClusters, diff --git a/pkg/utils/defaulter/clusterresourceplacement_test.go b/pkg/utils/defaulter/clusterresourceplacement_test.go index b2469b4c9..0c93dd9e8 100644 --- a/pkg/utils/defaulter/clusterresourceplacement_test.go +++ b/pkg/utils/defaulter/clusterresourceplacement_test.go @@ -34,10 +34,10 @@ func TestSetDefaultsClusterResourcePlacement(t *testing.T) { }{ "ClusterResourcePlacement with nil Spec": { obj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{}, + Spec: fleetv1beta1.PlacementSpec{}, }, wantObj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Policy: &fleetv1beta1.PlacementPolicy{ PlacementType: fleetv1beta1.PickAllPlacementType, }, @@ -61,7 +61,7 @@ func TestSetDefaultsClusterResourcePlacement(t *testing.T) { }, "ClusterResourcePlacement with nil TopologySpreadConstraints & Tolerations fields": { obj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Policy: &fleetv1beta1.PlacementPolicy{ TopologySpreadConstraints: []fleetv1beta1.TopologySpreadConstraint{ { @@ -93,7 +93,7 @@ func TestSetDefaultsClusterResourcePlacement(t *testing.T) { }, }, wantObj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Policy: &fleetv1beta1.PlacementPolicy{ TopologySpreadConstraints: []fleetv1beta1.TopologySpreadConstraint{ { @@ -130,7 +130,7 @@ func TestSetDefaultsClusterResourcePlacement(t *testing.T) { }, "ClusterResourcePlacement with serverside apply config not set": { obj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Strategy: fleetv1beta1.RolloutStrategy{ ApplyStrategy: &fleetv1beta1.ApplyStrategy{ Type: fleetv1beta1.ApplyStrategyTypeServerSideApply, @@ -139,7 +139,7 @@ func TestSetDefaultsClusterResourcePlacement(t *testing.T) { }, }, wantObj: &fleetv1beta1.ClusterResourcePlacement{ - Spec: fleetv1beta1.ClusterResourcePlacementSpec{ + Spec: fleetv1beta1.PlacementSpec{ Policy: &fleetv1beta1.PlacementPolicy{ PlacementType: fleetv1beta1.PickAllPlacementType, }, diff --git a/pkg/utils/validator/clusterresourceplacement_test.go b/pkg/utils/validator/clusterresourceplacement_test.go index 3f7ec64d4..bee65cd52 100644 --- a/pkg/utils/validator/clusterresourceplacement_test.go +++ b/pkg/utils/validator/clusterresourceplacement_test.go @@ -221,7 +221,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{resourceSelector}, Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -238,7 +238,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp-with-very-long-name-field-exceeding-DNS1035LabelMaxLength", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{resourceSelector}, Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -256,7 +256,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "rbac.authorization.k8s.io", @@ -284,7 +284,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "rbac.authorization.k8s.io", @@ -304,7 +304,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "apps", @@ -326,7 +326,7 @@ func TestValidateClusterResourcePlacement(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{resourceSelector}, }, }, diff --git a/pkg/webhook/clusterresourceplacement/v1beta1_clusterresourceplacement_validating_webhook_test.go b/pkg/webhook/clusterresourceplacement/v1beta1_clusterresourceplacement_validating_webhook_test.go index fdb407d68..2717be508 100644 --- a/pkg/webhook/clusterresourceplacement/v1beta1_clusterresourceplacement_validating_webhook_test.go +++ b/pkg/webhook/clusterresourceplacement/v1beta1_clusterresourceplacement_validating_webhook_test.go @@ -40,7 +40,7 @@ func TestHandle(t *testing.T) { Name: "test-crp", Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -60,7 +60,7 @@ func TestHandle(t *testing.T) { Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, DeletionTimestamp: ptr.To(metav1.NewTime(time.Now())), }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -81,7 +81,7 @@ func TestHandle(t *testing.T) { Finalizers: []string{}, DeletionTimestamp: ptr.To(metav1.NewTime(time.Now())), }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -100,7 +100,7 @@ func TestHandle(t *testing.T) { Name: "test-crp", Finalizers: []string{}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -119,7 +119,7 @@ func TestHandle(t *testing.T) { Name: "test-crp", Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -134,7 +134,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{resourceSelector}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -156,7 +156,7 @@ func TestHandle(t *testing.T) { Name: "test-crp", Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -176,7 +176,7 @@ func TestHandle(t *testing.T) { Finalizers: []string{}, DeletionTimestamp: ptr.To(metav1.NewTime(time.Now())), }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, @@ -196,7 +196,7 @@ func TestHandle(t *testing.T) { Labels: map[string]string{"key1": "value1"}, Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{resourceSelector}, Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -211,7 +211,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(2)), diff --git a/pkg/webhook/clusterresourceplacementdisruptionbudget/clusterresourceplacementdisruptionbudget_validating_webhook_test.go b/pkg/webhook/clusterresourceplacementdisruptionbudget/clusterresourceplacementdisruptionbudget_validating_webhook_test.go index c7908d1db..16f904a71 100644 --- a/pkg/webhook/clusterresourceplacementdisruptionbudget/clusterresourceplacementdisruptionbudget_validating_webhook_test.go +++ b/pkg/webhook/clusterresourceplacementdisruptionbudget/clusterresourceplacementdisruptionbudget_validating_webhook_test.go @@ -123,7 +123,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "pick-all-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -134,7 +134,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "crp-pickn", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -146,7 +146,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "crp-pickfixed", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, diff --git a/pkg/webhook/clusterresourceplacementeviction/clusterresourceplacementeviction_validating_webhook_test.go b/pkg/webhook/clusterresourceplacementeviction/clusterresourceplacementeviction_validating_webhook_test.go index 352ac47a7..67daa668a 100644 --- a/pkg/webhook/clusterresourceplacementeviction/clusterresourceplacementeviction_validating_webhook_test.go +++ b/pkg/webhook/clusterresourceplacementeviction/clusterresourceplacementeviction_validating_webhook_test.go @@ -83,7 +83,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -98,7 +98,7 @@ func TestHandle(t *testing.T) { }, Finalizers: []string{placementv1beta1.ClusterResourcePlacementCleanupFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -109,7 +109,7 @@ func TestHandle(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "crp-pickfixed", }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{}, Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, diff --git a/test/e2e/actuals_test.go b/test/e2e/actuals_test.go index 3d47be1d0..49a94ced6 100644 --- a/test/e2e/actuals_test.go +++ b/test/e2e/actuals_test.go @@ -720,7 +720,7 @@ func crpStatusWithOverrideUpdatedActual( ApplicableClusterResourceOverrides: wantClusterResourceOverrides, }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpRolloutCompletedConditions(crp.Generation, hasOverride), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -762,7 +762,7 @@ func crpStatusWithOverrideUpdatedFailedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpOverrideFailedConditions(crp.Generation), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -800,7 +800,7 @@ func crpStatusWithWorkSynchronizedUpdatedFailedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpWorkSynchronizedFailedConditions(crp.Generation, hasOverrides), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -865,7 +865,7 @@ func customizedCRPStatusUpdatedActual(crpName string, // // * The CRP is of the PickN placement type and the required N count cannot be fulfilled; or // * The CRP is of the PickFixed placement type and the list of target clusters specified cannot be fulfilled. - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -978,7 +978,7 @@ func safeRolloutWorkloadCRPStatusUpdatedActual(wantSelectedResourceIdentifiers [ }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, diff --git a/test/e2e/enveloped_object_placement_test.go b/test/e2e/enveloped_object_placement_test.go index 98a26bc93..c8a708c34 100644 --- a/test/e2e/enveloped_object_placement_test.go +++ b/test/e2e/enveloped_object_placement_test.go @@ -78,7 +78,7 @@ var _ = Describe("placing wrapped resources using a CRP", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -247,7 +247,7 @@ var _ = Describe("placing wrapped resources using a CRP", func() { // Add a custom finalizer; this would allow us to better observe the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -345,7 +345,7 @@ var _ = Describe("placing wrapped resources using a CRP", func() { Namespace: workNamespace.Name, }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpNotAvailableConditions(1, false), PlacementStatuses: PlacementStatuses, SelectedResources: wantSelectedResources, @@ -440,7 +440,7 @@ var _ = Describe("placing wrapped resources using a CRP", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -466,7 +466,7 @@ var _ = Describe("placing wrapped resources using a CRP", func() { return err } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpWorkSynchronizedFailedConditions(crp.Generation, false), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ { @@ -559,7 +559,7 @@ var _ = Describe("Process objects with generate name", Ordered, func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -585,7 +585,7 @@ var _ = Describe("Process objects with generate name", Ordered, func() { return err } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crp.Generation), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ { diff --git a/test/e2e/join_and_leave_test.go b/test/e2e/join_and_leave_test.go index b0b9f3ac8..e748da6ff 100644 --- a/test/e2e/join_and_leave_test.go +++ b/test/e2e/join_and_leave_test.go @@ -90,7 +90,7 @@ var _ = Describe("Test member cluster join and leave flow", Ordered, Serial, fun // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", diff --git a/test/e2e/placement_apply_strategy_test.go b/test/e2e/placement_apply_strategy_test.go index 117a0226e..1a5105c54 100644 --- a/test/e2e/placement_apply_strategy_test.go +++ b/test/e2e/placement_apply_strategy_test.go @@ -266,7 +266,7 @@ var _ = Describe("validating CRP when resources exists", Ordered, func() { workNamespaceName := fmt.Sprintf(workNamespaceNameTemplate, GinkgoParallelProcess()) appConfigMapName := fmt.Sprintf(appConfigMapNameTemplate, GinkgoParallelProcess()) - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crp.Generation), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ { @@ -448,7 +448,7 @@ var _ = Describe("validating CRP when resources exists", Ordered, func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -487,7 +487,7 @@ var _ = Describe("validating CRP when resources exists", Ordered, func() { Name: conflictedCRPName, // No need for the custom deletion blocker finalizer. }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -510,8 +510,8 @@ var _ = Describe("validating CRP when resources exists", Ordered, func() { }) It("should update conflicted CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -642,7 +642,7 @@ var _ = Describe("SSA", Ordered, func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -758,7 +758,7 @@ var _ = Describe("switching apply strategies", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -787,8 +787,8 @@ var _ = Describe("switching apply strategies", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -852,8 +852,8 @@ var _ = Describe("switching apply strategies", func() { // The rollout of the previous change will be blocked due to the rollout // strategy configuration (1 member cluster has failed; 0 clusters are // allowed to become unavailable). - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpRolloutStuckConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -921,8 +921,8 @@ var _ = Describe("switching apply strategies", func() { // The rollout of the previous change will be blocked due to the rollout // strategy configuration (1 member cluster has failed; 0 clusters are // allowed to become unavailable). - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpDiffReportedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1003,7 +1003,7 @@ var _ = Describe("switching apply strategies", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -1030,8 +1030,8 @@ var _ = Describe("switching apply strategies", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpDiffReportedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1140,8 +1140,8 @@ var _ = Describe("switching apply strategies", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpDiffReportedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1240,8 +1240,8 @@ var _ = Describe("switching apply strategies", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpRolloutCompletedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ diff --git a/test/e2e/placement_drift_diff_test.go b/test/e2e/placement_drift_diff_test.go index 30603e80b..db2df000f 100644 --- a/test/e2e/placement_drift_diff_test.go +++ b/test/e2e/placement_drift_diff_test.go @@ -178,8 +178,8 @@ var _ = Describe("take over existing resources", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -347,8 +347,8 @@ var _ = Describe("take over existing resources", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -549,8 +549,8 @@ var _ = Describe("detect drifts on placed resources", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpRolloutCompletedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -685,8 +685,8 @@ var _ = Describe("detect drifts on placed resources", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -866,8 +866,8 @@ var _ = Describe("detect drifts on placed resources", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1068,8 +1068,8 @@ var _ = Describe("report diff mode", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpDiffReportedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1274,8 +1274,8 @@ var _ = Describe("report diff mode", func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpDiffReportedConditions(crpGeneration, false), SelectedResources: workResourceIdentifiers(), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ @@ -1423,7 +1423,7 @@ var _ = Describe("mixed diff and drift reportings", Ordered, func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -1475,8 +1475,8 @@ var _ = Describe("mixed diff and drift reportings", Ordered, func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: []placementv1beta1.ResourceIdentifier{ { @@ -1719,8 +1719,8 @@ var _ = Describe("mixed diff and drift reportings", Ordered, func() { var refreshedLastDeployDriftObservedTimeOnCluster2 metav1.Time var refreshedFirstDeployDriftObservedTimeOnCluster2 metav1.Time - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: []placementv1beta1.ResourceIdentifier{ { @@ -1953,8 +1953,8 @@ var _ = Describe("mixed diff and drift reportings", Ordered, func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crpGeneration), SelectedResources: []placementv1beta1.ResourceIdentifier{ { @@ -2103,8 +2103,8 @@ var _ = Describe("mixed diff and drift reportings", Ordered, func() { }) It("should update CRP status as expected", func() { - buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.ClusterResourcePlacementStatus { - return &placementv1beta1.ClusterResourcePlacementStatus{ + buildWantCRPStatus := func(crpGeneration int64) *placementv1beta1.PlacementStatus { + return &placementv1beta1.PlacementStatus{ Conditions: crpRolloutCompletedConditions(crpGeneration, false), SelectedResources: []placementv1beta1.ResourceIdentifier{ { diff --git a/test/e2e/placement_eviction_test.go b/test/e2e/placement_eviction_test.go index 74cc3010a..34d182251 100644 --- a/test/e2e/placement_eviction_test.go +++ b/test/e2e/placement_eviction_test.go @@ -544,7 +544,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -636,7 +636,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -742,7 +742,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -840,7 +840,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -932,7 +932,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -1024,7 +1024,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -1130,7 +1130,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), @@ -1228,7 +1228,7 @@ var _ = Describe("ClusterResourcePlacement eviction of bound binding - PickN CRP // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, NumberOfClusters: ptr.To(int32(len(allMemberClusterNames))), diff --git a/test/e2e/placement_negative_cases_test.go b/test/e2e/placement_negative_cases_test.go index 7e028ef27..9b0bb60c8 100644 --- a/test/e2e/placement_negative_cases_test.go +++ b/test/e2e/placement_negative_cases_test.go @@ -96,7 +96,7 @@ var _ = Describe("handling errors and failures gracefully", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -122,7 +122,7 @@ var _ = Describe("handling errors and failures gracefully", func() { return err } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crp.Generation), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ { diff --git a/test/e2e/placement_pickall_test.go b/test/e2e/placement_pickall_test.go index b682f5f75..fffc403d7 100644 --- a/test/e2e/placement_pickall_test.go +++ b/test/e2e/placement_pickall_test.go @@ -46,7 +46,7 @@ var _ = Describe("placing resources using a CRP with no placement policy specifi // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -87,7 +87,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -131,7 +131,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -201,7 +201,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -316,7 +316,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -387,7 +387,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -461,7 +461,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -614,7 +614,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -689,7 +689,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -765,7 +765,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -944,7 +944,7 @@ var _ = Describe("placing resources using a CRP of PickAll placement type", func // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, diff --git a/test/e2e/placement_pickfixed_test.go b/test/e2e/placement_pickfixed_test.go index 32225b435..9adba284b 100644 --- a/test/e2e/placement_pickfixed_test.go +++ b/test/e2e/placement_pickfixed_test.go @@ -45,7 +45,7 @@ var _ = Describe("placing resources using a CRP of PickFixed placement type", fu // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -94,7 +94,7 @@ var _ = Describe("placing resources using a CRP of PickFixed placement type", fu // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -160,7 +160,7 @@ var _ = Describe("placing resources using a CRP of PickFixed placement type", fu // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, diff --git a/test/e2e/placement_pickn_test.go b/test/e2e/placement_pickn_test.go index cffc3e9ae..f35dd1e5e 100644 --- a/test/e2e/placement_pickn_test.go +++ b/test/e2e/placement_pickn_test.go @@ -50,7 +50,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -97,7 +97,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -168,7 +168,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -236,7 +236,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -314,7 +314,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -433,7 +433,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -507,7 +507,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -578,7 +578,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -653,7 +653,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -737,7 +737,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -831,7 +831,7 @@ var _ = Describe("placing resources using a CRP of PickN placement", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, diff --git a/test/e2e/placement_selecting_resources_test.go b/test/e2e/placement_selecting_resources_test.go index 1b21ff3b1..e066e3ce1 100644 --- a/test/e2e/placement_selecting_resources_test.go +++ b/test/e2e/placement_selecting_resources_test.go @@ -60,7 +60,7 @@ var _ = Describe("creating CRP and selecting resources by name", Ordered, func() // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), }, } @@ -113,7 +113,7 @@ var _ = Describe("creating CRP and selecting resources by label", Ordered, func( // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -177,7 +177,7 @@ var _ = Describe("validating CRP when cluster-scoped resources become selected a // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -263,7 +263,7 @@ var _ = Describe("validating CRP when cluster-scoped resources become unselected // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -348,7 +348,7 @@ var _ = Describe("validating CRP when cluster-scoped and namespace-scoped resour // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ RollingUpdate: &placementv1beta1.RollingUpdateConfig{ @@ -441,7 +441,7 @@ var _ = Describe("validating CRP when adding resources in a matching namespace", // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ RollingUpdate: &placementv1beta1.RollingUpdateConfig{ @@ -528,7 +528,7 @@ var _ = Describe("validating CRP when deleting resources in a matching namespace // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ RollingUpdate: &placementv1beta1.RollingUpdateConfig{ @@ -619,7 +619,7 @@ var _ = Describe("validating CRP when selecting a reserved resource", Ordered, f // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -651,7 +651,7 @@ var _ = Describe("validating CRP when selecting a reserved resource", Ordered, f return err } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Type: string(placementv1beta1.ClusterResourcePlacementScheduledConditionType), @@ -701,7 +701,7 @@ var _ = Describe("When creating a pickN ClusterResourcePlacement with duplicated // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: corev1.GroupName, @@ -733,7 +733,7 @@ var _ = Describe("When creating a pickN ClusterResourcePlacement with duplicated if err := hubClient.Get(ctx, types.NamespacedName{Name: crpName}, gotCRP); err != nil { return err } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: []metav1.Condition{ { Status: metav1.ConditionFalse, @@ -799,7 +799,7 @@ var _ = Describe("validating CRP when failed to apply resources", Ordered, func( // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), }, } @@ -825,7 +825,7 @@ var _ = Describe("validating CRP when failed to apply resources", Ordered, func( workNamespaceName := fmt.Sprintf(workNamespaceNameTemplate, GinkgoParallelProcess()) appConfigMapName := fmt.Sprintf(appConfigMapNameTemplate, GinkgoParallelProcess()) - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpAppliedFailedConditions(crp.Generation), PlacementStatuses: []placementv1beta1.ResourcePlacementStatus{ { @@ -937,7 +937,7 @@ var _ = Describe("validating CRP when placing cluster scope resource (other than // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "rbac.authorization.k8s.io", @@ -1037,7 +1037,7 @@ var _ = Describe("validating CRP revision history allowing single revision when // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -1131,7 +1131,7 @@ var _ = Describe("validating CRP revision history allowing multiple revisions wh // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -1224,7 +1224,7 @@ var _ = Describe("validating CRP when selected resources cross the 1MB limit", O // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, ClusterNames: []string{memberCluster1EastProdName, memberCluster2EastCanaryName}, @@ -1363,7 +1363,7 @@ var _ = Describe("creating CRP and checking selected resources order", Ordered, Name: crpName, Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", diff --git a/test/e2e/rollout_test.go b/test/e2e/rollout_test.go index 727045e6c..b90f7de34 100644 --- a/test/e2e/rollout_test.go +++ b/test/e2e/rollout_test.go @@ -91,7 +91,7 @@ var _ = Describe("placing wrapped resources using a CRP", Ordered, func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -1164,7 +1164,7 @@ func buildCRPForSafeRollout() *placementv1beta1.ClusterResourcePlacement { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, diff --git a/test/e2e/scheduler_watchers_test.go b/test/e2e/scheduler_watchers_test.go index d4334caa5..2089afdd0 100644 --- a/test/e2e/scheduler_watchers_test.go +++ b/test/e2e/scheduler_watchers_test.go @@ -76,7 +76,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -145,7 +145,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -228,7 +228,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -338,7 +338,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -407,7 +407,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -496,7 +496,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -561,7 +561,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -620,7 +620,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -725,7 +725,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -792,7 +792,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -856,7 +856,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -921,7 +921,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -980,7 +980,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1051,7 +1051,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1140,7 +1140,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1214,7 +1214,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1298,7 +1298,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1417,7 +1417,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1486,7 +1486,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1551,7 +1551,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1638,7 +1638,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1719,7 +1719,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -1801,7 +1801,7 @@ var _ = Describe("responding to specific member cluster changes", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, diff --git a/test/e2e/taint_toleration_test.go b/test/e2e/taint_toleration_test.go index 7024b91f3..523fb4ad3 100644 --- a/test/e2e/taint_toleration_test.go +++ b/test/e2e/taint_toleration_test.go @@ -45,7 +45,7 @@ var _ = Describe("placing resource using a cluster resource placement with pickF // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -95,7 +95,7 @@ var _ = Describe("placing resources using a cluster resource placement with no p // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -168,7 +168,7 @@ var _ = Describe("placing resources using a cluster resource placement with no p // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -241,7 +241,7 @@ var _ = Describe("picking N clusters with affinities and topology spread constra // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -327,7 +327,7 @@ var _ = Describe("picking all clusters using pickAll placement policy, add taint // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, }, diff --git a/test/e2e/updaterun_test.go b/test/e2e/updaterun_test.go index 678eff88f..6ff1d596c 100644 --- a/test/e2e/updaterun_test.go +++ b/test/e2e/updaterun_test.go @@ -67,7 +67,7 @@ var _ = Describe("test CRP rollout with staged update run", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.ExternalRolloutStrategyType, @@ -224,7 +224,7 @@ var _ = Describe("test CRP rollout with staged update run", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -437,7 +437,7 @@ var _ = Describe("test CRP rollout with staged update run", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, diff --git a/test/e2e/utils_test.go b/test/e2e/utils_test.go index b5ff7d364..66ec7f045 100644 --- a/test/e2e/utils_test.go +++ b/test/e2e/utils_test.go @@ -1278,7 +1278,7 @@ func createCRPWithApplyStrategy(crpName string, applyStrategy *placementv1beta1. // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, diff --git a/test/e2e/webhook_test.go b/test/e2e/webhook_test.go index d86ab9214..0b7d43c29 100644 --- a/test/e2e/webhook_test.go +++ b/test/e2e/webhook_test.go @@ -45,7 +45,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: selector, }, } @@ -63,7 +63,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -86,7 +86,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickNPlacementType, @@ -137,7 +137,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "", @@ -167,7 +167,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() { // the behavior of the controllers. Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: []placementv1beta1.ClusterResourceSelector{ { Group: "apps", @@ -200,7 +200,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), }, } @@ -305,7 +305,7 @@ var _ = Describe("webhook tests for CRP tolerations", Ordered, func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ Tolerations: []placementv1beta1.Toleration{ @@ -1308,7 +1308,7 @@ var _ = Describe("webhook tests for ClusterResourcePlacementEviction CREATE oper Name: crpName, Finalizers: []string{"example.com/finalizer"}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -1340,7 +1340,7 @@ var _ = Describe("webhook tests for ClusterResourcePlacementEviction CREATE oper ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, diff --git a/test/scheduler/utils_test.go b/test/scheduler/utils_test.go index 50da929c4..9b7246e03 100644 --- a/test/scheduler/utils_test.go +++ b/test/scheduler/utils_test.go @@ -284,7 +284,7 @@ func createPickFixedCRPWithPolicySnapshot(crpName string, targetClusters []strin Name: crpName, Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: defaultResourceSelectors, Policy: policy, }, @@ -320,7 +320,7 @@ func createNilSchedulingPolicyCRPWithPolicySnapshot(crpName string, policySnapsh Name: crpName, Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: defaultResourceSelectors, Policy: policy, }, @@ -493,7 +493,7 @@ func createPickAllCRPWithPolicySnapshot(crpName string, policySnapshotName strin Name: crpName, Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: defaultResourceSelectors, Policy: policy, }, @@ -567,7 +567,7 @@ func createPickNCRPWithPolicySnapshot(crpName string, policySnapshotName string, Name: crpName, Finalizers: []string{customDeletionBlockerFinalizer}, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: defaultResourceSelectors, Policy: policy, }, diff --git a/test/upgrade/after/actuals_test.go b/test/upgrade/after/actuals_test.go index 10a83b5ea..32b309632 100644 --- a/test/upgrade/after/actuals_test.go +++ b/test/upgrade/after/actuals_test.go @@ -386,7 +386,7 @@ func customizedCRPStatusUpdatedActual(crpName string, // // * The CRP is of the PickN placement type and the required N count cannot be fulfilled; or // * The CRP is of the PickFixed placement type and the list of target clusters specified cannot be fulfilled. - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -441,7 +441,7 @@ func crpWithOneFailedAvailabilityCheckStatusUpdatedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpNotAvailableConditions(crp.Generation, false), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -498,7 +498,7 @@ func crpWithOneFailedApplyOpStatusUpdatedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpNotAppliedConditions(crp.Generation), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -619,7 +619,7 @@ func crpWithStuckRolloutDueToOneFailedAvailabilityCheckStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -734,7 +734,7 @@ func crpWithStuckRolloutDueToOneFailedApplyOpStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -798,7 +798,7 @@ func crpWithStuckRolloutDueToUntrackableResourcesStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, diff --git a/test/upgrade/before/actuals_test.go b/test/upgrade/before/actuals_test.go index 5ed3059bf..0c54f117a 100644 --- a/test/upgrade/before/actuals_test.go +++ b/test/upgrade/before/actuals_test.go @@ -387,7 +387,7 @@ func customizedCRPStatusUpdatedActual(crpName string, // // * The CRP is of the PickN placement type and the required N count cannot be fulfilled; or // * The CRP is of the PickFixed placement type and the list of target clusters specified cannot be fulfilled. - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -444,7 +444,7 @@ func crpWithOneFailedAvailabilityCheckStatusUpdatedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpNotAvailableConditions(crp.Generation, false), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -502,7 +502,7 @@ func crpWithOneFailedApplyOpStatusUpdatedActual( }) } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: crpNotAppliedConditions(crp.Generation), PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -624,7 +624,7 @@ func crpWithStuckRolloutDueToOneFailedAvailabilityCheckStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -740,7 +740,7 @@ func crpWithStuckRolloutDueToOneFailedApplyOpStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, @@ -804,7 +804,7 @@ func crpWithStuckRolloutDueToUntrackableResourcesStatusUpdatedActual( }, } - wantStatus := placementv1beta1.ClusterResourcePlacementStatus{ + wantStatus := placementv1beta1.PlacementStatus{ Conditions: wantCRPConditions, PlacementStatuses: wantPlacementStatus, SelectedResources: wantSelectedResourceIdentifiers, diff --git a/test/upgrade/before/scenarios_test.go b/test/upgrade/before/scenarios_test.go index 6046091f0..cfc8f4630 100644 --- a/test/upgrade/before/scenarios_test.go +++ b/test/upgrade/before/scenarios_test.go @@ -50,7 +50,7 @@ var _ = Describe("CRP with trackable resources, all available (before upgrade)", ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -113,7 +113,7 @@ var _ = Describe("CRP with non-trackable resources, all available (before upgrad ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -204,7 +204,7 @@ var _ = Describe("CRP with availability failure (before upgrade)", Ordered, func ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -292,7 +292,7 @@ var _ = Describe("CRP with apply op failure (before upgrade)", Ordered, func() { ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickFixedPlacementType, @@ -413,7 +413,7 @@ var _ = Describe("CRP stuck in the rollout process (blocked by availability fail ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Policy: &placementv1beta1.PlacementPolicy{ PlacementType: placementv1beta1.PickAllPlacementType, @@ -585,7 +585,7 @@ var _ = Describe("CRP stuck in the rollout process (blocked by apply op failure) ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, @@ -739,7 +739,7 @@ var _ = Describe("CRP stuck in the rollout process (long wait time)", Ordered, f ObjectMeta: metav1.ObjectMeta{ Name: crpName, }, - Spec: placementv1beta1.ClusterResourcePlacementSpec{ + Spec: placementv1beta1.PlacementSpec{ ResourceSelectors: workResourceSelector(workNamespaceName), Strategy: placementv1beta1.RolloutStrategy{ Type: placementv1beta1.RollingUpdateRolloutStrategyType, diff --git a/test/upgrade/setup.sh b/test/upgrade/setup.sh index b33ecfd7a..c22f1db50 100755 --- a/test/upgrade/setup.sh +++ b/test/upgrade/setup.sh @@ -63,7 +63,7 @@ done # Install the hub agent to the hub cluster. kind export kubeconfig --name $HUB_CLUSTER -helm install hub-agent ../../charts/hub-agent/ \ +helm install hub-agent charts/hub-agent/ \ --set image.pullPolicy=Never \ --set image.repository=$REGISTRY/$HUB_AGENT_IMAGE \ --set image.tag=$IMAGE_TAG \ @@ -113,7 +113,7 @@ HUB_SERVER_URL="https://$(docker inspect $HUB_CLUSTER-control-plane --format='{{ for (( i=0; i<${MEMBER_CLUSTER_COUNT}; i++ )); do kind export kubeconfig --name "${MEMBER_CLUSTERS[$i]}" - helm install member-agent ../../charts/member-agent/ \ + helm install member-agent charts/member-agent/ \ --set config.hubURL=$HUB_SERVER_URL \ --set image.repository=$REGISTRY/$MEMBER_AGENT_IMAGE \ --set image.tag=$IMAGE_TAG \ diff --git a/test/upgrade/upgrade.sh b/test/upgrade/upgrade.sh index d3fd1d584..0d12b48d8 100755 --- a/test/upgrade/upgrade.sh +++ b/test/upgrade/upgrade.sh @@ -30,9 +30,9 @@ fi # Build the Fleet agent images. echo "Building and the Fleet agent images..." -TAG=$IMAGE_TAG make -C "../.." docker-build-hub-agent -TAG=$IMAGE_TAG make -C "../.." docker-build-member-agent -TAG=$IMAGE_TAG make -C "../.." docker-build-refresh-token +TAG=$IMAGE_TAG make docker-build-hub-agent +TAG=$IMAGE_TAG make docker-build-member-agent +TAG=$IMAGE_TAG make docker-build-refresh-token # Load the Fleet agent images (for upgrading) into the kind clusters. @@ -52,7 +52,7 @@ done if [ -n "$UPGRADE_HUB_SIDE" ]; then echo "Upgrading the hub agent in the hub cluster..." kind export kubeconfig --name $HUB_CLUSTER - helm upgrade hub-agent ../../charts/hub-agent/ \ + helm upgrade hub-agent charts/hub-agent/ \ --set image.pullPolicy=Never \ --set image.repository=$REGISTRY/$HUB_AGENT_IMAGE \ --set image.tag=$IMAGE_TAG \ @@ -75,7 +75,7 @@ if [ -n "$UPGRADE_MEMBER_SIDE" ]; then for (( i=0; i<${MEMBER_CLUSTER_COUNT}; i++ )); do kind export kubeconfig --name "${MEMBER_CLUSTERS[$i]}" - helm upgrade member-agent ../../charts/member-agent/ \ + helm upgrade member-agent charts/member-agent/ \ --set config.hubURL=$HUB_SERVER_URL \ --set image.repository=$REGISTRY/$MEMBER_AGENT_IMAGE \ --set image.tag=$IMAGE_TAG \ diff --git a/tools/draincluster/drain_test.go b/tools/draincluster/drain_test.go index 810c697b1..9cac1a119 100644 --- a/tools/draincluster/drain_test.go +++ b/tools/draincluster/drain_test.go @@ -190,7 +190,7 @@ func TestCollectClusterScopedResourcesSelectedByCRP(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ { Group: "rbac.authorization.k8s.io", @@ -237,7 +237,7 @@ func TestCollectClusterScopedResourcesSelectedByCRP(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "test-crp", }, - Status: placementv1beta1.ClusterResourcePlacementStatus{ + Status: placementv1beta1.PlacementStatus{ SelectedResources: []placementv1beta1.ResourceIdentifier{ { Group: "",