Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(podAnnotations): individualized Pod Annotations #222

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 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.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.core.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.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.db.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.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.reports.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.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.storage.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
10 changes: 9 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 @@ -351,7 +359,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] Common annotations to be applied to all managed 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
Loading