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(eventtemplates): declarative configuration of Event Template ConfigMaps #215

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Nov 27, 2024

Fixes #214
Related to #225
Depends on cryostatio/cryostat#726

To test:

  1. Create a configmap containing a JFR event template: oc create configmap mytemplate --from-file=mytemplate.jfc
  2. helm install --set core.image.repository=quay.io/andrewazores/cryostat --set core.image.tag=event-templates-declarative-1 cryostat --set core.config.eventTemplates.configMapNames='{mytemplate}' ./charts/cryostat
  3. Follow the post-install port forwarding steps, then open the Cryostat Web UI. Define a localhost:0 custom target. Go to Events, then Event Templates, and ensure that the mytemplate custom Event Template is listed.

Comment on lines 225 to 229
{{- range .Values.core.config.eventTemplates.configMapNames}}
- name: {{ . }}
configMap:
name: {{ . }}
{{- end }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on using a projected volume here to combine all config-map contents into a single volume? One benefit is that we can define a single volumeMount on /opt/cryostat.d/templates.d, thus reducing the manifest/object def size.

Reference: https://kubernetes.io/docs/concepts/storage/projected-volumes/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I could do this. It would be a single mount but the definition for the projected volume itself would still look about the same, so I'm not really sure I understand what benefit it brings... ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I suppose reducing the number of volume mount definitions can help reduce the manifest size (thus, object size in etcd). And grouping them under a single volume seems to make it easier to recognize their purpose when reading the manifest (my opinion).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can do the same for #219.

Comment on lines 88 to 91
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: []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we can allow specifying the key(s) within the configmaps? Something similar to Cryostat CR.

I guess one case could be that a user uses a Configmap to put all Cryostat configurations (i.e. Event template and Automated Rules). I might be overthinking :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, but it seems like it'd be pretty messy trying to put all of the configurations of different types into one ConfigMap and use filenames to differentiate them. It would also much more quickly run into the ConfigMap size limit that way. I think using one or more ConfigMaps for each type of configuration file is a good medium option, where if there are many custom Event Templates that add up to too large a filesize then they can be split across multiple ConfigMaps, for example, but otherwise they can just be combined together as separate files and mounted that way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that makes sense! I think the current way is good then^^

@@ -216,3 +222,8 @@ spec:
secret:
secretName: {{ .Release.Name }}-proxy-tls
{{- end }}
{{- range .Values.core.config.eventTemplates.configMapNames}}
- name: {{ . }}
configMap:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should we enforce that these configmaps are available at the time of installation (i.e. optional: false)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, I think optional: false is the default (which makes sense), but I can mark them as explicitly non-optional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, sounds good!

@@ -216,3 +222,11 @@ spec:
secret:
secretName: {{ .Release.Name }}-proxy-tls
{{- end }}
- name: declarative-event-templates
Copy link
Member

@tthvo tthvo Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set the defaultMode to read-only (i.e. 0440)?

I think we should be okayy to set 0440 without running into #225 (comment), since Cryostat has default GID 0 in the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Declarative Event Templates
2 participants