Skip to content

Commit a0832c4

Browse files
aalexandruaalexand
andauthored
Add AvailabilityZones field (#92)
* Add AvailabilityZones field * Update db test * Update swagger --------- Co-authored-by: aalexand <[email protected]>
1 parent 69aa011 commit a0832c4

File tree

10 files changed

+153
-2
lines changed

10 files changed

+153
-2
lines changed

config/crd/bases/registry.ethos.adobe.com_clusters.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ spec:
7474
- certificateAuthorityData
7575
- endpoint
7676
type: object
77+
availabilityZones:
78+
description: AvailabilityZones cluster availability zones
79+
items:
80+
properties:
81+
id:
82+
type: string
83+
name:
84+
type: string
85+
required:
86+
- name
87+
type: object
88+
type: array
7789
businessUnit:
7890
description: The BU that owns the cluster
7991
type: string

local/client/dummy-crd.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ spec:
6565
taints:
6666
- workload=memory-optimized:NoSchedule
6767
accountId: "11111-2222-3333-4444-555555555"
68+
availabilityZones:
69+
- name: us-east-1a
70+
id: use1-az1
71+
- name: us-east-1b
72+
id: use1-az2
73+
- name: us-east-1c
74+
id: use1-az3
6875
virtualNetworks:
6976
- id: "/subscriptions/11111-2222-3333-4444-555555555/resourceGroups/cluster01_local_network/providers/Microsoft.Network/virtualNetworks/cluster01_local_useast1-vnet/subnets/cluster01_local_useast1_master_network_10_0_0_0_24"
7077
cidrs:

local/database/dummy-data.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@
266266
clusterCapacity: 30
267267
clusterProvisioning: 30
268268
lastUpdated: "2023-03-22T11:55:41Z"
269+
availabilityZones:
270+
- name: us-east-1a
271+
id: use1-az1
272+
- name: us-east-1b
273+
id: use1-az2
274+
- name: us-east-1c
275+
id: use1-az3
269276
status: Active
270277
phase: Running
271278
tags:

pkg/api/registry/v1/cluster_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ type ClusterSpec struct {
119119

120120
// ServiceMetadata service specific metadata
121121
ServiceMetadata ServiceMetadata `json:"services,omitempty"`
122+
123+
// AvailabilityZones cluster availability zones
124+
AvailabilityZones []AvailabilityZone `json:"availabilityZones,omitempty"`
122125
}
123126

124127
// Offering the cluster is meant for
@@ -255,6 +258,11 @@ type ServiceMetadataItem map[string]ServiceMetadataMap
255258

256259
type ServiceMetadataMap map[string]string
257260

261+
type AvailabilityZone struct {
262+
Name string `json:"name"`
263+
ID string `json:"id,omitempty"`
264+
}
265+
258266
// ClusterStatus defines the observed state of Cluster
259267
type ClusterStatus struct {
260268
// Send/Receive Errors

pkg/api/registry/v1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apiserver/docs/docs.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,17 @@ const docTemplate = `{
468468
}
469469
}
470470
},
471+
"github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone": {
472+
"type": "object",
473+
"properties": {
474+
"id": {
475+
"type": "string"
476+
},
477+
"name": {
478+
"type": "string"
479+
}
480+
}
481+
},
471482
"github_com_adobe_cluster-registry_pkg_api_registry_v1.Capacity": {
472483
"type": "object",
473484
"properties": {
@@ -504,6 +515,13 @@ const docTemplate = `{
504515
}
505516
]
506517
},
518+
"availabilityZones": {
519+
"description": "AvailabilityZones cluster availability zones",
520+
"type": "array",
521+
"items": {
522+
"$ref": "#/definitions/github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone"
523+
}
524+
},
507525
"businessUnit": {
508526
"description": "The BU that owns the cluster\n+kubebuilder:validation:Required",
509527
"type": "string"

pkg/apiserver/docs/swagger.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@
466466
}
467467
}
468468
},
469+
"github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone": {
470+
"type": "object",
471+
"properties": {
472+
"id": {
473+
"type": "string"
474+
},
475+
"name": {
476+
"type": "string"
477+
}
478+
}
479+
},
469480
"github_com_adobe_cluster-registry_pkg_api_registry_v1.Capacity": {
470481
"type": "object",
471482
"properties": {
@@ -502,6 +513,13 @@
502513
}
503514
]
504515
},
516+
"availabilityZones": {
517+
"description": "AvailabilityZones cluster availability zones",
518+
"type": "array",
519+
"items": {
520+
"$ref": "#/definitions/github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone"
521+
}
522+
},
505523
"businessUnit": {
506524
"description": "The BU that owns the cluster\n+kubebuilder:validation:Required",
507525
"type": "string"

pkg/apiserver/docs/swagger.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ definitions:
2929
+kubebuilder:validation:Required
3030
type: string
3131
type: object
32+
github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone:
33+
properties:
34+
id:
35+
type: string
36+
name:
37+
type: string
38+
type: object
3239
github_com_adobe_cluster-registry_pkg_api_registry_v1.Capacity:
3340
properties:
3441
clusterCapacity:
@@ -57,6 +64,11 @@ definitions:
5764
description: |-
5865
Information about K8s API endpoint and CA cert
5966
+kubebuilder:validation:Required
67+
availabilityZones:
68+
description: AvailabilityZones cluster availability zones
69+
items:
70+
$ref: '#/definitions/github_com_adobe_cluster-registry_pkg_api_registry_v1.AvailabilityZone'
71+
type: array
6072
businessUnit:
6173
description: |-
6274
The BU that owns the cluster

pkg/database/database_test.go

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,22 @@ var _ = Describe("Database Suite", func() {
626626
Phase: "Running",
627627
Type: "Dedicated",
628628
Capabilities: []string{"gpu-compute"},
629-
LastUpdated: "2020-03-20T07:55:46.132Z",
630-
Tags: map[string]string{"onboarding": "on", "scaling": "on"},
629+
AvailabilityZones: []registryv1.AvailabilityZone{
630+
{
631+
Name: "us-east-1a",
632+
ID: "use1-az1",
633+
},
634+
{
635+
Name: "us-east-1b",
636+
ID: "use1-az2",
637+
},
638+
{
639+
Name: "us-east-1c",
640+
ID: "use1-az3",
641+
},
642+
},
643+
LastUpdated: "2020-03-20T07:55:46.132Z",
644+
Tags: map[string]string{"onboarding": "on", "scaling": "on"},
631645
},
632646
},
633647
},
@@ -1106,6 +1120,20 @@ var _ = Describe("Database Suite", func() {
11061120
Capabilities: []string{"gpu-compute"},
11071121
LastUpdated: "2020-03-20T07:55:46.132Z",
11081122
Tags: map[string]string{"onboarding": "on", "scaling": "on"},
1123+
AvailabilityZones: []registryv1.AvailabilityZone{
1124+
{
1125+
Name: "us-east-1a",
1126+
ID: "use1-az1",
1127+
},
1128+
{
1129+
Name: "us-east-1b",
1130+
ID: "use1-az2",
1131+
},
1132+
{
1133+
Name: "us-east-1c",
1134+
ID: "use1-az3",
1135+
},
1136+
},
11091137
},
11101138
},
11111139
},
@@ -1427,6 +1455,20 @@ var _ = Describe("Database Suite", func() {
14271455
Capabilities: []string{"gpu-compute"},
14281456
LastUpdated: "2020-03-20T07:55:46.132Z",
14291457
Tags: map[string]string{"onboarding": "on", "scaling": "on"},
1458+
AvailabilityZones: []registryv1.AvailabilityZone{
1459+
{
1460+
Name: "us-east-1a",
1461+
ID: "use1-az1",
1462+
},
1463+
{
1464+
Name: "us-east-1b",
1465+
ID: "use1-az2",
1466+
},
1467+
{
1468+
Name: "us-east-1c",
1469+
ID: "use1-az3",
1470+
},
1471+
},
14301472
},
14311473
},
14321474
},

pkg/database/testdata/clusters.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,10 @@
228228
tags:
229229
onboarding: "on"
230230
scaling: "on"
231+
availabilityZones:
232+
- name: us-east-1a
233+
id: use1-az1
234+
- name: us-east-1b
235+
id: use1-az2
236+
- name: us-east-1c
237+
id: use1-az3

0 commit comments

Comments
 (0)