Skip to content

Commit

Permalink
feat(podAnnotations): individualized Pod Annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 29, 2024
1 parent b91e9bd commit a10f976
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 26 deletions.
8 changes: 7 additions & 1 deletion charts/cryostat/README.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ spec:
app.kubernetes.io/component: cryostat
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- with .Values.core.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
5 changes: 4 additions & 1 deletion charts/cryostat/templates/db_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ spec:
app.kubernetes.io/component: db
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- with .Values.db.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
5 changes: 4 additions & 1 deletion charts/cryostat/templates/reports_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ spec:
app.kubernetes.io/component: reports
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- with .Values.reports.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
5 changes: 4 additions & 1 deletion charts/cryostat/templates/storage_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ spec:
app.kubernetes.io/component: storage
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- with .Values.storage.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
32 changes: 32 additions & 0 deletions charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -514,3 +514,35 @@ tests:
path: spec.template.spec.containers[?(@.name=='cryostat-jfr-datasource')].imagePullPolicy
value: "IfNotPresent"

- it: should set default podAnnotations
set:
podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set pod-specific podAnnotations
set:
core.podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set merge pod-specific and default podAnnotations
set:
core.podAnnotations:
foo: bar
podAnnotations:
alice: bob
asserts:
- equal:
path: spec.template.metadata.annotations
value:
alice: bob
foo: bar
32 changes: 32 additions & 0 deletions charts/cryostat/tests/db_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,35 @@ tests:
path: spec.template.spec.containers[?(@.name=='cryostat-db')].imagePullPolicy
value: "IfNotPresent"

- it: should set default podAnnotations
set:
podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set pod-specific podAnnotations
set:
db.podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set merge pod-specific and default podAnnotations
set:
db.podAnnotations:
foo: bar
podAnnotations:
alice: bob
asserts:
- equal:
path: spec.template.metadata.annotations
value:
alice: bob
foo: bar
36 changes: 36 additions & 0 deletions charts/cryostat/tests/reports_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,39 @@ tests:
- equal:
path: spec.template.spec.containers[?(@.name=='cryostat-reports')].imagePullPolicy
value: "IfNotPresent"

- it: should set default podAnnotations
set:
reports.replicas: 1
podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set pod-specific podAnnotations
set:
reports.replicas: 1
reports.podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set merge pod-specific and default podAnnotations
set:
reports.replicas: 1
reports.podAnnotations:
foo: bar
podAnnotations:
alice: bob
asserts:
- equal:
path: spec.template.metadata.annotations
value:
alice: bob
foo: bar
33 changes: 33 additions & 0 deletions charts/cryostat/tests/storage_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,36 @@ tests:
- equal:
path: spec.template.spec.containers[?(@.name=='cryostat-storage')].imagePullPolicy
value: "IfNotPresent"

- it: should set default podAnnotations
set:
podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set pod-specific podAnnotations
set:
storage.podAnnotations:
foo: bar
asserts:
- equal:
path: spec.template.metadata.annotations
value:
foo: bar

- it: should set merge pod-specific and default podAnnotations
set:
storage.podAnnotations:
foo: bar
podAnnotations:
alice: bob
asserts:
- equal:
path: spec.template.metadata.annotations
value:
alice: bob
foo: bar
40 changes: 20 additions & 20 deletions charts/cryostat/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,26 @@
"db": {
"type": "object",
"properties": {
"image": {
"type": "object",
"properties": {
"repository": {
"type": "string",
"description": "Repository for the database container image",
"default": "quay.io/cryostat/cryostat-db"
},
"pullPolicy": {
"type": "string",
"description": "Image pull policy for the database container image",
"default": "Always"
},
"tag": {
"type": "string",
"description": "Tag for the database container image",
"default": "latest"
}
}
},
"securityContext": {
"type": "object",
"properties": {
Expand All @@ -399,26 +419,6 @@
}
}
},
"image": {
"type": "object",
"properties": {
"repository": {
"type": "string",
"description": "Repository for the database container image",
"default": "quay.io/cryostat/cryostat-db"
},
"pullPolicy": {
"type": "string",
"description": "Image pull policy for the database container image",
"default": "Always"
},
"tag": {
"type": "string",
"description": "Tag for the database container image",
"default": "latest"
}
}
},
"service": {
"type": "object",
"properties": {
Expand Down
14 changes: 13 additions & 1 deletion charts/cryostat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ core:
pullPolicy: Always
## @param core.image.tag Tag for the main Cryostat container image
tag: "4.0.0-snapshot"
## @param core.podAnnotations [object] Annotations to be applied to the Cryostat Pods
podAnnotations: {}
service:
## @param core.service.type Type of Service to create for the Cryostat application
type: ClusterIP
Expand Down Expand Up @@ -96,6 +98,8 @@ reports:
pullPolicy: Always
## @param reports.image.tag Tag for the Report Generator image
tag: "4.0.0-snapshot"
## @param reports.podAnnotations [object] Annotations to be applied to the Report Generator Pods
podAnnotations: {}
service:
## @param reports.service.type Type of Service to create for the Report Generator Deployment
type: ClusterIP
Expand Down Expand Up @@ -134,6 +138,8 @@ db:
pullPolicy: Always
## @param db.image.tag Tag for the database container image
tag: "latest"
## @param db.podAnnotations [object] Annotations to be applied to the Database Pods
podAnnotations: {}
service:
## @param db.service.type Type of Service to create for the database
type: ClusterIP
Expand Down Expand Up @@ -169,6 +175,8 @@ storage:
encryption:
## @param storage.encryption.enabled Enable at-rest encryption of stored objects. The storage container will generate a secret key for each stored object and use this key to encrypt and decrypt objects transparently. The key is written to the object metadata, so in the default storage container configuration this only adds a small layer of additional security.
enabled: true
## @param storage.podAnnotations [object] Annotations to be applied to the Storage Pods
podAnnotations: {}
service:
## @param storage.service.type Type of Service to create for the object storage
type: ClusterIP
Expand Down Expand Up @@ -199,6 +207,8 @@ grafana:
pullPolicy: Always
## @param grafana.image.tag Tag for the Grafana container image
tag: "latest"
## @param grafana.podAnnotations [object] Annotations to be applied to the Grafana Pods
podAnnotations: {}
service:
## @param grafana.service.type Type of Service to create for Grafana
type: ClusterIP
Expand Down Expand Up @@ -229,6 +239,8 @@ datasource:
pullPolicy: Always
## @param datasource.image.tag Tag for the JFR Data Source container image
tag: "latest"
## @param datasource.podAnnotations [object] Annotations to be applied to the JFR Datasource Pods
podAnnotations: {}
resources:
requests:
## @param datasource.resources.requests.cpu CPU resource request for the JFR Data Source container. See: [ResourceRequirements](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#resources)
Expand Down Expand Up @@ -351,7 +363,7 @@ serviceAccount:
## @param serviceAccount.name The name of the service account to use. If not set and create is true, a name is generated using the fullname template
name: ""

## @param podAnnotations [object] Annotations to be applied to the Cryostat Pod
## @param podAnnotations [object] Annotations to be applied to the various Pods
podAnnotations: {}

## @param podSecurityContext [object] Security Context for the Cryostat Pod. Defaults to meet "restricted" [Pod Security Standard](https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted). See: [PodSecurityContext](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#security-context)
Expand Down

0 comments on commit a10f976

Please sign in to comment.