diff --git a/charts/cryostat/README.md b/charts/cryostat/README.md index 6234921..4a05ffb 100644 --- a/charts/cryostat/README.md +++ b/charts/cryostat/README.md @@ -84,6 +84,7 @@ 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.eventTemplates.configMapNames` | List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are .jfc (XML) JFR Event Templates, to be mounted to the Cryostat container. | `[]` | ### Report Generator Deployment diff --git a/charts/cryostat/templates/cryostat_deployment.yaml b/charts/cryostat/templates/cryostat_deployment.yaml index cb0fbca..64c2ac3 100644 --- a/charts/cryostat/templates/cryostat_deployment.yaml +++ b/charts/cryostat/templates/cryostat_deployment.yaml @@ -141,6 +141,12 @@ spec: failureThreshold: 18 resources: {{- toYaml .Values.core.resources | nindent 12 }} + volumeMounts: + {{- range .Values.core.config.eventTemplates.configMapNames }} + - name: {{ . }} + mountPath: /opt/cryostat.d/templates.d/{{ . }} + readOnly: true + {{- end }} - name: {{ printf "%s-%s" .Chart.Name "grafana" }} securityContext: {{- toYaml .Values.grafana.securityContext | nindent 12 }} @@ -216,3 +222,8 @@ spec: secret: secretName: {{ .Release.Name }}-proxy-tls {{- end }} + {{- range .Values.core.config.eventTemplates.configMapNames}} + - name: {{ . }} + configMap: + name: {{ . }} + {{- end }} diff --git a/charts/cryostat/tests/cryostat_deployment_test.yaml b/charts/cryostat/tests/cryostat_deployment_test.yaml index 0548fc7..3352fb8 100644 --- a/charts/cryostat/tests/cryostat_deployment_test.yaml +++ b/charts/cryostat/tests/cryostat_deployment_test.yaml @@ -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: @@ -514,3 +516,28 @@ tests: path: spec.template.spec.containers[?(@.name=='cryostat-jfr-datasource')].imagePullPolicy value: "IfNotPresent" + - it: should add volume mounts for declarative event templates + set: + core.config.eventTemplates.configMapNames: ['a', 'b'] + asserts: + - equal: + path: spec.template.spec.containers[?(@.name=='cryostat')].volumeMounts + value: + - name: a + mountPath: /opt/cryostat.d/templates.d/a + readOnly: true + - name: b + mountPath: /opt/cryostat.d/templates.d/b + readOnly: true + - equal: + path: spec.template.spec.volumes + value: + - name: alpha-config + configMap: + name: RELEASE-NAME-alpha-config + - name: a + configMap: + name: a + - name: b + configMap: + name: b diff --git a/charts/cryostat/values.schema.json b/charts/cryostat/values.schema.json index 88c3baf..d37ee74 100644 --- a/charts/cryostat/values.schema.json +++ b/charts/cryostat/values.schema.json @@ -258,6 +258,22 @@ } } } + }, + "config": { + "type": "object", + "properties": { + "eventTemplates": { + "type": "object", + "properties": { + "configMapNames": { + "type": "array", + "description": "List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are .jfc (XML) JFR Event Templates, to be mounted to the Cryostat container.", + "default": [], + "items": {} + } + } + } + } } } }, diff --git a/charts/cryostat/values.yaml b/charts/cryostat/values.yaml index 79fdd4d..a45efec 100644 --- a/charts/cryostat/values.yaml +++ b/charts/cryostat/values.yaml @@ -85,6 +85,10 @@ 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: + eventTemplates: + ## @param core.config.eventTemplates.configMapNames [array] List of ConfigMap names. Each ConfigMap is expected to contain one or more files, which are .jfc (XML) JFR Event Templates, to be mounted to the Cryostat container. + configMapNames: [] ## @section Report Generator Deployment ## @extra reports Configuration for the Reports Generator deployment