-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[stable/kong] Options to install Prometheus plugin with ServiceMonitor #14346
[stable/kong] Options to install Prometheus plugin with ServiceMonitor #14346
Conversation
Hi @decayofmind. Thanks for your PR. I'm waiting for a helm member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @hbagdi |
/assign @shashiranjan84 |
@hbagdi any luck this will be useful? |
Signed-off-by: Roman Komkov <[email protected]>
@decayofmind Sorry for the delayed responses on this. Have been very busy with multiple things flying around. I'll try to get to this soon. |
We will keep this PR around for now. Once that get's in, this PR can be simplified quite a bit:
|
Since #15079 is merged in. We can work on this PR. Also, it probably might be more accurate to provide |
@hbagdi But, if you think it's better, I have no objections to change the variable name as you said :) |
For installation of CRDs I've used a built-in Helm feature/hook (https://github.com/helm/helm/blob/master/docs/charts_hooks.md#the-available-hooks) to install CRDs before any other template. If something else is over-complicated, let me now, I'll remove it from PR.
A ServiceMonitor will be installed only if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase this PR on latest master.
Signed-off-by: Roman Komkov <[email protected]>
@hbagdi I've done some changes you requested, could you please take a look at my PR one more time. |
@@ -0,0 +1,13 @@ | |||
{{- if and .Values.ingressController.enabled .Values.ingressController.metrics.enabled }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in a review before, let's remove this.
The user can create an additional KongPlugin resource if the need be after the Kong Ingress Controller is installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do note that Kong will expose some basic observability stats even if this plugin is not enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let it be as you're suggesting, I've got the point :)
@@ -251,5 +251,5 @@ spec: | |||
volumes: | |||
- name: custom-nginx-template-volume | |||
configMap: | |||
name: {{ .Release.Name }}-kong-default-custom-server-blocks | |||
name: {{ template "kong.fullname" . }}-default-custom-server-blocks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may not be the matter of this PR, but in general, all objects in a chart should be addressing {{ template "<chartname.fullname>" }}
in its names.
It allows a user to override objects naming for the whole installation, by taking into account .Values.nameOverride
and .Values.fullNameOverride
(not yet in Kong chart) variables passed to the chart.
@@ -8,6 +8,9 @@ metadata: | |||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | |||
release: "{{ .Release.Name }}" | |||
heritage: "{{ .Release.Service }}" | |||
annotations: | |||
"helm.sh/hook": crd-install | |||
"helm.sh/hook-delete-policy": "before-hook-creation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these changes can go away once KongPlugin resource is removed.
Signed-off-by: Roman Komkov <[email protected]>
Signed-off-by: Roman Komkov <[email protected]>
@@ -8,6 +8,9 @@ metadata: | |||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | |||
release: "{{ .Release.Name }}" | |||
heritage: "{{ .Release.Service }}" | |||
annotations: | |||
"helm.sh/hook": crd-install | |||
"helm.sh/hook-delete-policy": "before-hook-creation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes to CRDs can be removed since the Prometheus plugin is not being automatically created.
Another problem that I see here:
If multiple Kong Ingress Controllers are being installed one after the other, then this will incorrectly delete the CRD first, and then re-install the CRD. This will lead to deletion of all the custom resources that were present in the cluster before the installation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@decayofmind Could you address this comment?
Thanks!
@decayofmind Left one comment and other than that, this PR looks good. |
/ok-to-test |
Please rebase on master. This is real close and almost ready to merge. |
@decayofmind Please address the one outstanding comment and fix the lint failure. Once that's done, we are good to merge. |
Signed-off-by: Roman Komkov <[email protected]>
Signed-off-by: Roman Komkov <[email protected]>
@hbagdi It seems like everything is finally fixed |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: decayofmind, hbagdi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@decayofmind Thank you for your contribution! |
helm#14346) * Options to install Prometheus plugin with ServiceMonitor Signed-off-by: Roman Komkov <[email protected]> * Changes after code review Signed-off-by: Roman Komkov <[email protected]> * Removed ingressController and plugin dependency. Signed-off-by: Roman Komkov <[email protected]> * Version bumped Signed-off-by: Roman Komkov <[email protected]> * Remove helm-hook annotations Signed-off-by: Roman Komkov <[email protected]> * Remove trailing whitespace Signed-off-by: Roman Komkov <[email protected]>
helm#14346) * Options to install Prometheus plugin with ServiceMonitor Signed-off-by: Roman Komkov <[email protected]> * Changes after code review Signed-off-by: Roman Komkov <[email protected]> * Removed ingressController and plugin dependency. Signed-off-by: Roman Komkov <[email protected]> * Version bumped Signed-off-by: Roman Komkov <[email protected]> * Remove helm-hook annotations Signed-off-by: Roman Komkov <[email protected]> * Remove trailing whitespace Signed-off-by: Roman Komkov <[email protected]>
What this PR does / why we need it:
This PR provides an option to install kong-prometheus plugin as KongPlugin custom resource.
Prometheus-operator ServiceMonitor could be installed as well.
As a side-effect of this PR, Kong CRDs are not being deleted with the release anymore. It prevents from losing Kong declarative configuration while uninstalling Kong.
The proposed change was inspired by Prometheus-operator and Velero charts.
Checklist
[stable/chart]
)