Skip to content

Commit 544ad77

Browse files
authored
feat: add cluster-registry-sync-manager chart (#211)
feat: add cluster-registry-sync-manager chart
1 parent faa674c commit 544ad77

21 files changed

+585
-18
lines changed

Makefile

+26-10
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,22 @@ all: format generate build test test-e2e
3838
###############
3939

4040
SETUP_CMD = "./local/setup.sh"
41-
ifeq ($(API),true)
42-
ifeq ($(CLIENT),)
43-
SETUP_CMD += "1 0"
44-
endif
45-
else ifeq ($(API),)
46-
ifeq ($(CLIENT),true)
47-
SETUP_CMD += "0 1"
48-
endif
41+
# By default run all components in the local setup
42+
# To exclude a component, set the corresponding variable to false
43+
ifeq ($(API),false)
44+
SETUP_CMD += "0"
45+
else
46+
SETUP_CMD += "1"
47+
endif
48+
ifeq ($(CLIENT),false)
49+
SETUP_CMD += "0"
50+
else
51+
SETUP_CMD += "1"
52+
endif
53+
ifeq ($(SYNC_MANAGER),false)
54+
SETUP_CMD += "0"
55+
else
56+
SETUP_CMD += "1"
4957
endif
5058

5159
.PHONY: clean
@@ -63,7 +71,7 @@ setup:
6371
############
6472

6573
.PHONY: build
66-
build: build-apiserver build-client
74+
build: build-apiserver build-client build-sync-manager
6775

6876
.PHONY: build-apiserver
6977
build-apiserver:
@@ -73,13 +81,17 @@ build-apiserver:
7381
build-client:
7482
$(GO_BUILD_RECIPE) -o cluster-registry-client cmd/client/client.go
7583

84+
.PHONY: build-sync-manager
85+
build-sync-manager:
86+
$(GO_BUILD_RECIPE) -o cluster-registry-sync-manager cmd/sync/manager/manager.go
87+
7688
.PHONY: release
7789
release:
7890
./hack/release.sh
7991

8092
.PHONY: image
8193
image: GOOS := linux
82-
image: .hack-apiserver-image .hack-client-image
94+
image: .hack-apiserver-image .hack-client-image .hack-sync-manager-image
8395

8496
.hack-apiserver-image: cmd/apiserver/Dockerfile build-apiserver
8597
docker build -t $(IMAGE_APISERVER):$(TAG) -f cmd/apiserver/Dockerfile .
@@ -89,6 +101,10 @@ image: .hack-apiserver-image .hack-client-image
89101
docker build -t $(IMAGE_CLIENT):$(TAG) -f cmd/client/Dockerfile .
90102
touch $@
91103

104+
.hack-sync-manager-image: cmd/sync/manager/Dockerfile build-sync-manager
105+
docker build -t $(IMAGE_SYNC_MANAGER):$(TAG) -f cmd/sync/manager/Dockerfile .
106+
touch $@
107+
92108
.PHONY: update-go-deps
93109
update-go-deps:
94110
for m in $$(go list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v2
2+
name: cluster-registry-sync-manager
3+
4+
description: Cluster Registry is a Rest API representing the source of record for
5+
all Kubernetes clusters in the infrastructure fleet. All clusters are automatically
6+
registered, and the information is accurately reflected in the Cluster Registry
7+
using a client-server architecture.
8+
9+
type: application
10+
home: https://github.com/adobe/cluster-registry
11+
12+
maintainers:
13+
- name: aalexandru
14+
15+
- name: radu-catalina
16+
17+
18+
version: 0.1.0
19+
appVersion: v1.6.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# cluster-registry-sync-manager
2+
3+
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.6.0](https://img.shields.io/badge/AppVersion-v1.6.0-informational?style=flat-square)
4+
5+
Cluster Registry is a Rest API representing the source of record for all Kubernetes clusters in the infrastructure fleet. All clusters are automatically registered, and the information is accurately reflected in the Cluster Registry using a client-server architecture.
6+
7+
**Homepage:** <https://github.com/adobe/cluster-registry>
8+
9+
## Maintainers
10+
11+
| Name | Email | Url |
12+
| ---- | ------ | --- |
13+
| aalexandru | <[email protected]> | |
14+
| radu-catalina | <[email protected]> | |
15+
16+
## Values
17+
18+
| Key | Type | Default | Description |
19+
|-----|------|---------|-------------|
20+
| clusterRegistrySyncManager.health.healthProbeBindAddress | string | `":8081"` | |
21+
| clusterRegistrySyncManager.leaderElection.leaderElect | bool | `false` | |
22+
| clusterRegistrySyncManager.leaderElection.resourceLock | string | `"leases"` | |
23+
| clusterRegistrySyncManager.leaderElection.resourceName | string | `"sync.registry.ethos.adobe.com"` | |
24+
| clusterRegistrySyncManager.leaderElection.resourceNamespace | string | `"cluster-registry"` | |
25+
| clusterRegistrySyncManager.metrics.bindAddress | string | `"0.0.0.0:9090"` | |
26+
| clusterRegistrySyncManager.namespace | string | `"cluster-registry"` | |
27+
| clusterRegistrySyncManager.watchedGVKs | object | `{}` | |
28+
| clusterRegistrySyncManager.webhook.port | int | `9443` | |
29+
| fullnameOverride | string | `"cluster-registry-sync-manager"` | |
30+
| image.pullPolicy | string | `"IfNotPresent"` | |
31+
| image.registry | string | `"ghcr.io/adobe/cluster-registry-sync-manager"` | |
32+
| imagePullSecrets | list | `[]` | |
33+
| livenessProbe.httpGet.path | string | `"/healthz"` | |
34+
| livenessProbe.httpGet.port | int | `9091` | |
35+
| livenessProbe.initialDelaySeconds | int | `15` | |
36+
| livenessProbe.periodSeconds | int | `20` | |
37+
| nameOverride | string | `"cluster-registry-sync-manager"` | |
38+
| podDisruptionBudget.enabled | bool | `true` | |
39+
| podDisruptionBudget.minAvailable | string | `"50%"` | |
40+
| podMonitor.enabled | bool | `false` | |
41+
| podMonitor.extraLabels | object | `{}` | |
42+
| ports[0].containerPort | int | `9090` | |
43+
| ports[0].name | string | `"metrics"` | |
44+
| rbac.create | bool | `true` | |
45+
| readinessProbe.httpGet.path | string | `"/readyz"` | |
46+
| readinessProbe.httpGet.port | int | `9091` | |
47+
| readinessProbe.initialDelaySeconds | int | `5` | |
48+
| readinessProbe.periodSeconds | int | `10` | |
49+
| replicaCount | int | `2` | |
50+
| resources.limits.cpu | string | `"200m"` | |
51+
| resources.limits.memory | string | `"400Mi"` | |
52+
| resources.requests.cpu | string | `"100m"` | |
53+
| resources.requests.memory | string | `"200Mi"` | |
54+
| serviceAccount.create | bool | `true` | |
55+
| serviceAccount.name | string | `"cluster-registry-sync-manager"` | |
56+
| terminationGracePeriodSeconds | int | `10` | |
57+
58+
----------------------------------------------
59+
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "cluster-registry-sync-manager.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "cluster-registry-sync-manager.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "cluster-registry-sync-manager.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "cluster-registry-sync-manager.labels" -}}
37+
helm.sh/chart: {{ include "cluster-registry-sync-manager.chart" . }}
38+
{{ include "cluster-registry-sync-manager.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
component: cluster-registry
44+
{{- end }}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "cluster-registry-sync-manager.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "cluster-registry-sync-manager.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end }}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "cluster-registry-sync-manager.serviceAccountName" -}}
58+
{{- if .Values.serviceAccount.create }}
59+
{{- default (include "cluster-registry-sync-manager.fullname" .) .Values.serviceAccount.name }}
60+
{{- else }}
61+
{{- default "default" .Values.serviceAccount.name }}
62+
{{- end }}
63+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: cluster-registry-sync-manager
5+
labels:
6+
{{- include "cluster-registry-sync-manager.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- registry.ethos.adobe.com
10+
resources:
11+
- clustersyncs
12+
verbs:
13+
- create
14+
- delete
15+
- get
16+
- list
17+
- patch
18+
- update
19+
- watch
20+
- apiGroups:
21+
- registry.ethos.adobe.com
22+
resources:
23+
- clustersyncs/finalizers
24+
verbs:
25+
- update
26+
- apiGroups:
27+
- registry.ethos.adobe.com
28+
resources:
29+
- clustersyncs/status
30+
verbs:
31+
- get
32+
- patch
33+
- update
34+
{{- with .Values.extraRBAC }}
35+
{{- toYaml . | nindent 2 }}
36+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: cluster-registry-sync-manager
5+
labels:
6+
{{- include "cluster-registry-sync-manager.labels" . | nindent 4 }}
7+
roleRef:
8+
apiGroup: rbac.authorization.k8s.io
9+
kind: ClusterRole
10+
name: cluster-registry-sync-manager
11+
subjects:
12+
- kind: ServiceAccount
13+
name: {{ include "cluster-registry-sync-manager.serviceAccountName" . }}
14+
namespace: {{ .Release.Namespace }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.clusterRegistrySyncManager }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: sync-manager-config
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "cluster-registry-sync-manager.labels" . | nindent 4 }}
9+
data:
10+
config.yaml: |-
11+
apiVersion: config.registry.ethos.adobe.com/v1
12+
kind: SyncConfig
13+
health:
14+
healthProbeBindAddress: {{ .Values.clusterRegistrySyncManager.health.healthProbeBindAddress }}
15+
metrics:
16+
bindAddress: {{ .Values.clusterRegistrySyncManager.metrics.bindAddress }}
17+
webhook:
18+
port: {{ .Values.clusterRegistrySyncManager.webhook.port }}
19+
leaderElection:
20+
leaderElect: {{ .Values.clusterRegistrySyncManager.leaderElection.leaderElect }}
21+
resourceNamespace: {{ .Release.Namespace }}
22+
resourceName: {{ .Values.clusterRegistrySyncManager.leaderElection.resourceName }}
23+
namespace: {{ .Release.Namespace }}
24+
watchedGVKs:
25+
{{- range $_, $gvk := .Values.clusterRegistrySyncManager.watchedGVKs }}
26+
- group: {{ $gvk.group }}
27+
version: {{ $gvk.version }}
28+
kind: {{ $gvk.kind }}
29+
{{- end }}
30+
{{- end }}

0 commit comments

Comments
 (0)