Skip to content

Commit 702edcc

Browse files
authored
Add PDB and PodMonitor and fix some bugs (#85)
* Add PDB and PodMonitor and fix some bugs * Check if percentage * Check if percentage * Nit
1 parent 91510eb commit 702edcc

14 files changed

+100
-50
lines changed

charts/cluster-registry-client/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ maintainers:
1515
- name: radu-catalina
1616
1717

18-
version: 0.1.6
18+
version: 0.1.7
1919
appVersion: v1.4.2

charts/cluster-registry-client/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cluster-registry-client
22

3-
![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)
3+
![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)
44

55
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.
66

@@ -34,12 +34,15 @@ Cluster Registry is a Rest API representing the source of record for all Kuberne
3434
| livenessProbe.initialDelaySeconds | int | `15` | |
3535
| livenessProbe.periodSeconds | int | `20` | |
3636
| nameOverride | string | `"cluster-registry-client"` | |
37+
| podDisruptionBudget.enabled | bool | `true` | |
38+
| podDisruptionBudget.minAvailable | string | `"50%"` | |
39+
| podMonitor.enabled | bool | `false` | |
40+
| podMonitor.extraLabels | object | `{}` | |
3741
| ports[0].containerPort | int | `9090` | |
3842
| ports[0].name | string | `"metrics"` | |
3943
| ports[1].containerPort | int | `9092` | |
4044
| ports[1].name | string | `"amwebhook"` | |
4145
| rbac.create | bool | `true` | |
42-
| rbac.nameSuffix | string | `"cluster-client"` | |
4346
| readinessProbe.httpGet.path | string | `"/readyz"` | |
4447
| readinessProbe.httpGet.port | int | `9091` | |
4548
| readinessProbe.initialDelaySeconds | int | `5` | |
@@ -54,4 +57,4 @@ Cluster Registry is a Rest API representing the source of record for all Kuberne
5457
| terminationGracePeriodSeconds | int | `10` | |
5558

5659
----------------------------------------------
57-
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
60+
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)

charts/cluster-registry-client/templates/_helpers.tpl

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ helm.sh/chart: {{ include "cluster-registry-client.chart" . }}
4040
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4141
{{- end }}
4242
app.kubernetes.io/managed-by: {{ .Release.Service }}
43-
{{ include "cluster-registry-client.appLabels" . }}
44-
{{ include "cluster-registry-client.componentLabels" . }}
43+
component: cluster-registry
4544
{{- end }}
4645

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

55-
{{/*
56-
Cluster Registry client application label
57-
*/}}
58-
{{- define "cluster-registry-client.appLabels" -}}
59-
app: cluster-registry-client
60-
{{- end }}
61-
62-
{{/*
63-
Cluster Registry component label
64-
*/}}
65-
{{- define "cluster-registry-client.componentLabels" -}}
66-
component: cluster-registry
67-
{{- end }}
68-
6954
{{/*
7055
Create the name of the service account to use
7156
*/}}

charts/cluster-registry-client/templates/cluster-rolebinding.yaml renamed to charts/cluster-registry-client/templates/clusterrolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
4-
name: cluster-registry-client-rolebinding
4+
name: cluster-registry-client
55
labels:
66
{{- include "cluster-registry-client.labels" . | nindent 4 }}
77
roleRef:

charts/cluster-registry-client/templates/configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ConfigMap
44
metadata:
55
name: client-config
6+
namespace: {{ .Release.Namespace }}
67
labels:
78
{{- include "cluster-registry-client.labels" . | nindent 4 }}
89
data:

charts/cluster-registry-client/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ spec:
88
replicas: {{ .Values.replicaCount | required ".Values.replicaCount is required" }}
99
selector:
1010
matchLabels:
11-
app: cluster-registry-client
11+
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
1212
template:
1313
metadata:
1414
labels:
15-
{{- include "cluster-registry-client.appLabels" . | nindent 8 }}
15+
{{- include "cluster-registry-client.selectorLabels" . | nindent 8 }}
1616
annotations:
1717
kubectl.kubernetes.io/default-container: manager
1818
spec:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.podDisruptionBudget.enabled }}
2+
{{- $isPercentage := regexMatch "^[0-9]+%$" (.Values.podDisruptionBudget.minAvailable | quote) }}
3+
{{- if and (not $isPercentage) (le (.Values.replicaCount | int) (.Values.podDisruptionBudget.minAvailable | int)) }}
4+
{{- fail ".Values.replicaCount should be greater than .Values.podDisruptionBudget.minAvailable" }}
5+
{{- else }}
6+
apiVersion: policy/v1
7+
kind: PodDisruptionBudget
8+
metadata:
9+
labels:
10+
{{- include "cluster-registry-client.labels" . | nindent 4 }}
11+
name: {{ template "cluster-registry-client.fullname" . }}
12+
namespace: {{ .Release.Namespace }}
13+
spec:
14+
selector:
15+
matchLabels:
16+
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
17+
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
18+
{{- end }}
19+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- if .Values.podMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
labels:
6+
{{- include "cluster-registry-client.labels" . | nindent 4 }}
7+
{{- if .Values.podMonitor.extraLabels }}
8+
{{- toYaml .Values.podMonitor.extraLabels | nindent 4 }}
9+
{{- end }}
10+
name: cluster-registry-client
11+
namespace: {{ .Release.Namespace }}
12+
spec:
13+
jobLabel: app
14+
namespaceSelector:
15+
matchNames:
16+
- {{ .Release.Namespace }}
17+
podMetricsEndpoints:
18+
- interval: 60s
19+
path: /metrics
20+
port: metrics
21+
- interval: 60s
22+
path: /metrics/extra
23+
port: metrics
24+
selector:
25+
matchLabels:
26+
{{- include "cluster-registry-client.selectorLabels" . | nindent 6 }}
27+
{{- end }}

charts/cluster-registry-client/templates/role-leader-election.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: Role
44
metadata:
5-
name: cluster-registry-leader-election-role
5+
name: cluster-registry-leader-election
66
namespace: {{ .Release.Namespace }}
77
labels:
88
{{- include "cluster-registry-client.labels" . | nindent 4 }}

0 commit comments

Comments
 (0)