Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRD structure prepared #24

Merged
merged 9 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 37 additions & 17 deletions api/v1/gardenercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// 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.

// 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 GardenerCluster. Edit gardenercluster_types.go to remove/update
Foo string `json:"foo,omitempty"`
}

// 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
}
type State string
Disper marked this conversation as resolved.
Show resolved Hide resolved

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
Expand All @@ -59,6 +43,42 @@ type GardenerClusterList struct {
Items []GardenerCluster `json:"items"`
}

// GardenerClusterSpec defines the desired state of GardenerCluster
type GardenerClusterSpec struct {
Shoot Shoot `json:"shoot,omitempty"`
Kubeconfig Kubeconfig `json:"kubeconfig,omitempty"`
}

// Shoot defines the desired state of the Gardener's shoot
type Shoot struct {
Name string `json:"name,omitempty"`
}

// Kubeconfig defines the desired kubeconfig location
type Kubeconfig struct {
SecretKeyRef SecretKeyRef `json:"secretKeyRef,omitempty"`
Disper marked this conversation as resolved.
Show resolved Hide resolved
}

// SecretKeyRef defines the location, and structure of the secret containing kubeconfig
type SecretKeyRef struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Key string `json:"key,omitempty"`
}

// GardenerClusterStatus defines the observed state of GardenerCluster
type GardenerClusterStatus struct {
// State signifies current state of Gardener Cluster.
// Value can be one of ("Ready", "Processing", "Error", "Deleting").
State State `json:"state,omitempty"`

Disper marked this conversation as resolved.
Show resolved Hide resolved
// List of status conditions to indicate the status of a ServiceInstance.
// +optional
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

func init() {
SchemeBuilder.Register(&GardenerCluster{}, &GardenerClusterList{})
}
58 changes: 57 additions & 1 deletion api/v1/zz_generated.deepcopy.go

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

49 changes: 0 additions & 49 deletions config/crd/bases/clusterinventory.kyma-project.io_clusters.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions config/rbac/cluster_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rules:
- apiGroups:
- clusterinventory.kyma-project.io
resources:
- clusters
- gardenerclusters
verbs:
- create
- delete
Expand All @@ -26,6 +26,6 @@ rules:
- apiGroups:
- clusterinventory.kyma-project.io
resources:
- clusters/status
- gardenerclusters/status
verbs:
- get
4 changes: 2 additions & 2 deletions config/rbac/cluster_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ rules:
- apiGroups:
- clusterinventory.kyma-project.io
resources:
- clusters
- gardenerclusters
verbs:
- get
- list
- watch
- apiGroups:
- clusterinventory.kyma-project.io
resources:
- clusters/status
- gardenerclusters/status
verbs:
- get
12 changes: 0 additions & 12 deletions config/samples/clusterinventory_v1_cluster.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions config/samples/clusterinventory_v1_gardenercluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: clusterinventory.kyma-project.io/v1
kind: GardenerCluster
metadata:
labels:
kyma-project.io/instance-id: instance-id
kyma-project.io/runtime-id: runtime-id
kyma-project.io/broker-plan-id: plan-id
kyma-project.io/broker-plan-name: plan-name
kyma-project.io/global-account-id: global-account-id
kyma-project.io/subaccount-id: subAccount-id
kyma-project.io/shoot-name: shoot-name
kyma-project.io/region: region
operator.kyma-project.io/kyma-name: kymaName
name: cluster-sample
namespace: default
spec:
shoot:
name: "my-shoot"
kubeconfig:
secretKeyRef:
name: "kubeconfig-secret-name"
namespace: "kubeconfig-secret-namespace"
key: "config"
2 changes: 1 addition & 1 deletion config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Append samples of your project ##
resources:
- clusterinventory_v1_cluster.yaml
- clusterinventory_v1_gardenercluster.yaml
#+kubebuilder:scaffold:manifestskustomizesamples