From c3245d9b22dcfd54661564373ef3f8c694614b0c Mon Sep 17 00:00:00 2001 From: QuentinBisson Date: Sat, 30 Mar 2024 15:40:18 +0100 Subject: [PATCH] Use pod monitor --- helm/etcd-backup-operator/Chart.yaml | 2 +- helm/etcd-backup-operator/templates/_helpers.tpl | 1 + .../templates/configmap.yaml | 2 +- .../templates/deployment.yaml | 6 +++++- .../templates/network-policy.yaml | 2 +- .../templates/podmonitor.yaml | 16 ++++++++++++++++ helm/etcd-backup-operator/templates/service.yaml | 16 ---------------- helm/etcd-backup-operator/values.schema.json | 11 +++-------- helm/etcd-backup-operator/values.yaml | 4 ++-- 9 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 helm/etcd-backup-operator/templates/podmonitor.yaml delete mode 100644 helm/etcd-backup-operator/templates/service.yaml diff --git a/helm/etcd-backup-operator/Chart.yaml b/helm/etcd-backup-operator/Chart.yaml index 5559a2a6..dd4fc699 100644 --- a/helm/etcd-backup-operator/Chart.yaml +++ b/helm/etcd-backup-operator/Chart.yaml @@ -5,5 +5,5 @@ home: "https://github.com/giantswarm/etcd-backup-operator" version: "[[ .Version ]]" appVersion: "[[ .AppVersion ]]" annotations: - application.giantswarm.io/team: team-turtles + application.giantswarm.io/team: turtles config.giantswarm.io/version: 1.x.x diff --git a/helm/etcd-backup-operator/templates/_helpers.tpl b/helm/etcd-backup-operator/templates/_helpers.tpl index efc78c83..40b8c442 100644 --- a/helm/etcd-backup-operator/templates/_helpers.tpl +++ b/helm/etcd-backup-operator/templates/_helpers.tpl @@ -21,6 +21,7 @@ app: {{ include "name" . | quote }} {{ include "labels.selector" . }} application.giantswarm.io/branch: {{ .Values.project.branch | quote }} application.giantswarm.io/commit: {{ .Values.project.commit | quote }} +application.giantswarm.io/team: {{ index .Chart.Annotations "application.giantswarm.io/team" | quote }} app.kubernetes.io/managed-by: {{ .Release.Service | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} helm.sh/chart: {{ include "chart" . | quote }} diff --git a/helm/etcd-backup-operator/templates/configmap.yaml b/helm/etcd-backup-operator/templates/configmap.yaml index 4efa8f32..d2e0cf23 100644 --- a/helm/etcd-backup-operator/templates/configmap.yaml +++ b/helm/etcd-backup-operator/templates/configmap.yaml @@ -12,7 +12,7 @@ data: debug: server: true listen: - address: "http://0.0.0.0:{{ .Values.service.port }}" + address: "http://0.0.0.0:{{ .Values.port }}" service: kubernetes: address: '' diff --git a/helm/etcd-backup-operator/templates/deployment.yaml b/helm/etcd-backup-operator/templates/deployment.yaml index b2f1ecd2..fe4983e9 100644 --- a/helm/etcd-backup-operator/templates/deployment.yaml +++ b/helm/etcd-backup-operator/templates/deployment.yaml @@ -73,6 +73,10 @@ spec: - daemon - --config.dirs=/var/run/{{ include "name" . }}/configmap/ - --config.files=config + ports: + - name: metrics + containerPort: {{ .Values.port }} + protocol: TCP volumeMounts: - mountPath: /var/lib/etcd name: etcd-datadir @@ -99,7 +103,7 @@ spec: livenessProbe: httpGet: path: /healthz - port: {{ .Values.service.port }} + port: {{ .Values.port }} initialDelaySeconds: 30 timeoutSeconds: 1 securityContext: diff --git a/helm/etcd-backup-operator/templates/network-policy.yaml b/helm/etcd-backup-operator/templates/network-policy.yaml index e62f33f4..fb5b6999 100644 --- a/helm/etcd-backup-operator/templates/network-policy.yaml +++ b/helm/etcd-backup-operator/templates/network-policy.yaml @@ -11,7 +11,7 @@ spec: {{- include "labels.selector" . | nindent 6 }} ingress: - ports: - - port: {{ .Values.service.port }} + - port: {{ .Values.port }} protocol: TCP egress: - {} diff --git a/helm/etcd-backup-operator/templates/podmonitor.yaml b/helm/etcd-backup-operator/templates/podmonitor.yaml new file mode 100644 index 00000000..429a0c2b --- /dev/null +++ b/helm/etcd-backup-operator/templates/podmonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: + {{- include "labels.common" . | nindent 4 }} + name: {{ include "resource.default.name" . }} + namespace: {{ include "resource.default.namespace" . }} +spec: + namespaceSelector: + matchNames: + - {{ include "resource.default.namespace" . }} + podMetricsEndpoints: + - port: metrics + selector: + matchLabels: + {{- include "labels.selector" . | nindent 6}} diff --git a/helm/etcd-backup-operator/templates/service.yaml b/helm/etcd-backup-operator/templates/service.yaml deleted file mode 100644 index c8a19396..00000000 --- a/helm/etcd-backup-operator/templates/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "resource.default.name" . }} - namespace: {{ include "resource.default.namespace" . }} - labels: - {{- include "labels.common" . | nindent 4 }} - giantswarm.io/monitoring: "true" - annotations: - prometheus.io/scrape: "true" -spec: - ports: - - name: metrics - port: {{ .Values.service.port }} - selector: - {{- include "labels.selector" . | nindent 4 }} diff --git a/helm/etcd-backup-operator/values.schema.json b/helm/etcd-backup-operator/values.schema.json index 7fc37146..1c57a741 100644 --- a/helm/etcd-backup-operator/values.schema.json +++ b/helm/etcd-backup-operator/values.schema.json @@ -106,6 +106,9 @@ } } }, + "port": { + "type": "integer" + }, "priorityClassName": { "type": "string" }, @@ -179,14 +182,6 @@ } } }, - "service": { - "type": "object", - "properties": { - "port": { - "type": "integer" - } - } - }, "skipManagementClusterBackup": { "type": "boolean" }, diff --git a/helm/etcd-backup-operator/values.yaml b/helm/etcd-backup-operator/values.yaml index 5a5ec735..d3af0c29 100644 --- a/helm/etcd-backup-operator/values.yaml +++ b/helm/etcd-backup-operator/values.yaml @@ -6,12 +6,12 @@ pod: id: 1000 group: id: 1000 -service: - port: 8050 project: branch: "[[ .Branch ]]" commit: "[[ .SHA ]]" +port: 8050 + registry: domain: gsoci.azurecr.io