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

fix issue with service monitor #335

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

edwintye
Copy link
Contributor

Fixes #324 where helm install with flag --set prometheus.enabled=true fails unless the system namespace exists. Set this to the same namespace as all the other resources installed via the chart. Additionally, restrict the namespace selector to be within the same namespace as well so there is chance of accidental cross namespace lookup and drag in another service by chance.

Furthermore, fixes the selector label on the service itself as the current select

selector:
  control-plane: "controller-manager"

points to nothing. This can be easily verified without the need of a ServiceMonitor by port forwarding to the service and perform a simply curl against the endpoint. The change is to use the selectorLabels that is used under .spec.template.metadata.labels in the Deployment.

@CLAassistant
Copy link

CLAassistant commented Nov 10, 2023

CLA assistant check
All committers have signed the CLA.

@yorugac yorugac self-requested a review November 15, 2023 07:43
Copy link
Collaborator

@yorugac yorugac left a comment

Choose a reason for hiding this comment

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

Hi @edwintye, thank you for working on this! Namespace fix is great and working 👍 There are a couple of change requests though: please see the comments.

@@ -17,5 +17,5 @@ spec:
port: 8443
targetPort: https
selector:
control-plane: "controller-manager"
{{- include "k6-operator.selectorLabels" . | nindent 4 }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to fix the Chart so that control-plane: "controller-manager" would work. Rationale: it'd be preferable to keep the labeling consistent with kustomize base, i.e. here:
https://github.com/grafana/k6-operator/blob/main/config/manager/manager.yaml

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, whatever changes you guys want. I have moved the label inside the deployment template instead.

@edwintye edwintye force-pushed the fix-issue-324-sm-namespace branch from 6e8ee6e to 5c74b21 Compare November 24, 2023 14:06
Copy link
Collaborator

@yorugac yorugac left a comment

Choose a reason for hiding this comment

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

Thank you for the updates @edwintye. LGTM 👍

@yorugac yorugac merged commit 4024780 into grafana:main Nov 27, 2023
6 checks passed
@datsabk
Copy link

datsabk commented Nov 29, 2023

@yorugac - What is the target date to release this change in the chart?

@yorugac
Copy link
Collaborator

yorugac commented Nov 29, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helm chart: ServiceMonitor namespace is not templated (system)
5 participants