Skip to content

Commit

Permalink
fixed issue open-cluster-management-io#112 - spreated types.go file
Browse files Browse the repository at this point in the history
Signed-off-by: Ilan Pinto <[email protected]>

fixed format

Signed-off-by: Ilan Pinto <[email protected]>

fixed issue open-cluster-management-io#112 - spreated types.go file

renamed types
  • Loading branch information
ilan-pinto committed Dec 20, 2021
1 parent 623a2d6 commit cb026fc
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 71 deletions.
43 changes: 0 additions & 43 deletions cluster/v1beta1/types.go → cluster/v1beta1/types_placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
48 changes: 48 additions & 0 deletions cluster/v1beta1/types_placementbinding.go
Original file line number Diff line number Diff line change
@@ -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"`
}
54 changes: 27 additions & 27 deletions cluster/v1beta1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit cb026fc

Please sign in to comment.