From cca7df9188fb920dcfab374940452393e2037619 Mon Sep 17 00:00:00 2001 From: haoqing0110 Date: Tue, 7 Mar 2023 14:04:06 +0000 Subject: [PATCH] add config-spec-hash annotation to manifestwork Signed-off-by: haoqing0110 --- go.mod | 2 + go.sum | 4 +- .../controllers/agentdeploy/util_test.go | 77 +++++++ .../controllers/agentdeploy/utils.go | 36 +++ vendor/modules.txt | 3 +- ...gement.io_clustermanagementaddons.crd.yaml | 213 ++++++++++++++++++ ...anagement.io_managedclusteraddons.crd.yaml | 32 +++ .../v1alpha1/types_clustermanagementaddon.go | 146 ++++++++++++ .../v1alpha1/types_managedclusteraddon.go | 11 + .../addon/v1alpha1/zz_generated.deepcopy.go | 203 ++++++++++++++++- .../zz_generated.swagger_doc_generated.go | 76 ++++++- .../fake/fake_manifestworkreplicaset.go | 126 +++++++++++ .../v1alpha1/fake/fake_placemanifestwork.go | 126 ----------- .../work/v1alpha1/fake/fake_work_client.go | 4 +- .../work/v1alpha1/generated_expansion.go | 2 +- .../work/v1alpha1/manifestworkreplicaset.go | 179 +++++++++++++++ .../typed/work/v1alpha1/placemanifestwork.go | 179 --------------- .../typed/work/v1alpha1/work_client.go | 6 +- .../informers/externalversions/generic.go | 4 +- .../work/v1alpha1/interface.go | 10 +- .../work/v1alpha1/manifestworkreplicaset.go | 74 ++++++ .../work/v1alpha1/placemanifestwork.go | 74 ------ .../work/v1alpha1/expansion_generated.go | 12 +- .../work/v1alpha1/manifestworkreplicaset.go | 83 +++++++ .../work/v1alpha1/placemanifestwork.go | 83 ------- .../utils/work/v1/workbuilder/workbuilder.go | 13 ++ ...anagement.io_appliedmanifestworks.crd.yaml | 4 + ...anagement.io_appliedmanifestworks.crd.yaml | 4 + .../api/work/v1/types.go | 13 ++ .../api/work/v1/zz_generated.deepcopy.go | 4 + .../v1/zz_generated.swagger_doc_generated.go | 5 +- ...ement.io_manifestworkreplicasets.crd.yaml} | 40 ++-- .../api/work/v1alpha1/register.go | 4 +- ...pes.go => types_manifestworkreplicaset.go} | 79 ++++--- .../work/v1alpha1/zz_generated.deepcopy.go | 54 +++-- .../zz_generated.swagger_doc_generated.go | 44 ++-- 36 files changed, 1441 insertions(+), 588 deletions(-) create mode 100644 vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_manifestworkreplicaset.go delete mode 100644 vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_placemanifestwork.go create mode 100644 vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/manifestworkreplicaset.go delete mode 100644 vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/placemanifestwork.go create mode 100644 vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/manifestworkreplicaset.go delete mode 100644 vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/placemanifestwork.go create mode 100644 vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/manifestworkreplicaset.go delete mode 100644 vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/placemanifestwork.go rename vendor/open-cluster-management.io/api/work/v1alpha1/{0000_00_work.open-cluster-management.io_placemanifestworks.crd.yaml => 0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml} (93%) rename vendor/open-cluster-management.io/api/work/v1alpha1/{types.go => types_manifestworkreplicaset.go} (56%) diff --git a/go.mod b/go.mod index fd6ae71fc..07aa87cfa 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module open-cluster-management.io/addon-framework go 1.19 +replace open-cluster-management.io/api => github.com/haoqing0110/api v0.0.0-20230314030136-5f4cd436ed1a + require ( github.com/evanphx/json-patch v4.12.0+incompatible github.com/fatih/structs v1.1.0 diff --git a/go.sum b/go.sum index 26b6c5429..58acc0c98 100644 --- a/go.sum +++ b/go.sum @@ -230,6 +230,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/haoqing0110/api v0.0.0-20230314030136-5f4cd436ed1a h1:eON8smxYh6/LI6q/ljrmwAxYP37m9AMygprWXzpN4gY= +github.com/haoqing0110/api v0.0.0-20230314030136-5f4cd436ed1a/go.mod h1:TjWobG3dTZJf/Ye04358/F/381RjE/+HXVDGMnZBpjc= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -805,8 +807,6 @@ k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+O k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y= k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -open-cluster-management.io/api v0.10.1-0.20230216050312-b716d4a5c514 h1:jtodRlbcZdvtFzzBDjwJ2XfjaLn0XMpRXBZUsTRMcnE= -open-cluster-management.io/api v0.10.1-0.20230216050312-b716d4a5c514/go.mod h1:3u4r42Zbg0utOdgarQEgAR35NAKcHgkt9xZWUTW6VAw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/addonmanager/controllers/agentdeploy/util_test.go b/pkg/addonmanager/controllers/agentdeploy/util_test.go index 5f8e4d204..51df17896 100644 --- a/pkg/addonmanager/controllers/agentdeploy/util_test.go +++ b/pkg/addonmanager/controllers/agentdeploy/util_test.go @@ -1 +1,78 @@ package agentdeploy + +import ( + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + addonapiv1alpha1 "open-cluster-management.io/api/addon/v1alpha1" + workapiv1 "open-cluster-management.io/api/work/v1" +) + +func TestConfigsToAnnotations(t *testing.T) { + cases := []struct { + name string + configReference []addonapiv1alpha1.ConfigReference + expectAnnotations map[string]string + }{ + { + name: "generate annotaions", + configReference: []addonapiv1alpha1.ConfigReference{ + { + ConfigGroupResource: addonapiv1alpha1.ConfigGroupResource{ + Group: "addon.open-cluster-management.io", + Resource: "addondeploymentconfigs", + }, + DesiredConfig: &addonapiv1alpha1.ConfigSpecHash{ + ConfigReferent: addonapiv1alpha1.ConfigReferent{ + Name: "test", + Namespace: "open-cluster-management", + }, + SpecHash: "hash1", + }, + }, + { + ConfigGroupResource: addonapiv1alpha1.ConfigGroupResource{ + Resource: "addonhubconfigs", + }, + DesiredConfig: &addonapiv1alpha1.ConfigSpecHash{ + ConfigReferent: addonapiv1alpha1.ConfigReferent{ + Name: "test", + }, + SpecHash: "hash2", + }, + }, + }, + expectAnnotations: map[string]string{ + workapiv1.ManifestConfigSpecHashAnnotationKey: `{"addondeploymentconfigs.addon.open-cluster-management.io/open-cluster-management/test":"hash1","addonhubconfigs//test":"hash2"}`}, + }, + { + name: "generate annotaions without configReference", + configReference: []addonapiv1alpha1.ConfigReference{}, + expectAnnotations: nil, + }, + { + name: "generate annotaions without DesiredConfig", + configReference: []addonapiv1alpha1.ConfigReference{ + { + ConfigGroupResource: addonapiv1alpha1.ConfigGroupResource{ + Group: "addon.open-cluster-management.io", + Resource: "addondeploymentconfigs", + }, + }, + }, + expectAnnotations: map[string]string{ + workapiv1.ManifestConfigSpecHashAnnotationKey: `{}`}, + }, + } + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + annotations, err := configsToAnnotations(c.configReference) + assert.NoError(t, err) + if !reflect.DeepEqual(annotations, c.expectAnnotations) { + t.Fatalf("Expected annotations to be equal but got %v (expected) and %v (actual)", c.expectAnnotations, annotations) + } + }) + } +} diff --git a/pkg/addonmanager/controllers/agentdeploy/utils.go b/pkg/addonmanager/controllers/agentdeploy/utils.go index 1ad54d5c2..602b78b00 100644 --- a/pkg/addonmanager/controllers/agentdeploy/utils.go +++ b/pkg/addonmanager/controllers/agentdeploy/utils.go @@ -1,6 +1,7 @@ package agentdeploy import ( + "encoding/json" "fmt" "k8s.io/apimachinery/pkg/api/meta" @@ -292,10 +293,16 @@ func (b *addonWorksBuilder) BuildDeployWorks(addonWorkNamespace string, } } + annotations, err := configsToAnnotations(addon.Status.ConfigReferences) + if err != nil { + return nil, nil, err + } + return b.workBuilder.Build(deployObjects, newAddonWorkObjectMeta(b.processor.manifestWorkNamePrefix(addon.Namespace, addon.Name), addon.Name, addon.Namespace, addonWorkNamespace, owner), workbuilder.ExistingManifestWorksOption(existingWorks), workbuilder.ManifestConfigOption(manifestOptions), + workbuilder.ManifestAnnotations(annotations), workbuilder.DeletionOption(deletionOption)) } @@ -492,3 +499,32 @@ func getDeletionOrphaningRule(obj runtime.Object) (*workapiv1.OrphaningRule, err } return rule, nil } + +func configsToAnnotations(configReference []addonapiv1alpha1.ConfigReference) (map[string]string, error) { + if len(configReference) == 0 { + return nil, nil + } + + annotations := make(map[string]string, len(configReference)) + for _, v := range configReference { + if v.DesiredConfig == nil { + continue + } + resourceStr := v.Resource + if len(v.Group) > 0 { + resourceStr += fmt.Sprintf(".%s", v.Group) + } + resourceStr += fmt.Sprintf("/%s/%s", v.DesiredConfig.Namespace, v.DesiredConfig.Name) + + annotations[resourceStr] = v.DesiredConfig.SpecHash + } + + jsonBytes, err := json.Marshal(annotations) + if err != nil { + return nil, err + } + + return map[string]string{ + workapiv1.ManifestConfigSpecHashAnnotationKey: string(jsonBytes), + }, nil +} diff --git a/vendor/modules.txt b/vendor/modules.txt index de55c2307..ca38c4563 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1226,7 +1226,7 @@ k8s.io/utils/path k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# open-cluster-management.io/api v0.10.1-0.20230216050312-b716d4a5c514 +# open-cluster-management.io/api v0.10.1-0.20230216050312-b716d4a5c514 => github.com/haoqing0110/api v0.0.0-20230314030136-5f4cd436ed1a ## explicit; go 1.19 open-cluster-management.io/api/addon/v1alpha1 open-cluster-management.io/api/client/addon/clientset/versioned @@ -1319,3 +1319,4 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.3.0 ## explicit; go 1.12 sigs.k8s.io/yaml +# open-cluster-management.io/api => github.com/haoqing0110/api v0.0.0-20230314030136-5f4cd436ed1a diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml index 6f37446a6..1eb2dfc19 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml @@ -108,6 +108,59 @@ spec: description: Namespace is the namespace of the placement type: string minLength: 1 + rolloutStrategy: + description: The rollout strategy to apply addon configurations change. The rollout strategy only watches the addon configurations defined in ClusterManagementAddOn. + type: object + default: + type: UpdateAll + properties: + rollingUpdate: + description: Rolling update with placement config params. Present only if the type is RollingUpdate. + type: object + properties: + maxConcurrency: + description: 'The maximum concurrently updating number of addons. Value can be an absolute number (ex: 5) or a percentage of desired addons (ex: 10%). Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, once the addon configs change, the addon on 30% of the selected clusters will adopt the new configs. When the addons with new configs are healthy, the addon on the remaining clusters will be further updated.' + default: 25% + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + rollingUpdateWithCanary: + description: Rolling update with placement config params. Present only if the type is RollingUpdateWithCanary. + type: object + required: + - placement + properties: + maxConcurrency: + description: 'The maximum concurrently updating number of addons. Value can be an absolute number (ex: 5) or a percentage of desired addons (ex: 10%). Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, once the addon configs change, the addon on 30% of the selected clusters will adopt the new configs. When the addons with new configs are healthy, the addon on the remaining clusters will be further updated.' + default: 25% + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + placement: + description: Canary placement reference. + type: object + required: + - name + - namespace + properties: + name: + description: Name is the name of the placement + type: string + minLength: 1 + namespace: + description: Namespace is the namespace of the placement + type: string + minLength: 1 + type: + description: "Type is the type of the rollout strategy, it supports UpdateAll, RollingUpdate and RollingUpdateWithCanary: - UpdateAll: when configs change, apply the new configs to all the selected clusters at once. This is the default strategy. - RollingUpdate: when configs change, apply the new configs to all the selected clusters with the concurrence rate defined in MaxConcurrency. - RollingUpdateWithCanary: when configs change, wait and check if add-ons on the canary placement selected clusters have applied the new configs and are healthy, then apply the new configs to all the selected clusters with the concurrence rate defined in MaxConcurrency. \n The field lastKnownGoodConfig in the status record the last successfully applied spec hash of canary placement. If the config spec hash changes after the canary is passed and before the rollout is done, the current rollout will continue, then roll out to the latest change. \n For example, the addon configs have spec hash A. The canary is passed and the lastKnownGoodConfig would be A, and all the selected clusters are rolling out to A. Then the config spec hash changes to B. At this time, the clusters will continue rolling out to A. When the rollout is done and canary passed B, the lastKnownGoodConfig would be B and all the clusters will start rolling out to B. \n The canary placement does not have to be a subset of the install placement, and it is more like a reference for finding and checking canary clusters before upgrading all. To trigger the rollout on the canary clusters, you can define another rollout strategy with the type RollingUpdate, or even manually upgrade the addons on those clusters." + type: string + default: UpdateAll + enum: + - UpdateAll + - RollingUpdate + - RollingUpdateWithCanary x-kubernetes-list-map-keys: - namespace - name @@ -156,6 +209,166 @@ spec: status: description: status represents the current status of cluster management add-on. type: object + properties: + defaultconfigReferences: + description: defaultconfigReferences is a list of current add-on default configuration references. + type: array + items: + description: DefaultConfigReference is a reference to the current add-on configuration. This resource is used to record the configuration resource for the current add-on. + type: object + required: + - resource + properties: + desiredConfig: + description: desiredConfig record the desired config spec hash. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string + group: + description: group of the add-on configuration. + type: string + default: "" + resource: + description: resource of the add-on configuration. + type: string + minLength: 1 + installProgression: + description: installProgression is a list of current add-on configuration references per placement. + type: array + items: + type: object + required: + - name + - namespace + properties: + conditions: + description: conditions describe the state of the managed and monitored components for the operator. + type: array + items: + description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + type: object + required: + - lastTransitionTime + - message + - reason + - status + - type + 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. + type: string + format: date-time + message: + description: message is a human readable message indicating details about the transition. This may be an empty string. + type: string + maxLength: 32768 + 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. + type: integer + format: int64 + minimum: 0 + 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. + type: string + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + status: + description: status of the condition, one of True, False, Unknown. + type: string + enum: + - "True" + - "False" + - Unknown + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + type: string + 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])$ + configReferences: + description: configReferences is a list of current add-on configuration references. + type: array + items: + description: InstallConfigReference is a reference to the current add-on configuration. This resource is used to record the configuration resource for the current add-on. + type: object + required: + - resource + properties: + desiredConfig: + description: desiredConfig record the desired config name and spec hash. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string + group: + description: group of the add-on configuration. + type: string + default: "" + lastAppliedConfig: + description: lastAppliedConfig records the config spec hash when the all the corresponding ManagedClusterAddOn are applied successfully. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string + lastKnownGoodConfig: + description: lastKnownGoodConfig records the last known good config spec hash. For fresh install or rollout with type UpdateAll or RollingUpdate, the lastKnownGoodConfig is the same as lastAppliedConfig. For rollout with type RollingUpdateWithCanary, the lastKnownGoodConfig is the last successfully applied config spec hash of the canary placement. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string + resource: + description: resource of the add-on configuration. + type: string + minLength: 1 + name: + description: Name is the name of the placement + type: string + minLength: 1 + namespace: + description: Namespace is the namespace of the placement + type: string + minLength: 1 served: true storage: true subresources: diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml index 58aa84610..80d9ce92f 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml @@ -154,10 +154,42 @@ spec: - name - resource properties: + desiredConfig: + description: desiredConfig record the desired config spec hash. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string group: description: group of the add-on configuration. type: string default: "" + lastAppliedConfig: + description: lastAppliedConfig record the config spec hash when the corresponding ManifestWork is applied successfully. + type: object + required: + - name + properties: + name: + description: name of the add-on configuration. + type: string + minLength: 1 + namespace: + description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope. + type: string + specHash: + description: spec hash for an add-on configuration. + type: string lastObservedGeneration: description: lastObservedGeneration is the observed generation of the add-on configuration. type: integer diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_clustermanagementaddon.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_clustermanagementaddon.go index 1792f4216..378d87f30 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_clustermanagementaddon.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_clustermanagementaddon.go @@ -2,6 +2,7 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) // +genclient @@ -127,6 +128,15 @@ type ConfigReferent struct { Name string `json:"name"` } +// ConfigSpecHash represents the namespace,name and spec hash for an add-on configuration. +type ConfigSpecHash struct { + // namespace and name for an add-on configuration. + ConfigReferent `json:",inline"` + + // spec hash for an add-on configuration. + SpecHash string `json:"specHash"` +} + // InstallStrategy represents that related ManagedClusterAddOns should be installed // on certain clusters. type InstallStrategy struct { @@ -175,10 +185,146 @@ type PlacementStrategy struct { // User can override the configuration by updating the managedClusterAddon directly. // +optional Configs []AddOnConfig `json:"configs,omitempty"` + // The rollout strategy to apply addon configurations change. + // The rollout strategy only watches the addon configurations defined in ClusterManagementAddOn. + // +kubebuilder:default={type: UpdateAll} + // +optional + RolloutStrategy *RolloutStrategy `json:"rolloutStrategy,omitempty"` +} + +// RolloutStrategy represents the rollout strategy of the add-on configuration. +type RolloutStrategy struct { + // Type is the type of the rollout strategy, it supports UpdateAll, RollingUpdate and RollingUpdateWithCanary: + // - UpdateAll: when configs change, apply the new configs to all the selected clusters at once. + // This is the default strategy. + // - RollingUpdate: when configs change, apply the new configs to all the selected clusters with + // the concurrence rate defined in MaxConcurrency. + // - RollingUpdateWithCanary: when configs change, wait and check if add-ons on the canary placement + // selected clusters have applied the new configs and are healthy, then apply the new configs to + // all the selected clusters with the concurrence rate defined in MaxConcurrency. + // + // The field lastKnownGoodConfig in the status record the last successfully applied + // spec hash of canary placement. If the config spec hash changes after the canary is passed and + // before the rollout is done, the current rollout will continue, then roll out to the latest change. + // + // For example, the addon configs have spec hash A. The canary is passed and the lastKnownGoodConfig + // would be A, and all the selected clusters are rolling out to A. + // Then the config spec hash changes to B. At this time, the clusters will continue rolling out to A. + // When the rollout is done and canary passed B, the lastKnownGoodConfig would be B and + // all the clusters will start rolling out to B. + // + // The canary placement does not have to be a subset of the install placement, and it is more like a + // reference for finding and checking canary clusters before upgrading all. To trigger the rollout + // on the canary clusters, you can define another rollout strategy with the type RollingUpdate, or even + // manually upgrade the addons on those clusters. + // + // +kubebuilder:validation:Enum=UpdateAll;RollingUpdate;RollingUpdateWithCanary + // +kubebuilder:default:=UpdateAll + // +optional + Type string `json:"type"` + + // Rolling update with placement config params. Present only if the type is RollingUpdate. + // +optional + RollingUpdate *RollingUpdate `json:"rollingUpdate,omitempty"` + + // Rolling update with placement config params. Present only if the type is RollingUpdateWithCanary. + // +optional + RollingUpdateWithCanary *RollingUpdateWithCanary `json:"rollingUpdateWithCanary,omitempty"` +} + +const ( + // AddonRolloutStrategyUpdateAll is the addon rollout strategy representing apply the new configs to + // all the selected clusters at once. + AddonRolloutStrategyUpdateAll string = "UpdateAll" + // AddonRolloutStrategyRollingUpdate is the addon rollout strategy representing apply the new configs to + // all the selected clusters with the concurrency rate. + AddonRolloutStrategyRollingUpdate string = "RollingUpdate" + // AddonRolloutStrategyRollingUpdate is the addon rollout strategy representing wait and check + // if add-ons on the canary have applied the new configs, then apply the new configs to + // all the selected clusters with the concurrency rate. + AddonRolloutStrategyRollingUpdateWithCanary string = "RollingUpdateWithCanary" +) + +// RollingUpdate represents the behavior to rolling update add-on configurations +// on the selected clusters. +type RollingUpdate struct { + // The maximum concurrently updating number of addons. + // Value can be an absolute number (ex: 5) or a percentage of desired addons (ex: 10%). + // Absolute number is calculated from percentage by rounding up. + // Defaults to 25%. + // Example: when this is set to 30%, once the addon configs change, the addon on 30% of the selected clusters + // will adopt the new configs. When the addons with new configs are healthy, the addon on the remaining clusters + // will be further updated. + // +kubebuilder:default:="25%" + // +optional + MaxConcurrency *intstr.IntOrString `json:"maxConcurrency,omitempty"` +} + +// RollingUpdateWithCanary represents the canary placement and behavior to rolling update add-on configurations +// on the selected clusters. +type RollingUpdateWithCanary struct { + // Canary placement reference. + // +kubebuilder:validation:Required + // +required + Placement PlacementRef `json:"placement,omitempty"` + + // the behavior to rolling update add-on configurations. + RollingUpdate `json:",inline"` } // ClusterManagementAddOnStatus represents the current status of cluster management add-on. type ClusterManagementAddOnStatus struct { + // defaultconfigReferences is a list of current add-on default configuration references. + // +optional + DefaultConfigReferences []DefaultConfigReference `json:"defaultconfigReferences,omitempty"` + // installProgression is a list of current add-on configuration references per placement. + // +optional + InstallProgression []InstallProgression `json:"installProgression,omitempty"` +} + +type InstallProgression struct { + PlacementRef `json:",inline"` + + // configReferences is a list of current add-on configuration references. + // +optional + ConfigReferences []InstallConfigReference `json:"configReferences,omitempty"` + + // conditions describe the state of the managed and monitored components for the operator. + // +patchMergeKey=type + // +patchStrategy=merge + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` +} + +// DefaultConfigReference is a reference to the current add-on configuration. +// This resource is used to record the configuration resource for the current add-on. +type DefaultConfigReference struct { + // This field is synced from ClusterManagementAddOn Configurations. + ConfigGroupResource `json:",inline"` + + // desiredConfig record the desired config spec hash. + DesiredConfig *ConfigSpecHash `json:"desiredConfig"` +} + +// InstallConfigReference is a reference to the current add-on configuration. +// This resource is used to record the configuration resource for the current add-on. +type InstallConfigReference struct { + // This field is synced from ClusterManagementAddOn Configurations. + ConfigGroupResource `json:",inline"` + + // desiredConfig record the desired config name and spec hash. + DesiredConfig *ConfigSpecHash `json:"desiredConfig"` + + // lastKnownGoodConfig records the last known good config spec hash. + // For fresh install or rollout with type UpdateAll or RollingUpdate, the + // lastKnownGoodConfig is the same as lastAppliedConfig. + // For rollout with type RollingUpdateWithCanary, the lastKnownGoodConfig + // is the last successfully applied config spec hash of the canary placement. + LastKnownGoodConfig *ConfigSpecHash `json:"lastKnownGoodConfig"` + + // lastAppliedConfig records the config spec hash when the all the corresponding + // ManagedClusterAddOn are applied successfully. + LastAppliedConfig *ConfigSpecHash `json:"lastAppliedConfig"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_managedclusteraddon.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_managedclusteraddon.go index d757b8ef6..9cb2ab4d2 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/types_managedclusteraddon.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/types_managedclusteraddon.go @@ -165,6 +165,9 @@ const ( // ManagedClusterAddOnCondtionConfigured represents that the addon agent is configured with its configuration ManagedClusterAddOnCondtionConfigured string = "Configured" + + // ManagedClusterAddOnCondtionProgressing represents that the addon agent is applying configurations. + ManagedClusterAddOnCondtionProgressing string = "Progressing" ) // ObjectReference contains enough information to let you inspect or modify the referred object. @@ -199,6 +202,14 @@ type ConfigReference struct { // lastObservedGeneration is the observed generation of the add-on configuration. LastObservedGeneration int64 `json:"lastObservedGeneration"` + + // desiredConfig record the desired config spec hash. + // +optional + DesiredConfig *ConfigSpecHash `json:"desiredConfig"` + + // lastAppliedConfig record the config spec hash when the corresponding ManifestWork is applied successfully. + // +optional + LastAppliedConfig *ConfigSpecHash `json:"lastAppliedConfig"` } // HealthCheckMode indicates the mode for the addon to check its healthiness status diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go index aad8da4ba..c8475850c 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.deepcopy.go @@ -9,6 +9,7 @@ import ( corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + intstr "k8s.io/apimachinery/pkg/util/intstr" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -137,7 +138,7 @@ func (in *ClusterManagementAddOn) DeepCopyInto(out *ClusterManagementAddOn) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + in.Status.DeepCopyInto(&out.Status) return } @@ -225,6 +226,20 @@ func (in *ClusterManagementAddOnSpec) DeepCopy() *ClusterManagementAddOnSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterManagementAddOnStatus) DeepCopyInto(out *ClusterManagementAddOnStatus) { *out = *in + if in.DefaultConfigReferences != nil { + in, out := &in.DefaultConfigReferences, &out.DefaultConfigReferences + *out = make([]DefaultConfigReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.InstallProgression != nil { + in, out := &in.InstallProgression, &out.InstallProgression + *out = make([]InstallProgression, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -297,6 +312,16 @@ func (in *ConfigReference) DeepCopyInto(out *ConfigReference) { *out = *in out.ConfigGroupResource = in.ConfigGroupResource out.ConfigReferent = in.ConfigReferent + if in.DesiredConfig != nil { + in, out := &in.DesiredConfig, &out.DesiredConfig + *out = new(ConfigSpecHash) + **out = **in + } + if in.LastAppliedConfig != nil { + in, out := &in.LastAppliedConfig, &out.LastAppliedConfig + *out = new(ConfigSpecHash) + **out = **in + } return } @@ -326,6 +351,23 @@ func (in *ConfigReferent) DeepCopy() *ConfigReferent { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ConfigSpecHash) DeepCopyInto(out *ConfigSpecHash) { + *out = *in + out.ConfigReferent = in.ConfigReferent + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigSpecHash. +func (in *ConfigSpecHash) DeepCopy() *ConfigSpecHash { + if in == nil { + return nil + } + out := new(ConfigSpecHash) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CustomizedVariable) DeepCopyInto(out *CustomizedVariable) { *out = *in @@ -342,6 +384,28 @@ func (in *CustomizedVariable) DeepCopy() *CustomizedVariable { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DefaultConfigReference) DeepCopyInto(out *DefaultConfigReference) { + *out = *in + out.ConfigGroupResource = in.ConfigGroupResource + if in.DesiredConfig != nil { + in, out := &in.DesiredConfig, &out.DesiredConfig + *out = new(ConfigSpecHash) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DefaultConfigReference. +func (in *DefaultConfigReference) DeepCopy() *DefaultConfigReference { + if in == nil { + return nil + } + out := new(DefaultConfigReference) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HealthCheck) DeepCopyInto(out *HealthCheck) { *out = *in @@ -358,6 +422,69 @@ func (in *HealthCheck) DeepCopy() *HealthCheck { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallConfigReference) DeepCopyInto(out *InstallConfigReference) { + *out = *in + out.ConfigGroupResource = in.ConfigGroupResource + if in.DesiredConfig != nil { + in, out := &in.DesiredConfig, &out.DesiredConfig + *out = new(ConfigSpecHash) + **out = **in + } + if in.LastKnownGoodConfig != nil { + in, out := &in.LastKnownGoodConfig, &out.LastKnownGoodConfig + *out = new(ConfigSpecHash) + **out = **in + } + if in.LastAppliedConfig != nil { + in, out := &in.LastAppliedConfig, &out.LastAppliedConfig + *out = new(ConfigSpecHash) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallConfigReference. +func (in *InstallConfigReference) DeepCopy() *InstallConfigReference { + if in == nil { + return nil + } + out := new(InstallConfigReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstallProgression) DeepCopyInto(out *InstallProgression) { + *out = *in + out.PlacementRef = in.PlacementRef + if in.ConfigReferences != nil { + in, out := &in.ConfigReferences, &out.ConfigReferences + *out = make([]InstallConfigReference, 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]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstallProgression. +func (in *InstallProgression) DeepCopy() *InstallProgression { + if in == nil { + return nil + } + out := new(InstallProgression) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InstallStrategy) DeepCopyInto(out *InstallStrategy) { *out = *in @@ -488,7 +615,9 @@ func (in *ManagedClusterAddOnStatus) DeepCopyInto(out *ManagedClusterAddOnStatus if in.ConfigReferences != nil { in, out := &in.ConfigReferences, &out.ConfigReferences *out = make([]ConfigReference, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Registrations != nil { in, out := &in.Registrations, &out.Registrations @@ -582,6 +711,11 @@ func (in *PlacementStrategy) DeepCopyInto(out *PlacementStrategy) { *out = make([]AddOnConfig, len(*in)) copy(*out, *in) } + if in.RolloutStrategy != nil { + in, out := &in.RolloutStrategy, &out.RolloutStrategy + *out = new(RolloutStrategy) + (*in).DeepCopyInto(*out) + } return } @@ -612,6 +746,71 @@ func (in *RegistrationConfig) DeepCopy() *RegistrationConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RollingUpdate) DeepCopyInto(out *RollingUpdate) { + *out = *in + if in.MaxConcurrency != nil { + in, out := &in.MaxConcurrency, &out.MaxConcurrency + *out = new(intstr.IntOrString) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdate. +func (in *RollingUpdate) DeepCopy() *RollingUpdate { + if in == nil { + return nil + } + out := new(RollingUpdate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RollingUpdateWithCanary) DeepCopyInto(out *RollingUpdateWithCanary) { + *out = *in + out.Placement = in.Placement + in.RollingUpdate.DeepCopyInto(&out.RollingUpdate) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdateWithCanary. +func (in *RollingUpdateWithCanary) DeepCopy() *RollingUpdateWithCanary { + if in == nil { + return nil + } + out := new(RollingUpdateWithCanary) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RolloutStrategy) DeepCopyInto(out *RolloutStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + *out = new(RollingUpdate) + (*in).DeepCopyInto(*out) + } + if in.RollingUpdateWithCanary != nil { + in, out := &in.RollingUpdateWithCanary, &out.RollingUpdateWithCanary + *out = new(RollingUpdateWithCanary) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RolloutStrategy. +func (in *RolloutStrategy) DeepCopy() *RolloutStrategy { + if in == nil { + return nil + } + out := new(RolloutStrategy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subject) DeepCopyInto(out *Subject) { *out = *in diff --git a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go index d34cd1673..be4b57483 100644 --- a/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/addon/v1alpha1/zz_generated.swagger_doc_generated.go @@ -102,7 +102,9 @@ func (ClusterManagementAddOnSpec) SwaggerDoc() map[string]string { } var map_ClusterManagementAddOnStatus = map[string]string{ - "": "ClusterManagementAddOnStatus represents the current status of cluster management add-on.", + "": "ClusterManagementAddOnStatus represents the current status of cluster management add-on.", + "defaultconfigReferences": "defaultconfigReferences is a list of current add-on default configuration references.", + "installProgression": "installProgression is a list of current add-on configuration references per placement.", } func (ClusterManagementAddOnStatus) SwaggerDoc() map[string]string { @@ -149,6 +151,44 @@ func (ConfigReferent) SwaggerDoc() map[string]string { return map_ConfigReferent } +var map_ConfigSpecHash = map[string]string{ + "": "ConfigSpecHash represents the namespace,name and spec hash for an add-on configuration.", + "specHash": "spec hash for an add-on configuration.", +} + +func (ConfigSpecHash) SwaggerDoc() map[string]string { + return map_ConfigSpecHash +} + +var map_DefaultConfigReference = map[string]string{ + "": "DefaultConfigReference is a reference to the current add-on configuration. This resource is used to record the configuration resource for the current add-on.", + "desiredConfig": "desiredConfig record the desired config spec hash.", +} + +func (DefaultConfigReference) SwaggerDoc() map[string]string { + return map_DefaultConfigReference +} + +var map_InstallConfigReference = map[string]string{ + "": "InstallConfigReference is a reference to the current add-on configuration. This resource is used to record the configuration resource for the current add-on.", + "desiredConfig": "desiredConfig record the desired config name and spec hash.", + "lastKnownGoodConfig": "lastKnownGoodConfig records the last known good config spec hash. For fresh install or rollout with type UpdateAll or RollingUpdate, the lastKnownGoodConfig is the same as lastAppliedConfig. For rollout with type RollingUpdateWithCanary, the lastKnownGoodConfig is the last successfully applied config spec hash of the canary placement.", + "lastAppliedConfig": "lastAppliedConfig records the config spec hash when the all the corresponding ManagedClusterAddOn are applied successfully.", +} + +func (InstallConfigReference) SwaggerDoc() map[string]string { + return map_InstallConfigReference +} + +var map_InstallProgression = map[string]string{ + "configReferences": "configReferences is a list of current add-on configuration references.", + "conditions": "conditions describe the state of the managed and monitored components for the operator.", +} + +func (InstallProgression) SwaggerDoc() map[string]string { + return map_InstallProgression +} + var map_InstallStrategy = map[string]string{ "": "InstallStrategy represents that related ManagedClusterAddOns should be installed on certain clusters.", "type": "Type is the type of the install strategy, it can be: - Manual: no automatic install - Placements: install to clusters selected by placements.", @@ -169,16 +209,48 @@ func (PlacementRef) SwaggerDoc() map[string]string { } var map_PlacementStrategy = map[string]string{ - "configs": "Configs is the configuration of managedClusterAddon during installation. User can override the configuration by updating the managedClusterAddon directly.", + "configs": "Configs is the configuration of managedClusterAddon during installation. User can override the configuration by updating the managedClusterAddon directly.", + "rolloutStrategy": "The rollout strategy to apply addon configurations change. The rollout strategy only watches the addon configurations defined in ClusterManagementAddOn.", } func (PlacementStrategy) SwaggerDoc() map[string]string { return map_PlacementStrategy } +var map_RollingUpdate = map[string]string{ + "": "RollingUpdate represents the behavior to rolling update add-on configurations on the selected clusters.", + "maxConcurrency": "The maximum concurrently updating number of addons. Value can be an absolute number (ex: 5) or a percentage of desired addons (ex: 10%). Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, once the addon configs change, the addon on 30% of the selected clusters will adopt the new configs. When the addons with new configs are healthy, the addon on the remaining clusters will be further updated.", +} + +func (RollingUpdate) SwaggerDoc() map[string]string { + return map_RollingUpdate +} + +var map_RollingUpdateWithCanary = map[string]string{ + "": "RollingUpdateWithCanary represents the canary placement and behavior to rolling update add-on configurations on the selected clusters.", + "placement": "Canary placement reference.", +} + +func (RollingUpdateWithCanary) SwaggerDoc() map[string]string { + return map_RollingUpdateWithCanary +} + +var map_RolloutStrategy = map[string]string{ + "": "RolloutStrategy represents the rollout strategy of the add-on configuration.", + "type": "Type is the type of the rollout strategy, it supports UpdateAll, RollingUpdate and RollingUpdateWithCanary: - UpdateAll: when configs change, apply the new configs to all the selected clusters at once.\n This is the default strategy.\n- RollingUpdate: when configs change, apply the new configs to all the selected clusters with\n the concurrence rate defined in MaxConcurrency.\n- RollingUpdateWithCanary: when configs change, wait and check if add-ons on the canary placement\n selected clusters have applied the new configs and are healthy, then apply the new configs to\n all the selected clusters with the concurrence rate defined in MaxConcurrency.\n\n The field lastKnownGoodConfig in the status record the last successfully applied\n spec hash of canary placement. If the config spec hash changes after the canary is passed and\n before the rollout is done, the current rollout will continue, then roll out to the latest change.\n\n For example, the addon configs have spec hash A. The canary is passed and the lastKnownGoodConfig\n would be A, and all the selected clusters are rolling out to A.\n Then the config spec hash changes to B. At this time, the clusters will continue rolling out to A.\n When the rollout is done and canary passed B, the lastKnownGoodConfig would be B and\n all the clusters will start rolling out to B.\n\n The canary placement does not have to be a subset of the install placement, and it is more like a\n reference for finding and checking canary clusters before upgrading all. To trigger the rollout\n on the canary clusters, you can define another rollout strategy with the type RollingUpdate, or even\n manually upgrade the addons on those clusters.", + "rollingUpdate": "Rolling update with placement config params. Present only if the type is RollingUpdate.", + "rollingUpdateWithCanary": "Rolling update with placement config params. Present only if the type is RollingUpdateWithCanary.", +} + +func (RolloutStrategy) SwaggerDoc() map[string]string { + return map_RolloutStrategy +} + var map_ConfigReference = map[string]string{ "": "ConfigReference is a reference to the current add-on configuration. This resource is used to locate the configuration resource for the current add-on.", "lastObservedGeneration": "lastObservedGeneration is the observed generation of the add-on configuration.", + "desiredConfig": "desiredConfig record the desired config spec hash.", + "lastAppliedConfig": "lastAppliedConfig record the config spec hash when the corresponding ManifestWork is applied successfully.", } func (ConfigReference) SwaggerDoc() map[string]string { diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_manifestworkreplicaset.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_manifestworkreplicaset.go new file mode 100644 index 000000000..a58142312 --- /dev/null +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_manifestworkreplicaset.go @@ -0,0 +1,126 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "open-cluster-management.io/api/work/v1alpha1" +) + +// FakeManifestWorkReplicaSets implements ManifestWorkReplicaSetInterface +type FakeManifestWorkReplicaSets struct { + Fake *FakeWorkV1alpha1 + ns string +} + +var manifestworkreplicasetsResource = schema.GroupVersionResource{Group: "work.open-cluster-management.io", Version: "v1alpha1", Resource: "manifestworkreplicasets"} + +var manifestworkreplicasetsKind = schema.GroupVersionKind{Group: "work.open-cluster-management.io", Version: "v1alpha1", Kind: "ManifestWorkReplicaSet"} + +// Get takes name of the manifestWorkReplicaSet, and returns the corresponding manifestWorkReplicaSet object, and an error if there is any. +func (c *FakeManifestWorkReplicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(manifestworkreplicasetsResource, c.ns, name), &v1alpha1.ManifestWorkReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), err +} + +// List takes label and field selectors, and returns the list of ManifestWorkReplicaSets that match those selectors. +func (c *FakeManifestWorkReplicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ManifestWorkReplicaSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(manifestworkreplicasetsResource, manifestworkreplicasetsKind, c.ns, opts), &v1alpha1.ManifestWorkReplicaSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ManifestWorkReplicaSetList{ListMeta: obj.(*v1alpha1.ManifestWorkReplicaSetList).ListMeta} + for _, item := range obj.(*v1alpha1.ManifestWorkReplicaSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested manifestWorkReplicaSets. +func (c *FakeManifestWorkReplicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(manifestworkreplicasetsResource, c.ns, opts)) + +} + +// Create takes the representation of a manifestWorkReplicaSet and creates it. Returns the server's representation of the manifestWorkReplicaSet, and an error, if there is any. +func (c *FakeManifestWorkReplicaSets) Create(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.CreateOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(manifestworkreplicasetsResource, c.ns, manifestWorkReplicaSet), &v1alpha1.ManifestWorkReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), err +} + +// Update takes the representation of a manifestWorkReplicaSet and updates it. Returns the server's representation of the manifestWorkReplicaSet, and an error, if there is any. +func (c *FakeManifestWorkReplicaSets) Update(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(manifestworkreplicasetsResource, c.ns, manifestWorkReplicaSet), &v1alpha1.ManifestWorkReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeManifestWorkReplicaSets) UpdateStatus(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (*v1alpha1.ManifestWorkReplicaSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(manifestworkreplicasetsResource, "status", c.ns, manifestWorkReplicaSet), &v1alpha1.ManifestWorkReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), err +} + +// Delete takes name of the manifestWorkReplicaSet and deletes it. Returns an error if one occurs. +func (c *FakeManifestWorkReplicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(manifestworkreplicasetsResource, c.ns, name, opts), &v1alpha1.ManifestWorkReplicaSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeManifestWorkReplicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(manifestworkreplicasetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ManifestWorkReplicaSetList{}) + return err +} + +// Patch applies the patch and returns the patched manifestWorkReplicaSet. +func (c *FakeManifestWorkReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(manifestworkreplicasetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ManifestWorkReplicaSet{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), err +} diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_placemanifestwork.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_placemanifestwork.go deleted file mode 100644 index 4df72fb6b..000000000 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_placemanifestwork.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" - v1alpha1 "open-cluster-management.io/api/work/v1alpha1" -) - -// FakePlaceManifestWorks implements PlaceManifestWorkInterface -type FakePlaceManifestWorks struct { - Fake *FakeWorkV1alpha1 - ns string -} - -var placemanifestworksResource = schema.GroupVersionResource{Group: "work.open-cluster-management.io", Version: "v1alpha1", Resource: "placemanifestworks"} - -var placemanifestworksKind = schema.GroupVersionKind{Group: "work.open-cluster-management.io", Version: "v1alpha1", Kind: "PlaceManifestWork"} - -// Get takes name of the placeManifestWork, and returns the corresponding placeManifestWork object, and an error if there is any. -func (c *FakePlaceManifestWorks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PlaceManifestWork, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(placemanifestworksResource, c.ns, name), &v1alpha1.PlaceManifestWork{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PlaceManifestWork), err -} - -// List takes label and field selectors, and returns the list of PlaceManifestWorks that match those selectors. -func (c *FakePlaceManifestWorks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PlaceManifestWorkList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(placemanifestworksResource, placemanifestworksKind, c.ns, opts), &v1alpha1.PlaceManifestWorkList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.PlaceManifestWorkList{ListMeta: obj.(*v1alpha1.PlaceManifestWorkList).ListMeta} - for _, item := range obj.(*v1alpha1.PlaceManifestWorkList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested placeManifestWorks. -func (c *FakePlaceManifestWorks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(placemanifestworksResource, c.ns, opts)) - -} - -// Create takes the representation of a placeManifestWork and creates it. Returns the server's representation of the placeManifestWork, and an error, if there is any. -func (c *FakePlaceManifestWorks) Create(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.CreateOptions) (result *v1alpha1.PlaceManifestWork, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(placemanifestworksResource, c.ns, placeManifestWork), &v1alpha1.PlaceManifestWork{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PlaceManifestWork), err -} - -// Update takes the representation of a placeManifestWork and updates it. Returns the server's representation of the placeManifestWork, and an error, if there is any. -func (c *FakePlaceManifestWorks) Update(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (result *v1alpha1.PlaceManifestWork, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(placemanifestworksResource, c.ns, placeManifestWork), &v1alpha1.PlaceManifestWork{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PlaceManifestWork), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePlaceManifestWorks) UpdateStatus(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (*v1alpha1.PlaceManifestWork, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(placemanifestworksResource, "status", c.ns, placeManifestWork), &v1alpha1.PlaceManifestWork{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PlaceManifestWork), err -} - -// Delete takes name of the placeManifestWork and deletes it. Returns an error if one occurs. -func (c *FakePlaceManifestWorks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(placemanifestworksResource, c.ns, name, opts), &v1alpha1.PlaceManifestWork{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakePlaceManifestWorks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(placemanifestworksResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.PlaceManifestWorkList{}) - return err -} - -// Patch applies the patch and returns the patched placeManifestWork. -func (c *FakePlaceManifestWorks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PlaceManifestWork, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(placemanifestworksResource, c.ns, name, pt, data, subresources...), &v1alpha1.PlaceManifestWork{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.PlaceManifestWork), err -} diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_work_client.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_work_client.go index a31b1c8b7..96a067e84 100644 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_work_client.go +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/fake/fake_work_client.go @@ -12,8 +12,8 @@ type FakeWorkV1alpha1 struct { *testing.Fake } -func (c *FakeWorkV1alpha1) PlaceManifestWorks(namespace string) v1alpha1.PlaceManifestWorkInterface { - return &FakePlaceManifestWorks{c, namespace} +func (c *FakeWorkV1alpha1) ManifestWorkReplicaSets(namespace string) v1alpha1.ManifestWorkReplicaSetInterface { + return &FakeManifestWorkReplicaSets{c, namespace} } // RESTClient returns a RESTClient that is used to communicate diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/generated_expansion.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/generated_expansion.go index ce26c8afa..2d68b77b6 100644 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/generated_expansion.go +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/generated_expansion.go @@ -2,4 +2,4 @@ package v1alpha1 -type PlaceManifestWorkExpansion interface{} +type ManifestWorkReplicaSetExpansion interface{} diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/manifestworkreplicaset.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/manifestworkreplicaset.go new file mode 100644 index 000000000..cbed3401f --- /dev/null +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/manifestworkreplicaset.go @@ -0,0 +1,179 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + scheme "open-cluster-management.io/api/client/work/clientset/versioned/scheme" + v1alpha1 "open-cluster-management.io/api/work/v1alpha1" +) + +// ManifestWorkReplicaSetsGetter has a method to return a ManifestWorkReplicaSetInterface. +// A group's client should implement this interface. +type ManifestWorkReplicaSetsGetter interface { + ManifestWorkReplicaSets(namespace string) ManifestWorkReplicaSetInterface +} + +// ManifestWorkReplicaSetInterface has methods to work with ManifestWorkReplicaSet resources. +type ManifestWorkReplicaSetInterface interface { + Create(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.CreateOptions) (*v1alpha1.ManifestWorkReplicaSet, error) + Update(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (*v1alpha1.ManifestWorkReplicaSet, error) + UpdateStatus(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (*v1alpha1.ManifestWorkReplicaSet, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ManifestWorkReplicaSet, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ManifestWorkReplicaSetList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ManifestWorkReplicaSet, err error) + ManifestWorkReplicaSetExpansion +} + +// manifestWorkReplicaSets implements ManifestWorkReplicaSetInterface +type manifestWorkReplicaSets struct { + client rest.Interface + ns string +} + +// newManifestWorkReplicaSets returns a ManifestWorkReplicaSets +func newManifestWorkReplicaSets(c *WorkV1alpha1Client, namespace string) *manifestWorkReplicaSets { + return &manifestWorkReplicaSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the manifestWorkReplicaSet, and returns the corresponding manifestWorkReplicaSet object, and an error if there is any. +func (c *manifestWorkReplicaSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + result = &v1alpha1.ManifestWorkReplicaSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ManifestWorkReplicaSets that match those selectors. +func (c *manifestWorkReplicaSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ManifestWorkReplicaSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ManifestWorkReplicaSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested manifestWorkReplicaSets. +func (c *manifestWorkReplicaSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a manifestWorkReplicaSet and creates it. Returns the server's representation of the manifestWorkReplicaSet, and an error, if there is any. +func (c *manifestWorkReplicaSets) Create(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.CreateOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + result = &v1alpha1.ManifestWorkReplicaSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(manifestWorkReplicaSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a manifestWorkReplicaSet and updates it. Returns the server's representation of the manifestWorkReplicaSet, and an error, if there is any. +func (c *manifestWorkReplicaSets) Update(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + result = &v1alpha1.ManifestWorkReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + Name(manifestWorkReplicaSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(manifestWorkReplicaSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *manifestWorkReplicaSets) UpdateStatus(ctx context.Context, manifestWorkReplicaSet *v1alpha1.ManifestWorkReplicaSet, opts v1.UpdateOptions) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + result = &v1alpha1.ManifestWorkReplicaSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + Name(manifestWorkReplicaSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(manifestWorkReplicaSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the manifestWorkReplicaSet and deletes it. Returns an error if one occurs. +func (c *manifestWorkReplicaSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *manifestWorkReplicaSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched manifestWorkReplicaSet. +func (c *manifestWorkReplicaSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ManifestWorkReplicaSet, err error) { + result = &v1alpha1.ManifestWorkReplicaSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("manifestworkreplicasets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/placemanifestwork.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/placemanifestwork.go deleted file mode 100644 index 1d9501b2d..000000000 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/placemanifestwork.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" - scheme "open-cluster-management.io/api/client/work/clientset/versioned/scheme" - v1alpha1 "open-cluster-management.io/api/work/v1alpha1" -) - -// PlaceManifestWorksGetter has a method to return a PlaceManifestWorkInterface. -// A group's client should implement this interface. -type PlaceManifestWorksGetter interface { - PlaceManifestWorks(namespace string) PlaceManifestWorkInterface -} - -// PlaceManifestWorkInterface has methods to work with PlaceManifestWork resources. -type PlaceManifestWorkInterface interface { - Create(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.CreateOptions) (*v1alpha1.PlaceManifestWork, error) - Update(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (*v1alpha1.PlaceManifestWork, error) - UpdateStatus(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (*v1alpha1.PlaceManifestWork, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PlaceManifestWork, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PlaceManifestWorkList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PlaceManifestWork, err error) - PlaceManifestWorkExpansion -} - -// placeManifestWorks implements PlaceManifestWorkInterface -type placeManifestWorks struct { - client rest.Interface - ns string -} - -// newPlaceManifestWorks returns a PlaceManifestWorks -func newPlaceManifestWorks(c *WorkV1alpha1Client, namespace string) *placeManifestWorks { - return &placeManifestWorks{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the placeManifestWork, and returns the corresponding placeManifestWork object, and an error if there is any. -func (c *placeManifestWorks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PlaceManifestWork, err error) { - result = &v1alpha1.PlaceManifestWork{} - err = c.client.Get(). - Namespace(c.ns). - Resource("placemanifestworks"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of PlaceManifestWorks that match those selectors. -func (c *placeManifestWorks) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PlaceManifestWorkList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.PlaceManifestWorkList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("placemanifestworks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested placeManifestWorks. -func (c *placeManifestWorks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("placemanifestworks"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a placeManifestWork and creates it. Returns the server's representation of the placeManifestWork, and an error, if there is any. -func (c *placeManifestWorks) Create(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.CreateOptions) (result *v1alpha1.PlaceManifestWork, err error) { - result = &v1alpha1.PlaceManifestWork{} - err = c.client.Post(). - Namespace(c.ns). - Resource("placemanifestworks"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(placeManifestWork). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a placeManifestWork and updates it. Returns the server's representation of the placeManifestWork, and an error, if there is any. -func (c *placeManifestWorks) Update(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (result *v1alpha1.PlaceManifestWork, err error) { - result = &v1alpha1.PlaceManifestWork{} - err = c.client.Put(). - Namespace(c.ns). - Resource("placemanifestworks"). - Name(placeManifestWork.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(placeManifestWork). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *placeManifestWorks) UpdateStatus(ctx context.Context, placeManifestWork *v1alpha1.PlaceManifestWork, opts v1.UpdateOptions) (result *v1alpha1.PlaceManifestWork, err error) { - result = &v1alpha1.PlaceManifestWork{} - err = c.client.Put(). - Namespace(c.ns). - Resource("placemanifestworks"). - Name(placeManifestWork.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(placeManifestWork). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the placeManifestWork and deletes it. Returns an error if one occurs. -func (c *placeManifestWorks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("placemanifestworks"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *placeManifestWorks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("placemanifestworks"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched placeManifestWork. -func (c *placeManifestWorks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PlaceManifestWork, err error) { - result = &v1alpha1.PlaceManifestWork{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("placemanifestworks"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/work_client.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/work_client.go index 31b7c7779..e40a02a22 100644 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/work_client.go +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1alpha1/work_client.go @@ -12,7 +12,7 @@ import ( type WorkV1alpha1Interface interface { RESTClient() rest.Interface - PlaceManifestWorksGetter + ManifestWorkReplicaSetsGetter } // WorkV1alpha1Client is used to interact with features provided by the work.open-cluster-management.io group. @@ -20,8 +20,8 @@ type WorkV1alpha1Client struct { restClient rest.Interface } -func (c *WorkV1alpha1Client) PlaceManifestWorks(namespace string) PlaceManifestWorkInterface { - return newPlaceManifestWorks(c, namespace) +func (c *WorkV1alpha1Client) ManifestWorkReplicaSets(namespace string) ManifestWorkReplicaSetInterface { + return newManifestWorkReplicaSets(c, namespace) } // NewForConfig creates a new WorkV1alpha1Client for the given config. diff --git a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/generic.go b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/generic.go index dac57bc71..4bdfcab70 100644 --- a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/generic.go +++ b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/generic.go @@ -44,8 +44,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1().ManifestWorks().Informer()}, nil // Group=work.open-cluster-management.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("placemanifestworks"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1alpha1().PlaceManifestWorks().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("manifestworkreplicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Work().V1alpha1().ManifestWorkReplicaSets().Informer()}, nil } diff --git a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/interface.go b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/interface.go index 92ef97e7a..e53e70803 100644 --- a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/interface.go +++ b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/interface.go @@ -8,8 +8,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // PlaceManifestWorks returns a PlaceManifestWorkInformer. - PlaceManifestWorks() PlaceManifestWorkInformer + // ManifestWorkReplicaSets returns a ManifestWorkReplicaSetInformer. + ManifestWorkReplicaSets() ManifestWorkReplicaSetInformer } type version struct { @@ -23,7 +23,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PlaceManifestWorks returns a PlaceManifestWorkInformer. -func (v *version) PlaceManifestWorks() PlaceManifestWorkInformer { - return &placeManifestWorkInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +// ManifestWorkReplicaSets returns a ManifestWorkReplicaSetInformer. +func (v *version) ManifestWorkReplicaSets() ManifestWorkReplicaSetInformer { + return &manifestWorkReplicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/manifestworkreplicaset.go b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/manifestworkreplicaset.go new file mode 100644 index 000000000..65cb3c822 --- /dev/null +++ b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/manifestworkreplicaset.go @@ -0,0 +1,74 @@ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + versioned "open-cluster-management.io/api/client/work/clientset/versioned" + internalinterfaces "open-cluster-management.io/api/client/work/informers/externalversions/internalinterfaces" + v1alpha1 "open-cluster-management.io/api/client/work/listers/work/v1alpha1" + workv1alpha1 "open-cluster-management.io/api/work/v1alpha1" +) + +// ManifestWorkReplicaSetInformer provides access to a shared informer and lister for +// ManifestWorkReplicaSets. +type ManifestWorkReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ManifestWorkReplicaSetLister +} + +type manifestWorkReplicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewManifestWorkReplicaSetInformer constructs a new informer for ManifestWorkReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewManifestWorkReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredManifestWorkReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredManifestWorkReplicaSetInformer constructs a new informer for ManifestWorkReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredManifestWorkReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &workv1alpha1.ManifestWorkReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *manifestWorkReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredManifestWorkReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *manifestWorkReplicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&workv1alpha1.ManifestWorkReplicaSet{}, f.defaultInformer) +} + +func (f *manifestWorkReplicaSetInformer) Lister() v1alpha1.ManifestWorkReplicaSetLister { + return v1alpha1.NewManifestWorkReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/placemanifestwork.go b/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/placemanifestwork.go deleted file mode 100644 index 52bb6c238..000000000 --- a/vendor/open-cluster-management.io/api/client/work/informers/externalversions/work/v1alpha1/placemanifestwork.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" - versioned "open-cluster-management.io/api/client/work/clientset/versioned" - internalinterfaces "open-cluster-management.io/api/client/work/informers/externalversions/internalinterfaces" - v1alpha1 "open-cluster-management.io/api/client/work/listers/work/v1alpha1" - workv1alpha1 "open-cluster-management.io/api/work/v1alpha1" -) - -// PlaceManifestWorkInformer provides access to a shared informer and lister for -// PlaceManifestWorks. -type PlaceManifestWorkInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.PlaceManifestWorkLister -} - -type placeManifestWorkInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewPlaceManifestWorkInformer constructs a new informer for PlaceManifestWork type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPlaceManifestWorkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPlaceManifestWorkInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredPlaceManifestWorkInformer constructs a new informer for PlaceManifestWork type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPlaceManifestWorkInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.WorkV1alpha1().PlaceManifestWorks(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.WorkV1alpha1().PlaceManifestWorks(namespace).Watch(context.TODO(), options) - }, - }, - &workv1alpha1.PlaceManifestWork{}, - resyncPeriod, - indexers, - ) -} - -func (f *placeManifestWorkInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPlaceManifestWorkInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *placeManifestWorkInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&workv1alpha1.PlaceManifestWork{}, f.defaultInformer) -} - -func (f *placeManifestWorkInformer) Lister() v1alpha1.PlaceManifestWorkLister { - return v1alpha1.NewPlaceManifestWorkLister(f.Informer().GetIndexer()) -} diff --git a/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/expansion_generated.go b/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/expansion_generated.go index 9424912ec..c58c7915f 100644 --- a/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/expansion_generated.go +++ b/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/expansion_generated.go @@ -2,10 +2,10 @@ package v1alpha1 -// PlaceManifestWorkListerExpansion allows custom methods to be added to -// PlaceManifestWorkLister. -type PlaceManifestWorkListerExpansion interface{} +// ManifestWorkReplicaSetListerExpansion allows custom methods to be added to +// ManifestWorkReplicaSetLister. +type ManifestWorkReplicaSetListerExpansion interface{} -// PlaceManifestWorkNamespaceListerExpansion allows custom methods to be added to -// PlaceManifestWorkNamespaceLister. -type PlaceManifestWorkNamespaceListerExpansion interface{} +// ManifestWorkReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ManifestWorkReplicaSetNamespaceLister. +type ManifestWorkReplicaSetNamespaceListerExpansion interface{} diff --git a/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/manifestworkreplicaset.go b/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/manifestworkreplicaset.go new file mode 100644 index 000000000..96c6694ce --- /dev/null +++ b/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/manifestworkreplicaset.go @@ -0,0 +1,83 @@ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "open-cluster-management.io/api/work/v1alpha1" +) + +// ManifestWorkReplicaSetLister helps list ManifestWorkReplicaSets. +// All objects returned here must be treated as read-only. +type ManifestWorkReplicaSetLister interface { + // List lists all ManifestWorkReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ManifestWorkReplicaSet, err error) + // ManifestWorkReplicaSets returns an object that can list and get ManifestWorkReplicaSets. + ManifestWorkReplicaSets(namespace string) ManifestWorkReplicaSetNamespaceLister + ManifestWorkReplicaSetListerExpansion +} + +// manifestWorkReplicaSetLister implements the ManifestWorkReplicaSetLister interface. +type manifestWorkReplicaSetLister struct { + indexer cache.Indexer +} + +// NewManifestWorkReplicaSetLister returns a new ManifestWorkReplicaSetLister. +func NewManifestWorkReplicaSetLister(indexer cache.Indexer) ManifestWorkReplicaSetLister { + return &manifestWorkReplicaSetLister{indexer: indexer} +} + +// List lists all ManifestWorkReplicaSets in the indexer. +func (s *manifestWorkReplicaSetLister) List(selector labels.Selector) (ret []*v1alpha1.ManifestWorkReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ManifestWorkReplicaSet)) + }) + return ret, err +} + +// ManifestWorkReplicaSets returns an object that can list and get ManifestWorkReplicaSets. +func (s *manifestWorkReplicaSetLister) ManifestWorkReplicaSets(namespace string) ManifestWorkReplicaSetNamespaceLister { + return manifestWorkReplicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ManifestWorkReplicaSetNamespaceLister helps list and get ManifestWorkReplicaSets. +// All objects returned here must be treated as read-only. +type ManifestWorkReplicaSetNamespaceLister interface { + // List lists all ManifestWorkReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ManifestWorkReplicaSet, err error) + // Get retrieves the ManifestWorkReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ManifestWorkReplicaSet, error) + ManifestWorkReplicaSetNamespaceListerExpansion +} + +// manifestWorkReplicaSetNamespaceLister implements the ManifestWorkReplicaSetNamespaceLister +// interface. +type manifestWorkReplicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ManifestWorkReplicaSets in the indexer for a given namespace. +func (s manifestWorkReplicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ManifestWorkReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ManifestWorkReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ManifestWorkReplicaSet from the indexer for a given namespace and name. +func (s manifestWorkReplicaSetNamespaceLister) Get(name string) (*v1alpha1.ManifestWorkReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("manifestworkreplicaset"), name) + } + return obj.(*v1alpha1.ManifestWorkReplicaSet), nil +} diff --git a/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/placemanifestwork.go b/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/placemanifestwork.go deleted file mode 100644 index af5a3075e..000000000 --- a/vendor/open-cluster-management.io/api/client/work/listers/work/v1alpha1/placemanifestwork.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" - v1alpha1 "open-cluster-management.io/api/work/v1alpha1" -) - -// PlaceManifestWorkLister helps list PlaceManifestWorks. -// All objects returned here must be treated as read-only. -type PlaceManifestWorkLister interface { - // List lists all PlaceManifestWorks in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.PlaceManifestWork, err error) - // PlaceManifestWorks returns an object that can list and get PlaceManifestWorks. - PlaceManifestWorks(namespace string) PlaceManifestWorkNamespaceLister - PlaceManifestWorkListerExpansion -} - -// placeManifestWorkLister implements the PlaceManifestWorkLister interface. -type placeManifestWorkLister struct { - indexer cache.Indexer -} - -// NewPlaceManifestWorkLister returns a new PlaceManifestWorkLister. -func NewPlaceManifestWorkLister(indexer cache.Indexer) PlaceManifestWorkLister { - return &placeManifestWorkLister{indexer: indexer} -} - -// List lists all PlaceManifestWorks in the indexer. -func (s *placeManifestWorkLister) List(selector labels.Selector) (ret []*v1alpha1.PlaceManifestWork, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.PlaceManifestWork)) - }) - return ret, err -} - -// PlaceManifestWorks returns an object that can list and get PlaceManifestWorks. -func (s *placeManifestWorkLister) PlaceManifestWorks(namespace string) PlaceManifestWorkNamespaceLister { - return placeManifestWorkNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// PlaceManifestWorkNamespaceLister helps list and get PlaceManifestWorks. -// All objects returned here must be treated as read-only. -type PlaceManifestWorkNamespaceLister interface { - // List lists all PlaceManifestWorks in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.PlaceManifestWork, err error) - // Get retrieves the PlaceManifestWork from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.PlaceManifestWork, error) - PlaceManifestWorkNamespaceListerExpansion -} - -// placeManifestWorkNamespaceLister implements the PlaceManifestWorkNamespaceLister -// interface. -type placeManifestWorkNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all PlaceManifestWorks in the indexer for a given namespace. -func (s placeManifestWorkNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PlaceManifestWork, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.PlaceManifestWork)) - }) - return ret, err -} - -// Get retrieves the PlaceManifestWork from the indexer for a given namespace and name. -func (s placeManifestWorkNamespaceLister) Get(name string) (*v1alpha1.PlaceManifestWork, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("placemanifestwork"), name) - } - return obj.(*v1alpha1.PlaceManifestWork), nil -} diff --git a/vendor/open-cluster-management.io/api/utils/work/v1/workbuilder/workbuilder.go b/vendor/open-cluster-management.io/api/utils/work/v1/workbuilder/workbuilder.go index 5935abec3..daf4df9d1 100644 --- a/vendor/open-cluster-management.io/api/utils/work/v1/workbuilder/workbuilder.go +++ b/vendor/open-cluster-management.io/api/utils/work/v1/workbuilder/workbuilder.go @@ -54,6 +54,7 @@ type internalWorkBuilder struct { executorOption *workapiv1.ManifestWorkExecutor existingManifestWorks []workapiv1.ManifestWork manifestConfigOption []workapiv1.ManifestConfigOption + annotations map[string]string } type WorkBuilderOption func(*internalWorkBuilder) *internalWorkBuilder @@ -85,6 +86,13 @@ func ManifestWorkExecutorOption(executor *workapiv1.ManifestWorkExecutor) WorkBu } } +func ManifestAnnotations(annotations map[string]string) WorkBuilderOption { + return func(builder *internalWorkBuilder) *internalWorkBuilder { + builder.annotations = annotations + return builder + } +} + func NewWorkBuilder() *WorkBuilder { return &WorkBuilder{ manifestLimit: int(float64(DefaultManifestLimit) * DefaultManifestThreshold), @@ -259,6 +267,7 @@ func (f *internalWorkBuilder) initManifestWork(index int) *workapiv1.ManifestWor ObjectMeta: f.generateManifestWorkObjectMeta(index), } f.setManifestWorkOptions(work) + f.setAnnotations(work) return work } @@ -269,6 +278,10 @@ func (f *internalWorkBuilder) setManifestWorkOptions(work *workapiv1.ManifestWor work.Spec.Executor = f.executorOption } +func (f *internalWorkBuilder) setAnnotations(work *workapiv1.ManifestWork) { + work.SetAnnotations(f.annotations) +} + func (f *internalWorkBuilder) bufferOfManifestWork(work *workapiv1.ManifestWork) int { totalSize := 0 for _, manifest := range work.Spec.Workload.Manifests { diff --git a/vendor/open-cluster-management.io/api/work/v1/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml b/vendor/open-cluster-management.io/api/work/v1/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml index 07fe26ee8..b44731fca 100644 --- a/vendor/open-cluster-management.io/api/work/v1/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml +++ b/vendor/open-cluster-management.io/api/work/v1/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml @@ -72,6 +72,10 @@ spec: version: description: Version is the version of the Kubernetes resource. type: string + evictionStartTime: + description: 'EvictionStartTime represents the current appliedmanifestwork will be evicted after a grace period. An appliedmanifestwork will be evicted from the managed cluster in the following two scenarios: - the manifestwork of the current appliedmanifestwork is missing on the hub, or - the appliedmanifestwork hub hash does not match the current hub hash of the work agent.' + type: string + format: date-time served: true storage: true subresources: diff --git a/vendor/open-cluster-management.io/api/work/v1/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml b/vendor/open-cluster-management.io/api/work/v1/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml index 981f9147e..06a5a9140 100644 --- a/vendor/open-cluster-management.io/api/work/v1/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml +++ b/vendor/open-cluster-management.io/api/work/v1/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml @@ -73,6 +73,10 @@ spec: version: description: Version is the version of the Kubernetes resource. type: string + evictionStartTime: + description: 'EvictionStartTime represents the current appliedmanifestwork will be evicted after a grace period. An appliedmanifestwork will be evicted from the managed cluster in the following two scenarios: - the manifestwork of the current appliedmanifestwork is missing on the hub, or - the appliedmanifestwork hub hash does not match the current hub hash of the work agent.' + type: string + format: date-time version: v1 versions: - name: v1 diff --git a/vendor/open-cluster-management.io/api/work/v1/types.go b/vendor/open-cluster-management.io/api/work/v1/types.go index 36a66bc22..ff5158f7c 100644 --- a/vendor/open-cluster-management.io/api/work/v1/types.go +++ b/vendor/open-cluster-management.io/api/work/v1/types.go @@ -26,6 +26,12 @@ type ManifestWork struct { Status ManifestWorkStatus `json:"status,omitempty"` } +const ( + // ManifestConfigSpecHashAnnotationKey is the annotation key to identify the configurations + // used by the manifestwork. + ManifestConfigSpecHashAnnotationKey = "open-cluster-management.io/config-spec-hash" +) + // ManifestWorkSpec represents a desired configuration of manifests to be deployed on the managed cluster. type ManifestWorkSpec struct { // Workload represents the manifest workload to be deployed on a managed cluster. @@ -545,6 +551,13 @@ type AppliedManifestWorkStatus struct { // However, the resource will not be undeleted, so it can be removed from this list and eventual consistency is preserved. // +optional AppliedResources []AppliedManifestResourceMeta `json:"appliedResources,omitempty"` + + // EvictionStartTime represents the current appliedmanifestwork will be evicted after a grace period. + // An appliedmanifestwork will be evicted from the managed cluster in the following two scenarios: + // - the manifestwork of the current appliedmanifestwork is missing on the hub, or + // - the appliedmanifestwork hub hash does not match the current hub hash of the work agent. + // +optional + EvictionStartTime *metav1.Time `json:"evictionStartTime,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go index 3fb3f47e4..fedeb46d5 100644 --- a/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/work/v1/zz_generated.deepcopy.go @@ -112,6 +112,10 @@ func (in *AppliedManifestWorkStatus) DeepCopyInto(out *AppliedManifestWorkStatus *out = make([]AppliedManifestResourceMeta, len(*in)) copy(*out, *in) } + if in.EvictionStartTime != nil { + in, out := &in.EvictionStartTime, &out.EvictionStartTime + *out = (*in).DeepCopy() + } return } diff --git a/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go index c82a457dc..aad5a7795 100644 --- a/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/work/v1/zz_generated.swagger_doc_generated.go @@ -53,8 +53,9 @@ func (AppliedManifestWorkSpec) SwaggerDoc() map[string]string { } var map_AppliedManifestWorkStatus = map[string]string{ - "": "AppliedManifestWorkStatus represents the current status of AppliedManifestWork", - "appliedResources": "AppliedResources represents a list of resources defined within the manifestwork that are applied. Only resources with valid GroupVersionResource, namespace, and name are suitable. An item in this slice is deleted when there is no mapped manifest in manifestwork.Spec or by finalizer. The resource relating to the item will also be removed from managed cluster. The deleted resource may still be present until the finalizers for that resource are finished. However, the resource will not be undeleted, so it can be removed from this list and eventual consistency is preserved.", + "": "AppliedManifestWorkStatus represents the current status of AppliedManifestWork", + "appliedResources": "AppliedResources represents a list of resources defined within the manifestwork that are applied. Only resources with valid GroupVersionResource, namespace, and name are suitable. An item in this slice is deleted when there is no mapped manifest in manifestwork.Spec or by finalizer. The resource relating to the item will also be removed from managed cluster. The deleted resource may still be present until the finalizers for that resource are finished. However, the resource will not be undeleted, so it can be removed from this list and eventual consistency is preserved.", + "evictionStartTime": "EvictionStartTime represents the current appliedmanifestwork will be evicted after a grace period. An appliedmanifestwork will be evicted from the managed cluster in the following two scenarios:\n - the manifestwork of the current appliedmanifestwork is missing on the hub, or\n - the appliedmanifestwork hub hash does not match the current hub hash of the work agent.", } func (AppliedManifestWorkStatus) SwaggerDoc() map[string]string { diff --git a/vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_placemanifestworks.crd.yaml b/vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml similarity index 93% rename from vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_placemanifestworks.crd.yaml rename to vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml index 5df48ed8e..c45b47c78 100644 --- a/vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_placemanifestworks.crd.yaml +++ b/vendor/open-cluster-management.io/api/work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml @@ -1,17 +1,16 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: placemanifestworks.work.open-cluster-management.io + name: manifestworkreplicasets.work.open-cluster-management.io spec: group: work.open-cluster-management.io names: - kind: PlaceManifestWork - listKind: PlaceManifestWorkList - plural: placemanifestworks + kind: ManifestWorkReplicaSet + listKind: ManifestWorkReplicaSetList + plural: manifestworkreplicasets shortNames: - - pmw - - pmws - singular: placemanifestwork + - mwrs + singular: manifestworkreplicaset scope: Namespaced preserveUnknownFields: false versions: @@ -35,7 +34,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: PlaceManifestWork is the Schema for the PlaceManifestWorks API. This custom resource is able to apply ManifestWork using Placement for 0..n ManagedCluster(in their namespaces). It will also remove the ManifestWork custom resources when deleted. Lastly the specific ManifestWork custom resources created per ManagedCluster namespace will be adjusted based on PlacementDecision changes. + description: ManifestWorkReplicaSet is the Schema for the ManifestWorkReplicaSet API. This custom resource is able to apply ManifestWork using Placement for 0..n ManagedCluster(in their namespaces). It will also remove the ManifestWork custom resources when deleted. Lastly the specific ManifestWork custom resources created per ManagedCluster namespace will be adjusted based on PlacementDecision changes. type: object properties: apiVersion: @@ -49,6 +48,8 @@ spec: spec: description: Spec reperesents the desired ManifestWork payload and Placement reference to be reconciled type: object + required: + - placementRefs properties: manifestWorkTemplate: description: ManifestWorkTemplate is the ManifestWorkSpec that will be used to generate a per-cluster ManifestWork @@ -224,13 +225,20 @@ spec: type: object x-kubernetes-preserve-unknown-fields: true x-kubernetes-embedded-resource: true - placementRef: - description: PacementRef is the name of the Placement resource, from which a PlacementDecision will be found and used to distribute the ManifestWork - type: object - properties: - name: - description: Name of the Placement resource in the current namespace - type: string + placementRefs: + description: PacementRefs is a list of the names of the Placement resource, from which a PlacementDecision will be found and used to distribute the ManifestWork. + type: array + minItems: 1 + items: + description: localPlacementReference is the name of a Placement resource in current namespace + type: object + required: + - name + properties: + name: + description: Name of the Placement resource in the current namespace + type: string + minLength: 1 status: description: Status represent the current status of Placing ManifestWork resources type: object @@ -296,7 +304,7 @@ spec: description: 'TODO: Progressing is the number of ManifestWorks with condition Progressing: true' type: integer total: - description: Total number of ManifestWorks managed by the PlaceManifestWork + description: Total number of ManifestWorks managed by the ManifestWorkReplicaSet type: integer served: true storage: true diff --git a/vendor/open-cluster-management.io/api/work/v1alpha1/register.go b/vendor/open-cluster-management.io/api/work/v1alpha1/register.go index 1c84d2ef9..752d65e54 100644 --- a/vendor/open-cluster-management.io/api/work/v1alpha1/register.go +++ b/vendor/open-cluster-management.io/api/work/v1alpha1/register.go @@ -30,8 +30,8 @@ func Resource(resource string) schema.GroupResource { // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(GroupVersion, - &PlaceManifestWork{}, - &PlaceManifestWorkList{}, + &ManifestWorkReplicaSet{}, + &ManifestWorkReplicaSetList{}, ) metav1.AddToGroupVersion(scheme, GroupVersion) diff --git a/vendor/open-cluster-management.io/api/work/v1alpha1/types.go b/vendor/open-cluster-management.io/api/work/v1alpha1/types_manifestworkreplicaset.go similarity index 56% rename from vendor/open-cluster-management.io/api/work/v1alpha1/types.go rename to vendor/open-cluster-management.io/api/work/v1alpha1/types_manifestworkreplicaset.go index 6bf683887..09b8c5e75 100644 --- a/vendor/open-cluster-management.io/api/work/v1alpha1/types.go +++ b/vendor/open-cluster-management.io/api/work/v1alpha1/types_manifestworkreplicaset.go @@ -28,7 +28,7 @@ import ( // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true -// +kubebuilder:resource:path=placemanifestworks,shortName=pmw;pmws,scope=Namespaced +// +kubebuilder:resource:path=manifestworkreplicasets,shortName=mwrs,scope=Namespaced // +kubebuilder:storageversion // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Placement",type="string",JSONPath=".status.conditions[?(@.type==\"PlacementVerified\")].reason",description="Reason" @@ -36,33 +36,36 @@ import ( // +kubebuilder:printcolumn:name="ManifestWorks",type="string",JSONPath=".status.conditions[?(@.type==\"ManifestworkApplied\")].reason",description="Reason" // +kubebuilder:printcolumn:name="Applied",type="string",JSONPath=".status.conditions[?(@.type==\"ManifestworkApplied\")].status",description="Applied" -// PlaceManifestWork is the Schema for the PlaceManifestWorks API. This custom resource is able to apply +// ManifestWorkReplicaSet is the Schema for the ManifestWorkReplicaSet API. This custom resource is able to apply // ManifestWork using Placement for 0..n ManagedCluster(in their namespaces). It will also remove the ManifestWork custom resources // when deleted. Lastly the specific ManifestWork custom resources created per ManagedCluster namespace will be adjusted based on PlacementDecision // changes. -type PlaceManifestWork struct { +type ManifestWorkReplicaSet struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` // Spec reperesents the desired ManifestWork payload and Placement reference to be reconciled - Spec PlaceManifestWorkSpec `json:"spec,omitempty"` + Spec ManifestWorkReplicaSetSpec `json:"spec,omitempty"` // Status represent the current status of Placing ManifestWork resources - Status PlaceManifestWorkStatus `json:"status,omitempty"` + Status ManifestWorkReplicaSetStatus `json:"status,omitempty"` } -// PlaceManifestWorkSpec defines the desired state of PlaceManifestWork -type PlaceManifestWorkSpec struct { +// ManifestWorkReplicaSetSpec defines the desired state of ManifestWorkReplicaSet +type ManifestWorkReplicaSetSpec struct { // ManifestWorkTemplate is the ManifestWorkSpec that will be used to generate a per-cluster ManifestWork ManifestWorkTemplate work.ManifestWorkSpec `json:"manifestWorkTemplate"` - // PacementRef is the name of the Placement resource, from which a PlacementDecision will be found and used - // to distribute the ManifestWork - PlacementRef LocalPlacementReference `json:"placementRef,omitempty"` + // PacementRefs is a list of the names of the Placement resource, from which a PlacementDecision will be found and used + // to distribute the ManifestWork. + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinItems=1 + // +required + PlacementRefs []LocalPlacementReference `json:"placementRefs"` } -// PlaceManifestWorkStatus defines the observed state of PlaceManifestWork -type PlaceManifestWorkStatus struct { +// ManifestWorkReplicaSetStatus defines the observed state of ManifestWorkReplicaSet +type ManifestWorkReplicaSetStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file @@ -73,19 +76,22 @@ type PlaceManifestWorkStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` // Summary totals of resulting ManifestWorks - PlacedManifestWorkSummary PlacedManifestWorkSummary `json:"summary"` + Summary ManifestWorkReplicaSetSummary `json:"summary"` } // localPlacementReference is the name of a Placement resource in current namespace type LocalPlacementReference struct { // Name of the Placement resource in the current namespace + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinLength=1 Name string `json:"name"` } -// PlaceManifestWorkSummary provides reference counts of all ManifestWorks that are associated with a -// given PlaceManifestWork resource, for their respective states -type PlacedManifestWorkSummary struct { - // Total number of ManifestWorks managed by the PlaceManifestWork +// ManifestWorkReplicaSetSummary provides reference counts of all ManifestWorks that are associated with a +// given ManifestWorkReplicaSet resource, for their respective states +type ManifestWorkReplicaSetSummary struct { + // Total number of ManifestWorks managed by the ManifestWorkReplicaSet Total int `json:"total"` // TODO: Progressing is the number of ManifestWorks with condition Progressing: true Progressing int `json:"progressing"` @@ -100,30 +106,37 @@ type PlacedManifestWorkSummary struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true // -// PlaceManifestWorkList contains a list of PlaceManifestWork -type PlaceManifestWorkList struct { +// ManifestWorkReplicaSetList contains a list of ManifestWorkReplicaSet +type ManifestWorkReplicaSetList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []PlaceManifestWork `json:"items"` + Items []ManifestWorkReplicaSet `json:"items"` } -type PlaceWorkConditionType string - const ( - PlacementDecisionNotFound = "PlacementDecisionNotFound" - PlacementDecisionEmpty = "PlacementDecisionEmpty" - - AsExpected = "AsExpected" - Processing = "Processing" - NotAsExpected = "NotAsExpected" - - // PlacementDecisionVerified indicates if Placement is valid + // ReasonPlacementDecisionNotFound is a reason for ManifestWorkReplicaSetConditionPlacementVerified condition type + // representing placement decision is not found for the ManifestWorkSet + ReasonPlacementDecisionNotFound = "PlacementDecisionNotFound" + // ReasonPlacementDecisionEmpty is a reason for ManifestWorkReplicaSetConditionPlacementVerified condition type + // representing the placement decision is empty for the ManifestWorkSet + ReasonPlacementDecisionEmpty = "PlacementDecisionEmpty" + // ReasonAsExpected is a reason for ManifestWorkReplicaSetConditionManifestworkApplied condition type representing + // the ManifestWorkSet is applied correctly. + ReasonAsExpected = "AsExpected" + // ReasonProcessing is a reason for ManifestWorkReplicaSetConditionManifestworkApplied condition type representing + // the ManifestWorkSet is under processing + ReasonProcessing = "Processing" + // ReasonNotAsExpected is a reason for ManifestWorkReplicaSetConditionManifestworkApplied condition type representing + // the ManifestWorkSet is not applied correctly. + ReasonNotAsExpected = "NotAsExpected" + + // ManifestWorkSetConditionPlacementVerified indicates if Placement is valid // // Reason: AsExpected, PlacementDecisionNotFound, PlacementDecisionEmpty or NotAsExpected - PlacementDecisionVerified PlaceWorkConditionType = "PlacementVerified" + ManifestWorkReplicaSetConditionPlacementVerified string = "PlacementVerified" - // ManifestWorkApplied confirms that a ManifestWork has been created in each cluster defined by PlacementDecision + // ManifestWorkSetConditionManifestworkApplied confirms that a ManifestWork has been created in each cluster defined by PlacementDecision // // Reason: AsExpected, NotAsExpected or Processing - ManifestworkApplied PlaceWorkConditionType = "ManifestworkApplied" + ManifestWorkReplicaSetConditionManifestworkApplied string = "ManifestworkApplied" ) diff --git a/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.deepcopy.go index d1d6894ef..a81786dd5 100644 --- a/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.deepcopy.go @@ -27,7 +27,7 @@ func (in *LocalPlacementReference) DeepCopy() *LocalPlacementReference { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlaceManifestWork) DeepCopyInto(out *PlaceManifestWork) { +func (in *ManifestWorkReplicaSet) DeepCopyInto(out *ManifestWorkReplicaSet) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -36,18 +36,18 @@ func (in *PlaceManifestWork) DeepCopyInto(out *PlaceManifestWork) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlaceManifestWork. -func (in *PlaceManifestWork) DeepCopy() *PlaceManifestWork { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestWorkReplicaSet. +func (in *ManifestWorkReplicaSet) DeepCopy() *ManifestWorkReplicaSet { if in == nil { return nil } - out := new(PlaceManifestWork) + out := new(ManifestWorkReplicaSet) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PlaceManifestWork) DeepCopyObject() runtime.Object { +func (in *ManifestWorkReplicaSet) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -55,13 +55,13 @@ func (in *PlaceManifestWork) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlaceManifestWorkList) DeepCopyInto(out *PlaceManifestWorkList) { +func (in *ManifestWorkReplicaSetList) DeepCopyInto(out *ManifestWorkReplicaSetList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]PlaceManifestWork, len(*in)) + *out = make([]ManifestWorkReplicaSet, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -69,18 +69,18 @@ func (in *PlaceManifestWorkList) DeepCopyInto(out *PlaceManifestWorkList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlaceManifestWorkList. -func (in *PlaceManifestWorkList) DeepCopy() *PlaceManifestWorkList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestWorkReplicaSetList. +func (in *ManifestWorkReplicaSetList) DeepCopy() *ManifestWorkReplicaSetList { if in == nil { return nil } - out := new(PlaceManifestWorkList) + out := new(ManifestWorkReplicaSetList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PlaceManifestWorkList) DeepCopyObject() runtime.Object { +func (in *ManifestWorkReplicaSetList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -88,25 +88,29 @@ func (in *PlaceManifestWorkList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlaceManifestWorkSpec) DeepCopyInto(out *PlaceManifestWorkSpec) { +func (in *ManifestWorkReplicaSetSpec) DeepCopyInto(out *ManifestWorkReplicaSetSpec) { *out = *in in.ManifestWorkTemplate.DeepCopyInto(&out.ManifestWorkTemplate) - out.PlacementRef = in.PlacementRef + if in.PlacementRefs != nil { + in, out := &in.PlacementRefs, &out.PlacementRefs + *out = make([]LocalPlacementReference, len(*in)) + copy(*out, *in) + } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlaceManifestWorkSpec. -func (in *PlaceManifestWorkSpec) DeepCopy() *PlaceManifestWorkSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestWorkReplicaSetSpec. +func (in *ManifestWorkReplicaSetSpec) DeepCopy() *ManifestWorkReplicaSetSpec { if in == nil { return nil } - out := new(PlaceManifestWorkSpec) + out := new(ManifestWorkReplicaSetSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlaceManifestWorkStatus) DeepCopyInto(out *PlaceManifestWorkStatus) { +func (in *ManifestWorkReplicaSetStatus) DeepCopyInto(out *ManifestWorkReplicaSetStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions @@ -115,32 +119,32 @@ func (in *PlaceManifestWorkStatus) DeepCopyInto(out *PlaceManifestWorkStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } - out.PlacedManifestWorkSummary = in.PlacedManifestWorkSummary + out.Summary = in.Summary return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlaceManifestWorkStatus. -func (in *PlaceManifestWorkStatus) DeepCopy() *PlaceManifestWorkStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestWorkReplicaSetStatus. +func (in *ManifestWorkReplicaSetStatus) DeepCopy() *ManifestWorkReplicaSetStatus { if in == nil { return nil } - out := new(PlaceManifestWorkStatus) + out := new(ManifestWorkReplicaSetStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlacedManifestWorkSummary) DeepCopyInto(out *PlacedManifestWorkSummary) { +func (in *ManifestWorkReplicaSetSummary) DeepCopyInto(out *ManifestWorkReplicaSetSummary) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacedManifestWorkSummary. -func (in *PlacedManifestWorkSummary) DeepCopy() *PlacedManifestWorkSummary { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestWorkReplicaSetSummary. +func (in *ManifestWorkReplicaSetSummary) DeepCopy() *ManifestWorkReplicaSetSummary { if in == nil { return nil } - out := new(PlacedManifestWorkSummary) + out := new(ManifestWorkReplicaSetSummary) in.DeepCopyInto(out) return out } diff --git a/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.swagger_doc_generated.go index b9cb6aa80..1eb35b56c 100644 --- a/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/work/v1alpha1/zz_generated.swagger_doc_generated.go @@ -20,53 +20,53 @@ func (LocalPlacementReference) SwaggerDoc() map[string]string { return map_LocalPlacementReference } -var map_PlaceManifestWork = map[string]string{ - "": "PlaceManifestWork is the Schema for the PlaceManifestWorks API. This custom resource is able to apply ManifestWork using Placement for 0..n ManagedCluster(in their namespaces). It will also remove the ManifestWork custom resources when deleted. Lastly the specific ManifestWork custom resources created per ManagedCluster namespace will be adjusted based on PlacementDecision changes.", +var map_ManifestWorkReplicaSet = map[string]string{ + "": "ManifestWorkReplicaSet is the Schema for the ManifestWorkReplicaSet API. This custom resource is able to apply ManifestWork using Placement for 0..n ManagedCluster(in their namespaces). It will also remove the ManifestWork custom resources when deleted. Lastly the specific ManifestWork custom resources created per ManagedCluster namespace will be adjusted based on PlacementDecision changes.", "spec": "Spec reperesents the desired ManifestWork payload and Placement reference to be reconciled", "status": "Status represent the current status of Placing ManifestWork resources", } -func (PlaceManifestWork) SwaggerDoc() map[string]string { - return map_PlaceManifestWork +func (ManifestWorkReplicaSet) SwaggerDoc() map[string]string { + return map_ManifestWorkReplicaSet } -var map_PlaceManifestWorkList = map[string]string{ - "": "\n\nPlaceManifestWorkList contains a list of PlaceManifestWork", +var map_ManifestWorkReplicaSetList = map[string]string{ + "": "\n\nManifestWorkReplicaSetList contains a list of ManifestWorkReplicaSet", } -func (PlaceManifestWorkList) SwaggerDoc() map[string]string { - return map_PlaceManifestWorkList +func (ManifestWorkReplicaSetList) SwaggerDoc() map[string]string { + return map_ManifestWorkReplicaSetList } -var map_PlaceManifestWorkSpec = map[string]string{ - "": "PlaceManifestWorkSpec defines the desired state of PlaceManifestWork", +var map_ManifestWorkReplicaSetSpec = map[string]string{ + "": "ManifestWorkReplicaSetSpec defines the desired state of ManifestWorkReplicaSet", "manifestWorkTemplate": "ManifestWorkTemplate is the ManifestWorkSpec that will be used to generate a per-cluster ManifestWork", - "placementRef": "PacementRef is the name of the Placement resource, from which a PlacementDecision will be found and used to distribute the ManifestWork", + "placementRefs": "PacementRefs is a list of the names of the Placement resource, from which a PlacementDecision will be found and used to distribute the ManifestWork.", } -func (PlaceManifestWorkSpec) SwaggerDoc() map[string]string { - return map_PlaceManifestWorkSpec +func (ManifestWorkReplicaSetSpec) SwaggerDoc() map[string]string { + return map_ManifestWorkReplicaSetSpec } -var map_PlaceManifestWorkStatus = map[string]string{ - "": "PlaceManifestWorkStatus defines the observed state of PlaceManifestWork", +var map_ManifestWorkReplicaSetStatus = map[string]string{ + "": "ManifestWorkReplicaSetStatus defines the observed state of ManifestWorkReplicaSet", "conditions": "Conditions contains the different condition statuses for distrbution of ManifestWork resources Valid condition types are: 1. AppliedManifestWorks represents ManifestWorks have been distributed as per placement All, Partial, None, Problem 2. PlacementRefValid", "summary": "Summary totals of resulting ManifestWorks", } -func (PlaceManifestWorkStatus) SwaggerDoc() map[string]string { - return map_PlaceManifestWorkStatus +func (ManifestWorkReplicaSetStatus) SwaggerDoc() map[string]string { + return map_ManifestWorkReplicaSetStatus } -var map_PlacedManifestWorkSummary = map[string]string{ - "": "PlaceManifestWorkSummary provides reference counts of all ManifestWorks that are associated with a given PlaceManifestWork resource, for their respective states", - "total": "Total number of ManifestWorks managed by the PlaceManifestWork", +var map_ManifestWorkReplicaSetSummary = map[string]string{ + "": "ManifestWorkReplicaSetSummary provides reference counts of all ManifestWorks that are associated with a given ManifestWorkReplicaSet resource, for their respective states", + "total": "Total number of ManifestWorks managed by the ManifestWorkReplicaSet", "available": "Available is the number of ManifestWorks with condition Available: true", "Applied": "Applied is the number of ManifestWorks with condition Applied: true", } -func (PlacedManifestWorkSummary) SwaggerDoc() map[string]string { - return map_PlacedManifestWorkSummary +func (ManifestWorkReplicaSetSummary) SwaggerDoc() map[string]string { + return map_ManifestWorkReplicaSetSummary } // AUTO-GENERATED FUNCTIONS END HERE