Browse Source

chore: make changes backward-compatible

Moritz Johner 4 years ago
parent
commit
ef4eebb5cc

+ 6 - 2
deploy/charts/external-secrets/README.md

@@ -51,6 +51,8 @@ The command removes all the Kubernetes components associated with the chart and
 | certController.podLabels | object | `{}` |  |
 | certController.podSecurityContext | object | `{}` |  |
 | certController.priorityClassName | string | `""` | Pod priority class name. |
+| certController.prometheus.enabled | bool | `false` | deprecated. will be removed with 0.7.0, use serviceMonitor instead |
+| certController.prometheus.service.port | int | `8080` | deprecated. will be removed with 0.7.0, use serviceMonitor instead |
 | certController.rbac.create | bool | `true` | Specifies whether role and rolebinding resources should be created. |
 | certController.requeueInterval | string | `"5m"` |  |
 | certController.resources | object | `{}` |  |
@@ -86,8 +88,8 @@ The command removes all the Kubernetes components associated with the chart and
 | priorityClassName | string | `""` | Pod priority class name. |
 | processClusterExternalSecret | bool | `true` | if true, the operator will process cluster external secret. Else, it will ignore them. |
 | processClusterStore | bool | `true` | if true, the operator will process cluster store. Else, it will ignore them. |
-| prometheus.enabled | bool | `false` | Specifies whether to expose Service resource for collecting Prometheus metrics |
-| prometheus.service.port | int | `8080` |  |
+| prometheus.enabled | bool | `false` | deprecated. will be removed with 0.7.0, use serviceMonitor instead. |
+| prometheus.service.port | int | `8080` | deprecated. will be removed with 0.7.0, use serviceMonitor instead. |
 | rbac.create | bool | `true` | Specifies whether role and rolebinding resources should be created. |
 | replicaCount | int | `1` |  |
 | resources | object | `{}` |  |
@@ -123,6 +125,8 @@ The command removes all the Kubernetes components associated with the chart and
 | webhook.podSecurityContext | object | `{}` |  |
 | webhook.port | int | `10250` | The port the webhook will listen to |
 | webhook.priorityClassName | string | `""` | Pod priority class name. |
+| webhook.prometheus.enabled | bool | `false` | deprecated. will be removed with 0.7.0, use serviceMonitor instead |
+| webhook.prometheus.service.port | int | `8080` | deprecated. will be removed with 0.7.0, use serviceMonitor instead |
 | webhook.rbac.create | bool | `true` | Specifies whether role and rolebinding resources should be created. |
 | webhook.replicaCount | int | `1` |  |
 | webhook.resources | object | `{}` |  |

+ 1 - 1
deploy/charts/external-secrets/templates/cert-controller-deployment.yaml

@@ -59,7 +59,7 @@ spec:
             {{- end }}
           {{- end }}
           ports:
-            - containerPort: 8080
+            - containerPort: {{ .Values.certController.prometheus.service.port }}
               protocol: TCP
               name: metrics
           readinessProbe:

+ 20 - 0
deploy/charts/external-secrets/templates/cert-controller-service.yaml

@@ -0,0 +1,20 @@
+{{- if and .Values.certController.create .Values.certController.prometheus.enabled }}
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "external-secrets.fullname" . }}-cert-controller-metrics
+  labels:
+    {{- include "external-secrets.labels" . | nindent 4 }}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/scrape: "true"
+    prometheus.io/port: {{ .Values.certController.prometheus.service.port | quote }}
+spec:
+  type: ClusterIP
+  ports:
+  - port: {{ .Values.certController.prometheus.service.port }}
+    protocol: TCP
+    name: metrics
+  selector:
+    {{- include "external-secrets-cert-controller.selectorLabels" . | nindent 4 }}
+{{- end }}

+ 1 - 1
deploy/charts/external-secrets/templates/deployment.yaml

@@ -78,7 +78,7 @@ spec:
           {{- end }}
           {{- end }}
           ports:
-            - containerPort: 8080
+            - containerPort: {{ .Values.prometheus.service.port }}
               protocol: TCP
               name: metrics
           {{- with .Values.extraEnv }}

+ 21 - 0
deploy/charts/external-secrets/templates/service.yaml

@@ -0,0 +1,21 @@
+{{- if .Values.prometheus.enabled }}
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "external-secrets.fullname" . }}-metrics
+  namespace: {{ .Release.Namespace | quote }}
+  labels:
+    {{- include "external-secrets.labels" . | nindent 4 }}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/scrape: "true"
+    prometheus.io/port: {{ .Values.prometheus.service.port | quote }}
+spec:
+  type: ClusterIP
+  ports:
+    - port: {{ .Values.prometheus.service.port }}
+      protocol: TCP
+      name: metrics
+  selector:
+    {{- include "external-secrets.selectorLabels" . | nindent 4 }}
+{{- end }}

+ 1 - 1
deploy/charts/external-secrets/templates/webhook-deployment.yaml

@@ -59,7 +59,7 @@ spec:
             {{- end }}
           {{- end }}
           ports:
-            - containerPort: 8080
+            - containerPort: {{ .Values.webhook.prometheus.service.port }}
               protocol: TCP
               name: metrics
             - containerPort: {{ .Values.webhook.port }}

+ 12 - 0
deploy/charts/external-secrets/templates/webhook-service.yaml

@@ -7,6 +7,12 @@ metadata:
   labels:
     {{- include "external-secrets-webhook.labels" . | nindent 4 }}
     external-secrets.io/component : webhook
+  {{- if .Values.webhook.prometheus.enabled}}
+  annotations:
+    prometheus.io/path: "/metrics"
+    prometheus.io/scrape: "true"
+    prometheus.io/port: {{ .Values.prometheus.service.port | quote }}
+  {{- end }}
 spec:
   type: ClusterIP
   ports:
@@ -14,6 +20,12 @@ spec:
     targetPort: {{ .Values.webhook.port }}
     protocol: TCP
     name: webhook
+  {{- if .Values.webhook.prometheus.enabled}}
+  - port: {{ .Values.webhook.prometheus.service.port}}
+    targetPort: {{ .Values.webhook.prometheus.service.port}}
+    protocol: TCP
+    name: metrics
+  {{- end }}
   selector:
     {{- include "external-secrets-webhook.selectorLabels" . | nindent 4 }}
 {{- end }}

+ 16 - 1
deploy/charts/external-secrets/values.yaml

@@ -92,9 +92,10 @@ resources: {}
   #   memory: 32Mi
 
 prometheus:
-  # -- Specifies whether to expose Service resource for collecting Prometheus metrics
+  # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead.
   enabled: false
   service:
+    # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead.
     port: 8080
 
 serviceMonitor:
@@ -159,6 +160,13 @@ webhook:
     # -- Pod priority class name.
   priorityClassName: ""
 
+  prometheus:
+    # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead
+    enabled: false
+    service:
+      # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead
+      port: 8080
+
   serviceMonitor:
     # -- Specifies whether to create a ServiceMonitor resource for collecting Prometheus metrics
     enabled: false
@@ -233,6 +241,13 @@ certController:
     # -- Pod priority class name.
   priorityClassName: ""
 
+  prometheus:
+    # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead
+    enabled: false
+    service:
+      # -- deprecated. will be removed with 0.7.0, use serviceMonitor instead
+      port: 8080
+
   serviceMonitor:
     # -- Specifies whether to create a ServiceMonitor resource for collecting Prometheus metrics
     enabled: false