From aca3b663716a2f3d57958df9839b71b6709c364c Mon Sep 17 00:00:00 2001 From: Mohamed ElSerngawy Date: Sun, 12 Mar 2023 23:53:50 -0400 Subject: [PATCH] Add manifestWorkReplicaSet feature check (#192) Signed-off-by: melserngawy --- go.mod | 10 +++++----- go.sum | 20 +++++++++---------- .../manifestworkreplicaset_validating.go | 19 ++++++++++++++++++ .../manifestworkreplicaset_validating_test.go | 19 ++++++++++++++++++ .../api/resource/v1alpha1/generated.proto | 3 ++- vendor/k8s.io/api/resource/v1alpha1/types.go | 3 ++- .../applyconfigurations/internal/internal.go | 2 ++ vendor/k8s.io/client-go/transport/cache.go | 2 +- .../component-base/logs/api/v1/pflags.go | 9 +++++++++ .../metrics/legacyregistry/registry.go | 3 +++ .../k8s.io/component-base/metrics/metric.go | 20 ------------------- vendor/modules.txt | 10 +++++----- .../api/feature/feature.go | 7 ++++++- ...anagement.io_appliedmanifestworks.crd.yaml | 4 ++++ ...anagement.io_appliedmanifestworks.crd.yaml | 4 ++++ .../api/work/v1/types.go | 7 +++++++ .../api/work/v1/zz_generated.deepcopy.go | 4 ++++ .../v1/zz_generated.swagger_doc_generated.go | 5 +++-- 18 files changed, 105 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index 9afedc71f..272ffd38e 100644 --- a/go.mod +++ b/go.mod @@ -14,15 +14,15 @@ require ( github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 - k8s.io/api v0.26.1 + k8s.io/api v0.26.2 k8s.io/apiextensions-apiserver v0.26.1 - k8s.io/apimachinery v0.26.1 + k8s.io/apimachinery v0.26.2 k8s.io/apiserver v0.26.1 - k8s.io/client-go v0.26.1 - k8s.io/component-base v0.26.1 + k8s.io/client-go v0.26.2 + k8s.io/component-base v0.26.2 k8s.io/klog/v2 v2.80.1 k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 - open-cluster-management.io/api v0.10.1-0.20230227155011-2c63272fa800 + open-cluster-management.io/api v0.10.1-0.20230310025041-ca0770573954 sigs.k8s.io/controller-runtime v0.14.4 ) diff --git a/go.sum b/go.sum index eec309016..b283a997b 100644 --- a/go.sum +++ b/go.sum @@ -974,30 +974,30 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI= k8s.io/api v0.18.0-beta.2/go.mod h1:2oeNnWEqcSmaM/ibSh3t7xcIqbkGXhzZdn4ezV9T4m0= -k8s.io/api v0.26.1 h1:f+SWYiPd/GsiWwVRz+NbFyCgvv75Pk9NK6dlkZgpCRQ= -k8s.io/api v0.26.1/go.mod h1:xd/GBNgR0f707+ATNyPmQ1oyKSgndzXij81FzWGsejg= +k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ= +k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU= k8s.io/apiextensions-apiserver v0.17.0/go.mod h1:XiIFUakZywkUl54fVXa7QTEHcqQz9HG55nHd1DCoHj8= k8s.io/apiextensions-apiserver v0.18.0-beta.2/go.mod h1:Hnrg5jx8/PbxRbUoqDGxtQkULjwx8FDW4WYJaKNK+fk= k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI= k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM= k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= k8s.io/apimachinery v0.18.0-beta.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA= -k8s.io/apimachinery v0.26.1 h1:8EZ/eGJL+hY/MYCNwhmDzVqq2lPl3N3Bo8rvweJwXUQ= -k8s.io/apimachinery v0.26.1/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= +k8s.io/apimachinery v0.26.2 h1:da1u3D5wfR5u2RpLhE/ZtZS2P7QvDgLZTi9wrNZl/tQ= +k8s.io/apimachinery v0.26.2/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I= k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg= k8s.io/apiserver v0.18.0-beta.2/go.mod h1:bnblMkMoCFnIfVnVftd0SXJPzyvrk3RtaqSbblphF/A= k8s.io/apiserver v0.26.1 h1:6vmnAqCDO194SVCPU3MU8NcDgSqsUA62tBUSWrFXhsc= k8s.io/apiserver v0.26.1/go.mod h1:wr75z634Cv+sifswE9HlAo5FQ7UoUauIICRlOE+5dCg= k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k= k8s.io/client-go v0.18.0-beta.2/go.mod h1:UvuVxHjKWIcgy0iMvF+bwNDW7l0mskTNOaOW1Qv5BMA= -k8s.io/client-go v0.26.1 h1:87CXzYJnAMGaa/IDDfRdhTzxk/wzGZ+/HUQpqgVSZXU= -k8s.io/client-go v0.26.1/go.mod h1:IWNSglg+rQ3OcvDkhY6+QLeasV4OYHDjdqeWkDQZwGE= +k8s.io/client-go v0.26.2 h1:s1WkVujHX3kTp4Zn4yGNFK+dlDXy1bAAkIl+cFAiuYI= +k8s.io/client-go v0.26.2/go.mod h1:u5EjOuSyBa09yqqyY7m3abZeovO/7D/WehVVlZ2qcqU= k8s.io/code-generator v0.17.0/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= k8s.io/code-generator v0.18.0-beta.2/go.mod h1:+UHX5rSbxmR8kzS+FAv7um6dtYrZokQvjHpDSYRVkTc= k8s.io/component-base v0.17.0/go.mod h1:rKuRAokNMY2nn2A6LP/MiwpoaMRHpfRnrPaUJJj1Yoc= k8s.io/component-base v0.18.0-beta.2/go.mod h1:HVk5FpRnyzQ/MjBr9//e/yEBjTVa2qjGXCTuUzcD7ks= -k8s.io/component-base v0.26.1 h1:4ahudpeQXHZL5kko+iDHqLj/FSGAEUnSVO0EBbgDd+4= -k8s.io/component-base v0.26.1/go.mod h1:VHrLR0b58oC035w6YQiBSbtsf0ThuSwXP+p5dD/kAWU= +k8s.io/component-base v0.26.2 h1:IfWgCGUDzrD6wLLgXEstJKYZKAFS2kO+rBRi0p3LqcI= +k8s.io/component-base v0.26.2/go.mod h1:DxbuIe9M3IZPRxPIzhch2m1eT7uFrSBJUBuVCQEBivs= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= @@ -1024,8 +1024,8 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -open-cluster-management.io/api v0.10.1-0.20230227155011-2c63272fa800 h1:/f9jJbabrWG/PCS42Vcxh/Gl0qxNCaGsZ59fQB1jLhc= -open-cluster-management.io/api v0.10.1-0.20230227155011-2c63272fa800/go.mod h1:TjWobG3dTZJf/Ye04358/F/381RjE/+HXVDGMnZBpjc= +open-cluster-management.io/api v0.10.1-0.20230310025041-ca0770573954 h1:u+X8exw4O1FCJ9DZBvpQMLsAxL5kQWGAAoZL+I50AX8= +open-cluster-management.io/api v0.10.1-0.20230310025041-ca0770573954/go.mod h1:TjWobG3dTZJf/Ye04358/F/381RjE/+HXVDGMnZBpjc= 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/webhook/v1alpha1/manifestworkreplicaset_validating.go b/pkg/webhook/v1alpha1/manifestworkreplicaset_validating.go index 5c996c2f7..6b65fd1c6 100644 --- a/pkg/webhook/v1alpha1/manifestworkreplicaset_validating.go +++ b/pkg/webhook/v1alpha1/manifestworkreplicaset_validating.go @@ -2,10 +2,13 @@ package v1alpha1 import ( "context" + "errors" "open-cluster-management.io/work/pkg/webhook/common" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" + utilfeature "k8s.io/apiserver/pkg/util/feature" + ocmfeature "open-cluster-management.io/api/feature" workv1alpha1 "open-cluster-management.io/api/work/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" @@ -39,10 +42,18 @@ func (r *ManifestWorkReplicaSetWebhook) ValidateUpdate(ctx context.Context, oldO // ValidateDelete implements webhook.Validator so a webhook will be registered for the type func (r *ManifestWorkReplicaSetWebhook) ValidateDelete(_ context.Context, obj runtime.Object) error { + if err := checkFeatureEnabled(); err != nil { + return err + } + return nil } func (r *ManifestWorkReplicaSetWebhook) validateRequest(newmwrSet *workv1alpha1.ManifestWorkReplicaSet, oldmwrSet *workv1alpha1.ManifestWorkReplicaSet, ctx context.Context) error { + if err := checkFeatureEnabled(); err != nil { + return err + } + if err := validatePlaceManifests(newmwrSet); err != nil { return apierrors.NewBadRequest(err.Error()) } @@ -58,3 +69,11 @@ func (r *ManifestWorkReplicaSetWebhook) validateRequest(newmwrSet *workv1alpha1. func validatePlaceManifests(mwrSet *workv1alpha1.ManifestWorkReplicaSet) error { return common.ManifestValidator.ValidateManifests(mwrSet.Spec.ManifestWorkTemplate.Workload.Manifests) } + +func checkFeatureEnabled() error { + if !utilfeature.DefaultMutableFeatureGate.Enabled(ocmfeature.ManifestWorkReplicaSet) { + return errors.New("ManifestWorkReplicaSet feature is disabled") + } + + return nil +} diff --git a/pkg/webhook/v1alpha1/manifestworkreplicaset_validating_test.go b/pkg/webhook/v1alpha1/manifestworkreplicaset_validating_test.go index 968d55eb6..334641a97 100644 --- a/pkg/webhook/v1alpha1/manifestworkreplicaset_validating_test.go +++ b/pkg/webhook/v1alpha1/manifestworkreplicaset_validating_test.go @@ -2,9 +2,12 @@ package v1alpha1 import ( "context" + "fmt" admissionv1 "k8s.io/api/admission/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + utilfeature "k8s.io/apiserver/pkg/util/feature" + ocmfeature "open-cluster-management.io/api/feature" workv1alpha1 "open-cluster-management.io/api/work/v1alpha1" helpertest "open-cluster-management.io/work/pkg/hub/test" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" @@ -18,6 +21,8 @@ var manifestWorkReplicaSetSchema = metav1.GroupVersionResource{ } func TestWebHookValidateRequest(t *testing.T) { + setupFeatureGate(t) + request := admission.Request{ AdmissionRequest: admissionv1.AdmissionRequest{ Resource: manifestWorkReplicaSetSchema, @@ -53,6 +58,8 @@ func TestWebHookValidateRequest(t *testing.T) { } func TestWebHookCreateRequest(t *testing.T) { + setupFeatureGate(t) + webHook := ManifestWorkReplicaSetWebhook{} mwrSet := &workv1alpha1.ManifestWorkReplicaSet{} err := webHook.ValidateCreate(context.Background(), mwrSet) @@ -77,6 +84,8 @@ func TestWebHookCreateRequest(t *testing.T) { } func TestWebHookUpdateRequest(t *testing.T) { + setupFeatureGate(t) + webHook := ManifestWorkReplicaSetWebhook{} mwrSet := helpertest.CreateTestManifestWorkReplicaSet("mwrSet-test", "default", "place-test") err := webHook.ValidateUpdate(context.Background(), nil, mwrSet) @@ -107,3 +116,13 @@ func TestWebHookUpdateRequest(t *testing.T) { t.Fatal(err) } } + +func setupFeatureGate(t *testing.T) { + defaultFG := utilfeature.DefaultMutableFeatureGate + if err := defaultFG.Add(ocmfeature.DefaultHubWorkFeatureGates); err != nil { + t.Fatal(err) + } + if err := defaultFG.Set(fmt.Sprintf("%s=true", ocmfeature.ManifestWorkReplicaSet)); err != nil { + t.Fatal(err) + } +} diff --git a/vendor/k8s.io/api/resource/v1alpha1/generated.proto b/vendor/k8s.io/api/resource/v1alpha1/generated.proto index 5fc35e405..2e814d155 100644 --- a/vendor/k8s.io/api/resource/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/resource/v1alpha1/generated.proto @@ -248,7 +248,8 @@ message ResourceClaimStatus { // There can be at most 32 such reservations. This may get increased in // the future, but not reduced. // - // +listType=set + // +listType=map + // +listMapKey=uid // +optional repeated ResourceClaimConsumerReference reservedFor = 3; diff --git a/vendor/k8s.io/api/resource/v1alpha1/types.go b/vendor/k8s.io/api/resource/v1alpha1/types.go index 9d7d4a191..af5703840 100644 --- a/vendor/k8s.io/api/resource/v1alpha1/types.go +++ b/vendor/k8s.io/api/resource/v1alpha1/types.go @@ -112,7 +112,8 @@ type ResourceClaimStatus struct { // There can be at most 32 such reservations. This may get increased in // the future, but not reduced. // - // +listType=set + // +listType=map + // +listMapKey=uid // +optional ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,3,opt,name=reservedFor"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go index 4f3636b27..94dd2160d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -11661,6 +11661,8 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1alpha1.ResourceClaimConsumerReference elementRelationship: associative + keys: + - uid - name: io.k8s.api.resource.v1alpha1.ResourceClaimTemplate map: fields: diff --git a/vendor/k8s.io/client-go/transport/cache.go b/vendor/k8s.io/client-go/transport/cache.go index 9d2889d19..edcc6d1d4 100644 --- a/vendor/k8s.io/client-go/transport/cache.go +++ b/vendor/k8s.io/client-go/transport/cache.go @@ -109,7 +109,7 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { // If we use are reloading files, we need to handle certificate rotation properly // TODO(jackkleeman): We can also add rotation here when config.HasCertCallback() is true - if config.TLS.ReloadTLSFiles { + if config.TLS.ReloadTLSFiles && tlsConfig != nil && tlsConfig.GetClientCertificate != nil { dynamicCertDialer := certRotatingDialer(tlsConfig.GetClientCertificate, dial) tlsConfig.GetClientCertificate = dynamicCertDialer.GetClientCertificate dial = dynamicCertDialer.connDialer.DialContext diff --git a/vendor/k8s.io/component-base/logs/api/v1/pflags.go b/vendor/k8s.io/component-base/logs/api/v1/pflags.go index 36a98cc81..b74e132a7 100644 --- a/vendor/k8s.io/component-base/logs/api/v1/pflags.go +++ b/vendor/k8s.io/component-base/logs/api/v1/pflags.go @@ -36,6 +36,9 @@ type vmoduleConfigurationPFlag struct { // String returns the -vmodule parameter (comma-separated list of pattern=N). func (wrapper vmoduleConfigurationPFlag) String() string { + if wrapper.value == nil { + return "" + } var patterns []string for _, item := range *wrapper.value { patterns = append(patterns, fmt.Sprintf("%s=%d", item.FilePattern, item.Verbosity)) @@ -82,10 +85,16 @@ type verbosityLevelPflag struct { } func (wrapper verbosityLevelPflag) String() string { + if wrapper.value == nil { + return "0" + } return strconv.FormatInt(int64(*wrapper.value), 10) } func (wrapper verbosityLevelPflag) Get() interface{} { + if wrapper.value == nil { + return VerbosityLevel(0) + } return *wrapper.value } diff --git a/vendor/k8s.io/component-base/metrics/legacyregistry/registry.go b/vendor/k8s.io/component-base/metrics/legacyregistry/registry.go index ed0f1c348..79c806d8b 100644 --- a/vendor/k8s.io/component-base/metrics/legacyregistry/registry.go +++ b/vendor/k8s.io/component-base/metrics/legacyregistry/registry.go @@ -42,6 +42,9 @@ var ( // Register registers a collectable metric but uses the global registry Register = defaultRegistry.Register + + // Registerer exposes the global registerer + Registerer = defaultRegistry.Registerer ) func init() { diff --git a/vendor/k8s.io/component-base/metrics/metric.go b/vendor/k8s.io/component-base/metrics/metric.go index cf5bccfa7..87352e92e 100644 --- a/vendor/k8s.io/component-base/metrics/metric.go +++ b/vendor/k8s.io/component-base/metrics/metric.go @@ -216,7 +216,6 @@ var noopCounterVec = &prometheus.CounterVec{} var noopHistogramVec = &prometheus.HistogramVec{} var noopTimingHistogramVec = &promext.TimingHistogramVec{} var noopGaugeVec = &prometheus.GaugeVec{} -var noopObserverVec = &noopObserverVector{} // just use a convenience struct for all the no-ops var noop = &noopMetric{} @@ -235,22 +234,3 @@ func (noopMetric) Desc() *prometheus.Desc { return nil } func (noopMetric) Write(*dto.Metric) error { return nil } func (noopMetric) Describe(chan<- *prometheus.Desc) {} func (noopMetric) Collect(chan<- prometheus.Metric) {} - -type noopObserverVector struct{} - -func (noopObserverVector) GetMetricWith(prometheus.Labels) (prometheus.Observer, error) { - return noop, nil -} -func (noopObserverVector) GetMetricWithLabelValues(...string) (prometheus.Observer, error) { - return noop, nil -} -func (noopObserverVector) With(prometheus.Labels) prometheus.Observer { return noop } -func (noopObserverVector) WithLabelValues(...string) prometheus.Observer { return noop } -func (noopObserverVector) CurryWith(prometheus.Labels) (prometheus.ObserverVec, error) { - return noopObserverVec, nil -} -func (noopObserverVector) MustCurryWith(prometheus.Labels) prometheus.ObserverVec { - return noopObserverVec -} -func (noopObserverVector) Describe(chan<- *prometheus.Desc) {} -func (noopObserverVector) Collect(chan<- prometheus.Metric) {} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7517fc781..f7c28c2a9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -624,7 +624,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.26.1 +# k8s.io/api v0.26.2 ## explicit; go 1.19 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -692,7 +692,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextension k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/fake k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/fake -# k8s.io/apimachinery v0.26.1 +# k8s.io/apimachinery v0.26.2 ## explicit; go 1.19 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -886,7 +886,7 @@ k8s.io/apiserver/plugin/pkg/audit/truncate k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook -# k8s.io/client-go v0.26.1 +# k8s.io/client-go v0.26.2 ## explicit; go 1.19 k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1196,7 +1196,7 @@ k8s.io/client-go/util/jsonpath k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/workqueue -# k8s.io/component-base v0.26.1 +# k8s.io/component-base v0.26.2 ## explicit; go 1.19 k8s.io/component-base/cli/flag k8s.io/component-base/config @@ -1273,7 +1273,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.20230227155011-2c63272fa800 +# open-cluster-management.io/api v0.10.1-0.20230310025041-ca0770573954 ## explicit; go 1.19 open-cluster-management.io/api/client/cluster/clientset/versioned open-cluster-management.io/api/client/cluster/clientset/versioned/fake diff --git a/vendor/open-cluster-management.io/api/feature/feature.go b/vendor/open-cluster-management.io/api/feature/feature.go index abe85f809..50ebe676e 100644 --- a/vendor/open-cluster-management.io/api/feature/feature.go +++ b/vendor/open-cluster-management.io/api/feature/feature.go @@ -56,6 +56,10 @@ const ( // A registraion request to be automatically approved must be initiated by specific users, these users are // specifed with "--cluster-auto-approval-users" flag in the registration hub controller. ManagedClusterAutoApproval featuregate.Feature = "ManagedClusterAutoApproval" + + // ManifestWorkReplicaSet will start new controller in the Hub that can be used to deploy manifestWorks to group + // of clusters selected by a placement. For more info check ManifestWorkReplicaSet APIs + ManifestWorkReplicaSet featuregate.Feature = "ManifestWorkReplicaSet" ) // DefaultSpokeRegistrationFeatureGates consists of all known ocm-registration @@ -79,7 +83,8 @@ var DefaultHubRegistrationFeatureGates = map[featuregate.Feature]featuregate.Fea // DefaultHubWorkFeatureGates consists of all known acm work wehbook feature keys. // To add a new feature, define a key for it above and add it here. var DefaultHubWorkFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ - NilExecutorValidating: {Default: false, PreRelease: featuregate.Alpha}, + NilExecutorValidating: {Default: false, PreRelease: featuregate.Alpha}, + ManifestWorkReplicaSet: {Default: false, PreRelease: featuregate.Alpha}, } // DefaultSpokeWorkFeatureGates consists of all known ocm work feature keys for work agent. 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..c2915a79a 100644 --- a/vendor/open-cluster-management.io/api/work/v1/types.go +++ b/vendor/open-cluster-management.io/api/work/v1/types.go @@ -545,6 +545,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 {