Skip to content

Commit

Permalink
fix(selector): apply component labels/selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Sep 18, 2024
1 parent c5a608b commit 4c8c74e
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ metadata:
name: {{ include "cryostat.fullname" . }}
labels:
{{- include "cryostat.labels" . | nindent 4 }}
component: cryostat
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cryostat.selectorLabels" . | nindent 6 }}
component: cryostat
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -21,6 +23,7 @@ spec:
{{- end }}
labels:
{{- include "cryostat.selectorLabels" . | nindent 8 }}
component: cryostat
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/templates/cryostat_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
name: {{ $fullName }}
labels:
{{- include "cryostat.labels" $ | nindent 4 }}
component: cryostat
{{- if (.Values.authentication.openshift).enabled }}
annotations:
service.alpha.openshift.io/serving-cert-secret-name: {{ .Release.Name }}-proxy-tls
Expand All @@ -25,3 +26,4 @@ spec:
{{- end }}
selector:
{{- include "cryostat.selectorLabels" $ | nindent 4 }}
component: cryostat
3 changes: 3 additions & 0 deletions charts/cryostat/templates/db_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ metadata:
name: {{ include "cryostat.fullname" . }}-db
labels:
{{- include "cryostat.labels" . | nindent 4 }}
component: db
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cryostat.selectorLabels" . | nindent 6 }}
component: db
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -21,6 +23,7 @@ spec:
{{- end }}
labels:
{{- include "cryostat.selectorLabels" . | nindent 8 }}
component: db
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/templates/db_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ metadata:
name: {{ $fullName }}-db
labels:
{{- include "cryostat.labels" $ | nindent 4 }}
component: db
spec:
type: {{ .Values.db.service.type }}
ports:
- port: {{ .Values.db.service.port }}
selector:
{{- include "cryostat.selectorLabels" $ | nindent 4 }}
component: db
3 changes: 3 additions & 0 deletions charts/cryostat/templates/reports_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ metadata:
name: {{ include "cryostat.fullname" . }}-reports
labels:
{{- include "cryostat.labels" . | nindent 4 }}
component: reports
spec:
replicas: {{ .Values.reports.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cryostat.selectorLabels" . | nindent 6 }}
component: reports
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -22,6 +24,7 @@ spec:
{{- end }}
labels:
{{- include "cryostat.selectorLabels" . | nindent 8 }}
component: reports
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/templates/reports_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ spec:
- port: {{ .Values.reports.service.httpPort }}
selector:
{{- include "cryostat.selectorLabels" $ | nindent 4 }}
component: reports
{{- end -}}
3 changes: 3 additions & 0 deletions charts/cryostat/templates/storage_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ metadata:
name: {{ include "cryostat.fullname" . }}-storage
labels:
{{- include "cryostat.labels" . | nindent 4 }}
component: storage
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cryostat.selectorLabels" . | nindent 6 }}
component: storage
template:
metadata:
{{- with .Values.podAnnotations }}
Expand All @@ -21,6 +23,7 @@ spec:
{{- end }}
labels:
{{- include "cryostat.selectorLabels" . | nindent 8 }}
component: storage
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/templates/storage_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ metadata:
name: {{ $fullName }}-storage
labels:
{{- include "cryostat.labels" $ | nindent 4 }}
component: storage
spec:
type: {{ .Values.storage.service.type }}
ports:
- port: {{ .Values.storage.service.port }}
selector:
{{- include "cryostat.selectorLabels" $ | nindent 4 }}
component: storage
3 changes: 3 additions & 0 deletions charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ tests:
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: cryostat
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: cryostat
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -44,6 +46,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
component: cryostat

- it: should validate all container settings including environment variables and security contexts
asserts:
Expand Down
3 changes: 3 additions & 0 deletions charts/cryostat/tests/cryostat_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: cryostat

- it: should create a Service with the correct settings when OpenShift authentication is enabled
set:
Expand Down Expand Up @@ -85,6 +86,7 @@ tests:
value:
app.kubernetes.io/name: cryostat
app.kubernetes.io/instance: RELEASE-NAME
component: cryostat
- equal:
path: metadata.labels
value:
Expand All @@ -93,6 +95,7 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: cryostat
- equal:
path: metadata.annotations
value:
Expand Down
3 changes: 3 additions & 0 deletions charts/cryostat/tests/db_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ tests:
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: db
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: db
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -44,6 +46,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
component: db

- it: should validate cryostat-db settings
asserts:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/tests/db_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: db

- it: should create a Service with the correct settings overrides
set:
Expand Down Expand Up @@ -55,3 +56,4 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: db
3 changes: 3 additions & 0 deletions charts/cryostat/tests/reports_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ tests:
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: reports
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: reports
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -52,6 +54,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
component: reports

- it: should validate all container settings including environment variables and security contexts
set:
Expand Down
3 changes: 3 additions & 0 deletions charts/cryostat/tests/storage_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ tests:
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: storage
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
component: storage
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -44,6 +46,7 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
component: storage

- it: should validate cryostat-storage settings
asserts:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/tests/storage_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: storage

- it: should create a Service with the correct settings overrides
set:
Expand Down Expand Up @@ -56,3 +57,4 @@ tests:
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
component: storage

0 comments on commit 4c8c74e

Please sign in to comment.