diff --git a/cluster/v1beta1/types.go b/cluster/v1beta1/placement_types.go similarity index 59% rename from cluster/v1beta1/types.go rename to cluster/v1beta1/placement_types.go index c0691ea72..bbfa1db48 100644 --- a/cluster/v1beta1/types.go +++ b/cluster/v1beta1/placement_types.go @@ -64,47 +64,4 @@ type ManagedClusterSetList struct { // 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"` -} +} \ No newline at end of file diff --git a/cluster/v1beta1/placementbinding_types.go b/cluster/v1beta1/placementbinding_types.go new file mode 100644 index 000000000..fa1933c78 --- /dev/null +++ b/cluster/v1beta1/placementbinding_types.go @@ -0,0 +1,48 @@ +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +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"` +}