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

Feature flagging for exporting of Kanister prometheus metrics #2235

Merged
merged 3 commits into from
Aug 4, 2023

Conversation

mellon-collie
Copy link
Contributor

@mellon-collie mellon-collie commented Aug 1, 2023

Change Overview

Adding a new helm flag and environment variable for feature toggling of the new Kanister prometheus metrics integration.

  1. Added new boolean helm flag called controller.metrics.enabled in the Values.yaml
  2. Added new environment variable called KANISTER_METRICS_ENABLED in deployment.yaml to capture the metrics.enabled flag in our codebase.

End goal: In order to switch on prometheus metrics, the end user can install the local helm chart with the following command:
helm install kanister ./helm/kanister-operator \ --create-namespace \ --namespace kanister \ --set image.repository=<your_registry>/<your_controller_image> \ --set image.tag=<your_image_tag> --controller.metrics.enabled=true

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • fixes N/A

Test Plan

After the above changes were made, the following tests were performed:

  1. helm uninstall kanister -n kanister to uninstall existing kanister deployment
  2. helm install kanister ./helm/kanister-operator --create-namespace --namespace kanister to run the local helm chart for kanister
  3. k get pods -n kanister to identify the new kanister operator pod that's running
  4. kubectl exec -n kanister -it <pod-name> -- /bin/bash to exec into the pod.
  5. echo $KANISTER_METRICS_ENABLED - the output should be a false.
  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

Thanks for submitting this pull request 🎉. The team will review it soon and get back to you.

If you haven't already, please take a moment to review our project contributing guideline and Code of Conduct document.

@infraq infraq added this to In Progress in Kanister Aug 1, 2023
@@ -53,3 +53,5 @@ resources:
# requests:
# cpu: 100m
# memory: 128Mi
metrics:
Copy link
Contributor

@pavannd1 pavannd1 Aug 2, 2023

Choose a reason for hiding this comment

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

Should we add this as a sub-value under controller above? Open to suggestions @viveksinghggits
Additionally, add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Makes sense. I've made it as a sub-value under controller. I've added a comment.
One more point - I'm maintaining two levels of hierarchy for the helm flags - like metrics.enabled instead of metrics_enabled because we may want to add more flags under metrics hierarchy in the future if we consider adding labels for a new metric partially.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's the right way to do it 👍🏼

Copy link
Contributor

Choose a reason for hiding this comment

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

do we just want to set the env var in the pod as part of this PR? Do we not want to use it anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@viveksinghggits Yes. The feature flag will start getting used in the next set of PRs for the metrics we export.

Kanister automation moved this from In Progress to Reviewer approved Aug 4, 2023
@pavannd1 pavannd1 added the kueue label Aug 4, 2023
@mergify mergify bot merged commit 93e668f into master Aug 4, 2023
14 checks passed
Kanister automation moved this from Reviewer approved to Done Aug 4, 2023
@mergify mergify bot deleted the kanister-prometheus-helm-flag branch August 4, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants