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

Add service metadata endpoints #69

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions config/crd/bases/registry.ethos.adobe.com_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ spec:
registeredAt:
description: Timestamp when cluster was registered in Cluster Registry
type: string
services:
additionalProperties:
additionalProperties:
additionalProperties:
type: string
type: object
type: object
description: ServiceMetadata service specific metadata
type: object
shortName:
description: Cluster name, without dash
maxLength: 64
Expand Down
33 changes: 29 additions & 4 deletions local/database/dummy-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,30 @@
tags:
onboarding: "off"
scaling: "off"
services:
12345:
ns-team-abc:
key1: value1
key2: value2
ns-team-xyz:
key3: value3
98765:
ns-team-example:
some.key: some.value
ns-team-example2:
foo: bar
- apiVersion: registry.ethos.adobe.com/v1
kind: Cluster
metadata:
name: cluster02-prod-euwest1
name: cluster02-prod-euwest1
namespace: cluster-registry
spec:
name: cluster02-prod-euwest1
shortName: cluster02prodeuwest1
name: cluster02-prod-euwest1
shortName: cluster02prodeuwest1
apiServer:
endpoint: https://cluster02-prod-euwest1.example.com
certificateAuthorityData: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0==
region: euwest1
region: euwest1
cloudType: azure
cloudProviderRegion: euwest1
environment: Prod
Expand Down Expand Up @@ -171,6 +183,19 @@
tags:
onboarding: "off"
scaling: "on"
services:
12345:
ns-team-abc:
keyA: valueA
keyB: valueB
55555:
ns-team-foo:
foo: bar
98765:
ns-team-example:
some.other.key: some.other.value
ns-team-foobar:
foo: bar
- apiVersion: registry.ethos.adobe.com/v1
kind: Cluster
metadata:
Expand Down
6 changes: 3 additions & 3 deletions local/database/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ set -o pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.."; pwd)"

echo 'Loading local environment variables...'
source ${ROOT_DIR}/local/.env.local
source ${ROOT_DIR}/.env.local

echo 'Create dynamodb schema...'
aws dynamodb delete-table --table-name ${DB_TABLE_NAME} --endpoint-url $DB_ENDPOINT > /dev/null 2>&1 || true
aws dynamodb create-table --cli-input-json file://${ROOT_DIR}/local/db/schema.json --endpoint-url $DB_ENDPOINT > /dev/null
aws dynamodb create-table --cli-input-json file://${ROOT_DIR}/database/schema.json --endpoint-url $DB_ENDPOINT > /dev/null

echo 'Populate database with dummy data..'
go run ${ROOT_DIR}/local/db/import.go --input-file ${ROOT_DIR}/local/db/dummy-data.yaml
go run ${ROOT_DIR}/database/import.go --input-file ${ROOT_DIR}/database/dummy-data.yaml
9 changes: 9 additions & 0 deletions pkg/api/registry/v1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ type ClusterSpec struct {

// Capacity cluster information
Capacity Capacity `json:"capacity,omitempty"`

// ServiceMetadata service specific metadata
ServiceMetadata ServiceMetadata `json:"services,omitempty"`
}

// Offering the cluster is meant for
Expand Down Expand Up @@ -256,6 +259,12 @@ type Capacity struct {
ClusterProvisioning int `json:"clusterProvisioning"`
}

type ServiceMetadata map[string]ServiceMetadataItem

type ServiceMetadataItem map[string]ServiceMetadataMap

type ServiceMetadataMap map[string]string

// ClusterStatus defines the observed state of Cluster
type ClusterStatus struct {
// Send/Receive Errors
Expand Down
145 changes: 140 additions & 5 deletions pkg/api/registry/v1/zz_generated.deepcopy.go

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

Loading
Loading