From 7c55e8f575eedbeb17eba00a12c926a53b22a1f3 Mon Sep 17 00:00:00 2001 From: DangPeng Liu Date: Tue, 15 Nov 2022 15:42:27 +0800 Subject: [PATCH] upgrade clusterset to v1beta2 (#537) Signed-off-by: ldpliu Signed-off-by: ldpliu --- cmd/controller/app/server.go | 7 +- go.mod | 2 +- go.sum | 4 +- hack/update-apiserver-gen.sh | 2 +- pkg/cache/managedclusterset.go | 18 +- pkg/cache/managedclusterset_test.go | 20 +- .../clusterclaim/clusterclaim_controller.go | 4 +- .../clusterclaim_controller_test.go | 8 +- .../clusterdeployment_controller.go | 4 +- .../clusterdeployment_controller_test.go | 18 +- .../clustersetmapper/clusterset_controller.go | 26 +- .../clusterset_controller_test.go | 44 ++-- .../globalclusterset/globalset_controller.go | 20 +- .../globalset_controller_test.go | 32 +-- .../syncclusterrolebinding_controller.go | 6 +- .../syncrolebinding_controller.go | 6 +- pkg/proxyserver/api/register.go | 4 +- .../apis/clusterview/v1alpha1/register.go | 6 +- .../apis/openapi/openapi_generated.go | 238 +++++++++++++++--- .../managedclusterset/managedclusterset.go | 22 +- pkg/utils/clusterset/clusterset.go | 16 +- pkg/webhook/clusterset/validatingWebhook.go | 14 +- .../clusterset/validatingWebhook_test.go | 10 +- test/e2e/clusterset_test.go | 22 +- test/e2e/util/managedclusterset.go | 22 +- test/e2e/webhook_test.go | 22 +- vendor/modules.txt | 4 +- ...gement.io_clustermanagementaddons.crd.yaml | 5 + ...anagement.io_managedclusteraddons.crd.yaml | 2 + .../v1alpha1/types_clustermanagementaddon.go | 5 + .../clientset/versioned/scheme/register.go | 14 +- .../clientset/versioned/fake/register.go | 14 +- .../clientset/versioned/scheme/register.go | 14 +- .../clientset/versioned/scheme/register.go | 14 +- ...uster-management.io_clusterclaims.crd.yaml | 2 +- ...uster-management.io_clusterclaims.crd.yaml | 2 +- .../api/cluster/v1alpha1/types.go | 7 +- .../v1alpha1/types_addonplacementscore.go | 4 +- .../zz_generated.swagger_doc_generated.go | 2 +- ...-management.io_managedclustersets.crd.yaml | 2 +- ...-cluster-management.io_placements.crd.yaml | 43 +++- .../v1beta1/types_managedclusterset.go | 8 +- .../api/cluster/v1beta1/types_placement.go | 81 +++++- .../v1beta1/types_placementdecision.go | 2 +- .../cluster/v1beta1/zz_generated.deepcopy.go | 38 +++ .../zz_generated.swagger_doc_generated.go | 28 ++- ...-management.io_managedclustersets.crd.yaml | 4 +- .../v1beta2/types_managedclusterset.go | 8 +- .../zz_generated.swagger_doc_generated.go | 2 +- ...anagement.io_appliedmanifestworks.crd.yaml | 3 + ...anagement.io_appliedmanifestworks.crd.yaml | 3 + .../api/work/v1/types.go | 3 + .../v1/zz_generated.swagger_doc_generated.go | 1 + 53 files changed, 637 insertions(+), 275 deletions(-) diff --git a/cmd/controller/app/server.go b/cmd/controller/app/server.go index 4bec1c2f7..b965da3c5 100644 --- a/cmd/controller/app/server.go +++ b/cmd/controller/app/server.go @@ -49,6 +49,8 @@ import ( clusterv1 "open-cluster-management.io/api/cluster/v1" clusterv1alaph1 "open-cluster-management.io/api/cluster/v1alpha1" clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" ) @@ -66,6 +68,7 @@ func init() { _ = actionv1beta1.AddToScheme(scheme) _ = clusterv1alaph1.Install(scheme) _ = clusterv1beta1.Install(scheme) + _ = clusterv1beta2.Install(scheme) _ = v1alpha1.AddToScheme(scheme) _ = routev1.Install(scheme) } @@ -154,13 +157,13 @@ func Run(o *options.ControllerRunOptions, ctx context.Context) error { } clusterSetAdminCache := cache.NewClusterSetCache( - clusterInformers.Cluster().V1beta1().ManagedClusterSets(), + clusterInformers.Cluster().V1beta2().ManagedClusterSets(), kubeInfomers.Rbac().V1().ClusterRoles(), kubeInfomers.Rbac().V1().ClusterRoleBindings(), utils.GetAdminResourceFromClusterRole, ) clusterSetViewCache := cache.NewClusterSetCache( - clusterInformers.Cluster().V1beta1().ManagedClusterSets(), + clusterInformers.Cluster().V1beta2().ManagedClusterSets(), kubeInfomers.Rbac().V1().ClusterRoles(), kubeInfomers.Rbac().V1().ClusterRoleBindings(), utils.GetViewResourceFromClusterRole, diff --git a/go.mod b/go.mod index 96fdf21b2..11fe0289c 100644 --- a/go.mod +++ b/go.mod @@ -81,7 +81,7 @@ require ( k8s.io/kube-aggregator v0.24.1 k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 open-cluster-management.io/addon-framework v0.5.0 - open-cluster-management.io/api v0.9.0 + open-cluster-management.io/api v0.9.1-0.20221107101616-fde10e6996f6 sigs.k8s.io/controller-runtime v0.12.1 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index ebb266784..00b17aea2 100644 --- a/go.sum +++ b/go.sum @@ -1011,8 +1011,8 @@ k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/l k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= open-cluster-management.io/addon-framework v0.5.0 h1:JsjzbS7gRvTbjxJdYGLJzJUO99zLQuOkyXL1fppcd5s= open-cluster-management.io/addon-framework v0.5.0/go.mod h1:Fymctw1tnmCTXnmAMgc0zdHetAw6UaiAsj1S6w5VW6s= -open-cluster-management.io/api v0.9.0 h1:JQidCTMY3RdS0m3UDP24j6ykNpxWJ20LEdNtbxJApxo= -open-cluster-management.io/api v0.9.0/go.mod h1:+OEARSAl2jIhuLItUcS30UgLA3khmA9ihygLVxzEn+U= +open-cluster-management.io/api v0.9.1-0.20221107101616-fde10e6996f6 h1:jXx0C2GKScyZSxyyvswxmgspQgx7SnBic80EM57EdOw= +open-cluster-management.io/api v0.9.1-0.20221107101616-fde10e6996f6/go.mod h1:9KkJPh/zpDevXj2P+zkvSVjC2pq2PQ1JDNLLEes8TEc= 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/hack/update-apiserver-gen.sh b/hack/update-apiserver-gen.sh index a9955d06f..5175c39a9 100755 --- a/hack/update-apiserver-gen.sh +++ b/hack/update-apiserver-gen.sh @@ -43,6 +43,6 @@ SC_PKG='github.com/stolostron/multicloud-operators-foundation' "${BINDIR}"/openapi-gen "$@" \ --v 1 --logtostderr \ --go-header-file "${REPO_ROOT}"/hack/custom-boilerplate.go.txt \ - --input-dirs "${SC_PKG}/pkg/proxyserver/apis/proxy/v1beta1,${SC_PKG}/pkg/proxyserver/apis/clusterview/v1,${SC_PKG}/pkg/proxyserver/apis/clusterview/v1alpha1,open-cluster-management.io/api/cluster/v1,open-cluster-management.io/api/cluster/v1beta1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/apis/meta/v1" \ + --input-dirs "${SC_PKG}/pkg/proxyserver/apis/proxy/v1beta1,${SC_PKG}/pkg/proxyserver/apis/clusterview/v1,${SC_PKG}/pkg/proxyserver/apis/clusterview/v1alpha1,open-cluster-management.io/api/cluster/v1,open-cluster-management.io/api/cluster/v1beta2,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/apis/meta/v1" \ --output-package "${SC_PKG}/pkg/proxyserver/apis/openapi" \ --report-filename ".api_violation.report" diff --git a/pkg/cache/managedclusterset.go b/pkg/cache/managedclusterset.go index 77779ea20..a7aa1a643 100644 --- a/pkg/cache/managedclusterset.go +++ b/pkg/cache/managedclusterset.go @@ -3,9 +3,9 @@ package cache import ( "time" - clusterinformerv1beta1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1beta1" - clusterv1beta1lister "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterinformerv1beta2 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1beta2" + clusterv1beta2lister "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta2" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" v1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -21,15 +21,15 @@ import ( // ClusterSetLister enforces ability to enumerate clusterSet based on role type ClusterSetLister interface { // List returns the list of ManagedClusterSet items that the user can access - List(user user.Info, selector labels.Selector) (*clusterv1beta1.ManagedClusterSetList, error) + List(user user.Info, selector labels.Selector) (*clusterv1beta2.ManagedClusterSetList, error) } type ClusterSetCache struct { Cache *AuthCache - clusterSetLister clusterv1beta1lister.ManagedClusterSetLister + clusterSetLister clusterv1beta2lister.ManagedClusterSetLister } -func NewClusterSetCache(clusterSetInformer clusterinformerv1beta1.ManagedClusterSetInformer, +func NewClusterSetCache(clusterSetInformer clusterinformerv1beta2.ManagedClusterSetInformer, clusterRoleInformer rbacv1informers.ClusterRoleInformer, clusterRolebindingInformer rbacv1informers.ClusterRoleBindingInformer, getResourceNamesFromClusterRole func(*v1.ClusterRole, string, string) (sets.String, bool), @@ -64,10 +64,10 @@ func (c *ClusterSetCache) Run(period time.Duration) { go utilwait.Forever(func() { c.Cache.synchronize() }, period) } -func (c *ClusterSetCache) List(userInfo user.Info, selector labels.Selector) (*clusterv1beta1.ManagedClusterSetList, error) { +func (c *ClusterSetCache) List(userInfo user.Info, selector labels.Selector) (*clusterv1beta2.ManagedClusterSetList, error) { names := c.Cache.listNames(userInfo) - clusterSetList := &clusterv1beta1.ManagedClusterSetList{} + clusterSetList := &clusterv1beta2.ManagedClusterSetList{} for key := range names { clusterSet, err := c.clusterSetLister.Get(key) if errors.IsNotFound(err) { @@ -96,7 +96,7 @@ func (c *ClusterSetCache) Get(name string) (runtime.Object, error) { func (c *ClusterSetCache) ConvertResource(name string) runtime.Object { clusterSet, err := c.clusterSetLister.Get(name) if err != nil { - clusterSet = &clusterv1beta1.ManagedClusterSet{ObjectMeta: metav1.ObjectMeta{Name: name}} + clusterSet = &clusterv1beta2.ManagedClusterSet{ObjectMeta: metav1.ObjectMeta{Name: name}} } return clusterSet diff --git a/pkg/cache/managedclusterset_test.go b/pkg/cache/managedclusterset_test.go index e0781038d..26ac30edf 100644 --- a/pkg/cache/managedclusterset_test.go +++ b/pkg/cache/managedclusterset_test.go @@ -15,12 +15,12 @@ import ( "k8s.io/client-go/kubernetes/fake" clusterfake "open-cluster-management.io/api/client/cluster/clientset/versioned/fake" clusterinformers "open-cluster-management.io/api/client/cluster/informers/externalversions" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) var ( - managedClusterSetList = clusterv1beta1.ManagedClusterSetList{ - Items: []clusterv1beta1.ManagedClusterSet{ + managedClusterSetList = clusterv1beta2.ManagedClusterSetList{ + Items: []clusterv1beta2.ManagedClusterSet{ { ObjectMeta: metav1.ObjectMeta{Name: "clusterset1", ResourceVersion: "1"}, }, @@ -138,16 +138,16 @@ var ( } ) -func newManagedClusterSet(names ...string) []*clusterv1beta1.ManagedClusterSet { - ret := []*clusterv1beta1.ManagedClusterSet{} +func newManagedClusterSet(names ...string) []*clusterv1beta2.ManagedClusterSet { + ret := []*clusterv1beta2.ManagedClusterSet{} for _, name := range names { - ret = append(ret, &clusterv1beta1.ManagedClusterSet{ObjectMeta: metav1.ObjectMeta{Name: name}}) + ret = append(ret, &clusterv1beta2.ManagedClusterSet{ObjectMeta: metav1.ObjectMeta{Name: name}}) } return ret } -func validateClusterSetCacheListList(clusterSetList *clusterv1beta1.ManagedClusterSetList, expectedSet sets.String) bool { +func validateClusterSetCacheListList(clusterSetList *clusterv1beta2.ManagedClusterSetList, expectedSet sets.String) bool { clusterSets := sets.String{} for _, clusterSet := range clusterSetList.Items { clusterSets.Insert(clusterSet.Name) @@ -171,12 +171,12 @@ func fakeNewClusterSetCache(stopCh chan struct{}) *ClusterSetCache { fakeClusterSetClient := clusterfake.NewSimpleClientset(&managedClusterSetList) clusterInformers := clusterinformers.NewSharedInformerFactory(fakeClusterSetClient, 10*time.Minute) for key := range managedClusterSetList.Items { - clusterInformers.Cluster().V1beta1().ManagedClusterSets().Informer().GetIndexer().Add(&managedClusterSetList.Items[key]) + clusterInformers.Cluster().V1beta2().ManagedClusterSets().Informer().GetIndexer().Add(&managedClusterSetList.Items[key]) } clusterInformers.Start(stopCh) return NewClusterSetCache( - clusterInformers.Cluster().V1beta1().ManagedClusterSets(), + clusterInformers.Cluster().V1beta2().ManagedClusterSets(), informers.Rbac().V1().ClusterRoles(), informers.Rbac().V1().ClusterRoleBindings(), utils.GetViewResourceFromClusterRole, @@ -267,7 +267,7 @@ func TestClusterSetCacheListObj(t *testing.T) { t.Run(test.name, func(t *testing.T) { clusterSetList, err := clusterSetCache.ListObjects(test.user) validateError(t, err, test.expectedErr) - assert.Equal(t, validateClusterSetCacheListList(clusterSetList.(*clusterv1beta1.ManagedClusterSetList), test.expectedClusterSets), true) + assert.Equal(t, validateClusterSetCacheListList(clusterSetList.(*clusterv1beta2.ManagedClusterSetList), test.expectedClusterSets), true) }) } } diff --git a/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller.go b/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller.go index dfe53f691..06e38aae5 100644 --- a/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller.go +++ b/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller.go @@ -9,7 +9,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/klog" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -133,7 +133,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu klog.V(5).Infof("Clusterclaim's clusterdeployment: %+v", clusterDeployment) var isModified = false - utils.SyncMapField(&isModified, &clusterclaim.Labels, clusterDeployment.Labels, clusterv1beta1.ClusterSetLabel) + utils.SyncMapField(&isModified, &clusterclaim.Labels, clusterDeployment.Labels, clusterv1beta2.ClusterSetLabel) if isModified { err = r.client.Update(ctx, clusterclaim, &client.UpdateOptions{}) diff --git a/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller_test.go b/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller_test.go index 0daa500f5..a896bcef3 100644 --- a/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller_test.go +++ b/pkg/controllers/clusterset/clusterclaim/clusterclaim_controller_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -78,7 +78,7 @@ func TestReconcile(t *testing.T) { Name: "dep1", Namespace: "dep1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, Spec: hivev1.ClusterDeploymentSpec{}, @@ -91,7 +91,7 @@ func TestReconcile(t *testing.T) { }, }, expectedlabel: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, { @@ -102,7 +102,7 @@ func TestReconcile(t *testing.T) { Name: "clusterClaim1", Namespace: "ns1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, Spec: hivev1.ClusterClaimSpec{ diff --git a/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller.go b/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller.go index 71f32aaf5..8104a84e3 100644 --- a/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller.go +++ b/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller.go @@ -4,7 +4,7 @@ import ( "context" "github.com/stolostron/multicloud-operators-foundation/pkg/utils" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" hivev1 "github.com/openshift/hive/apis/hive/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -191,7 +191,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu } var isModified = false - utils.SyncMapField(&isModified, &clusterdeployment.Labels, targetLabels, clusterv1beta1.ClusterSetLabel) + utils.SyncMapField(&isModified, &clusterdeployment.Labels, targetLabels, clusterv1beta2.ClusterSetLabel) if isModified { err = r.client.Update(ctx, clusterdeployment, &client.UpdateOptions{}) diff --git a/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller_test.go b/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller_test.go index 0bc8636dc..ff87d5c4a 100644 --- a/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller_test.go +++ b/pkg/controllers/clusterset/clusterdeployment/clusterdeployment_controller_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -92,7 +92,7 @@ func TestReconcile(t *testing.T) { Name: "pool1", Namespace: "poolNs1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, Spec: hivev1.ClusterPoolSpec{}, @@ -105,7 +105,7 @@ func TestReconcile(t *testing.T) { }, }, expectedlabel: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, { @@ -116,7 +116,7 @@ func TestReconcile(t *testing.T) { Name: "clusterdeployment1", Namespace: "ns1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, Spec: hivev1.ClusterDeploymentSpec{ @@ -167,7 +167,7 @@ func TestReconcile(t *testing.T) { Name: "pool1", Namespace: "poolNs1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, Spec: hivev1.ClusterPoolSpec{}, @@ -178,7 +178,7 @@ func TestReconcile(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "cd1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, }, @@ -190,7 +190,7 @@ func TestReconcile(t *testing.T) { }, }, expectedlabel: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, { @@ -210,7 +210,7 @@ func TestReconcile(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "cd1", Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, }, @@ -222,7 +222,7 @@ func TestReconcile(t *testing.T) { }, }, expectedlabel: map[string]string{ - clusterv1beta1.ClusterSetLabel: "clusterSet1", + clusterv1beta2.ClusterSetLabel: "clusterSet1", }, }, } diff --git a/pkg/controllers/clusterset/clustersetmapper/clusterset_controller.go b/pkg/controllers/clusterset/clustersetmapper/clusterset_controller.go index 5d9166831..08e90c2b7 100644 --- a/pkg/controllers/clusterset/clustersetmapper/clusterset_controller.go +++ b/pkg/controllers/clusterset/clustersetmapper/clusterset_controller.go @@ -7,7 +7,7 @@ import ( "github.com/stolostron/multicloud-operators-foundation/pkg/utils" clustersetutils "github.com/stolostron/multicloud-operators-foundation/pkg/utils/clusterset" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" hivev1 "github.com/openshift/hive/apis/hive/v1" "k8s.io/apimachinery/pkg/labels" @@ -63,7 +63,7 @@ func add(mgr manager.Manager, clusterSetClusterMapper *helpers.ClusterSetMapper, return err } - err = c.Watch(&source.Kind{Type: &clusterv1beta1.ManagedClusterSet{}}, &handler.EnqueueRequestForObject{}) + err = c.Watch(&source.Kind{Type: &clusterv1beta2.ManagedClusterSet{}}, &handler.EnqueueRequestForObject{}) if err != nil { return err } @@ -155,14 +155,14 @@ func add(mgr manager.Manager, clusterSetClusterMapper *helpers.ClusterSetMapper, func getRequiredClusterSet(labels map[string]string, clusterSetMapper *helpers.ClusterSetMapper, namespace string) []reconcile.Request { var currentSet string var requests []reconcile.Request - if labels != nil && len(labels[clusterv1beta1.ClusterSetLabel]) != 0 { + if labels != nil && len(labels[clusterv1beta2.ClusterSetLabel]) != 0 { request := reconcile.Request{ NamespacedName: types.NamespacedName{ - Name: labels[clusterv1beta1.ClusterSetLabel], + Name: labels[clusterv1beta2.ClusterSetLabel], }, } requests = append(requests, request) - currentSet = labels[clusterv1beta1.ClusterSetLabel] + currentSet = labels[clusterv1beta2.ClusterSetLabel] } managedClusterset := clusterSetMapper.GetObjectClusterset(namespace) @@ -180,7 +180,7 @@ func getRequiredClusterSet(labels map[string]string, clusterSetMapper *helpers.C } func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - clusterset := &clusterv1beta1.ManagedClusterSet{} + clusterset := &clusterv1beta2.ManagedClusterSet{} err := r.client.Get(ctx, types.NamespacedName{Name: req.Name}, clusterset) if err != nil { @@ -231,9 +231,9 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu } // applyClusterSetClusterRoles apply the clusterset clusterrole(admin/bind/view) -func (r *Reconciler) applyClusterSetClusterRoles(clusterset *clusterv1beta1.ManagedClusterSet) error { +func (r *Reconciler) applyClusterSetClusterRoles(clusterset *clusterv1beta2.ManagedClusterSet) error { errs := []error{} - if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta1.LegacyClusterSetLabel { + if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta2.ExclusiveClusterSetLabel { adminRole := clustersetutils.BuildAdminRole(clusterset.Name) err := utils.ApplyClusterRole(r.kubeClient, adminRole) if err != nil { @@ -260,7 +260,7 @@ func (r *Reconciler) applyClusterSetClusterRoles(clusterset *clusterv1beta1.Mana // cleanClusterSetResource clean the clusterrole // and delete clusterset related resource in clusterSetClusterMapper and clusterSetNamespaceMapper -func (r *Reconciler) cleanClusterSetResource(clusterset *clusterv1beta1.ManagedClusterSet) error { +func (r *Reconciler) cleanClusterSetResource(clusterset *clusterv1beta2.ManagedClusterSet) error { err := utils.DeleteClusterRole(r.kubeClient, utils.GenerateClustersetClusterroleName(clusterset.Name, "bind")) if err != nil { @@ -275,7 +275,7 @@ func (r *Reconciler) cleanClusterSetResource(clusterset *clusterv1beta1.ManagedC } //Only LegacyClusterSet has admin clusterrole, so only LegacyClusterSet need to delete it here. - if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta1.LegacyClusterSetLabel { + if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta2.ExclusiveClusterSetLabel { err := utils.DeleteClusterRole(r.kubeClient, utils.GenerateClustersetClusterroleName(clusterset.Name, "admin")) if err != nil { klog.Warningf("will reconcile since failed to delete clusterrole. clusterset: %v, err: %v", clusterset.Name, err) @@ -296,8 +296,8 @@ func (r *Reconciler) cleanClusterSetResource(clusterset *clusterv1beta1.ManagedC // r.clusterSetClusterMapper(map[string]sets.String) stores the map of to , each item in the map means the clusterset include these clusters // r.clusterSetNamespaceMapper (map[string]sets.String) stores the map of to , the namespaces are the namespace of clusterpools/clusterclaims/clusterdeployments which are in this clusterset. // These three Mappers are used to propagate the clusterset admin/bind/view permission to managedclusters/managedclusters namespaces/clusterpools namespace/clusterclaims namespace/clusterdeployments namespaces which are in the clusterset. -func (r *Reconciler) syncClustersetMapper(clusterset *clusterv1beta1.ManagedClusterSet) error { - selector, err := clusterv1beta1.BuildClusterSelector(clusterset) +func (r *Reconciler) syncClustersetMapper(clusterset *clusterv1beta2.ManagedClusterSet) error { + selector, err := clusterv1beta2.BuildClusterSelector(clusterset) if err != nil { return err } @@ -306,7 +306,7 @@ func (r *Reconciler) syncClustersetMapper(clusterset *clusterv1beta1.ManagedClus return err } - if clusterset.Spec.ClusterSelector.SelectorType != clusterv1beta1.LegacyClusterSetLabel { + if clusterset.Spec.ClusterSelector.SelectorType != clusterv1beta2.ExclusiveClusterSetLabel { r.globalClusterSetClusterMapper.UpdateClusterSetByObjects(clusterset.Name, clusters) return nil } diff --git a/pkg/controllers/clusterset/clustersetmapper/clusterset_controller_test.go b/pkg/controllers/clusterset/clustersetmapper/clusterset_controller_test.go index 12062c400..6bc140383 100644 --- a/pkg/controllers/clusterset/clustersetmapper/clusterset_controller_test.go +++ b/pkg/controllers/clusterset/clustersetmapper/clusterset_controller_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" k8sfake "k8s.io/client-go/kubernetes/fake" "k8s.io/klog" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" @@ -64,14 +64,14 @@ func TestMain(m *testing.M) { // AddToSchemes may be used to add all resources defined in the project to a Scheme var AddToSchemes runtime.SchemeBuilder // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back - AddToSchemes = append(AddToSchemes, clusterv1beta1.Install, clusterv1.Install) + AddToSchemes = append(AddToSchemes, clusterv1beta2.Install, clusterv1.Install) if err := AddToSchemes.AddToScheme(scheme); err != nil { klog.Errorf("Failed adding apis to scheme, %v", err) os.Exit(1) } - if err := clusterv1beta1.Install(scheme); err != nil { + if err := clusterv1beta2.Install(scheme); err != nil { klog.Errorf("Failed adding cluster to scheme, %v", err) os.Exit(1) } @@ -184,7 +184,7 @@ func TestReconcile(t *testing.T) { { name: "ManagedClusterSetHasFinalizerWithoutClusterRole", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: ManagedClusterSetName, DeletionTimestamp: &metav1.Time{ @@ -194,9 +194,9 @@ func TestReconcile(t *testing.T) { clustersetutils.ClustersetRoleFinalizerName, }, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LegacyClusterSetLabel, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.ExclusiveClusterSetLabel, }, }, }, @@ -215,13 +215,13 @@ func TestReconcile(t *testing.T) { { name: "ManagedClusterSetNoFinalizerWithoutClusterRole", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: ManagedClusterSetName, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LegacyClusterSetLabel, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.ExclusiveClusterSetLabel, }, }, }, @@ -229,7 +229,7 @@ func TestReconcile(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: ManagedClusterName, Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: ManagedClusterSetName, + clusterv1beta2.ClusterSetLabel: ManagedClusterSetName, }, }, }, @@ -250,13 +250,13 @@ func TestReconcile(t *testing.T) { { name: "ManagedClusterSetNoFinalizerWithClusterRole", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: ManagedClusterSetName, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LegacyClusterSetLabel, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.ExclusiveClusterSetLabel, }, }, }, @@ -276,13 +276,13 @@ func TestReconcile(t *testing.T) { { name: "Sync global set", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: "global", }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{}, }, }, @@ -344,14 +344,14 @@ func TestGetRequiredClusterSet(t *testing.T) { { name: "Only have set label", labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "set1", + clusterv1beta2.ClusterSetLabel: "set1", }, expectRequestLen: 1, }, { name: "Only have set label", labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: "set1", + clusterv1beta2.ClusterSetLabel: "set1", }, clusterSetMap: map[string]sets.String{"set2": sets.NewString("t1-ns", "t1-ns1")}, expectRequestLen: 2, diff --git a/pkg/controllers/clusterset/globalclusterset/globalset_controller.go b/pkg/controllers/clusterset/globalclusterset/globalset_controller.go index 34a2e0a83..e20a2cf85 100644 --- a/pkg/controllers/clusterset/globalclusterset/globalset_controller.go +++ b/pkg/controllers/clusterset/globalclusterset/globalset_controller.go @@ -5,7 +5,7 @@ import ( clustersetutils "github.com/stolostron/multicloud-operators-foundation/pkg/utils/clusterset" v1 "k8s.io/api/core/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -58,15 +58,15 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { return err } - err = c.Watch(&source.Kind{Type: &clusterv1beta1.ManagedClusterSet{}}, + err = c.Watch(&source.Kind{Type: &clusterv1beta2.ManagedClusterSet{}}, handler.EnqueueRequestsFromMapFunc( handler.MapFunc(func(a client.Object) []reconcile.Request { - clusterset, ok := a.(*clusterv1beta1.ManagedClusterSet) + clusterset, ok := a.(*clusterv1beta2.ManagedClusterSet) if !ok { klog.Error("clusterset handler received non-clusterset object") return []reconcile.Request{} } - if clusterset.Spec.ClusterSelector.SelectorType != clusterv1beta1.LabelSelector { + if clusterset.Spec.ClusterSelector.SelectorType != clusterv1beta2.LabelSelector { return []reconcile.Request{} } if clusterset.Name != clustersetutils.GlobalSetName { @@ -82,10 +82,10 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { }), ), ) - err = c.Watch(&source.Kind{Type: &clusterv1beta1.ManagedClusterSetBinding{}}, + err = c.Watch(&source.Kind{Type: &clusterv1beta2.ManagedClusterSetBinding{}}, handler.EnqueueRequestsFromMapFunc( handler.MapFunc(func(a client.Object) []reconcile.Request { - clustersetbinding, ok := a.(*clusterv1beta1.ManagedClusterSetBinding) + clustersetbinding, ok := a.(*clusterv1beta2.ManagedClusterSetBinding) if !ok { klog.Error("clustersetbinding handler received non-clustersetbinding object") return []reconcile.Request{} @@ -116,7 +116,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { } func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - clusterset := &clusterv1beta1.ManagedClusterSet{} + clusterset := &clusterv1beta2.ManagedClusterSet{} err := r.client.Get(ctx, types.NamespacedName{Name: req.Name}, clusterset) if err != nil { @@ -167,19 +167,19 @@ func (r *Reconciler) applyGlobalNsAndSetBinding() error { } //Apply clusterset Binding - globalSetBinding := &clusterv1beta1.ManagedClusterSetBinding{} + globalSetBinding := &clusterv1beta2.ManagedClusterSetBinding{} err = r.client.Get(context.TODO(), types.NamespacedName{Name: clustersetutils.GlobalSetName, Namespace: clustersetutils.GlobalSetNameSpace}, globalSetBinding) if err != nil { if !errors.IsNotFound(err) { return err } - setBinding := &clusterv1beta1.ManagedClusterSetBinding{ + setBinding := &clusterv1beta2.ManagedClusterSetBinding{ ObjectMeta: metav1.ObjectMeta{ Name: clustersetutils.GlobalSetName, Namespace: clustersetutils.GlobalSetNameSpace, }, - Spec: clusterv1beta1.ManagedClusterSetBindingSpec{ + Spec: clusterv1beta2.ManagedClusterSetBindingSpec{ ClusterSet: clustersetutils.GlobalSetName, }, } diff --git a/pkg/controllers/clusterset/globalclusterset/globalset_controller_test.go b/pkg/controllers/clusterset/globalclusterset/globalset_controller_test.go index e545ff9c2..b946decf1 100644 --- a/pkg/controllers/clusterset/globalclusterset/globalset_controller_test.go +++ b/pkg/controllers/clusterset/globalclusterset/globalset_controller_test.go @@ -22,7 +22,7 @@ import ( "k8s.io/apimachinery/pkg/types" k8sfake "k8s.io/client-go/kubernetes/fake" "k8s.io/klog" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/envtest" @@ -47,14 +47,14 @@ func TestMain(m *testing.M) { // AddToSchemes may be used to add all resources defined in the project to a Scheme var AddToSchemes runtime.SchemeBuilder // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back - AddToSchemes = append(AddToSchemes, clusterv1beta1.Install, clusterv1.Install) + AddToSchemes = append(AddToSchemes, clusterv1beta2.Install, clusterv1.Install) if err := AddToSchemes.AddToScheme(scheme); err != nil { klog.Errorf("Failed adding apis to scheme, %v", err) os.Exit(1) } - if err := clusterv1beta1.Install(scheme); err != nil { + if err := clusterv1beta2.Install(scheme); err != nil { klog.Errorf("Failed adding cluster to scheme, %v", err) os.Exit(1) } @@ -127,13 +127,13 @@ func TestApplyGlobalNsAndSetBinding(t *testing.T) { { name: "Has Global set", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: clustersetutils.GlobalSetName, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{}, }, }, @@ -144,7 +144,7 @@ func TestApplyGlobalNsAndSetBinding(t *testing.T) { { name: "deleting Global set", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: clustersetutils.GlobalSetName, DeletionTimestamp: &metav1.Time{ @@ -154,9 +154,9 @@ func TestApplyGlobalNsAndSetBinding(t *testing.T) { clustersetutils.ClustersetRoleFinalizerName, }, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{}, }, }, @@ -167,16 +167,16 @@ func TestApplyGlobalNsAndSetBinding(t *testing.T) { { name: "global set has annotation", existingObjs: []runtime.Object{ - &clusterv1beta1.ManagedClusterSet{ + &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: clustersetutils.GlobalSetName, Annotations: map[string]string{ globalNamespaceAnnotation: "true", }, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{}, }, }, @@ -194,7 +194,7 @@ func TestApplyGlobalNsAndSetBinding(t *testing.T) { Name: clustersetutils.GlobalSetName, }, }) - globalSetBinding := &clusterv1beta1.ManagedClusterSetBinding{} + globalSetBinding := &clusterv1beta2.ManagedClusterSetBinding{} setBindingExist := true globalNsExist := true err := r.client.Get(context.TODO(), types.NamespacedName{Name: clustersetutils.GlobalSetName, Namespace: clustersetutils.GlobalSetNameSpace}, globalSetBinding) diff --git a/pkg/controllers/clusterset/syncclusterrolebinding/syncclusterrolebinding_controller.go b/pkg/controllers/clusterset/syncclusterrolebinding/syncclusterrolebinding_controller.go index 8f91d6e73..793122efe 100644 --- a/pkg/controllers/clusterset/syncclusterrolebinding/syncclusterrolebinding_controller.go +++ b/pkg/controllers/clusterset/syncclusterrolebinding/syncclusterrolebinding_controller.go @@ -5,7 +5,7 @@ import ( "strings" "time" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "github.com/stolostron/multicloud-operators-foundation/pkg/cache" "github.com/stolostron/multicloud-operators-foundation/pkg/helpers" @@ -80,7 +80,7 @@ func (r *Reconciler) syncManagedClusterClusterroleBinding(ctx context.Context, c //Delete clusterrolebinding //List Clusterset related clusterrolebinding - clusterRoleBindingList, err := r.kubeClient.RbacV1().ClusterRoleBindings().List(ctx, metav1.ListOptions{LabelSelector: clusterv1beta1.ClusterSetLabel}) + clusterRoleBindingList, err := r.kubeClient.RbacV1().ClusterRoleBindings().List(ctx, metav1.ListOptions{LabelSelector: clusterv1beta2.ClusterSetLabel}) if err != nil { klog.Errorf("Error to list clusterrolebinding. error:%v", err) } @@ -120,7 +120,7 @@ func generateRequiredClusterRoleBinding(clusterName string, subjects []rbacv1.Su clusterRoleName := utils.GenerateClusterRoleName(clusterName, role) var labels = make(map[string]string) - labels[clusterv1beta1.ClusterSetLabel] = clustersetName + labels[clusterv1beta2.ClusterSetLabel] = clustersetName labels[clustersetutils.ClusterSetRole] = role return &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/controllers/clusterset/syncrolebinding/syncrolebinding_controller.go b/pkg/controllers/clusterset/syncrolebinding/syncrolebinding_controller.go index ff8c7ba68..fac68e841 100644 --- a/pkg/controllers/clusterset/syncrolebinding/syncrolebinding_controller.go +++ b/pkg/controllers/clusterset/syncrolebinding/syncrolebinding_controller.go @@ -7,7 +7,7 @@ import ( "github.com/stolostron/multicloud-operators-foundation/pkg/helpers" "github.com/stolostron/multicloud-operators-foundation/pkg/utils" clustersetutils "github.com/stolostron/multicloud-operators-foundation/pkg/utils/clusterset" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilwait "k8s.io/apimachinery/pkg/util/wait" @@ -92,7 +92,7 @@ func (r *Reconciler) syncRoleBinding(ctx context.Context, clustersetToNamespace } //Delete rolebinding - roleBindingList, err := r.kubeClient.RbacV1().RoleBindings("").List(ctx, metav1.ListOptions{LabelSelector: clusterv1beta1.ClusterSetLabel}) + roleBindingList, err := r.kubeClient.RbacV1().RoleBindings("").List(ctx, metav1.ListOptions{LabelSelector: clusterv1beta2.ClusterSetLabel}) if err != nil { klog.Errorf("Error to list clusterrolebinding. error:%v", err) } @@ -119,7 +119,7 @@ func (r *Reconciler) syncRoleBinding(ctx context.Context, clustersetToNamespace func generateRequiredRoleBinding(resourceNameSpace string, subjects []rbacv1.Subject, clustersetName string, role string) *rbacv1.RoleBinding { roleBindingName := utils.GenerateClustersetResourceRoleBindingName(role) var labels = make(map[string]string) - labels[clusterv1beta1.ClusterSetLabel] = clustersetName + labels[clusterv1beta2.ClusterSetLabel] = clustersetName labels[clustersetutils.ClusterSetRole] = role return &rbacv1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/proxyserver/api/register.go b/pkg/proxyserver/api/register.go index 56cb48b2b..fd2ebdf34 100644 --- a/pkg/proxyserver/api/register.go +++ b/pkg/proxyserver/api/register.go @@ -82,7 +82,7 @@ func installClusterViewGroup(server *genericapiserver.GenericAPIServer, } clusterSetCache := cache.NewClusterSetCache( - clusterInformer.Cluster().V1beta1().ManagedClusterSets(), + clusterInformer.Cluster().V1beta2().ManagedClusterSets(), informerFactory.Rbac().V1().ClusterRoles(), informerFactory.Rbac().V1().ClusterRoleBindings(), utils.GetViewResourceFromClusterRole, @@ -91,7 +91,7 @@ func installClusterViewGroup(server *genericapiserver.GenericAPIServer, v1beta1storage := map[string]rest.Storage{ "managedclustersets": managedclusterset.NewREST( client, clusterSetCache, clusterSetCache, - clusterInformer.Cluster().V1beta1().ManagedClusterSets().Lister(), + clusterInformer.Cluster().V1beta2().ManagedClusterSets().Lister(), informerFactory.Rbac().V1().ClusterRoles().Lister(), ), } diff --git a/pkg/proxyserver/apis/clusterview/v1alpha1/register.go b/pkg/proxyserver/apis/clusterview/v1alpha1/register.go index 0eee13895..4293df73d 100644 --- a/pkg/proxyserver/apis/clusterview/v1alpha1/register.go +++ b/pkg/proxyserver/apis/clusterview/v1alpha1/register.go @@ -4,7 +4,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) const GroupName = "clusterview.open-cluster-management.io" @@ -26,8 +26,8 @@ var ( // Adds the list of known types to api.Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(GroupVersion, - &clusterv1beta1.ManagedClusterSet{}, - &clusterv1beta1.ManagedClusterSetList{}, + &clusterv1beta2.ManagedClusterSet{}, + &clusterv1beta2.ManagedClusterSetList{}, ) metav1.AddToGroupVersion(scheme, GroupVersion) return nil diff --git a/pkg/proxyserver/apis/openapi/openapi_generated.go b/pkg/proxyserver/apis/openapi/openapi_generated.go index a23070c61..edc43a905 100644 --- a/pkg/proxyserver/apis/openapi/openapi_generated.go +++ b/pkg/proxyserver/apis/openapi/openapi_generated.go @@ -81,13 +81,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "open-cluster-management.io/api/cluster/v1.ManagedClusterSpec": schema_open_cluster_managementio_api_cluster_v1_ManagedClusterSpec(ref), "open-cluster-management.io/api/cluster/v1.ManagedClusterStatus": schema_open_cluster_managementio_api_cluster_v1_ManagedClusterStatus(ref), "open-cluster-management.io/api/cluster/v1.ManagedClusterVersion": schema_open_cluster_managementio_api_cluster_v1_ManagedClusterVersion(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSet": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSet(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBinding": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBinding(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBindingList": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindingList(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBindingSpec": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindingSpec(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetList": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetList(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetSpec": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetSpec(ref), - "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetStatus": schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetStatus(ref), + "open-cluster-management.io/api/cluster/v1.Taint": schema_open_cluster_managementio_api_cluster_v1_Taint(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSelector": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSelector(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSet": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSet(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBinding": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBinding(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingList": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingList(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingSpec": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingSpec(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingStatus": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingStatus(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetList": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetList(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetSpec": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetSpec(ref), + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetStatus": schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetStatus(ref), } } @@ -213,7 +216,15 @@ func schema_proxyserver_apis_proxy_v1beta1_ClusterStatusProxyOptions(ref common. } func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ + return common.EmbedOpenAPIDefinitionIntoV2Extension(common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n ::= \n (Note that may be empty, from the \"\" case in .)\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n ::= m | \"\" | k | M | G | T | P | E\n (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n ::= \"e\" | \"E\" \n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n a. No precision is lost\n b. No fractional digits will be emitted\n c. The exponent (or suffix) is as large as possible.\nThe sign will be omitted unless the number is negative.\n\nExamples:\n 1.5 will be serialized as \"1500m\"\n 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", + OneOf: common.GenerateOpenAPIV3OneOfSchema(resource.Quantity{}.OpenAPIV3OneOfTypes()), + Format: resource.Quantity{}.OpenAPISchemaFormat(), + }, + }, + }, common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.\n\nThe serialization format is:\n\n ::= \n (Note that may be empty, from the \"\" case in .)\n ::= 0 | 1 | ... | 9 ::= | ::= | . | . | . ::= \"+\" | \"-\" ::= | ::= | | ::= Ki | Mi | Gi | Ti | Pi | Ei\n (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)\n ::= m | \"\" | k | M | G | T | P | E\n (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)\n ::= \"e\" | \"E\" \n\nNo matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.\n\nWhen a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.\n\nBefore serializing, Quantity will be put in \"canonical form\". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:\n a. No precision is lost\n b. No fractional digits will be emitted\n c. The exponent (or suffix) is as large as possible.\nThe sign will be omitted unless the number is negative.\n\nExamples:\n 1.5 will be serialized as \"1500m\"\n 1.5Gi will be serialized as \"1536Mi\"\n\nNote that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.\n\nNon-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)\n\nThis format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.", @@ -221,7 +232,7 @@ func schema_apimachinery_pkg_api_resource_Quantity(ref common.ReferenceCallback) Format: resource.Quantity{}.OpenAPISchemaFormat(), }, }, - } + }) } func schema_apimachinery_pkg_api_resource_int64Amount(ref common.ReferenceCallback) common.OpenAPIDefinition { @@ -756,6 +767,13 @@ func schema_pkg_apis_meta_v1_CreateOptions(ref common.ReferenceCallback) common. Format: "", }, }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, @@ -1008,7 +1026,7 @@ func schema_pkg_apis_meta_v1_GroupVersionKind(ref common.ReferenceCallback) comm return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Description: "GroupVersionKind unambiguously identifies a kind. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", Type: []string{"object"}, Properties: map[string]spec.Schema{ "group": { @@ -1043,7 +1061,7 @@ func schema_pkg_apis_meta_v1_GroupVersionResource(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling", + Description: "GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion to avoid automatic coercion. It doesn't use a GroupVersion to avoid custom marshalling", Type: []string{"object"}, Properties: map[string]spec.Schema{ "group": { @@ -1264,7 +1282,7 @@ func schema_pkg_apis_meta_v1_ListMeta(ref common.ReferenceCallback) common.OpenA Properties: map[string]spec.Schema{ "selfLink": { SchemaProps: spec.SchemaProps{ - Description: "selfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.", + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", Type: []string{"string"}, Format: "", }, @@ -1416,7 +1434,7 @@ func schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref common.ReferenceCallback) co }, "time": { SchemaProps: spec.SchemaProps{ - Description: "Time is timestamp of when these fields were set. It should always be empty if Operation is 'Apply'", + Description: "Time is the timestamp of when the ManagedFields entry was added. The timestamp will also be updated if a field is added, the manager changes any of the owned fields value or removes a field. The timestamp does not update when a field is removed from the entry because another manager took it over.", Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), }, }, @@ -1476,7 +1494,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope }, "generateName": { SchemaProps: spec.SchemaProps{ - Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", + Description: "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency", Type: []string{"string"}, Format: "", }, @@ -1490,7 +1508,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope }, "selfLink": { SchemaProps: spec.SchemaProps{ - Description: "SelfLink is a URL representing this object. Populated by the system. Read-only.\n\nDEPRECATED Kubernetes will stop propagating this field in 1.20 release and the field is planned to be removed in 1.21 release.", + Description: "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.", Type: []string{"string"}, Format: "", }, @@ -1610,7 +1628,7 @@ func schema_pkg_apis_meta_v1_ObjectMeta(ref common.ReferenceCallback) common.Ope }, "clusterName": { SchemaProps: spec.SchemaProps{ - Description: "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request.", + Description: "Deprecated: ClusterName is a legacy field that was always cleared by the system and never used; it will be removed completely in 1.25.\n\nThe name in the go struct is changed to help clients detect accidental use.", Type: []string{"string"}, Format: "", }, @@ -1685,7 +1703,7 @@ func schema_pkg_apis_meta_v1_OwnerReference(ref common.ReferenceCallback) common }, "blockOwnerDeletion": { SchemaProps: spec.SchemaProps{ - Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", + Description: "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.", Type: []string{"boolean"}, Format: "", }, @@ -1850,6 +1868,13 @@ func schema_pkg_apis_meta_v1_PatchOptions(ref common.ReferenceCallback) common.O Format: "", }, }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, @@ -2470,6 +2495,13 @@ func schema_pkg_apis_meta_v1_UpdateOptions(ref common.ReferenceCallback) common. Format: "", }, }, + "fieldValidation": { + SchemaProps: spec.SchemaProps{ + Description: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + Type: []string{"string"}, + Format: "", + }, + }, }, }, }, @@ -2784,12 +2816,26 @@ func schema_open_cluster_managementio_api_cluster_v1_ManagedClusterSpec(ref comm Format: "int32", }, }, + "taints": { + SchemaProps: spec.SchemaProps{ + Description: "Taints is a property of managed cluster that allow the cluster to be repelled when scheduling. Taints, including 'ManagedClusterUnavailable' and 'ManagedClusterUnreachable', can not be added/removed by agent running on the managed cluster; while it's fine to add/remove other taints from either hub cluser or managed cluster.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("open-cluster-management.io/api/cluster/v1.Taint"), + }, + }, + }, + }, + }, }, Required: []string{"hubAcceptsClient"}, }, }, Dependencies: []string{ - "open-cluster-management.io/api/cluster/v1.ClientConfig"}, + "open-cluster-management.io/api/cluster/v1.ClientConfig", "open-cluster-management.io/api/cluster/v1.Taint"}, } } @@ -2894,11 +2940,85 @@ func schema_open_cluster_managementio_api_cluster_v1_ManagedClusterVersion(ref c } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSet(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1_Taint(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", + Description: "The managed cluster this Taint is attached to has the \"effect\" on any placement that does not tolerate the Taint.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "key": { + SchemaProps: spec.SchemaProps{ + Description: "Key is the taint key applied to a cluster. e.g. bar or foo.example.com/bar. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "value": { + SchemaProps: spec.SchemaProps{ + Description: "Value is the taint value corresponding to the taint key.", + Type: []string{"string"}, + Format: "", + }, + }, + "effect": { + SchemaProps: spec.SchemaProps{ + Description: "Effect indicates the effect of the taint on placements that do not tolerate the taint. Valid effects are NoSelect, PreferNoSelect and NoSelectIfNew.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "timeAdded": { + SchemaProps: spec.SchemaProps{ + Description: "TimeAdded represents the time at which the taint was added.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + }, + Required: []string{"key", "effect", "timeAdded"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} + +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedClusterSelector represents a selector of ManagedClusters", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "selectorType": { + SchemaProps: spec.SchemaProps{ + Description: "SelectorType could only be \"ExclusiveClusterSetLabel\" or \"LabelSelector\" \"ExclusiveClusterSetLabel\" means to use label \"cluster.open-cluster-management.io/clusterset:\"\" to select target clusters. \"LabelSelector\" means use labelSelector to select target managedClusters", + Type: []string{"string"}, + Format: "", + }, + }, + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "LabelSelector define the general labelSelector which clusterset will use to select target managedClusters", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSet(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { @@ -2925,14 +3045,14 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSet(ref SchemaProps: spec.SchemaProps{ Description: "Spec defines the attributes of the ManagedClusterSet", Default: map[string]interface{}{}, - Ref: ref("open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetSpec"), + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ Description: "Status represents the current status of the ManagedClusterSet", Default: map[string]interface{}{}, - Ref: ref("open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetStatus"), + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetStatus"), }, }, }, @@ -2940,11 +3060,11 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSet(ref }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetSpec", "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetStatus"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetSpec", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetStatus"}, } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBinding(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBinding(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -2975,7 +3095,14 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindi SchemaProps: spec.SchemaProps{ Description: "Spec defines the attributes of ManagedClusterSetBinding.", Default: map[string]interface{}{}, - Ref: ref("open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBindingSpec"), + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Status represents the current status of the ManagedClusterSetBinding", + Default: map[string]interface{}{}, + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingStatus"), }, }, }, @@ -2983,11 +3110,11 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindi }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBindingSpec"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingSpec", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBindingStatus"}, } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindingList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -3023,7 +3150,7 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindi Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBinding"), + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBinding"), }, }, }, @@ -3034,11 +3161,11 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindi }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSetBinding"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSetBinding"}, } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -3060,7 +3187,37 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetBindi } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetBindingStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ManagedClusterSetBindingStatus represents the current status of the ManagedClusterSetBinding.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions contains the different condition statuses for this ManagedClusterSetBinding.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + }, + Required: []string{"conditions"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -3096,7 +3253,7 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetList( Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSet"), + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSet"), }, }, }, @@ -3107,22 +3264,33 @@ func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetList( }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "open-cluster-management.io/api/cluster/v1beta1.ManagedClusterSet"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSet"}, } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "ManagedClusterSetSpec describes the attributes of the ManagedClusterSet", Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clusterSelector": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterSelector represents a selector of ManagedClusters", + Default: map[string]interface{}{}, + Ref: ref("open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSelector"), + }, + }, + }, }, }, + Dependencies: []string{ + "open-cluster-management.io/api/cluster/v1beta2.ManagedClusterSelector"}, } } -func schema_open_cluster_managementio_api_cluster_v1beta1_ManagedClusterSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { +func schema_open_cluster_managementio_api_cluster_v1beta2_ManagedClusterSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ diff --git a/pkg/proxyserver/rest/managedclusterset/managedclusterset.go b/pkg/proxyserver/rest/managedclusterset/managedclusterset.go index 81b8ea8c0..8a54cb7fb 100644 --- a/pkg/proxyserver/rest/managedclusterset/managedclusterset.go +++ b/pkg/proxyserver/rest/managedclusterset/managedclusterset.go @@ -16,8 +16,8 @@ import ( "k8s.io/apiserver/pkg/registry/rest" rbaclisters "k8s.io/client-go/listers/rbac/v1" clientset "open-cluster-management.io/api/client/cluster/clientset/versioned" - clusterv1beta1lister "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2lister "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta2" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) type REST struct { @@ -26,7 +26,7 @@ type REST struct { lister cache.ClusterSetLister clusterSetCache *cache.ClusterSetCache - clusterSetLister clusterv1beta1lister.ManagedClusterSetLister + clusterSetLister clusterv1beta2lister.ManagedClusterSetLister clusterRoleLister rbaclisters.ClusterRoleLister tableConverter rest.TableConvertor } @@ -36,7 +36,7 @@ func NewREST( client clientset.Interface, lister cache.ClusterSetLister, clusterSetCache *cache.ClusterSetCache, - clusterSetLister clusterv1beta1lister.ManagedClusterSetLister, + clusterSetLister clusterv1beta2lister.ManagedClusterSetLister, clusterRoleLister rbaclisters.ClusterRoleLister, ) *REST { return &REST{ @@ -46,13 +46,13 @@ func NewREST( clusterSetCache: clusterSetCache, clusterSetLister: clusterSetLister, clusterRoleLister: clusterRoleLister, - tableConverter: rest.NewDefaultTableConvertor(clusterv1beta1.Resource("managedclustersets")), + tableConverter: rest.NewDefaultTableConvertor(clusterv1beta2.Resource("managedclustersets")), } } // New returns a new managedClusterSet func (s *REST) New() runtime.Object { - return &clusterv1beta1.ManagedClusterSet{} + return &clusterv1beta2.ManagedClusterSet{} } func (s *REST) NamespaceScoped() bool { @@ -61,7 +61,7 @@ func (s *REST) NamespaceScoped() bool { // NewList returns a new managedClusterSet list func (*REST) NewList() runtime.Object { - return &clusterv1beta1.ManagedClusterSetList{} + return &clusterv1beta2.ManagedClusterSetList{} } var _ = rest.Lister(&REST{}) @@ -70,7 +70,7 @@ var _ = rest.Lister(&REST{}) func (s *REST) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) { user, ok := request.UserFrom(ctx) if !ok { - return nil, errors.NewForbidden(clusterv1beta1.Resource("managedclustersets"), "", fmt.Errorf("unable to list managedClusterset without a user on the context")) + return nil, errors.NewForbidden(clusterv1beta2.Resource("managedclustersets"), "", fmt.Errorf("unable to list managedClusterset without a user on the context")) } labelSelector, _ := helpers.InternalListOptionsToSelectors(options) @@ -94,7 +94,7 @@ func (s *REST) Watch(ctx context.Context, options *metainternalversion.ListOptio } user, ok := request.UserFrom(ctx) if !ok { - return nil, errors.NewForbidden(clusterv1beta1.Resource("managedclustersets"), "", fmt.Errorf("unable to list managedClusterSet without a user on the context")) + return nil, errors.NewForbidden(clusterv1beta2.Resource("managedclustersets"), "", fmt.Errorf("unable to list managedClusterSet without a user on the context")) } includeAllExistingClusterSets := (options != nil) && options.ResourceVersion == "0" @@ -111,7 +111,7 @@ var _ = rest.Getter(&REST{}) func (s *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) { user, ok := request.UserFrom(ctx) if !ok { - return nil, errors.NewForbidden(clusterv1beta1.Resource("managedclustersets"), "", fmt.Errorf("unable to get managedClusterSet without a user on the context")) + return nil, errors.NewForbidden(clusterv1beta2.Resource("managedclustersets"), "", fmt.Errorf("unable to get managedClusterSet without a user on the context")) } clusterSetList, err := s.lister.List(user, labels.Everything()) @@ -124,5 +124,5 @@ func (s *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) } } - return nil, errors.NewForbidden(clusterv1beta1.Resource("managedclustersets"), "", fmt.Errorf("the user cannot get the managedClusterSet %v", name)) + return nil, errors.NewForbidden(clusterv1beta2.Resource("managedclustersets"), "", fmt.Errorf("the user cannot get the managedClusterSet %v", name)) } diff --git a/pkg/utils/clusterset/clusterset.go b/pkg/utils/clusterset/clusterset.go index 03ac864b8..79af5920b 100644 --- a/pkg/utils/clusterset/clusterset.go +++ b/pkg/utils/clusterset/clusterset.go @@ -7,7 +7,7 @@ import ( "github.com/stolostron/multicloud-operators-foundation/pkg/utils" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) const ( @@ -22,13 +22,13 @@ const ( GlobalSetNameSpace string = "open-cluster-management-global-set" ) -var GlobalSet = &clusterv1beta1.ManagedClusterSet{ +var GlobalSet = &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: GlobalSetName, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{}, }, }, @@ -106,7 +106,7 @@ func BuildAdminRole(clustersetName string) *rbacv1.ClusterRole { ObjectMeta: metav1.ObjectMeta{ Name: adminroleName, Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: clustersetName, + clusterv1beta2.ClusterSetLabel: clustersetName, ClusterSetRole: "admin", }, }, @@ -152,7 +152,7 @@ func BuildViewRole(clustersetName string) *rbacv1.ClusterRole { ObjectMeta: metav1.ObjectMeta{ Name: viewroleName, Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: clustersetName, + clusterv1beta2.ClusterSetLabel: clustersetName, ClusterSetRole: "view", }, }, @@ -178,7 +178,7 @@ func BuildBindRole(clustersetName string) *rbacv1.ClusterRole { ObjectMeta: metav1.ObjectMeta{ Name: bindroleName, Labels: map[string]string{ - clusterv1beta1.ClusterSetLabel: clustersetName, + clusterv1beta2.ClusterSetLabel: clustersetName, ClusterSetRole: "bind", }, }, diff --git a/pkg/webhook/clusterset/validatingWebhook.go b/pkg/webhook/clusterset/validatingWebhook.go index 52b68c1fc..6317575b4 100644 --- a/pkg/webhook/clusterset/validatingWebhook.go +++ b/pkg/webhook/clusterset/validatingWebhook.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/kubernetes" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) type AdmissionHandler struct { @@ -37,7 +37,7 @@ var managedClustersGVR = metav1.GroupVersionResource{ var managedClusterSetsGVR = metav1.GroupVersionResource{ Group: "cluster.open-cluster-management.io", - Version: "v1beta1", + Version: "v1beta2", Resource: "managedclustersets", } @@ -72,7 +72,7 @@ func (a *AdmissionHandler) validateResource(request *v1.AdmissionRequest) *v1.Ad return status } - clusterset := &clusterv1beta1.ManagedClusterSet{} + clusterset := &clusterv1beta2.ManagedClusterSet{} if err := json.Unmarshal(request.Object.Raw, clusterset); err != nil { status.Allowed = false status.Result = &metav1.Status{ @@ -95,7 +95,7 @@ func (a *AdmissionHandler) validateResource(request *v1.AdmissionRequest) *v1.Ad } //allow create/update legacy clusterset - if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta1.LegacyClusterSetLabel { + if clusterset.Spec.ClusterSelector.SelectorType == clusterv1beta2.ExclusiveClusterSetLabel { return status } @@ -159,7 +159,7 @@ func (a *AdmissionHandler) validateCreateRequest(request *v1.AdmissionRequest) * labels := obj.GetLabels() clusterSetName := "" if len(labels) > 0 { - clusterSetName = labels[clusterv1beta1.ClusterSetLabel] + clusterSetName = labels[clusterv1beta2.ClusterSetLabel] } return a.allowUpdateClusterSet(request.UserInfo, clusterSetName) @@ -275,10 +275,10 @@ func (a *AdmissionHandler) isUpdateClusterset(request *v1.AdmissionRequest) (boo originalClusterSetName := "" currentClusterSetName := "" if len(oldLabels) > 0 { - originalClusterSetName = oldLabels[clusterv1beta1.ClusterSetLabel] + originalClusterSetName = oldLabels[clusterv1beta2.ClusterSetLabel] } if len(newLabels) > 0 { - currentClusterSetName = newLabels[clusterv1beta1.ClusterSetLabel] + currentClusterSetName = newLabels[clusterv1beta2.ClusterSetLabel] } // allow if managedClusterSet label is not updated diff --git a/pkg/webhook/clusterset/validatingWebhook_test.go b/pkg/webhook/clusterset/validatingWebhook_test.go index f268394bd..dbeec919c 100644 --- a/pkg/webhook/clusterset/validatingWebhook_test.go +++ b/pkg/webhook/clusterset/validatingWebhook_test.go @@ -28,10 +28,10 @@ const ( createClusterDeploymentFromPool = `{"apiVersion":"hive.openshift.io/v1","kind":"ClusterDeployment","metadata":{"name":"cd-pool","namespace":"cd-pool"},"spec":{"clusterName":"gcp-pool-9m688","clusterPoolRef":{"namespace":"pool","poolName":"gcp-pool"}}}` createClusterDeploymentInSet = `{"apiVersion":"hive.openshift.io/v1","kind":"ClusterDeployment","metadata":{"name":"cd-pool","namespace":"cd-pool","labels":{"cluster.open-cluster-management.io/clusterset":"clusterset1"}},"spec":{"clusterName":"gcp-pool-9m688"}}` createClusterDeploymentFromAgentCluster = `{"apiVersion":"hive.openshift.io/v1","kind":"ClusterDeployment","metadata":{"name":"cd-pool","namespace":"cd-pool","ownerReferences":[{"apiVersion":"capi-provider.agent-install.openshift.io/v1","kind":"AgentCluster"}]},"spec":{"clusterName":"gcp-pool-9m688"}}` - labelSelectorSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta1","kind":"ManagedClusterSet","metadata":{"name":"te-label-set"},"spec":{"clusterSelector":{"labelSelector":{"matchLabels":{"vendor":"ocp"}},"selectorType":"LabelSelector"}}}` - globalSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta1","kind":"ManagedClusterSet","metadata":{"name":"global"},"spec":{"clusterSelector":{"labelSelector":{},"selectorType":"LabelSelector"}}}` - defaultSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta1","kind":"ManagedClusterSet","metadata":{"name":"default"},"spec":{"clusterSelector":{"selectorType":"LegacyClusterSetLabel"}}}` - errorDefaultSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta1","kind":"ManagedClusterSet","metadata":{name":"default"},"spec":{"clusterSelector":{"selectorType":"LegacyClusterSetLabel"}}}` + labelSelectorSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta2","kind":"ManagedClusterSet","metadata":{"name":"te-label-set"},"spec":{"clusterSelector":{"labelSelector":{"matchLabels":{"vendor":"ocp"}},"selectorType":"LabelSelector"}}}` + globalSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta2","kind":"ManagedClusterSet","metadata":{"name":"global"},"spec":{"clusterSelector":{"labelSelector":{},"selectorType":"LabelSelector"}}}` + defaultSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta2","kind":"ManagedClusterSet","metadata":{"name":"default"},"spec":{"clusterSelector":{"selectorType":"ExclusiveClusterSetLabel"}}}` + errorDefaultSet = `{"apiVersion":"cluster.open-cluster-management.io/v1beta2","kind":"ManagedClusterSet","metadata":{name":"default"},"spec":{"clusterSelector":{"selectorType":"ExclusiveClusterSetLabel"}}}` ) func TestAdmissionHandler_ServerValidateResource(t *testing.T) { @@ -362,7 +362,7 @@ func TestAdmissionHandler_ServerValidateResource(t *testing.T) { actualResponse := admissionHandler.validateResource(c.request) if !reflect.DeepEqual(actualResponse.Allowed, c.expectedResponse.Allowed) { - t.Errorf("expected %#v but got: %#v", c.expectedResponse, actualResponse) + t.Errorf("case: %v,expected %#v but got: %#v", c.name, c.expectedResponse, actualResponse) } }) } diff --git a/test/e2e/clusterset_test.go b/test/e2e/clusterset_test.go index c6b7d46de..5470d32fb 100644 --- a/test/e2e/clusterset_test.go +++ b/test/e2e/clusterset_test.go @@ -6,7 +6,7 @@ import ( clustersetutils "github.com/stolostron/multicloud-operators-foundation/pkg/utils/clusterset" "k8s.io/apimachinery/pkg/api/errors" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" "github.com/onsi/ginkgo" "github.com/onsi/gomega" @@ -89,7 +89,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { // set managedClusterSet for managedCluster clusterSetLabel := map[string]string{ - clusterv1beta1.ClusterSetLabel: managedClusterSet, + clusterv1beta2.ClusterSetLabel: managedClusterSet, } err = util.UpdateManagedClusterLabels(clusterClient, managedCluster, clusterSetLabel) gomega.Expect(err).ToNot(gomega.HaveOccurred()) @@ -312,7 +312,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { ginkgo.By("globalClusterSet set binding should be created") gomega.Eventually(func() error { - _, err := clusterClient.ClusterV1beta1().ManagedClusterSetBindings(clustersetutils.GlobalSetNameSpace).Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) + _, err := clusterClient.ClusterV1beta2().ManagedClusterSetBindings(clustersetutils.GlobalSetNameSpace).Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) return err }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) }) @@ -333,13 +333,13 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { ginkgo.It("globalClusterSet ns should be created automatically after delete it", func() { ginkgo.By("globalClusterSet ns should be created after deleted") gomega.Eventually(func() error { - globalSet, err := clusterClient.ClusterV1beta1().ManagedClusterSets().Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) + globalSet, err := clusterClient.ClusterV1beta2().ManagedClusterSets().Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) if err != err { return err } //remove the global ns annotation globalSet.Annotations = make(map[string]string) - _, err = clusterClient.ClusterV1beta1().ManagedClusterSets().Update(context.Background(), globalSet, metav1.UpdateOptions{}) + _, err = clusterClient.ClusterV1beta2().ManagedClusterSets().Update(context.Background(), globalSet, metav1.UpdateOptions{}) return err }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) @@ -724,7 +724,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { ginkgo.It("managedCluster clusterRoleBinding and namespace roleBinding should be deleted successfully after managedClusterSet is deleted", func() { ginkgo.By("delete managedClusterSet") - err = clusterClient.ClusterV1beta1().ManagedClusterSets().Delete(context.Background(), managedClusterSet, metav1.DeleteOptions{}) + err = clusterClient.ClusterV1beta2().ManagedClusterSets().Delete(context.Background(), managedClusterSet, metav1.DeleteOptions{}) gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) ginkgo.By("managedCluster admin clusterRoleBinding should be deleted") @@ -794,7 +794,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { if err != nil { return err } - clusterDeploymentSet := clusterDeployment.Labels[clusterv1beta1.ClusterSetLabel] + clusterDeploymentSet := clusterDeployment.Labels[clusterv1beta2.ClusterSetLabel] if clusterDeploymentSet == managedClusterSet { return nil } @@ -807,7 +807,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { // set managedClusterSet for managedCluster managedClusterSet1 := util.RandomName() clusterSetLabel := map[string]string{ - clusterv1beta1.ClusterSetLabel: managedClusterSet1, + clusterv1beta2.ClusterSetLabel: managedClusterSet1, } err = util.UpdateManagedClusterLabels(clusterClient, managedCluster, clusterSetLabel) gomega.Expect(err).ToNot(gomega.HaveOccurred()) @@ -817,7 +817,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { if err != nil { return err } - clusterDeploymentSet := clusterDeployment.Labels[clusterv1beta1.ClusterSetLabel] + clusterDeploymentSet := clusterDeployment.Labels[clusterv1beta2.ClusterSetLabel] if clusterDeploymentSet == managedClusterSet1 { return nil } @@ -871,7 +871,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { ginkgo.By("Try to update clusterpool clusterset, and it should fail") managedClusterSet1 := util.RandomName() clusterSetLabel := map[string]string{ - clusterv1beta1.ClusterSetLabel: managedClusterSet1, + clusterv1beta2.ClusterSetLabel: managedClusterSet1, } err = util.UpdateClusterPoolLabel(hiveClient, clusterPool, clusterPoolNamespace, clusterSetLabel) gomega.Expect(err).Should(gomega.HaveOccurred()) @@ -881,7 +881,7 @@ var _ = ginkgo.Describe("Testing ManagedClusterSet", func() { ginkgo.By("Try to update claimed managedcluster clusterset, and it should fail") managedClusterSet1 := util.RandomName() clusterSetLabel := map[string]string{ - clusterv1beta1.ClusterSetLabel: managedClusterSet1, + clusterv1beta2.ClusterSetLabel: managedClusterSet1, } err = util.UpdateManagedClusterLabels(clusterClient, managedCluster, clusterSetLabel) gomega.Expect(err).Should(gomega.HaveOccurred()) diff --git a/test/e2e/util/managedclusterset.go b/test/e2e/util/managedclusterset.go index 91e32fe3e..80a9e9a72 100644 --- a/test/e2e/util/managedclusterset.go +++ b/test/e2e/util/managedclusterset.go @@ -6,38 +6,38 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) -func NewManagedClusterSet(name string) *clusterv1beta1.ManagedClusterSet { - return &clusterv1beta1.ManagedClusterSet{ +func NewManagedClusterSet(name string) *clusterv1beta2.ManagedClusterSet { + return &clusterv1beta2.ManagedClusterSet{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Spec: clusterv1beta1.ManagedClusterSetSpec{}, + Spec: clusterv1beta2.ManagedClusterSetSpec{}, } } -func NewManagedClusterSetBinding(namespace, name, clusterSetName string) *clusterv1beta1.ManagedClusterSetBinding { - return &clusterv1beta1.ManagedClusterSetBinding{ +func NewManagedClusterSetBinding(namespace, name, clusterSetName string) *clusterv1beta2.ManagedClusterSetBinding { + return &clusterv1beta2.ManagedClusterSetBinding{ ObjectMeta: metav1.ObjectMeta{ Namespace: namespace, Name: name, }, - Spec: clusterv1beta1.ManagedClusterSetBindingSpec{ + Spec: clusterv1beta2.ManagedClusterSetBindingSpec{ ClusterSet: clusterSetName, }, } } func CreateManagedClusterSet(client clusterclient.Interface, name string) error { - _, err := client.ClusterV1beta1().ManagedClusterSets().Create(context.TODO(), NewManagedClusterSet(name), metav1.CreateOptions{}) + _, err := client.ClusterV1beta2().ManagedClusterSets().Create(context.TODO(), NewManagedClusterSet(name), metav1.CreateOptions{}) return err } func DeleteManagedClusterSet(client clusterclient.Interface, name string) error { - err := client.ClusterV1beta1().ManagedClusterSets().Delete(context.TODO(), name, metav1.DeleteOptions{}) + err := client.ClusterV1beta2().ManagedClusterSets().Delete(context.TODO(), name, metav1.DeleteOptions{}) if errors.IsNotFound(err) { return nil } @@ -45,13 +45,13 @@ func DeleteManagedClusterSet(client clusterclient.Interface, name string) error } func CreateManagedClusterSetBinding(client clusterclient.Interface, namespace, name, clusterSetName string) error { - _, err := client.ClusterV1beta1().ManagedClusterSetBindings(namespace).Create(context.TODO(), + _, err := client.ClusterV1beta2().ManagedClusterSetBindings(namespace).Create(context.TODO(), NewManagedClusterSetBinding(namespace, name, clusterSetName), metav1.CreateOptions{}) return err } func DeleteManagedClusterSetBinding(client clusterclient.Interface, namespace, name string) error { - err := client.ClusterV1beta1().ManagedClusterSetBindings(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{}) + err := client.ClusterV1beta2().ManagedClusterSetBindings(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{}) if errors.IsNotFound(err) { return nil } diff --git a/test/e2e/webhook_test.go b/test/e2e/webhook_test.go index 4e223813d..3322ca961 100644 --- a/test/e2e/webhook_test.go +++ b/test/e2e/webhook_test.go @@ -14,7 +14,7 @@ import ( "k8s.io/apimachinery/pkg/util/rand" clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned" clusterv1 "open-cluster-management.io/api/cluster/v1" - clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1" + clusterv1beta2 "open-cluster-management.io/api/cluster/v1beta2" ) var _ = ginkgo.Describe("Testing user create/update managedCluster without mangedClusterSet label", func() { @@ -26,7 +26,7 @@ var _ = ginkgo.Describe("Testing user create/update managedCluster without mange var err error // create rbac with managedClusterSet/join permission for user rules := []rbacv1.PolicyRule{ - helpers.NewRule("create").Groups(clusterv1beta1.GroupName).Resources("managedclustersets/join").RuleOrDie(), + helpers.NewRule("create").Groups(clusterv1beta2.GroupName).Resources("managedclustersets/join").RuleOrDie(), helpers.NewRule("create", "update", "get").Groups(clusterv1.GroupName).Resources("managedclusters").RuleOrDie(), } err = util.CreateClusterRole(kubeClient, rbacName, rules) @@ -88,7 +88,7 @@ var _ = ginkgo.Describe("Testing user create/update managedCluster with mangedCl var err error // create rbac with managedClusterSet/join clusterset-e2e permission for user rules := []rbacv1.PolicyRule{ - helpers.NewRule("create").Groups(clusterv1beta1.GroupName).Resources("managedclustersets/join").Names(clusterSet1, clusterSet2).RuleOrDie(), + helpers.NewRule("create").Groups(clusterv1beta2.GroupName).Resources("managedclustersets/join").Names(clusterSet1, clusterSet2).RuleOrDie(), helpers.NewRule("create", "update", "get").Groups(clusterv1.GroupName).Resources("managedclusters").RuleOrDie(), } err = util.CreateClusterRole(kubeClient, rbacName, rules) @@ -180,7 +180,7 @@ var _ = ginkgo.Describe("Testing webhook cert rotation", func() { var err error // create rbac with managedClusterSet/join permission for user rules := []rbacv1.PolicyRule{ - helpers.NewRule("create").Groups(clusterv1beta1.GroupName).Resources("managedclustersets/join").RuleOrDie(), + helpers.NewRule("create").Groups(clusterv1beta2.GroupName).Resources("managedclustersets/join").RuleOrDie(), helpers.NewRule("create", "update", "get").Groups(clusterv1.GroupName).Resources("managedclusters").RuleOrDie(), } err = util.CreateClusterRole(kubeClient, rbacName, rules) @@ -234,7 +234,7 @@ var _ = ginkgo.Describe("Testing webhook cert rotation", func() { var _ = ginkgo.Describe("Testing clusterset create and update", func() { ginkgo.It("should get global Clusterset successfully", func() { gomega.Eventually(func() error { - _, err := clusterClient.ClusterV1beta1().ManagedClusterSets().Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) + _, err := clusterClient.ClusterV1beta2().ManagedClusterSets().Get(context.Background(), clustersetutils.GlobalSetName, metav1.GetOptions{}) return err }, eventuallyTimeout, eventuallyInterval).ShouldNot(gomega.HaveOccurred()) }) @@ -245,18 +245,18 @@ var _ = ginkgo.Describe("Testing clusterset create and update", func() { updateGlobalSet.Spec.ClusterSelector.LabelSelector.MatchLabels = map[string]string{ "vendor": "ocp", } - _, err := clusterClient.ClusterV1beta1().ManagedClusterSets().Update(context.Background(), updateGlobalSet, metav1.UpdateOptions{}) + _, err := clusterClient.ClusterV1beta2().ManagedClusterSets().Update(context.Background(), updateGlobalSet, metav1.UpdateOptions{}) gomega.Expect(err).To(gomega.HaveOccurred()) }) ginkgo.It("should not create other labelselector based Clusterset successfully", func() { - labelSelectorSet := &clusterv1beta1.ManagedClusterSet{ + labelSelectorSet := &clusterv1beta2.ManagedClusterSet{ ObjectMeta: metav1.ObjectMeta{ Name: "ocpset", }, - Spec: clusterv1beta1.ManagedClusterSetSpec{ - ClusterSelector: clusterv1beta1.ManagedClusterSelector{ - SelectorType: clusterv1beta1.LabelSelector, + Spec: clusterv1beta2.ManagedClusterSetSpec{ + ClusterSelector: clusterv1beta2.ManagedClusterSelector{ + SelectorType: clusterv1beta2.LabelSelector, LabelSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "vendor": "openshift", @@ -265,7 +265,7 @@ var _ = ginkgo.Describe("Testing clusterset create and update", func() { }, }, } - _, err := clusterClient.ClusterV1beta1().ManagedClusterSets().Create(context.Background(), labelSelectorSet, metav1.CreateOptions{}) + _, err := clusterClient.ClusterV1beta2().ManagedClusterSets().Create(context.Background(), labelSelectorSet, metav1.CreateOptions{}) gomega.Expect(err).To(gomega.HaveOccurred()) }) }) diff --git a/vendor/modules.txt b/vendor/modules.txt index aae92bbc1..f72fc80b7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1443,8 +1443,8 @@ open-cluster-management.io/addon-framework/pkg/common/workapplier open-cluster-management.io/addon-framework/pkg/common/workbuilder open-cluster-management.io/addon-framework/pkg/lease open-cluster-management.io/addon-framework/pkg/utils -# open-cluster-management.io/api v0.9.0 -## explicit; go 1.18 +# open-cluster-management.io/api v0.9.1-0.20221107101616-fde10e6996f6 +## explicit; go 1.19 open-cluster-management.io/api/addon/v1alpha1 open-cluster-management.io/api/client/addon/clientset/versioned open-cluster-management.io/api/client/addon/clientset/versioned/scheme 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 08bdb4056..0367afb8e 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 @@ -86,10 +86,15 @@ spec: group: description: group of the add-on configuration. type: string + default: "" resource: description: resource of the add-on configuration. type: string minLength: 1 + x-kubernetes-list-map-keys: + - group + - resource + x-kubernetes-list-type: map status: description: status represents the current status of cluster management add-on. type: object 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 9d12081b7..d8842c6db 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 @@ -54,6 +54,7 @@ spec: group: description: group of the add-on configuration. type: string + default: "" name: description: name of the add-on configuration. type: string @@ -156,6 +157,7 @@ spec: group: description: group of the add-on configuration. type: string + default: "" 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 9479a2de8..525748ac0 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 @@ -48,6 +48,9 @@ type ClusterManagementAddOnSpec struct { // An empty list means the add-on does not require configurations. // The default is an empty list // +optional + // +listType=map + // +listMapKey=group + // +listMapKey=resource SupportedConfigs []ConfigMeta `json:"supportedConfigs,omitempty"` } @@ -93,6 +96,8 @@ type ConfigCoordinates struct { // ConfigGroupResource represents the GroupResource of the add-on configuration type ConfigGroupResource struct { // group of the add-on configuration. + // +optional + // +kubebuilder:default="" Group string `json:"group"` // resource of the add-on configuration. diff --git a/vendor/open-cluster-management.io/api/client/addon/clientset/versioned/scheme/register.go b/vendor/open-cluster-management.io/api/client/addon/clientset/versioned/scheme/register.go index 3807d8631..9dd616b51 100644 --- a/vendor/open-cluster-management.io/api/client/addon/clientset/versioned/scheme/register.go +++ b/vendor/open-cluster-management.io/api/client/addon/clientset/versioned/scheme/register.go @@ -21,14 +21,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/fake/register.go b/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/fake/register.go index def0e0de6..7c275db88 100644 --- a/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/fake/register.go +++ b/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/fake/register.go @@ -27,14 +27,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/scheme/register.go b/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/scheme/register.go index d52290cc6..57c11727f 100644 --- a/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/scheme/register.go +++ b/vendor/open-cluster-management.io/api/client/cluster/clientset/versioned/scheme/register.go @@ -27,14 +27,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/scheme/register.go b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/scheme/register.go index 85a759144..91e9934e8 100644 --- a/vendor/open-cluster-management.io/api/client/work/clientset/versioned/scheme/register.go +++ b/vendor/open-cluster-management.io/api/client/work/clientset/versioned/scheme/register.go @@ -21,14 +21,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml index 0f5b20f73..16f883993 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml @@ -15,7 +15,7 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include, 1. id.k8s.io, it contains a unique identifier for the cluster. 2. clusterset.k8s.io, it contains an identifier that relates the cluster to the ClusterSet in which it belongs. ClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub. + description: "ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include, 1. id.k8s.io, it contains a unique identifier for the cluster. 2. clusterset.k8s.io, it contains an identifier that relates the cluster to the ClusterSet in which it belongs. \n ClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub." type: object properties: apiVersion: diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml index 2df656861..bba98c653 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml @@ -13,7 +13,7 @@ spec: preserveUnknownFields: false validation: openAPIV3Schema: - description: ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include, 1. id.k8s.io, it contains a unique identifier for the cluster. 2. clusterset.k8s.io, it contains an identifier that relates the cluster to the ClusterSet in which it belongs. ClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub. + description: "ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include, 1. id.k8s.io, it contains a unique identifier for the cluster. 2. clusterset.k8s.io, it contains an identifier that relates the cluster to the ClusterSet in which it belongs. \n ClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub." type: object properties: apiVersion: diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go index 044127d20..6cb57bc3b 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go @@ -11,9 +11,10 @@ import ( // ClusterClaim represents cluster information that a managed cluster claims // ClusterClaims with well known names include, -// 1. id.k8s.io, it contains a unique identifier for the cluster. -// 2. clusterset.k8s.io, it contains an identifier that relates the cluster -// to the ClusterSet in which it belongs. +// 1. id.k8s.io, it contains a unique identifier for the cluster. +// 2. clusterset.k8s.io, it contains an identifier that relates the cluster +// to the ClusterSet in which it belongs. +// // ClusterClaims created on a managed cluster will be collected and saved into // the status of the corresponding ManagedCluster on hub. type ClusterClaim struct { diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go index 039750c33..1ce73580b 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types_addonplacementscore.go @@ -20,7 +20,7 @@ type AddOnPlacementScore struct { Status AddOnPlacementScoreStatus `json:"status,omitempty"` } -//AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore. +// AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore. type AddOnPlacementScoreStatus struct { // Conditions contain the different condition statuses for this AddOnPlacementScore. // +patchMergeKey=type @@ -45,7 +45,7 @@ type AddOnPlacementScoreStatus struct { ValidUntil *metav1.Time `json:"validUntil"` } -//AddOnPlacementScoreItem represents the score name and value. +// AddOnPlacementScoreItem represents the score name and value. type AddOnPlacementScoreItem struct { // Name is the name of the score // +kubebuilder:validation:Required diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index f1c81946d..864fc58e7 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -12,7 +12,7 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE var map_ClusterClaim = map[string]string{ - "": "ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include,\n 1. id.k8s.io, it contains a unique identifier for the cluster.\n 2. clusterset.k8s.io, it contains an identifier that relates the cluster\n to the ClusterSet in which it belongs.\nClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub.", + "": "ClusterClaim represents cluster information that a managed cluster claims ClusterClaims with well known names include,\n 1. id.k8s.io, it contains a unique identifier for the cluster.\n 2. clusterset.k8s.io, it contains an identifier that relates the cluster\n to the ClusterSet in which it belongs.\n\nClusterClaims created on a managed cluster will be collected and saved into the status of the corresponding ManagedCluster on hub.", "spec": "Spec defines the attributes of the ClusterClaim.", } diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml index a543045ff..134e26a69 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml @@ -25,7 +25,7 @@ spec: name: v1beta1 schema: openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." + description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." type: object properties: apiVersion: diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml index 4c22187b6..2342ed799 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/0000_02_clusters.open-cluster-management.io_placements.crd.yaml @@ -25,7 +25,7 @@ spec: name: v1beta1 schema: openAPIV3Schema: - description: "Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace. \n Here is how the placement policy combines with other selection methods to determine a matching list of ManagedClusters: 1) Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; 2) ManagedClusters are organized into cluster-scoped ManagedClusterSets; 3) ManagedClusterSets are bound to workload namespaces; 4) Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set of potential ManagedClusters; 5) Then Placements subselect from that working set using label/claim selection. \n No ManagedCluster will be selected if no ManagedClusterSet is bound to the placement namespace. User is able to bind a ManagedClusterSet to a namespace by creating a ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`. \n A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} will be created to represent the ManagedClusters selected by this placement. \n If a ManagedCluster is selected and added into the PlacementDecisions, other components may apply workload on it; once it is removed from the PlacementDecisions, the workload applied on this ManagedCluster should be evicted accordingly." + description: "Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace. \n Here is how the placement policy combines with other selection methods to determine a matching list of ManagedClusters: 1. Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; 2. ManagedClusters are organized into cluster-scoped ManagedClusterSets; 3. ManagedClusterSets are bound to workload namespaces; 4. Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set of potential ManagedClusters; 5. Then Placements subselect from that working set using label/claim selection. \n No ManagedCluster will be selected if no ManagedClusterSet is bound to the placement namespace. User is able to bind a ManagedClusterSet to a namespace by creating a ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`. \n A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} will be created to represent the ManagedClusters selected by this placement. \n If a ManagedCluster is selected and added into the PlacementDecisions, other components may apply workload on it; once it is removed from the PlacementDecisions, the workload applied on this ManagedCluster should be evicted accordingly." type: object required: - spec @@ -149,7 +149,7 @@ spec: description: ScoreName defines the score name inside AddOnPlacementScore. AddOnPlacementScore contains a list of score name and score value, ScoreName specify the score to be used by the prioritizer. type: string builtIn: - description: 'BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable.' + description: 'BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. 4) Spread: spread the workload evenly to topologies.' type: string type: description: Type defines the type of the prioritizer score. Type is either "BuiltIn", "AddOn" or "", where "" is "BuiltIn" by default. When the type is "BuiltIn", need to specify a BuiltIn prioritizer name in BuiltIn. When the type is "AddOn", need to configure the score source in AddOn. @@ -169,6 +169,45 @@ spec: description: Mode is either Exact, Additive, "" where "" is Additive by default. In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, and additional prioritization will happen. In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases. type: string default: Additive + spreadPolicy: + description: SpreadPolicy defines how placement decisions should be distributed among a set of ManagedClusters. + type: object + properties: + spreadConstraints: + description: SpreadConstraints defines how the placement decision should be distributed among a set of ManagedClusters. The importance of the SpreadConstraintsTerms follows the natural order of their index in the slice. The scheduler first consider SpreadConstraintsTerms with smaller index then those with larger index to distribute the placement decision. + type: array + maxItems: 8 + items: + description: SpreadConstraintsTerm defines a terminology to spread placement decisions. + type: object + required: + - topologyKey + - topologyKeyType + properties: + maxSkew: + description: MaxSkew represents the degree to which the workload may be unevenly distributed. Skew is the maximum difference between the number of selected ManagedClusters in a topology and the global minimum. The global minimum is the minimum number of selected ManagedClusters for the topologies within the same TopologyKey. The minimum possible value of MaxSkew is 1, and the default value is 1. + type: integer + format: int32 + default: 1 + minimum: 1 + topologyKey: + description: TopologyKey is either a label key or a cluster claim name of ManagedClusters. + 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]$ + topologyKeyType: + description: TopologyKeyType indicates the type of TopologyKey. It could be Label or Claim. + type: string + enum: + - Label + - Claim + whenUnsatisfiable: + description: WhenUnsatisfiable represents the action of the scheduler when MaxSkew cannot be satisfied. It could be DoNotSchedule or ScheduleAnyway. The default value is ScheduleAnyway. DoNotSchedule instructs the scheduler not to schedule more ManagedClusters when MaxSkew is not satisfied. ScheduleAnyway instructs the scheduler to keep scheduling even if MaxSkew is not satisfied. + type: string + default: ScheduleAnyway + enum: + - DoNotSchedule + - ScheduleAnyway tolerations: description: Tolerations are applied to placements, and allow (but do not require) the managed clusters with certain taints to be selected by placements with matching tolerations. type: array diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_managedclusterset.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_managedclusterset.go index 4bdfd4ab5..2bc43f9e0 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_managedclusterset.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_managedclusterset.go @@ -4,7 +4,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//LegacyClusterSetLabel LabelKey +// LegacyClusterSetLabel LabelKey const ClusterSetLabel = "cluster.open-cluster-management.io/clusterset" // +genclient @@ -18,9 +18,9 @@ const ClusterSetLabel = "cluster.open-cluster-management.io/clusterset" // ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. // A workload can be defined to deployed on a ManagedClusterSet, which mean: -// 1. The workload can run on any ManagedCluster in the ManagedClusterSet -// 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet -// 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet +// 1. The workload can run on any ManagedCluster in the ManagedClusterSet +// 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet +// 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet // // In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name // `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go index b4ec052c3..9f4aabd6e 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placement.go @@ -18,12 +18,12 @@ import ( // // Here is how the placement policy combines with other selection methods to determine a matching // list of ManagedClusters: -// 1) Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; -// 2) ManagedClusters are organized into cluster-scoped ManagedClusterSets; -// 3) ManagedClusterSets are bound to workload namespaces; -// 4) Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set -// of potential ManagedClusters; -// 5) Then Placements subselect from that working set using label/claim selection. +// 1. Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; +// 2. ManagedClusters are organized into cluster-scoped ManagedClusterSets; +// 3. ManagedClusterSets are bound to workload namespaces; +// 4. Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set +// of potential ManagedClusters; +// 5. Then Placements subselect from that working set using label/claim selection. // // No ManagedCluster will be selected if no ManagedClusterSet is bound to the placement // namespace. User is able to bind a ManagedClusterSet to a namespace by creating a @@ -85,6 +85,11 @@ type PlacementSpec struct { // +optional PrioritizerPolicy PrioritizerPolicy `json:"prioritizerPolicy"` + // SpreadPolicy defines how placement decisions should be distributed among a + // set of ManagedClusters. + // +optional + SpreadPolicy SpreadPolicy `json:"spreadPolicy,omitempty"` + // Tolerations are applied to placements, and allow (but do not require) the managed clusters with // certain taints to be selected by placements with matching tolerations. // +optional @@ -185,6 +190,7 @@ type ScoreCoordinate struct { // 1) Balance: balance the decisions among the clusters. // 2) Steady: ensure the existing decision is stabilized. // 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. + // 4) Spread: spread the workload evenly to topologies. // +optional BuiltIn string `json:"builtIn,omitempty"` @@ -215,6 +221,69 @@ type AddOnScore struct { ScoreName string `json:"scoreName"` } +// SpreadPolicy defines how the placement decision should be spread among the ManagedClusters. +type SpreadPolicy struct { + // SpreadConstraints defines how the placement decision should be distributed among a set of ManagedClusters. + // The importance of the SpreadConstraintsTerms follows the natural order of their index in the slice. + // The scheduler first consider SpreadConstraintsTerms with smaller index then those with larger index + // to distribute the placement decision. + // +optional + // +kubebuilder:validation:MaxItems=8 + SpreadConstraints []SpreadConstraintsTerm `json:"spreadConstraints,omitempty"` +} + +// SpreadConstraintsTerm defines a terminology to spread placement decisions. +type SpreadConstraintsTerm struct { + // TopologyKey is either a label key or a cluster claim name of ManagedClusters. + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation: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]$` + // +kubebuilder:validation:MaxLength=316 + TopologyKey string `json:"topologyKey"` + + // TopologyKeyType indicates the type of TopologyKey. It could be Label or Claim. + // +required + // +kubebuilder:validation:Required + // +kubebuilder:validation:Enum=Label;Claim + TopologyKeyType TopologyKeyType `json:"topologyKeyType"` + + // MaxSkew represents the degree to which the workload may be unevenly distributed. + // Skew is the maximum difference between the number of selected ManagedClusters in a topology and the global minimum. + // The global minimum is the minimum number of selected ManagedClusters for the topologies within the same TopologyKey. + // The minimum possible value of MaxSkew is 1, and the default value is 1. + // +optional + // +kubebuilder:validation:Minimum=1 + // +kubebuilder:default=1 + MaxSkew int32 `json:"maxSkew"` + + // WhenUnsatisfiable represents the action of the scheduler when MaxSkew cannot be satisfied. + // It could be DoNotSchedule or ScheduleAnyway. The default value is ScheduleAnyway. + // DoNotSchedule instructs the scheduler not to schedule more ManagedClusters when MaxSkew is not satisfied. + // ScheduleAnyway instructs the scheduler to keep scheduling even if MaxSkew is not satisfied. + // +optional + // +kubebuilder:validation:Enum=DoNotSchedule;ScheduleAnyway + // +kubebuilder:default=ScheduleAnyway + WhenUnsatisfiable UnsatisfiableMaxSkewAction `json:"whenUnsatisfiable"` +} + +// TopologyKeyType represents the type of TopologyKey. +type TopologyKeyType string + +const ( + // Valid TopologyKeyType value is Claim, Label. + TopologyKeyTypeClaim TopologyKeyType = "Claim" + TopologyKeyTypeLabel TopologyKeyType = "Label" +) + +// UnsatisfiableMaxSkewAction represents the action when MaxSkew cannot be satisfied. +type UnsatisfiableMaxSkewAction string + +const ( + // Valid UnsatisfiableMaxSkewAction value is DoNotSchedule, ScheduleAnyway. + DoNotSchedule UnsatisfiableMaxSkewAction = "DoNotSchedule" + ScheduleAnyway UnsatisfiableMaxSkewAction = "ScheduleAnyway" +) + // Toleration represents the toleration object that can be attached to a placement. // The placement this Toleration is attached to tolerates any taint that matches // the triple using the matching operator . diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go index 208268432..e9072c8d6 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/types_placementdecision.go @@ -26,7 +26,7 @@ type PlacementDecision struct { Status PlacementDecisionStatus `json:"status,omitempty"` } -//The placementDecsion label name holding the placement name +// The placementDecsion label name holding the placement name const ( PlacementLabel string = "cluster.open-cluster-management.io/placement" ) diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go index 0b1209d19..f7a6f2f68 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.deepcopy.go @@ -485,6 +485,7 @@ func (in *PlacementSpec) DeepCopyInto(out *PlacementSpec) { } } in.PrioritizerPolicy.DeepCopyInto(&out.PrioritizerPolicy) + in.SpreadPolicy.DeepCopyInto(&out.SpreadPolicy) if in.Tolerations != nil { in, out := &in.Tolerations, &out.Tolerations *out = make([]Toleration, len(*in)) @@ -593,6 +594,43 @@ func (in *ScoreCoordinate) DeepCopy() *ScoreCoordinate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpreadConstraintsTerm) DeepCopyInto(out *SpreadConstraintsTerm) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpreadConstraintsTerm. +func (in *SpreadConstraintsTerm) DeepCopy() *SpreadConstraintsTerm { + if in == nil { + return nil + } + out := new(SpreadConstraintsTerm) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpreadPolicy) DeepCopyInto(out *SpreadPolicy) { + *out = *in + if in.SpreadConstraints != nil { + in, out := &in.SpreadConstraints, &out.SpreadConstraints + *out = make([]SpreadConstraintsTerm, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpreadPolicy. +func (in *SpreadPolicy) DeepCopy() *SpreadPolicy { + if in == nil { + return nil + } + out := new(SpreadPolicy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Toleration) DeepCopyInto(out *Toleration) { *out = *in diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go index 3b359308f..b8c70231c 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta1/zz_generated.swagger_doc_generated.go @@ -22,7 +22,7 @@ func (ManagedClusterSelector) SwaggerDoc() map[string]string { } var map_ManagedClusterSet = map[string]string{ - "": "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", + "": "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", "spec": "Spec defines the attributes of the ManagedClusterSet", "status": "Status represents the current status of the ManagedClusterSet", } @@ -136,7 +136,7 @@ func (ClusterSelector) SwaggerDoc() map[string]string { } var map_Placement = map[string]string{ - "": "Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace.\n\nHere is how the placement policy combines with other selection methods to determine a matching list of ManagedClusters: 1) Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters; 2) ManagedClusters are organized into cluster-scoped ManagedClusterSets; 3) ManagedClusterSets are bound to workload namespaces; 4) Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set\n of potential ManagedClusters;\n5) Then Placements subselect from that working set using label/claim selection.\n\nNo ManagedCluster will be selected if no ManagedClusterSet is bound to the placement namespace. User is able to bind a ManagedClusterSet to a namespace by creating a ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`.\n\nA slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} will be created to represent the ManagedClusters selected by this placement.\n\nIf a ManagedCluster is selected and added into the PlacementDecisions, other components may apply workload on it; once it is removed from the PlacementDecisions, the workload applied on this ManagedCluster should be evicted accordingly.", + "": "Placement defines a rule to select a set of ManagedClusters from the ManagedClusterSets bound to the placement namespace.\n\nHere is how the placement policy combines with other selection methods to determine a matching list of ManagedClusters:\n 1. Kubernetes clusters are registered with hub as cluster-scoped ManagedClusters;\n 2. ManagedClusters are organized into cluster-scoped ManagedClusterSets;\n 3. ManagedClusterSets are bound to workload namespaces;\n 4. Namespace-scoped Placements specify a slice of ManagedClusterSets which select a working set\n of potential ManagedClusters;\n 5. Then Placements subselect from that working set using label/claim selection.\n\nNo ManagedCluster will be selected if no ManagedClusterSet is bound to the placement namespace. User is able to bind a ManagedClusterSet to a namespace by creating a ManagedClusterSetBinding in that namespace if they have a RBAC rule to CREATE on the virtual subresource of `managedclustersets/bind`.\n\nA slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement name} will be created to represent the ManagedClusters selected by this placement.\n\nIf a ManagedCluster is selected and added into the PlacementDecisions, other components may apply workload on it; once it is removed from the PlacementDecisions, the workload applied on this ManagedCluster should be evicted accordingly.", "spec": "Spec defines the attributes of Placement.", "status": "Status represents the current status of the Placement", } @@ -161,6 +161,7 @@ var map_PlacementSpec = map[string]string{ "numberOfClusters": "NumberOfClusters represents the desired number of ManagedClusters to be selected which meet the placement requirements. 1) If not specified, all ManagedClusters which meet the placement requirements (including ClusterSets,\n and Predicates) will be selected;\n2) Otherwise if the nubmer of ManagedClusters meet the placement requirements is larger than\n NumberOfClusters, a random subset with desired number of ManagedClusters will be selected;\n3) If the nubmer of ManagedClusters meet the placement requirements is equal to NumberOfClusters,\n all of them will be selected;\n4) If the nubmer of ManagedClusters meet the placement requirements is less than NumberOfClusters,\n all of them will be selected, and the status of condition `PlacementConditionSatisfied` will be\n set to false;", "predicates": "Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed.", "prioritizerPolicy": "PrioritizerPolicy defines the policy of the prioritizers. If this field is unset, then default prioritizer mode and configurations are used. Referring to PrioritizerPolicy to see more description about Mode and Configurations.", + "spreadPolicy": "SpreadPolicy defines how placement decisions should be distributed among a set of ManagedClusters.", "tolerations": "Tolerations are applied to placements, and allow (but do not require) the managed clusters with certain taints to be selected by placements with matching tolerations.", } @@ -199,7 +200,7 @@ func (PrioritizerPolicy) SwaggerDoc() map[string]string { var map_ScoreCoordinate = map[string]string{ "": "ScoreCoordinate represents the configuration of the score type and score source", "type": "Type defines the type of the prioritizer score. Type is either \"BuiltIn\", \"AddOn\" or \"\", where \"\" is \"BuiltIn\" by default. When the type is \"BuiltIn\", need to specify a BuiltIn prioritizer name in BuiltIn. When the type is \"AddOn\", need to configure the score source in AddOn.", - "builtIn": "BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable.", + "builtIn": "BuiltIn defines the name of a BuiltIn prioritizer. Below are the valid BuiltIn prioritizer names. 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. 4) Spread: spread the workload evenly to topologies.", "addOn": "When type is \"AddOn\", AddOn defines the resource name and score name.", } @@ -207,6 +208,27 @@ func (ScoreCoordinate) SwaggerDoc() map[string]string { return map_ScoreCoordinate } +var map_SpreadConstraintsTerm = map[string]string{ + "": "SpreadConstraintsTerm defines a terminology to spread placement decisions.", + "topologyKey": "TopologyKey is either a label key or a cluster claim name of ManagedClusters.", + "topologyKeyType": "TopologyKeyType indicates the type of TopologyKey. It could be Label or Claim.", + "maxSkew": "MaxSkew represents the degree to which the workload may be unevenly distributed. Skew is the maximum difference between the number of selected ManagedClusters in a topology and the global minimum. The global minimum is the minimum number of selected ManagedClusters for the topologies within the same TopologyKey. The minimum possible value of MaxSkew is 1, and the default value is 1.", + "whenUnsatisfiable": "WhenUnsatisfiable represents the action of the scheduler when MaxSkew cannot be satisfied. It could be DoNotSchedule or ScheduleAnyway. The default value is ScheduleAnyway. DoNotSchedule instructs the scheduler not to schedule more ManagedClusters when MaxSkew is not satisfied. ScheduleAnyway instructs the scheduler to keep scheduling even if MaxSkew is not satisfied.", +} + +func (SpreadConstraintsTerm) SwaggerDoc() map[string]string { + return map_SpreadConstraintsTerm +} + +var map_SpreadPolicy = map[string]string{ + "": "SpreadPolicy defines how the placement decision should be spread among the ManagedClusters.", + "spreadConstraints": "SpreadConstraints defines how the placement decision should be distributed among a set of ManagedClusters. The importance of the SpreadConstraintsTerms follows the natural order of their index in the slice. The scheduler first consider SpreadConstraintsTerms with smaller index then those with larger index to distribute the placement decision.", +} + +func (SpreadPolicy) SwaggerDoc() map[string]string { + return map_SpreadPolicy +} + var map_Toleration = map[string]string{ "": "Toleration represents the toleration object that can be attached to a placement. The placement this Toleration is attached to tolerates any taint that matches the triple using the matching operator .", "key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.", diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta2/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1beta2/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml index 8eeb1233f..3f601df4d 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta2/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1beta2/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml @@ -31,7 +31,7 @@ spec: status: {} "schema": "openAPIV3Schema": - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." + description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." type: object properties: apiVersion: @@ -154,7 +154,7 @@ spec: status: {} "schema": "openAPIV3Schema": - description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." + description: "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet." type: object properties: apiVersion: diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta2/types_managedclusterset.go b/vendor/open-cluster-management.io/api/cluster/v1beta2/types_managedclusterset.go index ce8e93bc0..ff43f9b79 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta2/types_managedclusterset.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta2/types_managedclusterset.go @@ -4,7 +4,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -//ExclusiveClusterSetLabel LabelKey +// ExclusiveClusterSetLabel LabelKey const ClusterSetLabel = "cluster.open-cluster-management.io/clusterset" // +genclient @@ -18,9 +18,9 @@ const ClusterSetLabel = "cluster.open-cluster-management.io/clusterset" // ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. // A workload can be defined to deployed on a ManagedClusterSet, which mean: -// 1. The workload can run on any ManagedCluster in the ManagedClusterSet -// 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet -// 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet +// 1. The workload can run on any ManagedCluster in the ManagedClusterSet +// 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet +// 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet // // In order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name // `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. diff --git a/vendor/open-cluster-management.io/api/cluster/v1beta2/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1beta2/zz_generated.swagger_doc_generated.go index e5bdb6868..33ff38168 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1beta2/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/cluster/v1beta2/zz_generated.swagger_doc_generated.go @@ -22,7 +22,7 @@ func (ManagedClusterSelector) SwaggerDoc() map[string]string { } var map_ManagedClusterSet = map[string]string{ - "": "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", + "": "ManagedClusterSet defines a group of ManagedClusters that user's workload can run on. A workload can be defined to deployed on a ManagedClusterSet, which mean:\n 1. The workload can run on any ManagedCluster in the ManagedClusterSet\n 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet\n 3. The service exposed by the workload can be shared in any ManagedCluster in the ManagedClusterSet\n\nIn order to assign a ManagedCluster to a certian ManagedClusterSet, add a label with name `cluster.open-cluster-management.io/clusterset` on the ManagedCluster to refers to the ManagedClusterSet. User is not allow to add/remove this label on a ManagedCluster unless they have a RBAC rule to CREATE on a virtual subresource of managedclustersets/join. In order to update this label, user must have the permission on both the old and new ManagedClusterSet.", "spec": "Spec defines the attributes of the ManagedClusterSet", "status": "Status represents the current status of the ManagedClusterSet", } 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 892fd392e..07fe26ee8 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 @@ -30,6 +30,9 @@ spec: description: Spec represents the desired configuration of AppliedManifestWork. type: object properties: + agentID: + description: AgentID represents the ID of the work agent who is to handle this AppliedManifestWork. + type: string hubHash: description: HubHash represents the hash of the first hub kube apiserver to identify which hub this AppliedManifestWork links to. type: string 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 e75e8c054..981f9147e 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 @@ -31,6 +31,9 @@ spec: description: Spec represents the desired configuration of AppliedManifestWork. type: object properties: + agentID: + description: AgentID represents the ID of the work agent who is to handle this AppliedManifestWork. + type: string hubHash: description: HubHash represents the hash of the first hub kube apiserver to identify which hub this AppliedManifestWork links to. type: string 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 2777a157a..efa94f1ca 100644 --- a/vendor/open-cluster-management.io/api/work/v1/types.go +++ b/vendor/open-cluster-management.io/api/work/v1/types.go @@ -527,6 +527,9 @@ type AppliedManifestWorkSpec struct { // +required HubHash string `json:"hubHash"` + // AgentID represents the ID of the work agent who is to handle this AppliedManifestWork. + AgentID string `json:"agentID"` + // ManifestWorkName represents the name of the related manifestwork on the hub. // +required ManifestWorkName string `json:"manifestWorkName"` 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 24f8a4cbe..838080f7c 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 @@ -44,6 +44,7 @@ func (AppliedManifestWorkList) SwaggerDoc() map[string]string { var map_AppliedManifestWorkSpec = map[string]string{ "": "AppliedManifestWorkSpec represents the desired configuration of AppliedManifestWork", "hubHash": "HubHash represents the hash of the first hub kube apiserver to identify which hub this AppliedManifestWork links to.", + "agentID": "AgentID represents the ID of the work agent who is to handle this AppliedManifestWork.", "manifestWorkName": "ManifestWorkName represents the name of the related manifestwork on the hub.", }