diff --git a/cluster/v1beta1/types.go b/cluster/v1beta1/types_placement.go similarity index 59% rename from cluster/v1beta1/types.go rename to cluster/v1beta1/types_placement.go index c0691ea72..33c12f887 100644 --- a/cluster/v1beta1/types.go +++ b/cluster/v1beta1/types_placement.go @@ -65,46 +65,3 @@ 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"` -} diff --git a/cluster/v1beta1/types_placementbinding.go b/cluster/v1beta1/types_placementbinding.go new file mode 100644 index 000000000..fa1933c78 --- /dev/null +++ b/cluster/v1beta1/types_placementbinding.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"` +} diff --git a/cluster/v1beta1/zz_generated.swagger_doc_generated.go b/cluster/v1beta1/zz_generated.swagger_doc_generated.go index 2dea87dc5..4473f0810 100644 --- a/cluster/v1beta1/zz_generated.swagger_doc_generated.go +++ b/cluster/v1beta1/zz_generated.swagger_doc_generated.go @@ -21,6 +21,33 @@ func (ManagedClusterSet) SwaggerDoc() map[string]string { return map_ManagedClusterSet } +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 +} + 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.", @@ -49,31 +76,4 @@ 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 diff --git a/docs/development.md b/docs/development.md index a737d62cf..d4138531e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -57,7 +57,7 @@ For more information on the API markers to add to your Go types, see the [Kubebu To generate `zz_generated.deepcopy.go` & `zz_generated.swagger_doc_generated.go`: 1. You will need to create a `register.go` file in your `API_DIRECTORY`. You can get an example from [/cluster/v1/register.go](/cluster/v1/register.go). Make sure the `package`, `GroupName`, and `GroupVersion` are correct. Make sure the `addKnownTypes()` function adds types you are creating in `types.go`. 2. Add `add-crd-gen` in `Makefile` (step 2 of [Updating CRD schemas](#Updating-CRD-schemas)). -3. Run `make update-scripts` to see `zz_generated.deepcopy.go` & `zz_generated.swagger_doc_generated.go` generated in your API directory, and along with some related scripts generated in `client` directory. If `zz_generated.deepcopy.go` is not generated properly, please run the command in a container with `RUNTIME=docker make generate-with-container` (if you are using `podman`, set `RUNTIME=podman`). +3. Run `make update-scripts` to see `zz_generated.deepcopy.go` & `zz_generated.swagger_doc_generated.go` generated in your API directory, and along with some related scripts generated in `client` directory. If `zz_generated.deepcopy.go` is not generated properly, please run the command in a container with `RUNTIME=docker make update-with-container` (if you are using `podman`, set `RUNTIME=podman`). ## Verify Before you commit you changes, please run `make verify` locally to make sure you have generated all required files. \ No newline at end of file