Skip to content

Commit

Permalink
charts/*: drop wireService label, use app= instead, add servicemonito…
Browse files Browse the repository at this point in the history
…r support (#2413)

* charts/*: drop wireService label, use app= instead, add servicemonitor support

This aligns labels a bit more with how they look like in other
deployments. In some cases, we were already setting the `app` label,
too.

There's one possible regression:
The wire-server-metrics helm chart configured kube-prometheus-stack to
automatically scrape everything with a wireService label at port http,
path /i/metrics. This will be fixed in a followup, by adding
ServiceProbe resources to each workload that exposes metrics.

* charts/brig: add servicemonitor support

* charts/cannon: add servicemonitor support

* chart/cargohold: add servicemonitor support

* charts/galley: add servicemonitor support

* charts/gundeck: add servicemonitor support

* charts/proxy: add servicemonitor support

* charts/spar: add servicemonitor support

* changelog.d: add wireService label removal to changelog
  • Loading branch information
flokli authored Jun 10, 2022
1 parent 4ff579b commit 46d5edb
Show file tree
Hide file tree
Showing 80 changed files with 296 additions and 150 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ kube-integration-teardown-sans-federation:

.PHONY: kube-restart-%
kube-restart-%:
kubectl delete pod -n $(NAMESPACE) -l wireService=$(*)
kubectl delete pod -n $(NAMESPACE)-fed2 -l wireService=$(*)
kubectl delete pod -n $(NAMESPACE) -l app=$(*)
kubectl delete pod -n $(NAMESPACE)-fed2 -l app=$(*)

.PHONY: latest-tag
latest-tag:
Expand Down Expand Up @@ -522,8 +522,8 @@ kind-restart-nginx-ingress: .local/kind-kubeconfig

kind-restart-%: .local/kind-kubeconfig
export KUBECONFIG=$(CURDIR)/.local/kind-kubeconfig && \
kubectl delete pod -n $(NAMESPACE) -l wireService=$(*) && \
kubectl delete pod -n $(NAMESPACE)-fed2 -l wireService=$(*)
kubectl delete pod -n $(NAMESPACE) -l app=$(*) && \
kubectl delete pod -n $(NAMESPACE)-fed2 -l app=$(*)

# This target can be used to template a helm chart with values filled in from
# hack/helm_vars (what CI uses) as overrrides, if available. This allows debugging helm
Expand Down
34 changes: 34 additions & 0 deletions changelog.d/0-release-notes/wire-service-label
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
The `wireService` label has been removed.

In some cases, we were already setting the `app` label too.

Now we consistently use the `app` label to label different wire services.

The `wire-server-metrics` chart was previously running some custom
configuration to automatically add all payloads with a `wireService` label into
metrics scraping.

With the removal of the `wireService` label, this custom configuration has been
removed.

Instead, all services that expose metrics will now create `ServiceMonitor`
resources, if their helm chart is applied with `metrics.serviceMonitor.enable`
set to true.

This prevents scraping agents from querying services that don't expose metrics
at /i/metrics unnecessarily.

Additionally, makes it easier to run other metric scraping operators, like
`grafana-agent-operator`, without the need to also create some custom
`wireService` label config there.

Generally, if you have any monitoring solution installed in your cluster that
uses the Prometheus CRDs, set `metrics.serviceMonitor.enable` for the following charts:

- brig
- cannon
- cargohold
- galley
- gundeck
- proxy
- spar
4 changes: 1 addition & 3 deletions charts/account-pages/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: account-pages
labels:
wireService: account-pages
app: account-pages
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -16,12 +16,10 @@ spec:
maxSurge: {{ .Values.replicaCount | mul 2 }}
selector:
matchLabels:
wireService: account-pages
app: account-pages
template:
metadata:
labels:
wireService: account-pages
app: account-pages
release: {{ .Release.Name }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ingress/templates/ELB_account_pages_https.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
spec:
type: LoadBalancer
selector:
wireService: account-pages
app: account-pages
ports:
- name: https
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ingress/templates/ELB_nginz_https.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
spec:
type: LoadBalancer
selector:
wireService: nginz
app: nginz
ports:
- name: https
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ingress/templates/ELB_nginz_wss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
spec:
type: LoadBalancer
selector:
wireService: nginz
app: nginz
ports:
- name: wss
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ingress/templates/ELB_team_settings_https.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
spec:
type: LoadBalancer
selector:
wireService: team-settings
app: team-settings
ports:
- name: https
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion charts/aws-ingress/templates/ELB_webapp_https.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
spec:
type: LoadBalancer
selector:
wireService: webapp
app: webapp
ports:
- name: https
protocol: TCP
Expand Down
6 changes: 3 additions & 3 deletions charts/backoffice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: backoffice
labels:
wireService: backoffice
app: backoffice
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -16,11 +16,11 @@ spec:
maxSurge: {{ .Values.replicaCount }}
selector:
matchLabels:
wireService: backoffice
app: backoffice
template:
metadata:
labels:
wireService: backoffice
app: backoffice
release: {{ .Release.Name }}
annotations:
# An annotation of the configmap checksum ensures changes to the configmap cause a redeployment upon `helm upgrade`
Expand Down
4 changes: 2 additions & 2 deletions charts/backoffice/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Service
metadata:
name: backoffice
labels:
wireService: backoffice
app: backoffice
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -14,5 +14,5 @@ spec:
port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
selector:
wireService: backoffice
app: backoffice
release: {{ .Release.Name }}
2 changes: 1 addition & 1 deletion charts/brig/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ConfigMap
metadata:
name: "brig"
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand Down
6 changes: 3 additions & 3 deletions charts/brig/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Deployment
metadata:
name: brig
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -16,11 +16,11 @@ spec:
maxSurge: {{ .Values.replicaCount }}
selector:
matchLabels:
wireService: brig
app: brig
template:
metadata:
labels:
wireService: brig
app: brig
release: {{ .Release.Name }}
annotations:
# An annotation of the configmap checksum ensures changes to the configmap cause a redeployment upon `helm upgrade`
Expand Down
2 changes: 1 addition & 1 deletion charts/brig/templates/geoip-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Secret
metadata:
name: brig-geoip
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/brig/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Secret
metadata:
name: brig
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
Expand Down
4 changes: 2 additions & 2 deletions charts/brig/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Service
metadata:
name: brig
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -14,5 +14,5 @@ spec:
port: {{ .Values.service.externalPort }}
targetPort: {{ .Values.service.internalPort }}
selector:
wireService: brig
app: brig
release: {{ .Release.Name }}
2 changes: 1 addition & 1 deletion charts/brig/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name }}
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand Down
19 changes: 19 additions & 0 deletions charts/brig/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: brig
labels:
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
endpoints:
- port: http
path: /i/metrics
selector:
matchLabels:
app: brig
release: {{ .Release.Name }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/brig/templates/tests/brig-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Service
metadata:
name: "brig-integration"
labels:
wireService: brig-integration
app: brig-integration
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -13,7 +13,7 @@ spec:
- port: 9000
targetPort: 9000
selector:
wireService: brig-integration
app: brig-integration
release: {{ .Release.Name }}
---
apiVersion: v1
Expand All @@ -23,7 +23,7 @@ metadata:
annotations:
"helm.sh/hook": test-success
labels:
wireService: brig-integration
app: brig-integration
release: {{ .Release.Name }}
spec:
volumes:
Expand Down
2 changes: 1 addition & 1 deletion charts/brig/templates/tests/nginz-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ spec:
- port: 8080
targetPort: 8080
selector:
wireService: nginz
app: nginz
2 changes: 1 addition & 1 deletion charts/brig/templates/turnconfigmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ConfigMap
metadata:
name: "turn"
labels:
wireService: brig
app: brig
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand Down
3 changes: 3 additions & 0 deletions charts/brig/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ resources:
limits:
memory: "512Mi"
cpu: "500m"
metrics:
serviceMonitor:
enable: false
config:
logLevel: Info
logFormat: JSON
Expand Down
4 changes: 2 additions & 2 deletions charts/cannon/templates/headless-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kind: Service
metadata:
name: {{ .Values.service.name }}
labels:
wireService: cannon
app: cannon
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -23,5 +23,5 @@ spec:
targetPort: {{ .Values.service.internalPort }}
protocol: TCP
selector:
wireService: cannon
app: cannon
release: {{ .Release.Name }}
1 change: 0 additions & 1 deletion charts/cannon/templates/nginz-certificate-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: Secret
metadata:
name: {{ .Values.service.nginz.tls.secretName }}
labels:
wireService: cannon-nginz
app: cannon-nginz
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
Expand Down
1 change: 0 additions & 1 deletion charts/cannon/templates/nginz-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: Secret
metadata:
name: cannon-nginz
labels:
wireService: cannon-nginz
app: cannon-nginz
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
Expand Down
4 changes: 2 additions & 2 deletions charts/cannon/templates/nginz-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ kind: Service
metadata:
name: {{ .Values.service.nginz.name }}
labels:
wireService: cannon
app: cannon
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
Expand All @@ -35,6 +35,6 @@ spec:
targetPort: {{ .Values.service.nginz.internalPort }}
protocol: TCP
selector:
wireService: cannon
app: cannon
release: {{ .Release.Name }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/cannon/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: cannon
labels:
app: cannon
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
endpoints:
- port: http
path: /i/metrics
selector:
matchLabels:
app: cannon
release: {{ .Release.Name }}
{{- end }}
Loading

0 comments on commit 46d5edb

Please sign in to comment.