Skip to content

Commit

Permalink
Implement declarative probe templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Matsuoka committed Feb 28, 2025
1 parent 450cb2d commit f46f407
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 2 deletions.
5 changes: 4 additions & 1 deletion charts/cryostat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ helm install cryostat ./charts/cryostat
| `core.discovery.kubernetes.portNames` | List of port names that the Cryostat application should look for in order to consider a target as JMX connectable | `[]` |
| `core.discovery.kubernetes.builtInPortNumbersDisabled` | When false and `portNumbers` is empty, the Cryostat application will use the default port number `9091` to look for JMX connectable targets. | `false` |
| `core.discovery.kubernetes.portNumbers` | List of port numbers that the Cryostat application should look for in order to consider a target as JMX connectable | `[]` |

| `core.config.declarative.fsMode` | default filesystem mode (permissions) for declarative configuration volumes
| `440` |
| `core.config.probeTemplates.configMapNames` | List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are XML JMC Agent Event Probe Templates, to be mounted to the Cryostat container.
| `[]` |
### Report Generator Deployment

| Name | Description | Value |
Expand Down
15 changes: 15 additions & 0 deletions charts/cryostat/templates/cryostat_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ spec:
failureThreshold: 18
resources:
{{- toYaml .Values.core.resources | nindent 12 }}
{{- if .Values.core.config.probeTemplates.configMapNames}}
volumeMounts:
- name: declarative-probe-templates
mountPath: /opt/cryostat.d/probes.d
readOnly: true
{{- end }}
- name: {{ printf "%s-%s" .Chart.Name "grafana" }}
securityContext:
{{- toYaml .Values.grafana.securityContext | nindent 12 }}
Expand Down Expand Up @@ -216,3 +222,12 @@ spec:
secret:
secretName: {{ .Release.Name }}-proxy-tls
{{- end }}
- name: declarative-probe-templates
projected:
defaultMode: {{ .values.core.config.declarative.fsMode }}
sources:
{{- range .values.core.config.probeTemplates.configMapNames}}
- configMap:
name: {{ . }}
optional: false
{{- end }}
56 changes: 55 additions & 1 deletion charts/cryostat/tests/cryostat_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ tests:
requests:
cpu: 500m
memory: 384Mi
- notExists:
path: spec.template.spec.contains[?(@.name=='cryostat')].volumeMounts

- it: should set log level
set:
Expand Down Expand Up @@ -513,4 +515,56 @@ tests:
- equal:
path: spec.template.spec.containers[?(@.name=='cryostat-jfr-datasource')].imagePullPolicy
value: "IfNotPresent"

- it: should add volume mounts for declarative probe templates
set:
core.config.probeTemplates.configMapNames: ['a', 'b']
asserts:
- equal:
path: spec.template.spec.containers[?(@.name=='cryostat')].volumeMounts
value:
- name: declarative-probe-templates
mountPath: /opt/cryostat.d/probes.d
readOnly: true
- equal:
path: spec.template.spec.volumes
value:
- name: alpha-config
configMap:
name: RELEASE-NAME-alpha-config
- name: declarative-probe-templates
projected:
defaultMode: 0440
sources:
- configMap:
name: a
optional: false
- configMap:
name: b
optional: false
- it: should add volume mounts for declarative probe templates with a specific default fs mode
set:
core.config.probeTemplates.configMapNames: ['a', 'b']
core.config.declarative.fsMode: 0644
asserts:
- equal:
path: spec.template.spec.containers[?(@.name=='cryostat')].volumeMounts
value:
- name: declarative-probe-templates
mountPath: /opt/cryostat.d/probes.d
readOnly: true
- equal:
path: spec.template.spec.volumes
value:
- name: alpha-config
configMap:
name: RELEASE-NAME-alpha-config
- name: declarative-probe-templates
projected:
defualtMode: 0644
sources:
- configMap:
name: a
optional: false
- configMap:
name: b
optional: false
26 changes: 26 additions & 0 deletions charts/cryostat/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,32 @@
}
}
}
},
"config": {
"type": "object",
"properties": {
"declarative": {
"type": "object",
"properties": {
"fsMode": {
"type": "number",
"description": "default filesystem mode (permissions) for declarative configuration volumes",
"default": 440
}
}
},
"probeTemplates": {
"type": "object",
"properties": {
"configMapNames": {
"type": "array",
"description": "List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are XML JMC Agent Probe Templates, to be mounted to the Cryostat container.",
"default": [],
"items": {}
}
}
}
}
}
}
},
Expand Down
7 changes: 7 additions & 0 deletions charts/cryostat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ core:
builtInPortNumbersDisabled: false
## @param core.discovery.kubernetes.portNumbers [array] List of port numbers that the Cryostat application should look for in order to consider a target as JMX connectable
portNumbers: []
config:
declarative:
## @param core.config.declarative.fsMode default filesystem mode (permissions) for declarative configuration volumes
fsMode: 0440
probeTemplates:
## @param core.config.probeTemplates.configMapNames [array] List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are XML JMC Agent Probe Templates, to be mounted to the Cryostat container.

Check failure on line 93 in charts/cryostat/values.yaml

View workflow job for this annotation

GitHub Actions / lint-chart

93:230 [trailing-spaces] trailing spaces

Check failure on line 93 in charts/cryostat/values.yaml

View workflow job for this annotation

GitHub Actions / lint-chart

93:230 [trailing-spaces] trailing spaces

Check failure on line 93 in charts/cryostat/values.yaml

View workflow job for this annotation

GitHub Actions / lint-chart

93:230 [trailing-spaces] trailing spaces
configMapNames: []

## @section Report Generator Deployment
## @extra reports Configuration for the Reports Generator deployment
Expand Down

0 comments on commit f46f407

Please sign in to comment.