-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: (helm/v1alpha1): install the prometheus-operator CRDs before installing a chart which configures a ServiceMonitor #4383
🐛 fix: (helm/v1alpha1): install the prometheus-operator CRDs before installing a chart which configures a ServiceMonitor #4383
Conversation
Hi @monteiro-renato. Thanks for your PR. I'm waiting for a kubernetes-sigs 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-sigs/prow repository. |
8f901f0
to
fd809e1
Compare
aa7a43f
to
42940d4
Compare
aba0330
to
e545894
Compare
|
||
- name: Check Presence of ServiceMonitor | ||
run: | | ||
kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor |
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.
Fails with exit 1 code if the resource does not exist.
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 we have a bug.
For we are able to check it out we need enable prometheus in the HelmChart value.
By default it is
prometheus:
enable: false
we need to use shell to change it in the GitHUb action to set true
Something like example: https://github.com/kubernetes-sigs/kubebuilder/blob/master/.github/workflows/test-e2e-samples.yml#L43-L44
Then, the error will be faced
Not sure if the error is with chart manifests or in the action:
pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/github/test_chart.go
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'm passing the value to the helm install command in line 78 :)
Check the --set flag of the helm install
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.
nit: how about adding an explicit timeout flag for kubectl wait
:
--timeout=60s
Also, --for=''
could be another choice to consider?
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.
This is a bit of an hack since the kubectl wait is supposed to be used with resources that have a Status field.
The command fails right away if the resource doesn't exist so the --timeout
flag isn't really needed here (I guess --timeout=0
would be ok).
If kubectl get
on a non existent resource would somehow return a non zero exit code that's what I would have used but I don't think that's possible. And between processing the output of kubectl get
and simply using the hack above, I think the hack above is easier to understand.
The --for=''
could be an option yea; my thought was that it could lead to confusion as it might be less clear.
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.
Looks good to me!
|
||
- name: Check Presence of ServiceMonitor | ||
run: | | ||
kubectl wait --namespace project-v4-with-plugins-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/project-v4-with-plugins-controller-manager-metrics-monitor |
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.
nit: how about adding an explicit timeout flag for kubectl wait
:
--timeout=60s
Also, --for=''
could be another choice to consider?
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.
We also need to change the github action taht we are scaffolding for the projects, see; pkg/plugins/optional/helm/v1alpha/scaffolds/internal/templates/github/test_chart.go
e545894
to
ed95269
Compare
@@ -118,9 +124,13 @@ jobs: | |||
|
|||
- name: Install Helm chart for project | |||
run: | | |||
helm install my-release ./dist/chart --create-namespace --namespace {{ .ProjectName }}-system | |||
helm install my-release ./dist/chart --create-namespace --namespace {{ .ProjectName }}-system --set prometheus.enable=true |
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.
See, we cannot add this one here.
Because the Prometheus is disabled by default
If the person enables Prometheus in the chart and commits it.
Then, it will be enabled already, or if the author prefers, then it can be done.
Is that make sense?
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.
Yep updated it now 👍
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.
Just I nit all the rest shows great 🥇
Terrific work
See: https://github.com/kubernetes-sigs/kubebuilder/pull/4383/files#r1855209081
ed95269
to
35903fd
Compare
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | ||
helm repo update | ||
helm install prometheus-crds prometheus-community/prometheus-operator-crds | ||
|
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.
@monteiro-renato
this one needs to be commented on under # TODO: Uncomment if Prometheus is enabled
We should only install it if the chart enabled the option
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 thought it would be a bit easier to just install the CRDs all the time as they shouldn't add too much time to the action run.
I've shifted them to be under the TODO now 👍.
…nstalling a chart which configures a ServiceMonitor
35903fd
to
256de94
Compare
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.
/lgtm
/approved
/ok-to-test
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, Kavinjsir, monteiro-renato 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 |
Fixes: #4378