Skip to content

Commit

Permalink
Add maintenanceGroup and argoInstance fields (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
radu-catalina authored Feb 13, 2024
1 parent ce71c64 commit 9e75585
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 67 deletions.
8 changes: 8 additions & 0 deletions config/crd/bases/registry.ethos.adobe.com_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ spec:
- certificateAuthorityData
- endpoint
type: object
argoInstance:
description: The corresponding Argo instance of the cluster
type: string
availabilityZones:
description: AvailabilityZones cluster availability zones
items:
Expand Down Expand Up @@ -171,6 +174,9 @@ spec:
lastUpdated:
description: Timestamp when cluster information was updated
type: string
maintenanceGroup:
description: Cluster maintenance group
type: string
managingOrg:
description: The Org that is responsible for the cluster operations
type: string
Expand Down Expand Up @@ -322,13 +328,15 @@ spec:
required:
- accountId
- apiServer
- argoInstance
- businessUnit
- chargebackBusinessUnit
- chargedBack
- cloudProviderRegion
- cloudType
- environment
- lastUpdated
- maintenanceGroup
- managingOrg
- name
- offering
Expand Down
2 changes: 2 additions & 0 deletions local/client/dummy-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
apiServer:
endpoint: https://cluster01-local-useast1.example.com
certificateAuthorityData: LS0tLS1CRUdJTiBDRVJUSUZJ==
argoInstance: argocd-local-gen-01.cluster01-local-useast1.example.com
region: useast1
cloudType: azure
cloudProviderRegion: useast1
Expand Down Expand Up @@ -88,6 +89,7 @@ spec:
ownerID: ownerxxx
registeredAt: "2021-12-13T05:50:07.492Z"
lastUpdated: "2021-12-13T05:50:07.492Z"
maintenanceGroup: A
managingOrg: Ethos
capacity:
clusterCapacity: 50
Expand Down
8 changes: 8 additions & 0 deletions local/database/dummy-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
apiServer:
endpoint: https://cluster01-prod-useast1.example.com
certificateAuthorityData: LS0tLS1CRUdJTiBDRVJUSUZJ==
argoInstance: argocd-prod-gen-01.cluster01-prod-useast1.example.com
region: useast1
cloudType: azure
cloudProviderRegion: useast1
Expand Down Expand Up @@ -84,6 +85,7 @@
ownerID: ownerxxx
registeredAt: "2021-12-13T05:50:07.492Z"
lastUpdated: "2021-12-13T05:50:07.492Z"
maintenanceGroup: B
managingOrg: Ethos
capacity:
clusterCapacity: 50
Expand Down Expand Up @@ -117,13 +119,15 @@
apiServer:
endpoint: https://cluster02-prod-euwest1.example.com
certificateAuthorityData: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0==
argoInstance: argocd-prod-gen-02.cluster02-prod-euwest1.example.com
region: euwest1
cloudType: azure
cloudProviderRegion: euwest1
environment: Prod
type: Dedicated
businessUnit: BU2
chargebackBusinessUnit: BU2
chargedBack: true
offering:
- CaaS
- PaaS
Expand Down Expand Up @@ -168,6 +172,7 @@
- 10.3.0.0/24
registeredAt: "2019-02-10T06:15:32Z"
lastUpdated: "2020-02-10T06:15:32Z"
maintenanceGroup: A
managingOrg: Ethos
capacity:
clusterCapacity: 50
Expand Down Expand Up @@ -202,13 +207,15 @@
apiServer:
endpoint: https://cluster03-prod-uswest1.example.com
certificateAuthorityData: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS==
argoInstance: argocd-prod-gen-03.cluster03-prod-uswest1.example.com
region: uswest1
cloudType: aws
cloudProviderRegion: uswest1
environment: Prod
type: Dedicated
businessUnit: BU1
chargebackBusinessUnit: BU1
chargedBack: true
offering:
- PaaS
allowedTeams:
Expand Down Expand Up @@ -262,6 +269,7 @@
- 10.0.22.0/8
registeredAt: "2020-03-19T07:55:46.132Z"
lastUpdated: "2020-03-20T07:55:46.132Z"
maintenanceGroup: C
managingOrg: Ethos
capacity:
clusterCapacity: 30
Expand Down
8 changes: 8 additions & 0 deletions pkg/api/registry/v1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ type ClusterSpec struct {
// +kubebuilder:validation:Enum=Building;Testing;Running;Upgrading
Phase string `json:"phase"`

// Cluster maintenance group
// +kubebuilder:validation:Required
MaintenanceGroup string `json:"maintenanceGroup"`

// The corresponding Argo instance of the cluster
// +kubebuilder:validation:Required
ArgoInstance string `json:"argoInstance"`

// The type of the cluster
Type string `json:"type,omitempty"`

Expand Down
8 changes: 8 additions & 0 deletions pkg/apiserver/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ const docTemplate = `{
}
]
},
"argoInstance": {
"description": "The corresponding Argo instance of the cluster\n+kubebuilder:validation:Required",
"type": "string"
},
"availabilityZones": {
"description": "AvailabilityZones cluster availability zones",
"type": "array",
Expand Down Expand Up @@ -573,6 +577,10 @@ const docTemplate = `{
"description": "Timestamp when cluster information was updated",
"type": "string"
},
"maintenanceGroup": {
"description": "Cluster maintenance group\n+kubebuilder:validation:Required",
"type": "string"
},
"managingOrg": {
"description": "The Org that is responsible for the cluster operations\n+kubebuilder:validation:Required",
"type": "string"
Expand Down
8 changes: 8 additions & 0 deletions pkg/apiserver/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@
}
]
},
"argoInstance": {
"description": "The corresponding Argo instance of the cluster\n+kubebuilder:validation:Required",
"type": "string"
},
"availabilityZones": {
"description": "AvailabilityZones cluster availability zones",
"type": "array",
Expand Down Expand Up @@ -571,6 +575,10 @@
"description": "Timestamp when cluster information was updated",
"type": "string"
},
"maintenanceGroup": {
"description": "Cluster maintenance group\n+kubebuilder:validation:Required",
"type": "string"
},
"managingOrg": {
"description": "The Org that is responsible for the cluster operations\n+kubebuilder:validation:Required",
"type": "string"
Expand Down
10 changes: 10 additions & 0 deletions pkg/apiserver/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ definitions:
description: |-
Information about K8s API endpoint and CA cert
+kubebuilder:validation:Required
argoInstance:
description: |-
The corresponding Argo instance of the cluster
+kubebuilder:validation:Required
type: string
availabilityZones:
description: AvailabilityZones cluster availability zones
items:
Expand Down Expand Up @@ -115,6 +120,11 @@ definitions:
lastUpdated:
description: Timestamp when cluster information was updated
type: string
maintenanceGroup:
description: |-
Cluster maintenance group
+kubebuilder:validation:Required
type: string
managingOrg:
description: |-
The Org that is responsible for the cluster operations
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var _ = Describe("Cluster Controller", func() {
Name: "cluster01-prod-useast1",
ShortName: "cluster01produseast1",
APIServer: registryv1.APIServer{Endpoint: "", CertificateAuthorityData: ""},
ArgoInstance: "argocd-prod-gen-01.cluster01-prod-useast1.example.com",
Region: "useast1",
CloudType: "Azure",
Environment: "Prod",
Expand All @@ -83,6 +84,7 @@ var _ = Describe("Cluster Controller", func() {
Status: "Active",
Phase: "Running",
Type: "Shared",
MaintenanceGroup: "B",
Extra: registryv1.Extra{
DomainName: "",
LbEndpoints: map[string]string{},
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ var _ = Describe("Webhook Server", func() {
Name: "cluster01-prod-useast1",
ShortName: "cluster01produseast1",
APIServer: registryv1.APIServer{Endpoint: "", CertificateAuthorityData: ""},
ArgoInstance: "argocd-prod-gen-01.cluster01-prod-useast1.example.com",
Region: "useast1",
CloudType: "Azure",
Environment: "Prod",
Expand All @@ -198,6 +199,7 @@ var _ = Describe("Webhook Server", func() {
Status: "Active",
Phase: "Running",
Type: "Shared",
MaintenanceGroup: "B",
Extra: registryv1.Extra{
DomainName: "",
LbEndpoints: map[string]string{},
Expand Down
Loading

0 comments on commit 9e75585

Please sign in to comment.