Skip to content

Commit

Permalink
Add PDB and PodMonitor and fix some bugs (#85)
Browse files Browse the repository at this point in the history
* Add PDB and PodMonitor and fix some bugs

* Check if percentage

* Check if percentage

* Nit
  • Loading branch information
adriananeci authored Oct 30, 2023
1 parent 91510eb commit 702edcc
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 50 deletions.
2 changes: 1 addition & 1 deletion charts/cluster-registry-client/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ maintainers:
- name: radu-catalina
email: [email protected]

version: 0.1.6
version: 0.1.7
appVersion: v1.4.2
9 changes: 6 additions & 3 deletions charts/cluster-registry-client/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cluster-registry-client

![Version: 0.1.6](https://img.shields.io/badge/Version-0.1.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.4.2](https://img.shields.io/badge/AppVersion-v1.4.2-informational?style=flat-square)
![Version: 0.1.7](https://img.shields.io/badge/Version-0.1.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.4.2](https://img.shields.io/badge/AppVersion-v1.4.2-informational?style=flat-square)

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.

Expand Down Expand Up @@ -34,12 +34,15 @@ Cluster Registry is a Rest API representing the source of record for all Kuberne
| livenessProbe.initialDelaySeconds | int | `15` | |
| livenessProbe.periodSeconds | int | `20` | |
| nameOverride | string | `"cluster-registry-client"` | |
| podDisruptionBudget.enabled | bool | `true` | |
| podDisruptionBudget.minAvailable | string | `"50%"` | |
| podMonitor.enabled | bool | `false` | |
| podMonitor.extraLabels | object | `{}` | |
| ports[0].containerPort | int | `9090` | |
| ports[0].name | string | `"metrics"` | |
| ports[1].containerPort | int | `9092` | |
| ports[1].name | string | `"amwebhook"` | |
| rbac.create | bool | `true` | |
| rbac.nameSuffix | string | `"cluster-client"` | |
| readinessProbe.httpGet.path | string | `"/readyz"` | |
| readinessProbe.httpGet.port | int | `9091` | |
| readinessProbe.initialDelaySeconds | int | `5` | |
Expand All @@ -54,4 +57,4 @@ Cluster Registry is a Rest API representing the source of record for all Kuberne
| terminationGracePeriodSeconds | int | `10` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
17 changes: 1 addition & 16 deletions charts/cluster-registry-client/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ helm.sh/chart: {{ include "cluster-registry-client.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ include "cluster-registry-client.appLabels" . }}
{{ include "cluster-registry-client.componentLabels" . }}
component: cluster-registry
{{- end }}

{{/*
Expand All @@ -52,20 +51,6 @@ app.kubernetes.io/name: {{ include "cluster-registry-client.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Cluster Registry client application label
*/}}
{{- define "cluster-registry-client.appLabels" -}}
app: cluster-registry-client
{{- end }}

{{/*
Cluster Registry component label
*/}}
{{- define "cluster-registry-client.componentLabels" -}}
component: cluster-registry
{{- end }}

{{/*
Create the name of the service account to use
*/}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-registry-client-rolebinding
name: cluster-registry-client
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
roleRef:
Expand Down
1 change: 1 addition & 0 deletions charts/cluster-registry-client/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: client-config
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
data:
Expand Down
4 changes: 2 additions & 2 deletions charts/cluster-registry-client/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ spec:
replicas: {{ .Values.replicaCount | required ".Values.replicaCount is required" }}
selector:
matchLabels:
app: cluster-registry-client
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "cluster-registry-client.appLabels" . | nindent 8 }}
{{- include "cluster-registry-client.selectorLabels" . | nindent 8 }}
annotations:
kubectl.kubernetes.io/default-container: manager
spec:
Expand Down
19 changes: 19 additions & 0 deletions charts/cluster-registry-client/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.podDisruptionBudget.enabled }}
{{- $isPercentage := regexMatch "^[0-9]+%$" (.Values.podDisruptionBudget.minAvailable | quote) }}
{{- if and (not $isPercentage) (le (.Values.replicaCount | int) (.Values.podDisruptionBudget.minAvailable | int)) }}
{{- fail ".Values.replicaCount should be greater than .Values.podDisruptionBudget.minAvailable" }}
{{- else }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
name: {{ template "cluster-registry-client.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/cluster-registry-client/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
{{- if .Values.podMonitor.extraLabels }}
{{- toYaml .Values.podMonitor.extraLabels | nindent 4 }}
{{- end }}
name: cluster-registry-client
namespace: {{ .Release.Namespace }}
spec:
jobLabel: app
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- interval: 60s
path: /metrics
port: metrics
- interval: 60s
path: /metrics/extra
port: metrics
selector:
matchLabels:
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cluster-registry-leader-election-role
name: cluster-registry-leader-election
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cluster-registry-leader-election-rolebinding
name: cluster-registry-leader-election
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cluster-registry-client/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
{{ fail "No ports defined" }}
{{- end }}
selector:
{{- include "cluster-registry-client.appLabels" . | nindent 4 }}
{{- include "cluster-registry-client.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: cluster-registry-client
name: {{ include "cluster-registry-client.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cluster-registry-client.labels" . | nindent 4 }}
Expand Down
61 changes: 38 additions & 23 deletions charts/cluster-registry-client/values.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
nameOverride: cluster-registry-client
fullnameOverride: cluster-registry-client

replicaCount: 2
clusterRegistryClient:
alertmanagerWebhook:
bindAddress: 0.0.0.0:9092
alertMap: []
health:
healthProbeBindAddress: :9091
metrics:
bindAddress: 0.0.0.0:9090
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceNamespace: cluster-registry
resourceName: 0c4967d2.registry.ethos.adobe.com
rbac:
create: true
nameSuffix: cluster-client
serviceAccount:
# Specifies whether a service account should be created, else use: 'name: "default"''
create: true
# The name of the service account to use.
# If set, override, else will use chart fullname template
name: cluster-registry-client

imagePullSecrets: []
image:
pullPolicy: IfNotPresent
registry: ghcr.io/adobe/cluster-registry-client

ports:
- name: metrics
containerPort: 9090
- name: amwebhook
containerPort: 9092

resources:
limits:
cpu: 200m
memory: 400Mi
requests:
cpu: 100m
memory: 200Mi

livenessProbe:
httpGet:
path: /healthz
Expand All @@ -53,3 +35,36 @@ readinessProbe:
initialDelaySeconds: 5
periodSeconds: 10
terminationGracePeriodSeconds: 10

clusterRegistryClient:
alertmanagerWebhook:
bindAddress: 0.0.0.0:9092
alertMap: []
health:
healthProbeBindAddress: :9091
metrics:
bindAddress: 0.0.0.0:9090
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceNamespace: cluster-registry
resourceName: 0c4967d2.registry.ethos.adobe.com

rbac:
create: true

serviceAccount:
# Specifies whether a service account should be created, else use: 'name: "default"''
create: true
# The name of the service account to use.
# If set, override, else will use chart fullname template
name: cluster-registry-client

podDisruptionBudget:
enabled: true
minAvailable: 50%

podMonitor:
enabled: false
extraLabels: {}

0 comments on commit 702edcc

Please sign in to comment.