Skip to content

Commit

Permalink
feat(labels): add part-of selector label (#211)
Browse files Browse the repository at this point in the history
* feat(labels): add part-of selector label

* chore(service): rename ports to remove 'cryostat-' prefix

* set service ports appProtocol
  • Loading branch information
andrewazores authored Nov 21, 2024
1 parent 5bda844 commit f6127ef
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions charts/cryostat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Selector labels.
{{- define "cryostat.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cryostat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: cryostat
{{- end }}

{{/*
Expand Down
6 changes: 4 additions & 2 deletions charts/cryostat/templates/cryostat_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ spec:
- port: {{ .Values.core.service.httpPort }}
targetPort: 4180
protocol: TCP
name: cryostat-http
name: http
appProtocol: http
{{- if (.Values.authentication.openshift).enabled }}
- port: 443
targetPort: 8443
protocol: TCP
name: cryostat-https
name: https
appProtocol: https
{{- end }}
selector:
{{- include "cryostat.selectorLabels" $ | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/cookie_secret_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: 4.0.0-dev
Expand Down
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 @@ -23,12 +23,14 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -47,6 +49,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: cryostat

- it: should validate all container settings including environment variables and security contexts
asserts:
Expand Down
15 changes: 12 additions & 3 deletions charts/cryostat/tests/cryostat_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ tests:
value: TCP
- equal:
path: spec.ports[0].name
value: cryostat-http
value: http
- equal:
path: spec.ports[0].appProtocol
value: http
- equal:
path: metadata.labels
value:
Expand All @@ -41,6 +44,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: cryostat

- it: should create a Service with the correct settings when OpenShift authentication is enabled
set:
Expand Down Expand Up @@ -68,7 +72,7 @@ tests:
value: TCP
- equal:
path: spec.ports[0].name
value: cryostat-http
value: http
- equal:
path: spec.ports[1].port
value: 443
Expand All @@ -80,13 +84,17 @@ tests:
value: TCP
- equal:
path: spec.ports[1].name
value: cryostat-https
value: https
- equal:
path: spec.ports[1].appProtocol
value: https
- equal:
path: spec.selector
value:
app.kubernetes.io/name: cryostat
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: cryostat
- equal:
path: metadata.labels
value:
Expand All @@ -96,6 +104,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
app.kubernetes.io/component: cryostat
app.kubernetes.io/part-of: 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 @@ -23,12 +23,14 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: db
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: db
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -47,6 +49,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: db
app.kubernetes.io/part-of: cryostat

- it: should validate cryostat-db settings
asserts:
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/db_pvc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/db_secret_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: 4.0.0-dev
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 @@ -28,6 +28,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
app.kubernetes.io/component: db
app.kubernetes.io/part-of: cryostat

- it: should create a Service with the correct settings overrides
set:
Expand Down Expand Up @@ -57,3 +58,4 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
app.kubernetes.io/component: db
app.kubernetes.io/part-of: cryostat
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 @@ -31,11 +31,13 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: reports
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/component: reports
- equal:
path: spec.template.spec.serviceAccountName
Expand All @@ -55,6 +57,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: reports
app.kubernetes.io/part-of: cryostat

- it: should validate all container settings including environment variables and security contexts
set:
Expand Down
2 changes: 2 additions & 0 deletions charts/cryostat/tests/role_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
Expand All @@ -45,6 +46,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/route_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
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 @@ -23,12 +23,14 @@ tests:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: storage
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: cryostat
app.kubernetes.io/component: storage
app.kubernetes.io/part-of: cryostat
- equal:
path: spec.template.spec.serviceAccountName
value: RELEASE-NAME-cryostat
Expand All @@ -47,6 +49,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: storage
app.kubernetes.io/part-of: cryostat

- it: should validate cryostat-storage settings
asserts:
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/storage_pvc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: "4.0.0-dev"
Expand Down
1 change: 1 addition & 0 deletions charts/cryostat/tests/storage_secret_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tests:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/part-of: cryostat
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: cryostat
app.kubernetes.io/version: 4.0.0-dev
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 @@ -28,6 +28,7 @@ tests:
app.kubernetes.io/version: "4.0.0-dev"
helm.sh/chart: cryostat-2.0.0-dev
app.kubernetes.io/component: storage
app.kubernetes.io/part-of: cryostat

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

0 comments on commit f6127ef

Please sign in to comment.