Skip to content

Commit

Permalink
CRD renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
akgalwas committed Sep 12, 2023
1 parent 7abb129 commit 48784c7
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 95 deletions.
26 changes: 13 additions & 13 deletions api/v1/cluster_types.go → api/v1/gardenercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,42 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// ClusterSpec defines the desired state of Cluster
type ClusterSpec struct {
// GardenerClusterSpec defines the desired state of GardenerCluster
type GardenerClusterSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of Cluster. Edit cluster_types.go to remove/update
// Foo is an example field of GardenerCluster. Edit gardenercluster_types.go to remove/update
Foo string `json:"foo,omitempty"`
}

// ClusterStatus defines the observed state of Cluster
type ClusterStatus struct {
// GardenerClusterStatus defines the observed state of GardenerCluster
type GardenerClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// Cluster is the Schema for the clusters API
type Cluster struct {
// GardenerCluster is the Schema for the clusters API
type GardenerCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClusterSpec `json:"spec,omitempty"`
Status ClusterStatus `json:"status,omitempty"`
Spec GardenerClusterSpec `json:"spec,omitempty"`
Status GardenerClusterStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ClusterList contains a list of Cluster
type ClusterList struct {
// GardenerClusterList contains a list of GardenerCluster
type GardenerClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Cluster `json:"items"`
Items []GardenerCluster `json:"items"`
}

func init() {
SchemeBuilder.Register(&Cluster{}, &ClusterList{})
SchemeBuilder.Register(&GardenerCluster{}, &GardenerClusterList{})
}
38 changes: 19 additions & 19 deletions api/v1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func main() {
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Cluster")
setupLog.Error(err, "unable to create controller", "controller", "GardenerCluster")
os.Exit(1)
}
//+kubebuilder:scaffold:builder
Expand Down

This file was deleted.

16 changes: 8 additions & 8 deletions config/crd/bases/clusterinventory.kyma-project.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
name: clusters.clusterinventory.kyma-project.io
name: gardenerclusters.clusterinventory.kyma-project.io
spec:
group: clusterinventory.kyma-project.io
names:
kind: Cluster
listKind: ClusterList
plural: clusters
singular: cluster
kind: GardenerCluster
listKind: GardenerClusterList
plural: gardenerclusters
singular: gardenercluster
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Cluster is the Schema for the clusters API
description: Gardener Cluster is the Schema for the gardenerclusters API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -32,15 +32,15 @@ spec:
metadata:
type: object
spec:
description: ClusterSpec defines the desired state of Cluster
description: GardenerClusterSpec defines the desired state of GardenerCluster
properties:
foo:
description: Foo is an example field of Cluster. Edit cluster_types.go
to remove/update
type: string
type: object
status:
description: ClusterStatus defines the observed state of Cluster
description: GardenerClusterStatus defines the observed state of Cluster
type: object
type: object
served: true
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/cainjection_in_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
name: clusters.clusterinventory.kyma-project.io
name: gardenerclusters.clusterinventory.kyma-project.io
2 changes: 1 addition & 1 deletion config/crd/patches/webhook_in_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusters.clusterinventory.kyma-project.io
name: gardenerclusters.clusterinventory.kyma-project.io
spec:
conversion:
strategy: Webhook
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
)

// ClusterReconciler reconciles a Cluster object
// ClusterReconciler reconciles a GardenerCluster object
type ClusterReconciler struct {
client.Client
Scheme *runtime.Scheme
Expand All @@ -40,7 +40,7 @@ type ClusterReconciler struct {
// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
// TODO(user): Modify the Reconcile function to compare the state specified by
// the Cluster object against the actual cluster state, and then
// the GardenerCluster object against the actual cluster state, and then
// perform operations to make the cluster state reflect the state specified by
// the user.
//
Expand All @@ -57,6 +57,6 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
// SetupWithManager sets up the controller with the Manager.
func (r *ClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&clusterinventoryv1.Cluster{}).
For(&clusterinventoryv1.GardenerCluster{}).
Complete(r)
}

0 comments on commit 48784c7

Please sign in to comment.