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(templates): reimplement custom event templates from mounted volume #445

Merged
merged 6 commits into from
May 9, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented May 8, 2024

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Fixes: #431

Description of the change:

Adds startup hook processing to the S3-based template storage service. It will scan the templates storage directory (/opt/cryostat.d/templates.d by default, same as earlier versions) at start and attempt to upload any files it recursively finds there to S3 storage as an event template. This produces a copy within S3 storage which can be used the same as any other template that the user manually uploads through the UI/API.

Motivation for the change:

Part of 2.4 parity - this feature was enabled as a byproduct of old versions' direct filesystem storage of various resources, including custom event templates. The Operator used this to mount configmap files directly into the container's storage. With the move away from direct filesystem storage and instead using S3 for object storage this mechanism didn't work anymore, so this PR brings it back.

How to manually test:

  1. cd cryostat3; mkdir templates; cp mytemplate.jfc templates - to get a mytemplate.jfc, run the smoketest and download one of the existing event templates. Edit the resulting file and change the label, description, and provider attributes near the top, then move it to cryostat3/mytemplate.jfc.
  2. Check out and build this PR
  3. Run ./smoketest.bash -O
  4. Go to Events, select any connectable target, and ensure that your new mytemplate.jfc appears as a CUSTOM template in the table
  5. Try to re-upload the same file again and it should be rejected, or any other template file with the same label attribute
  6. Try to delete the custom template and it should be rejected in the latest version, deletions are accepted. They delete from S3 but leave the original copy on disk in place, so on next restart it would end up re-uploaded to S3.

In OpenShift,

  1. oc create configmap mytemplate --from-file=mytemplate.jfc
  2. Build and deploy Operator with CORE_IMG=quay.io/andrewazores/cryostat:3.0.0-mounted-templates-1
  3. Create a Cryostat CR with the following:
spec:
  eventTemplates:
    - configMapName: mytemplate
      filename: mytemplate.jfc
  1. Wait for redeployment, then repeat steps 4-6 above

Screenshot_2024-05-08_17-45-00

@andrewazores andrewazores added feat New feature or request safe-to-test labels May 8, 2024
@github-actions github-actions bot added the needs-triage Needs thorough attention from code reviewers label May 8, 2024
@andrewazores andrewazores removed the needs-triage Needs thorough attention from code reviewers label May 8, 2024
@andrewazores andrewazores marked this pull request as ready for review May 8, 2024 21:36
@andrewazores
Copy link
Member Author

/build_test

Copy link

github-actions bot commented May 8, 2024

Workflow started at 5/8/2024, 5:46:20 PM. View Actions Run.

Copy link

github-actions bot commented May 8, 2024

CI build and push: At least one test failed ❌ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/9008959091

@andrewazores
Copy link
Member Author

/build_test

Copy link

github-actions bot commented May 8, 2024

Workflow started at 5/8/2024, 5:53:09 PM. View Actions Run.

Copy link

github-actions bot commented May 8, 2024

No GraphQL schema changes detected.

Copy link

github-actions bot commented May 8, 2024

No OpenAPI schema changes detected.

Copy link

github-actions bot commented May 8, 2024

CI build and push: All tests pass ✅ (JDK17)
https://github.com/cryostatio/cryostat3/actions/runs/9009018618

@andrewazores andrewazores force-pushed the mounted-templates branch 2 times, most recently from 6b486ba to 4223b86 Compare May 9, 2024 15:53
Copy link
Contributor

@aali309 aali309 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@andrewazores andrewazores merged commit 319437a into cryostatio:main May 9, 2024
13 checks passed
@andrewazores andrewazores deleted the mounted-templates branch May 9, 2024 21:03
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.

[Request] Read-only Event Templates from mounted volume
3 participants