upgrade clusterset

Signed-off-by: Yang Le <yangle@redhat.com>
This commit is contained in:
Yang Le
2021-09-18 11:10:17 +08:00
parent 4983cfa6c2
commit 9307989329
47 changed files with 2075 additions and 60 deletions
@@ -8,11 +8,54 @@ spec:
kind: ManagedClusterSetBinding
listKind: ManagedClusterSetBindingList
plural: managedclustersetbindings
shortNames:
- mclsetbinding
- mclsetbindings
singular: managedclustersetbinding
scope: Namespaced
preserveUnknownFields: false
versions:
- name: v1alpha1
deprecated: true
deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSetBinding
is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSetBinding"
schema:
openAPIV3Schema:
description: ManagedClusterSetBinding projects a ManagedClusterSet into a
certain namespace. User is able to create a ManagedClusterSetBinding in
a namespace and bind it to a ManagedClusterSet if they have an RBAC rule
to CREATE on the virtual subresource of managedclustersets/bind. Workloads
created in the same namespace can only be distributed to ManagedClusters
in ManagedClusterSets bound in this namespace by higher level controllers.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of ManagedClusterSetBinding.
type: object
properties:
clusterSet:
description: ClusterSet is the name of the ManagedClusterSet to bind.
It must match the instance name of the ManagedClusterSetBinding
and cannot change once created. User is allowed to set this field
if they have an RBAC rule to CREATE on the virtual subresource of
managedclustersets/bind.
type: string
minLength: 1
served: true
storage: false
- name: v1beta1
schema:
openAPIV3Schema:
description: ManagedClusterSetBinding projects a ManagedClusterSet into a
+124
View File
@@ -8,11 +8,135 @@ spec:
kind: ManagedClusterSet
listKind: ManagedClusterSetList
plural: managedclustersets
shortNames:
- mclset
- mclsets
singular: managedclusterset
scope: Cluster
preserveUnknownFields: false
versions:
- name: v1alpha1
deprecated: true
deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSet
is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSet"
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."
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of the ManagedClusterSet
type: object
status:
description: Status represents the current status of the ManagedClusterSet
type: object
properties:
conditions:
description: Conditions contains the different condition statuses
for this ManagedClusterSet.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
served: true
storage: false
subresources:
status: {}
- additionalPrinterColumns:
- jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status
name: Empty
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: "ManagedClusterSet defines a group of ManagedClusters that user's
+1 -1
View File
@@ -17,6 +17,6 @@ require (
k8s.io/client-go v0.21.1
k8s.io/component-base v0.21.0
k8s.io/klog/v2 v2.8.0
open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308
open-cluster-management.io/api v0.0.0-20210916013819-2e58cdb938f9
sigs.k8s.io/controller-runtime v0.8.3
)
+2 -2
View File
@@ -959,8 +959,8 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308 h1:itWWudWVTqviZ2H2Arb1yTQ7NMUSPVDmWiVOpXiblOM=
open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE=
open-cluster-management.io/api v0.0.0-20210916013819-2e58cdb938f9 h1:ySrjJFbSuPbHEN0OvzTeQO8Bt93rjgvbce7lo2cQeZY=
open-cluster-management.io/api v0.0.0-20210916013819-2e58cdb938f9/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE=
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=
+2 -2
View File
@@ -56,8 +56,8 @@ func RunControllerManager(ctx context.Context, controllerContext *controllercmd.
schedulingController := scheduling.NewSchedulingController(
clusterClient,
clusterInformers.Cluster().V1().ManagedClusters(),
clusterInformers.Cluster().V1alpha1().ManagedClusterSets(),
clusterInformers.Cluster().V1alpha1().ManagedClusterSetBindings(),
clusterInformers.Cluster().V1beta1().ManagedClusterSets(),
clusterInformers.Cluster().V1beta1().ManagedClusterSetBindings(),
clusterInformers.Cluster().V1alpha1().Placements(),
clusterInformers.Cluster().V1alpha1().PlacementDecisions(),
scheduler,
@@ -9,12 +9,13 @@ import (
cache "k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
clusterlisterv1alpha1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1alpha1"
clusterlisterv1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
)
type clusterEventHandler struct {
clusterSetLister clusterlisterv1alpha1.ManagedClusterSetLister
clusterSetBindingLister clusterlisterv1alpha1.ManagedClusterSetBindingLister
clusterSetLister clusterlisterv1beta1.ManagedClusterSetLister
clusterSetBindingLister clusterlisterv1beta1.ManagedClusterSetBindingLister
placementLister clusterlisterv1alpha1.PlacementLister
enqueuePlacementFunc enqueuePlacementFunc
}
@@ -64,8 +64,8 @@ func TestOnClusterChange(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterEventHandler{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -165,8 +165,8 @@ func TestOnClusterUpdate(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterEventHandler{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -239,8 +239,8 @@ func TestOnClusterDelete(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterEventHandler{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -11,11 +11,12 @@ import (
errorhelpers "github.com/openshift/library-go/pkg/operator/v1helpers"
clusterlisterv1alpha1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1alpha1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterlisterv1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
type clusterSetEventHandler struct {
clusterSetBindingLister clusterlisterv1alpha1.ManagedClusterSetBindingLister
clusterSetBindingLister clusterlisterv1beta1.ManagedClusterSetBindingLister
placementLister clusterlisterv1alpha1.PlacementLister
enqueuePlacementFunc enqueuePlacementFunc
}
@@ -31,7 +32,7 @@ func (h *clusterSetEventHandler) OnUpdate(oldObj, newObj interface{}) {
func (h *clusterSetEventHandler) OnDelete(obj interface{}) {
var clusterSetName string
switch t := obj.(type) {
case *clusterapiv1alpha1.ManagedClusterSet:
case *clusterapiv1beta1.ManagedClusterSet:
clusterSetName = t.Name
case cache.DeletedFinalStateUnknown:
clusterSet, ok := t.Obj.(metav1.Object)
@@ -56,7 +57,7 @@ func (h *clusterSetEventHandler) OnDelete(obj interface{}) {
// controller queue for further reconciliation
func enqueuePlacementsByClusterSet(
clusterSetName string,
clusterSetBindingLister clusterlisterv1alpha1.ManagedClusterSetBindingLister,
clusterSetBindingLister clusterlisterv1beta1.ManagedClusterSetBindingLister,
placementLister clusterlisterv1alpha1.PlacementLister,
enqueuePlacementFunc enqueuePlacementFunc,
) error {
@@ -45,7 +45,7 @@ func TestEnqueuePlacementsByClusterSet(t *testing.T) {
queuedKeys := sets.NewString()
err := enqueuePlacementsByClusterSet(
c.clusterSetName,
clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -117,7 +117,7 @@ func TestOnClusterSetDelete(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterSetEventHandler{
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -12,11 +12,12 @@ import (
"k8s.io/klog/v2"
clusterlisterv1alpha1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1alpha1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterlisterv1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
type clusterSetBindingEventHandler struct {
clusterSetLister clusterlisterv1alpha1.ManagedClusterSetLister
clusterSetLister clusterlisterv1beta1.ManagedClusterSetLister
placementLister clusterlisterv1alpha1.PlacementLister
enqueuePlacementFunc enqueuePlacementFunc
}
@@ -31,7 +32,7 @@ func (h *clusterSetBindingEventHandler) OnUpdate(oldObj, newObj interface{}) {
func (h *clusterSetBindingEventHandler) OnDelete(obj interface{}) {
switch t := obj.(type) {
case *clusterapiv1alpha1.ManagedClusterSetBinding:
case *clusterapiv1beta1.ManagedClusterSetBinding:
h.onChange(obj)
case cache.DeletedFinalStateUnknown:
h.onChange(t.Obj)
@@ -57,7 +57,7 @@ func TestOnClusterSetBindingChange(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterSetBindingEventHandler{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -176,7 +176,7 @@ func TestOnClusterSetBindingDelete(t *testing.T) {
queuedKeys := sets.NewString()
handler := &clusterSetBindingEventHandler{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
enqueuePlacementFunc: func(namespace, name string) {
queuedKeys.Insert(fmt.Sprintf("%s/%s", namespace, name))
@@ -26,10 +26,13 @@ import (
clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned"
clusterinformerv1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1"
clusterinformerv1alpha1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1alpha1"
clusterinformerv1beta1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1beta1"
clusterlisterv1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1"
clusterlisterv1alpha1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1alpha1"
clusterlisterv1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
const (
@@ -45,8 +48,8 @@ type enqueuePlacementFunc func(namespace, name string)
type schedulingController struct {
clusterClient clusterclient.Interface
clusterLister clusterlisterv1.ManagedClusterLister
clusterSetLister clusterlisterv1alpha1.ManagedClusterSetLister
clusterSetBindingLister clusterlisterv1alpha1.ManagedClusterSetBindingLister
clusterSetLister clusterlisterv1beta1.ManagedClusterSetLister
clusterSetBindingLister clusterlisterv1beta1.ManagedClusterSetBindingLister
placementLister clusterlisterv1alpha1.PlacementLister
placementDecisionLister clusterlisterv1alpha1.PlacementDecisionLister
enqueuePlacementFunc enqueuePlacementFunc
@@ -58,8 +61,8 @@ type schedulingController struct {
func NewSchedulingController(
clusterClient clusterclient.Interface,
clusterInformer clusterinformerv1.ManagedClusterInformer,
clusterSetInformer clusterinformerv1alpha1.ManagedClusterSetInformer,
clusterSetBindingInformer clusterinformerv1alpha1.ManagedClusterSetBindingInformer,
clusterSetInformer clusterinformerv1beta1.ManagedClusterSetInformer,
clusterSetBindingInformer clusterinformerv1beta1.ManagedClusterSetBindingInformer,
placementInformer clusterinformerv1alpha1.PlacementInformer,
placementDecisionInformer clusterinformerv1alpha1.PlacementDecisionInformer,
scheduler Scheduler,
@@ -202,7 +205,7 @@ func (c *schedulingController) sync(ctx context.Context, syncCtx factory.SyncCon
}
// getManagedClusterSetBindings returns all bindings found in the placement namespace.
func (c *schedulingController) getValidManagedClusterSetBindings(placementNamespace string) ([]*clusterapiv1alpha1.ManagedClusterSetBinding, error) {
func (c *schedulingController) getValidManagedClusterSetBindings(placementNamespace string) ([]*clusterapiv1beta1.ManagedClusterSetBinding, error) {
// get all clusterset bindings under the placement namespace
bindings, err := c.clusterSetBindingLister.ManagedClusterSetBindings(placementNamespace).List(labels.Everything())
if err != nil {
@@ -212,7 +215,7 @@ func (c *schedulingController) getValidManagedClusterSetBindings(placementNamesp
bindings = nil
}
validBindings := []*clusterapiv1alpha1.ManagedClusterSetBinding{}
validBindings := []*clusterapiv1beta1.ManagedClusterSetBinding{}
for _, binding := range bindings {
// ignore clustersetbinding refers to a non-existent clusterset
_, err := c.clusterSetLister.Get(binding.Name)
@@ -229,7 +232,7 @@ func (c *schedulingController) getValidManagedClusterSetBindings(placementNamesp
}
// getEligibleClusterSets returns the names of clusterset that eligible for the placement
func (c *schedulingController) getEligibleClusterSets(placement *clusterapiv1alpha1.Placement, bindings []*clusterapiv1alpha1.ManagedClusterSetBinding) []string {
func (c *schedulingController) getEligibleClusterSets(placement *clusterapiv1alpha1.Placement, bindings []*clusterapiv1beta1.ManagedClusterSetBinding) []string {
// filter out invaid clustersetbindings
clusterSetNames := sets.NewString()
for _, binding := range bindings {
@@ -188,8 +188,8 @@ func TestSchedulingController_sync(t *testing.T) {
ctrl := schedulingController{
clusterClient: clusterClient,
clusterLister: clusterInformerFactory.Cluster().V1().ManagedClusters().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
placementDecisionLister: clusterInformerFactory.Cluster().V1alpha1().PlacementDecisions().Lister(),
scheduler: s,
@@ -242,8 +242,8 @@ func TestGetValidManagedClusterSetBindings(t *testing.T) {
clusterInformerFactory := testinghelpers.NewClusterInformerFactory(clusterClient, c.initObjs...)
ctrl := &schedulingController{
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
}
bindings, err := ctrl.getValidManagedClusterSetBindings(placementNamespace)
if err != nil {
@@ -548,8 +548,8 @@ func TestBind(t *testing.T) {
ctrl := schedulingController{
clusterClient: clusterClient,
clusterLister: clusterInformerFactory.Cluster().V1().ManagedClusters().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Lister(),
clusterSetLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Lister(),
clusterSetBindingLister: clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Lister(),
placementLister: clusterInformerFactory.Cluster().V1alpha1().Placements().Lister(),
placementDecisionLister: clusterInformerFactory.Cluster().V1alpha1().PlacementDecisions().Lister(),
scheduler: s,
+6 -5
View File
@@ -10,6 +10,7 @@ import (
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
type placementBuilder struct {
@@ -235,21 +236,21 @@ func (b *managedClusterBuilder) Build() *clusterapiv1.ManagedCluster {
return b.cluster
}
func NewClusterSet(clusterSetName string) *clusterapiv1alpha1.ManagedClusterSet {
return &clusterapiv1alpha1.ManagedClusterSet{
func NewClusterSet(clusterSetName string) *clusterapiv1beta1.ManagedClusterSet {
return &clusterapiv1beta1.ManagedClusterSet{
ObjectMeta: metav1.ObjectMeta{
Name: clusterSetName,
},
}
}
func NewClusterSetBinding(namespace, clusterSetName string) *clusterapiv1alpha1.ManagedClusterSetBinding {
return &clusterapiv1alpha1.ManagedClusterSetBinding{
func NewClusterSetBinding(namespace, clusterSetName string) *clusterapiv1beta1.ManagedClusterSetBinding {
return &clusterapiv1beta1.ManagedClusterSetBinding{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: clusterSetName,
},
Spec: clusterapiv1alpha1.ManagedClusterSetBindingSpec{
Spec: clusterapiv1beta1.ManagedClusterSetBindingSpec{
ClusterSet: clusterSetName,
},
}
+5 -4
View File
@@ -8,13 +8,14 @@ import (
clusterinformers "open-cluster-management.io/api/client/cluster/informers/externalversions"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
func NewClusterInformerFactory(clusterClient clusterclient.Interface, objects ...runtime.Object) clusterinformers.SharedInformerFactory {
clusterInformerFactory := clusterinformers.NewSharedInformerFactory(clusterClient, time.Minute*10)
clusterStore := clusterInformerFactory.Cluster().V1().ManagedClusters().Informer().GetStore()
clusterSetStore := clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSets().Informer().GetStore()
clusterSetBindingStore := clusterInformerFactory.Cluster().V1alpha1().ManagedClusterSetBindings().Informer().GetStore()
clusterSetStore := clusterInformerFactory.Cluster().V1beta1().ManagedClusterSets().Informer().GetStore()
clusterSetBindingStore := clusterInformerFactory.Cluster().V1beta1().ManagedClusterSetBindings().Informer().GetStore()
placementStore := clusterInformerFactory.Cluster().V1alpha1().Placements().Informer().GetStore()
placementDecisionStore := clusterInformerFactory.Cluster().V1alpha1().PlacementDecisions().Informer().GetStore()
@@ -22,9 +23,9 @@ func NewClusterInformerFactory(clusterClient clusterclient.Interface, objects ..
switch obj.(type) {
case *clusterapiv1.ManagedCluster:
clusterStore.Add(obj)
case *clusterapiv1alpha1.ManagedClusterSet:
case *clusterapiv1beta1.ManagedClusterSet:
clusterSetStore.Add(obj)
case *clusterapiv1alpha1.ManagedClusterSetBinding:
case *clusterapiv1beta1.ManagedClusterSetBinding:
clusterSetBindingStore.Add(obj)
case *clusterapiv1alpha1.Placement:
placementStore.Add(obj)
+7 -6
View File
@@ -12,6 +12,7 @@ import (
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
"open-cluster-management.io/placement/test/integration/util"
)
@@ -45,7 +46,7 @@ var _ = ginkgo.Describe("Placement", func() {
ginkgo.AfterEach(func() {
ginkgo.By("Delete managedclusterset")
clusterClient.ClusterV1alpha1().ManagedClusterSets().Delete(context.Background(), clusterSet1Name, metav1.DeleteOptions{})
clusterClient.ClusterV1beta1().ManagedClusterSets().Delete(context.Background(), clusterSet1Name, metav1.DeleteOptions{})
ginkgo.By("Delete managedclusters")
clusterClient.ClusterV1().ManagedClusters().DeleteCollection(context.Background(), metav1.DeleteOptions{}, metav1.ListOptions{
@@ -119,24 +120,24 @@ var _ = ginkgo.Describe("Placement", func() {
assertBindingClusterSet := func(clusterSetName string) {
ginkgo.By("Create clusterset/clustersetbinding")
clusterset := &clusterapiv1alpha1.ManagedClusterSet{
clusterset := &clusterapiv1beta1.ManagedClusterSet{
ObjectMeta: metav1.ObjectMeta{
Name: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
csb := &clusterapiv1alpha1.ManagedClusterSetBinding{
csb := &clusterapiv1beta1.ManagedClusterSetBinding{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: clusterSetName,
},
Spec: clusterapiv1alpha1.ManagedClusterSetBindingSpec{
Spec: clusterapiv1beta1.ManagedClusterSetBindingSpec{
ClusterSet: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}
+6 -5
View File
@@ -16,6 +16,7 @@ import (
apiequality "k8s.io/apimachinery/pkg/api/equality"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
clusterapiv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterapiv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
controllers "open-cluster-management.io/placement/pkg/controllers"
"open-cluster-management.io/placement/test/integration/util"
)
@@ -199,24 +200,24 @@ var _ = ginkgo.Describe("Placement", func() {
assertBindingClusterSet := func(clusterSetName string) {
ginkgo.By("Create clusterset/clustersetbinding")
clusterset := &clusterapiv1alpha1.ManagedClusterSet{
clusterset := &clusterapiv1beta1.ManagedClusterSet{
ObjectMeta: metav1.ObjectMeta{
Name: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSets().Create(context.Background(), clusterset, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
csb := &clusterapiv1alpha1.ManagedClusterSetBinding{
csb := &clusterapiv1beta1.ManagedClusterSetBinding{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: clusterSetName,
},
Spec: clusterapiv1alpha1.ManagedClusterSetBindingSpec{
Spec: clusterapiv1beta1.ManagedClusterSetBindingSpec{
ClusterSet: clusterSetName,
},
}
_, err = clusterClient.ClusterV1alpha1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
_, err = clusterClient.ClusterV1beta1().ManagedClusterSetBindings(namespace).Create(context.Background(), csb, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}
+1 -2
View File
@@ -36,8 +36,7 @@ var _ = ginkgo.BeforeSuite(func(done ginkgo.Done) {
testEnv = &envtest.Environment{
ErrorIfCRDPathMissing: true,
CRDDirectoryPaths: []string{
filepath.Join(".", "vendor", "open-cluster-management.io", "api", "cluster", "v1"),
filepath.Join(".", "vendor", "open-cluster-management.io", "api", "cluster", "v1alpha1"),
filepath.Join(".", "deploy", "hub"),
},
}
+6 -1
View File
@@ -860,7 +860,7 @@ k8s.io/utils/net
k8s.io/utils/path
k8s.io/utils/pointer
k8s.io/utils/trace
# open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308
# open-cluster-management.io/api v0.0.0-20210916013819-2e58cdb938f9
## explicit
open-cluster-management.io/api/client/cluster/clientset/versioned
open-cluster-management.io/api/client/cluster/clientset/versioned/fake
@@ -869,15 +869,20 @@ open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/
open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1/fake
open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1alpha1
open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1alpha1/fake
open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1
open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1/fake
open-cluster-management.io/api/client/cluster/informers/externalversions
open-cluster-management.io/api/client/cluster/informers/externalversions/cluster
open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1
open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1alpha1
open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1beta1
open-cluster-management.io/api/client/cluster/informers/externalversions/internalinterfaces
open-cluster-management.io/api/client/cluster/listers/cluster/v1
open-cluster-management.io/api/client/cluster/listers/cluster/v1alpha1
open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1
open-cluster-management.io/api/cluster/v1
open-cluster-management.io/api/cluster/v1alpha1
open-cluster-management.io/api/cluster/v1beta1
# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
@@ -10,12 +10,14 @@ import (
flowcontrol "k8s.io/client-go/util/flowcontrol"
clusterv1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1"
clusterv1alpha1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1alpha1"
clusterv1beta1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
ClusterV1() clusterv1.ClusterV1Interface
ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface
ClusterV1beta1() clusterv1beta1.ClusterV1beta1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
@@ -24,6 +26,7 @@ type Clientset struct {
*discovery.DiscoveryClient
clusterV1 *clusterv1.ClusterV1Client
clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client
clusterV1beta1 *clusterv1beta1.ClusterV1beta1Client
}
// ClusterV1 retrieves the ClusterV1Client
@@ -36,6 +39,11 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
return c.clusterV1alpha1
}
// ClusterV1beta1 retrieves the ClusterV1beta1Client
func (c *Clientset) ClusterV1beta1() clusterv1beta1.ClusterV1beta1Interface {
return c.clusterV1beta1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
@@ -65,6 +73,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
cs.clusterV1beta1, err = clusterv1beta1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@@ -79,6 +91,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.clusterV1 = clusterv1.NewForConfigOrDie(c)
cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c)
cs.clusterV1beta1 = clusterv1beta1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
@@ -89,6 +102,7 @@ func New(c rest.Interface) *Clientset {
var cs Clientset
cs.clusterV1 = clusterv1.New(c)
cs.clusterV1alpha1 = clusterv1alpha1.New(c)
cs.clusterV1beta1 = clusterv1beta1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
@@ -13,6 +13,8 @@ import (
fakeclusterv1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1/fake"
clusterv1alpha1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1alpha1"
fakeclusterv1alpha1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1alpha1/fake"
clusterv1beta1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1"
fakeclusterv1beta1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1/fake"
)
// NewSimpleClientset returns a clientset that will respond with the provided objects.
@@ -71,3 +73,8 @@ func (c *Clientset) ClusterV1() clusterv1.ClusterV1Interface {
func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake}
}
// ClusterV1beta1 retrieves the ClusterV1beta1Client
func (c *Clientset) ClusterV1beta1() clusterv1beta1.ClusterV1beta1Interface {
return &fakeclusterv1beta1.FakeClusterV1beta1{Fake: &c.Fake}
}
@@ -10,6 +10,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clusterv1 "open-cluster-management.io/api/cluster/v1"
clusterv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
var scheme = runtime.NewScheme()
@@ -18,6 +19,7 @@ var codecs = serializer.NewCodecFactory(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
clusterv1.AddToScheme,
clusterv1alpha1.AddToScheme,
clusterv1beta1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
@@ -10,6 +10,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clusterv1 "open-cluster-management.io/api/cluster/v1"
clusterv1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
var Scheme = runtime.NewScheme()
@@ -18,6 +19,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
clusterv1.AddToScheme,
clusterv1alpha1.AddToScheme,
clusterv1beta1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
@@ -0,0 +1,78 @@
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
rest "k8s.io/client-go/rest"
"open-cluster-management.io/api/client/cluster/clientset/versioned/scheme"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
type ClusterV1beta1Interface interface {
RESTClient() rest.Interface
ManagedClusterSetsGetter
ManagedClusterSetBindingsGetter
}
// ClusterV1beta1Client is used to interact with features provided by the cluster.open-cluster-management.io group.
type ClusterV1beta1Client struct {
restClient rest.Interface
}
func (c *ClusterV1beta1Client) ManagedClusterSets() ManagedClusterSetInterface {
return newManagedClusterSets(c)
}
func (c *ClusterV1beta1Client) ManagedClusterSetBindings(namespace string) ManagedClusterSetBindingInterface {
return newManagedClusterSetBindings(c, namespace)
}
// NewForConfig creates a new ClusterV1beta1Client for the given config.
func NewForConfig(c *rest.Config) (*ClusterV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &ClusterV1beta1Client{client}, nil
}
// NewForConfigOrDie creates a new ClusterV1beta1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *ClusterV1beta1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new ClusterV1beta1Client for the given RESTClient.
func New(c rest.Interface) *ClusterV1beta1Client {
return &ClusterV1beta1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1beta1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *ClusterV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
@@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1
@@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake
@@ -0,0 +1,28 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
v1beta1 "open-cluster-management.io/api/client/cluster/clientset/versioned/typed/cluster/v1beta1"
)
type FakeClusterV1beta1 struct {
*testing.Fake
}
func (c *FakeClusterV1beta1) ManagedClusterSets() v1beta1.ManagedClusterSetInterface {
return &FakeManagedClusterSets{c}
}
func (c *FakeClusterV1beta1) ManagedClusterSetBindings(namespace string) v1beta1.ManagedClusterSetBindingInterface {
return &FakeManagedClusterSetBindings{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeClusterV1beta1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}
@@ -0,0 +1,117 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// FakeManagedClusterSets implements ManagedClusterSetInterface
type FakeManagedClusterSets struct {
Fake *FakeClusterV1beta1
}
var managedclustersetsResource = schema.GroupVersionResource{Group: "cluster.open-cluster-management.io", Version: "v1beta1", Resource: "managedclustersets"}
var managedclustersetsKind = schema.GroupVersionKind{Group: "cluster.open-cluster-management.io", Version: "v1beta1", Kind: "ManagedClusterSet"}
// Get takes name of the managedClusterSet, and returns the corresponding managedClusterSet object, and an error if there is any.
func (c *FakeManagedClusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ManagedClusterSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(managedclustersetsResource, name), &v1beta1.ManagedClusterSet{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSet), err
}
// List takes label and field selectors, and returns the list of ManagedClusterSets that match those selectors.
func (c *FakeManagedClusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ManagedClusterSetList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(managedclustersetsResource, managedclustersetsKind, opts), &v1beta1.ManagedClusterSetList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ManagedClusterSetList{ListMeta: obj.(*v1beta1.ManagedClusterSetList).ListMeta}
for _, item := range obj.(*v1beta1.ManagedClusterSetList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested managedClusterSets.
func (c *FakeManagedClusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(managedclustersetsResource, opts))
}
// Create takes the representation of a managedClusterSet and creates it. Returns the server's representation of the managedClusterSet, and an error, if there is any.
func (c *FakeManagedClusterSets) Create(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.CreateOptions) (result *v1beta1.ManagedClusterSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(managedclustersetsResource, managedClusterSet), &v1beta1.ManagedClusterSet{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSet), err
}
// Update takes the representation of a managedClusterSet and updates it. Returns the server's representation of the managedClusterSet, and an error, if there is any.
func (c *FakeManagedClusterSets) Update(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (result *v1beta1.ManagedClusterSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(managedclustersetsResource, managedClusterSet), &v1beta1.ManagedClusterSet{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSet), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeManagedClusterSets) UpdateStatus(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (*v1beta1.ManagedClusterSet, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(managedclustersetsResource, "status", managedClusterSet), &v1beta1.ManagedClusterSet{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSet), err
}
// Delete takes name of the managedClusterSet and deletes it. Returns an error if one occurs.
func (c *FakeManagedClusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(managedclustersetsResource, name), &v1beta1.ManagedClusterSet{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeManagedClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(managedclustersetsResource, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ManagedClusterSetList{})
return err
}
// Patch applies the patch and returns the patched managedClusterSet.
func (c *FakeManagedClusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSet, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(managedclustersetsResource, name, pt, data, subresources...), &v1beta1.ManagedClusterSet{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSet), err
}
@@ -0,0 +1,114 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// FakeManagedClusterSetBindings implements ManagedClusterSetBindingInterface
type FakeManagedClusterSetBindings struct {
Fake *FakeClusterV1beta1
ns string
}
var managedclustersetbindingsResource = schema.GroupVersionResource{Group: "cluster.open-cluster-management.io", Version: "v1beta1", Resource: "managedclustersetbindings"}
var managedclustersetbindingsKind = schema.GroupVersionKind{Group: "cluster.open-cluster-management.io", Version: "v1beta1", Kind: "ManagedClusterSetBinding"}
// Get takes name of the managedClusterSetBinding, and returns the corresponding managedClusterSetBinding object, and an error if there is any.
func (c *FakeManagedClusterSetBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(managedclustersetbindingsResource, c.ns, name), &v1beta1.ManagedClusterSetBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSetBinding), err
}
// List takes label and field selectors, and returns the list of ManagedClusterSetBindings that match those selectors.
func (c *FakeManagedClusterSetBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ManagedClusterSetBindingList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(managedclustersetbindingsResource, managedclustersetbindingsKind, c.ns, opts), &v1beta1.ManagedClusterSetBindingList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ManagedClusterSetBindingList{ListMeta: obj.(*v1beta1.ManagedClusterSetBindingList).ListMeta}
for _, item := range obj.(*v1beta1.ManagedClusterSetBindingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested managedClusterSetBindings.
func (c *FakeManagedClusterSetBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(managedclustersetbindingsResource, c.ns, opts))
}
// Create takes the representation of a managedClusterSetBinding and creates it. Returns the server's representation of the managedClusterSetBinding, and an error, if there is any.
func (c *FakeManagedClusterSetBindings) Create(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.CreateOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(managedclustersetbindingsResource, c.ns, managedClusterSetBinding), &v1beta1.ManagedClusterSetBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSetBinding), err
}
// Update takes the representation of a managedClusterSetBinding and updates it. Returns the server's representation of the managedClusterSetBinding, and an error, if there is any.
func (c *FakeManagedClusterSetBindings) Update(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.UpdateOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(managedclustersetbindingsResource, c.ns, managedClusterSetBinding), &v1beta1.ManagedClusterSetBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSetBinding), err
}
// Delete takes name of the managedClusterSetBinding and deletes it. Returns an error if one occurs.
func (c *FakeManagedClusterSetBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(managedclustersetbindingsResource, c.ns, name), &v1beta1.ManagedClusterSetBinding{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeManagedClusterSetBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(managedclustersetbindingsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ManagedClusterSetBindingList{})
return err
}
// Patch applies the patch and returns the patched managedClusterSetBinding.
func (c *FakeManagedClusterSetBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSetBinding, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(managedclustersetbindingsResource, c.ns, name, pt, data, subresources...), &v1beta1.ManagedClusterSetBinding{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ManagedClusterSetBinding), err
}
@@ -0,0 +1,7 @@
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
type ManagedClusterSetExpansion interface{}
type ManagedClusterSetBindingExpansion interface{}
@@ -0,0 +1,168 @@
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
scheme "open-cluster-management.io/api/client/cluster/clientset/versioned/scheme"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetsGetter has a method to return a ManagedClusterSetInterface.
// A group's client should implement this interface.
type ManagedClusterSetsGetter interface {
ManagedClusterSets() ManagedClusterSetInterface
}
// ManagedClusterSetInterface has methods to work with ManagedClusterSet resources.
type ManagedClusterSetInterface interface {
Create(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.CreateOptions) (*v1beta1.ManagedClusterSet, error)
Update(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (*v1beta1.ManagedClusterSet, error)
UpdateStatus(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (*v1beta1.ManagedClusterSet, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ManagedClusterSet, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ManagedClusterSetList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSet, err error)
ManagedClusterSetExpansion
}
// managedClusterSets implements ManagedClusterSetInterface
type managedClusterSets struct {
client rest.Interface
}
// newManagedClusterSets returns a ManagedClusterSets
func newManagedClusterSets(c *ClusterV1beta1Client) *managedClusterSets {
return &managedClusterSets{
client: c.RESTClient(),
}
}
// Get takes name of the managedClusterSet, and returns the corresponding managedClusterSet object, and an error if there is any.
func (c *managedClusterSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ManagedClusterSet, err error) {
result = &v1beta1.ManagedClusterSet{}
err = c.client.Get().
Resource("managedclustersets").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ManagedClusterSets that match those selectors.
func (c *managedClusterSets) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ManagedClusterSetList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ManagedClusterSetList{}
err = c.client.Get().
Resource("managedclustersets").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested managedClusterSets.
func (c *managedClusterSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("managedclustersets").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a managedClusterSet and creates it. Returns the server's representation of the managedClusterSet, and an error, if there is any.
func (c *managedClusterSets) Create(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.CreateOptions) (result *v1beta1.ManagedClusterSet, err error) {
result = &v1beta1.ManagedClusterSet{}
err = c.client.Post().
Resource("managedclustersets").
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterSet).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a managedClusterSet and updates it. Returns the server's representation of the managedClusterSet, and an error, if there is any.
func (c *managedClusterSets) Update(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (result *v1beta1.ManagedClusterSet, err error) {
result = &v1beta1.ManagedClusterSet{}
err = c.client.Put().
Resource("managedclustersets").
Name(managedClusterSet.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterSet).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *managedClusterSets) UpdateStatus(ctx context.Context, managedClusterSet *v1beta1.ManagedClusterSet, opts v1.UpdateOptions) (result *v1beta1.ManagedClusterSet, err error) {
result = &v1beta1.ManagedClusterSet{}
err = c.client.Put().
Resource("managedclustersets").
Name(managedClusterSet.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterSet).
Do(ctx).
Into(result)
return
}
// Delete takes name of the managedClusterSet and deletes it. Returns an error if one occurs.
func (c *managedClusterSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("managedclustersets").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *managedClusterSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("managedclustersets").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched managedClusterSet.
func (c *managedClusterSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSet, err error) {
result = &v1beta1.ManagedClusterSet{}
err = c.client.Patch(pt).
Resource("managedclustersets").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -0,0 +1,162 @@
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
scheme "open-cluster-management.io/api/client/cluster/clientset/versioned/scheme"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetBindingsGetter has a method to return a ManagedClusterSetBindingInterface.
// A group's client should implement this interface.
type ManagedClusterSetBindingsGetter interface {
ManagedClusterSetBindings(namespace string) ManagedClusterSetBindingInterface
}
// ManagedClusterSetBindingInterface has methods to work with ManagedClusterSetBinding resources.
type ManagedClusterSetBindingInterface interface {
Create(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.CreateOptions) (*v1beta1.ManagedClusterSetBinding, error)
Update(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.UpdateOptions) (*v1beta1.ManagedClusterSetBinding, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.ManagedClusterSetBinding, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ManagedClusterSetBindingList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSetBinding, err error)
ManagedClusterSetBindingExpansion
}
// managedClusterSetBindings implements ManagedClusterSetBindingInterface
type managedClusterSetBindings struct {
client rest.Interface
ns string
}
// newManagedClusterSetBindings returns a ManagedClusterSetBindings
func newManagedClusterSetBindings(c *ClusterV1beta1Client, namespace string) *managedClusterSetBindings {
return &managedClusterSetBindings{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the managedClusterSetBinding, and returns the corresponding managedClusterSetBinding object, and an error if there is any.
func (c *managedClusterSetBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
result = &v1beta1.ManagedClusterSetBinding{}
err = c.client.Get().
Namespace(c.ns).
Resource("managedclustersetbindings").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ManagedClusterSetBindings that match those selectors.
func (c *managedClusterSetBindings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ManagedClusterSetBindingList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ManagedClusterSetBindingList{}
err = c.client.Get().
Namespace(c.ns).
Resource("managedclustersetbindings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested managedClusterSetBindings.
func (c *managedClusterSetBindings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("managedclustersetbindings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a managedClusterSetBinding and creates it. Returns the server's representation of the managedClusterSetBinding, and an error, if there is any.
func (c *managedClusterSetBindings) Create(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.CreateOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
result = &v1beta1.ManagedClusterSetBinding{}
err = c.client.Post().
Namespace(c.ns).
Resource("managedclustersetbindings").
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterSetBinding).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a managedClusterSetBinding and updates it. Returns the server's representation of the managedClusterSetBinding, and an error, if there is any.
func (c *managedClusterSetBindings) Update(ctx context.Context, managedClusterSetBinding *v1beta1.ManagedClusterSetBinding, opts v1.UpdateOptions) (result *v1beta1.ManagedClusterSetBinding, err error) {
result = &v1beta1.ManagedClusterSetBinding{}
err = c.client.Put().
Namespace(c.ns).
Resource("managedclustersetbindings").
Name(managedClusterSetBinding.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterSetBinding).
Do(ctx).
Into(result)
return
}
// Delete takes name of the managedClusterSetBinding and deletes it. Returns an error if one occurs.
func (c *managedClusterSetBindings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("managedclustersetbindings").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *managedClusterSetBindings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("managedclustersetbindings").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched managedClusterSetBinding.
func (c *managedClusterSetBindings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ManagedClusterSetBinding, err error) {
result = &v1beta1.ManagedClusterSetBinding{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("managedclustersetbindings").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}
@@ -5,6 +5,7 @@ package cluster
import (
v1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1"
v1alpha1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1alpha1"
v1beta1 "open-cluster-management.io/api/client/cluster/informers/externalversions/cluster/v1beta1"
internalinterfaces "open-cluster-management.io/api/client/cluster/informers/externalversions/internalinterfaces"
)
@@ -14,6 +15,8 @@ type Interface interface {
V1() v1.Interface
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
}
type group struct {
@@ -36,3 +39,8 @@ func (g *group) V1() v1.Interface {
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
}
@@ -0,0 +1,36 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
internalinterfaces "open-cluster-management.io/api/client/cluster/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// ManagedClusterSets returns a ManagedClusterSetInformer.
ManagedClusterSets() ManagedClusterSetInformer
// ManagedClusterSetBindings returns a ManagedClusterSetBindingInformer.
ManagedClusterSetBindings() ManagedClusterSetBindingInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// ManagedClusterSets returns a ManagedClusterSetInformer.
func (v *version) ManagedClusterSets() ManagedClusterSetInformer {
return &managedClusterSetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ManagedClusterSetBindings returns a ManagedClusterSetBindingInformer.
func (v *version) ManagedClusterSetBindings() ManagedClusterSetBindingInformer {
return &managedClusterSetBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
@@ -0,0 +1,73 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
versioned "open-cluster-management.io/api/client/cluster/clientset/versioned"
internalinterfaces "open-cluster-management.io/api/client/cluster/informers/externalversions/internalinterfaces"
v1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetInformer provides access to a shared informer and lister for
// ManagedClusterSets.
type ManagedClusterSetInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ManagedClusterSetLister
}
type managedClusterSetInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewManagedClusterSetInformer constructs a new informer for ManagedClusterSet type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewManagedClusterSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredManagedClusterSetInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredManagedClusterSetInformer constructs a new informer for ManagedClusterSet type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredManagedClusterSetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ClusterV1beta1().ManagedClusterSets().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ClusterV1beta1().ManagedClusterSets().Watch(context.TODO(), options)
},
},
&clusterv1beta1.ManagedClusterSet{},
resyncPeriod,
indexers,
)
}
func (f *managedClusterSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredManagedClusterSetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *managedClusterSetInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&clusterv1beta1.ManagedClusterSet{}, f.defaultInformer)
}
func (f *managedClusterSetInformer) Lister() v1beta1.ManagedClusterSetLister {
return v1beta1.NewManagedClusterSetLister(f.Informer().GetIndexer())
}
@@ -0,0 +1,74 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
versioned "open-cluster-management.io/api/client/cluster/clientset/versioned"
internalinterfaces "open-cluster-management.io/api/client/cluster/informers/externalversions/internalinterfaces"
v1beta1 "open-cluster-management.io/api/client/cluster/listers/cluster/v1beta1"
clusterv1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetBindingInformer provides access to a shared informer and lister for
// ManagedClusterSetBindings.
type ManagedClusterSetBindingInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ManagedClusterSetBindingLister
}
type managedClusterSetBindingInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewManagedClusterSetBindingInformer constructs a new informer for ManagedClusterSetBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewManagedClusterSetBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredManagedClusterSetBindingInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredManagedClusterSetBindingInformer constructs a new informer for ManagedClusterSetBinding type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredManagedClusterSetBindingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ClusterV1beta1().ManagedClusterSetBindings(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ClusterV1beta1().ManagedClusterSetBindings(namespace).Watch(context.TODO(), options)
},
},
&clusterv1beta1.ManagedClusterSetBinding{},
resyncPeriod,
indexers,
)
}
func (f *managedClusterSetBindingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredManagedClusterSetBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *managedClusterSetBindingInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&clusterv1beta1.ManagedClusterSetBinding{}, f.defaultInformer)
}
func (f *managedClusterSetBindingInformer) Lister() v1beta1.ManagedClusterSetBindingLister {
return v1beta1.NewManagedClusterSetBindingLister(f.Informer().GetIndexer())
}
@@ -9,6 +9,7 @@ import (
cache "k8s.io/client-go/tools/cache"
v1 "open-cluster-management.io/api/cluster/v1"
v1alpha1 "open-cluster-management.io/api/cluster/v1alpha1"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// GenericInformer is type of SharedIndexInformer which will locate and delegate to other
@@ -53,6 +54,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case v1alpha1.SchemeGroupVersion.WithResource("placementdecisions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().PlacementDecisions().Informer()}, nil
// Group=cluster.open-cluster-management.io, Version=v1beta1
case v1beta1.SchemeGroupVersion.WithResource("managedclustersets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1beta1().ManagedClusterSets().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("managedclustersetbindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1beta1().ManagedClusterSetBindings().Informer()}, nil
}
return nil, fmt.Errorf("no informer found for %v", resource)
@@ -0,0 +1,15 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
// ManagedClusterSetListerExpansion allows custom methods to be added to
// ManagedClusterSetLister.
type ManagedClusterSetListerExpansion interface{}
// ManagedClusterSetBindingListerExpansion allows custom methods to be added to
// ManagedClusterSetBindingLister.
type ManagedClusterSetBindingListerExpansion interface{}
// ManagedClusterSetBindingNamespaceListerExpansion allows custom methods to be added to
// ManagedClusterSetBindingNamespaceLister.
type ManagedClusterSetBindingNamespaceListerExpansion interface{}
@@ -0,0 +1,52 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetLister helps list ManagedClusterSets.
// All objects returned here must be treated as read-only.
type ManagedClusterSetLister interface {
// List lists all ManagedClusterSets in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSet, err error)
// Get retrieves the ManagedClusterSet from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ManagedClusterSet, error)
ManagedClusterSetListerExpansion
}
// managedClusterSetLister implements the ManagedClusterSetLister interface.
type managedClusterSetLister struct {
indexer cache.Indexer
}
// NewManagedClusterSetLister returns a new ManagedClusterSetLister.
func NewManagedClusterSetLister(indexer cache.Indexer) ManagedClusterSetLister {
return &managedClusterSetLister{indexer: indexer}
}
// List lists all ManagedClusterSets in the indexer.
func (s *managedClusterSetLister) List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSet, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ManagedClusterSet))
})
return ret, err
}
// Get retrieves the ManagedClusterSet from the index for a given name.
func (s *managedClusterSetLister) Get(name string) (*v1beta1.ManagedClusterSet, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("managedclusterset"), name)
}
return obj.(*v1beta1.ManagedClusterSet), nil
}
@@ -0,0 +1,83 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
v1beta1 "open-cluster-management.io/api/cluster/v1beta1"
)
// ManagedClusterSetBindingLister helps list ManagedClusterSetBindings.
// All objects returned here must be treated as read-only.
type ManagedClusterSetBindingLister interface {
// List lists all ManagedClusterSetBindings in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSetBinding, err error)
// ManagedClusterSetBindings returns an object that can list and get ManagedClusterSetBindings.
ManagedClusterSetBindings(namespace string) ManagedClusterSetBindingNamespaceLister
ManagedClusterSetBindingListerExpansion
}
// managedClusterSetBindingLister implements the ManagedClusterSetBindingLister interface.
type managedClusterSetBindingLister struct {
indexer cache.Indexer
}
// NewManagedClusterSetBindingLister returns a new ManagedClusterSetBindingLister.
func NewManagedClusterSetBindingLister(indexer cache.Indexer) ManagedClusterSetBindingLister {
return &managedClusterSetBindingLister{indexer: indexer}
}
// List lists all ManagedClusterSetBindings in the indexer.
func (s *managedClusterSetBindingLister) List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSetBinding, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ManagedClusterSetBinding))
})
return ret, err
}
// ManagedClusterSetBindings returns an object that can list and get ManagedClusterSetBindings.
func (s *managedClusterSetBindingLister) ManagedClusterSetBindings(namespace string) ManagedClusterSetBindingNamespaceLister {
return managedClusterSetBindingNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ManagedClusterSetBindingNamespaceLister helps list and get ManagedClusterSetBindings.
// All objects returned here must be treated as read-only.
type ManagedClusterSetBindingNamespaceLister interface {
// List lists all ManagedClusterSetBindings in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSetBinding, err error)
// Get retrieves the ManagedClusterSetBinding from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ManagedClusterSetBinding, error)
ManagedClusterSetBindingNamespaceListerExpansion
}
// managedClusterSetBindingNamespaceLister implements the ManagedClusterSetBindingNamespaceLister
// interface.
type managedClusterSetBindingNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ManagedClusterSetBindings in the indexer for a given namespace.
func (s managedClusterSetBindingNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ManagedClusterSetBinding, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ManagedClusterSetBinding))
})
return ret, err
}
// Get retrieves the ManagedClusterSetBinding from the indexer for a given namespace and name.
func (s managedClusterSetBindingNamespaceLister) Get(name string) (*v1beta1.ManagedClusterSetBinding, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("managedclustersetbinding"), name)
}
return obj.(*v1beta1.ManagedClusterSetBinding), nil
}
@@ -0,0 +1,255 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: managedclustersets.cluster.open-cluster-management.io
spec:
group: cluster.open-cluster-management.io
names:
kind: ManagedClusterSet
listKind: ManagedClusterSetList
plural: managedclustersets
shortNames:
- mclset
- mclsets
singular: managedclusterset
scope: Cluster
preserveUnknownFields: false
versions:
- name: v1alpha1
deprecated: true
deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSet
is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSet"
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."
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of the ManagedClusterSet
type: object
status:
description: Status represents the current status of the ManagedClusterSet
type: object
properties:
conditions:
description: Conditions contains the different condition statuses
for this ManagedClusterSet.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
served: true
storage: false
subresources:
status: {}
- additionalPrinterColumns:
- jsonPath: .status.conditions[?(@.type=="ClusterSetEmpty")].status
name: Empty
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
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."
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of the ManagedClusterSet
type: object
status:
description: Status represents the current status of the ManagedClusterSet
type: object
properties:
conditions:
description: Conditions contains the different condition statuses
for this ManagedClusterSet.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
@@ -0,0 +1,100 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: managedclustersetbindings.cluster.open-cluster-management.io
spec:
group: cluster.open-cluster-management.io
names:
kind: ManagedClusterSetBinding
listKind: ManagedClusterSetBindingList
plural: managedclustersetbindings
shortNames:
- mclsetbinding
- mclsetbindings
singular: managedclustersetbinding
scope: Namespaced
preserveUnknownFields: false
versions:
- name: v1alpha1
deprecated: true
deprecationWarning: "cluster.open-cluster-management.io/v1alpha1 ManagedClusterSetBinding
is deprecated; use cluster.open-cluster-management.io/v1beta1 ManagedClusterSetBinding"
schema:
openAPIV3Schema:
description: ManagedClusterSetBinding projects a ManagedClusterSet into a
certain namespace. User is able to create a ManagedClusterSetBinding in
a namespace and bind it to a ManagedClusterSet if they have an RBAC rule
to CREATE on the virtual subresource of managedclustersets/bind. Workloads
created in the same namespace can only be distributed to ManagedClusters
in ManagedClusterSets bound in this namespace by higher level controllers.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of ManagedClusterSetBinding.
type: object
properties:
clusterSet:
description: ClusterSet is the name of the ManagedClusterSet to bind.
It must match the instance name of the ManagedClusterSetBinding
and cannot change once created. User is allowed to set this field
if they have an RBAC rule to CREATE on the virtual subresource of
managedclustersets/bind.
type: string
minLength: 1
served: true
storage: false
- name: v1beta1
schema:
openAPIV3Schema:
description: ManagedClusterSetBinding projects a ManagedClusterSet into a
certain namespace. User is able to create a ManagedClusterSetBinding in
a namespace and bind it to a ManagedClusterSet if they have an RBAC rule
to CREATE on the virtual subresource of managedclustersets/bind. Workloads
created in the same namespace can only be distributed to ManagedClusters
in ManagedClusterSets bound in this namespace by higher level controllers.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the attributes of ManagedClusterSetBinding.
type: object
properties:
clusterSet:
description: ClusterSet is the name of the ManagedClusterSet to bind.
It must match the instance name of the ManagedClusterSetBinding
and cannot change once created. User is allowed to set this field
if they have an RBAC rule to CREATE on the virtual subresource of
managedclustersets/bind.
type: string
minLength: 1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
+9
View File
@@ -0,0 +1,9 @@
// Package v1beta1 contains API Schema definitions for the cluster v1beta1 API group
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=open-cluster-management.io/api/cluster
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +kubebuilder:validation:Optional
// +groupName=cluster.open-cluster-management.io
package v1beta1
+40
View File
@@ -0,0 +1,40 @@
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
GroupName = "cluster.open-cluster-management.io"
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// Install is a function which adds this version to a scheme
Install = schemeBuilder.AddToScheme
// SchemeGroupVersion generated code relies on this name
// Deprecated
SchemeGroupVersion = GroupVersion
// AddToScheme exists solely to keep the old generators creating valid code
// DEPRECATED
AddToScheme = schemeBuilder.AddToScheme
)
// Resource generated code relies on this being here, but it logically belongs to the group
// DEPRECATED
func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion,
&ManagedClusterSet{},
&ManagedClusterSetList{},
&ManagedClusterSetBinding{},
&ManagedClusterSetBindingList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}
+110
View File
@@ -0,0 +1,110 @@
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope="Cluster",shortName={"mclset","mclsets"}
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Empty",type="string",JSONPath=".status.conditions[?(@.type==\"ClusterSetEmpty\")].status"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// 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
//
// 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 ManagedClusterSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the attributes of the ManagedClusterSet
Spec ManagedClusterSetSpec `json:"spec"`
// Status represents the current status of the ManagedClusterSet
// +optional
Status ManagedClusterSetStatus `json:"status,omitempty"`
}
// ManagedClusterSetSpec describes the attributes of the ManagedClusterSet
type ManagedClusterSetSpec struct {
}
// ManagedClusterSetStatus represents the current status of the ManagedClusterSet.
type ManagedClusterSetStatus struct {
// Conditions contains the different condition statuses for this ManagedClusterSet.
Conditions []metav1.Condition `json:"conditions"`
}
const (
// ManagedClusterSetConditionEmpty means no ManagedCluster is included in the
// ManagedClusterSet.
ManagedClusterSetConditionEmpty string = "ClusterSetEmpty"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ManagedClusterSetList is a collection of ManagedClusterSet.
type ManagedClusterSetList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of ManagedClusterSet.
Items []ManagedClusterSet `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:scope="Namespaced",shortName={"mclsetbinding","mclsetbindings"}
// +kubebuilder:storageversion
// ManagedClusterSetBinding projects a ManagedClusterSet into a certain namespace.
// User is able to create a ManagedClusterSetBinding in a namespace and bind it to a
// ManagedClusterSet if they have an RBAC rule to CREATE on the virtual subresource of
// managedclustersets/bind. Workloads created in the same namespace can only be
// distributed to ManagedClusters in ManagedClusterSets bound in this namespace by
// higher level controllers.
type ManagedClusterSetBinding struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the attributes of ManagedClusterSetBinding.
Spec ManagedClusterSetBindingSpec `json:"spec"`
}
// ManagedClusterSetBindingSpec defines the attributes of ManagedClusterSetBinding.
type ManagedClusterSetBindingSpec struct {
// ClusterSet is the name of the ManagedClusterSet to bind. It must match the
// instance name of the ManagedClusterSetBinding and cannot change once created.
// User is allowed to set this field if they have an RBAC rule to CREATE on the
// virtual subresource of managedclustersets/bind.
// +kubebuilder:validation:MinLength=1
ClusterSet string `json:"clusterSet"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ManagedClusterSetBindingList is a collection of ManagedClusterSetBinding.
type ManagedClusterSetBindingList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of ManagedClusterSetBinding.
Items []ManagedClusterSetBinding `json:"items"`
}
@@ -0,0 +1,186 @@
// +build !ignore_autogenerated
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1beta1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSet) DeepCopyInto(out *ManagedClusterSet) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSet.
func (in *ManagedClusterSet) DeepCopy() *ManagedClusterSet {
if in == nil {
return nil
}
out := new(ManagedClusterSet)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterSet) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetBinding) DeepCopyInto(out *ManagedClusterSetBinding) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetBinding.
func (in *ManagedClusterSetBinding) DeepCopy() *ManagedClusterSetBinding {
if in == nil {
return nil
}
out := new(ManagedClusterSetBinding)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterSetBinding) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetBindingList) DeepCopyInto(out *ManagedClusterSetBindingList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ManagedClusterSetBinding, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetBindingList.
func (in *ManagedClusterSetBindingList) DeepCopy() *ManagedClusterSetBindingList {
if in == nil {
return nil
}
out := new(ManagedClusterSetBindingList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterSetBindingList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetBindingSpec) DeepCopyInto(out *ManagedClusterSetBindingSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetBindingSpec.
func (in *ManagedClusterSetBindingSpec) DeepCopy() *ManagedClusterSetBindingSpec {
if in == nil {
return nil
}
out := new(ManagedClusterSetBindingSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetList) DeepCopyInto(out *ManagedClusterSetList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ManagedClusterSet, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetList.
func (in *ManagedClusterSetList) DeepCopy() *ManagedClusterSetList {
if in == nil {
return nil
}
out := new(ManagedClusterSetList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterSetList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetSpec) DeepCopyInto(out *ManagedClusterSetSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetSpec.
func (in *ManagedClusterSetSpec) DeepCopy() *ManagedClusterSetSpec {
if in == nil {
return nil
}
out := new(ManagedClusterSetSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterSetStatus) DeepCopyInto(out *ManagedClusterSetStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]v1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterSetStatus.
func (in *ManagedClusterSetStatus) DeepCopy() *ManagedClusterSetStatus {
if in == nil {
return nil
}
out := new(ManagedClusterSetStatus)
in.DeepCopyInto(out)
return out
}
@@ -0,0 +1,79 @@
package v1beta1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
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.",
"spec": "Spec defines the attributes of the ManagedClusterSet",
"status": "Status represents the current status of the ManagedClusterSet",
}
func (ManagedClusterSet) SwaggerDoc() map[string]string {
return map_ManagedClusterSet
}
var map_ManagedClusterSetBinding = map[string]string{
"": "ManagedClusterSetBinding projects a ManagedClusterSet into a certain namespace. User is able to create a ManagedClusterSetBinding in a namespace and bind it to a ManagedClusterSet if they have an RBAC rule to CREATE on the virtual subresource of managedclustersets/bind. Workloads created in the same namespace can only be distributed to ManagedClusters in ManagedClusterSets bound in this namespace by higher level controllers.",
"spec": "Spec defines the attributes of ManagedClusterSetBinding.",
}
func (ManagedClusterSetBinding) SwaggerDoc() map[string]string {
return map_ManagedClusterSetBinding
}
var map_ManagedClusterSetBindingList = map[string]string{
"": "ManagedClusterSetBindingList is a collection of ManagedClusterSetBinding.",
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
"items": "Items is a list of ManagedClusterSetBinding.",
}
func (ManagedClusterSetBindingList) SwaggerDoc() map[string]string {
return map_ManagedClusterSetBindingList
}
var map_ManagedClusterSetBindingSpec = map[string]string{
"": "ManagedClusterSetBindingSpec defines the attributes of ManagedClusterSetBinding.",
"clusterSet": "ClusterSet is the name of the ManagedClusterSet to bind. It must match the instance name of the ManagedClusterSetBinding and cannot change once created. User is allowed to set this field if they have an RBAC rule to CREATE on the virtual subresource of managedclustersets/bind.",
}
func (ManagedClusterSetBindingSpec) SwaggerDoc() map[string]string {
return map_ManagedClusterSetBindingSpec
}
var map_ManagedClusterSetList = map[string]string{
"": "ManagedClusterSetList is a collection of ManagedClusterSet.",
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
"items": "Items is a list of ManagedClusterSet.",
}
func (ManagedClusterSetList) SwaggerDoc() map[string]string {
return map_ManagedClusterSetList
}
var map_ManagedClusterSetSpec = map[string]string{
"": "ManagedClusterSetSpec describes the attributes of the ManagedClusterSet",
}
func (ManagedClusterSetSpec) SwaggerDoc() map[string]string {
return map_ManagedClusterSetSpec
}
var map_ManagedClusterSetStatus = map[string]string{
"": "ManagedClusterSetStatus represents the current status of the ManagedClusterSet.",
"conditions": "Conditions contains the different condition statuses for this ManagedClusterSet.",
}
func (ManagedClusterSetStatus) SwaggerDoc() map[string]string {
return map_ManagedClusterSetStatus
}
// AUTO-GENERATED FUNCTIONS END HERE