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

Chart: Add controller.metrics.prometheusRule.annotations. #11849

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

adberger
Copy link
Contributor

What this PR does / why we need it:

I need the following annotation when ingress-nginx is installed before prometheus-stack:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true

Ref: https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/#skip-dry-run-for-new-custom-resources-types

Same as here but for PrometheusRule instead of ServiceMonitor: #9677

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • CVE Report (Scanner found CVE and adding report)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

How Has This Been Tested?

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added the area/helm Issues or PRs related to helm charts label Aug 22, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 22, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @adberger!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 22, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @adberger. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

Copy link

netlify bot commented Aug 22, 2024

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit 1df77b8
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/66ccfc5474718e000880a725

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 22, 2024
@longwuyuan
Copy link
Contributor

What, if any, is the requirement for maintenance & support on this new ArgoCD annotation (and also the other ArgoCD annotation you mentioned).

@longwuyuan
Copy link
Contributor

Also, any improved way to show this text from here in the README for the chart or the values file

I need the following annotation when ingress-nginx is installed before prometheus-stack:

Folks may need to hunt down this PR to understand what the key is for

@adberger
Copy link
Contributor Author

What, if any, is the requirement for maintenance & support on this new ArgoCD annotation (and also the other ArgoCD annotation you mentioned).

What do you mean by: "requirement for maintenance & support"?

The changes I've contributed can't just be used for ArgoCD but for anyone who wishes to annotate the PrometheusRule in any way.
If you wish I can add ArgoCD as an example :)

@longwuyuan
Copy link
Contributor

This and the other key seems to only facilitate ArgoCD integration, while not appearing to be explicitly so, just looking at the code changes. So wondering what non ArgoCD-users get out of both of these changes.

I love ArgoCD to death so please do not misunderstand. These comments and questions are to get explicit info here, in the context that the project is trying to remove less used features (sort of). For example it would be so lovely to integrate with external-dns but that kind of thinking has resulting in some bad status.

@longwuyuan
Copy link
Contributor

To state precisely, the non-ArgoCD-userbase has not posted multiple issues or PRs related to annotation the serviceMonitor or the promtheusRule.

While I myself would love to use this key, the point I am trying to make here is your justification is not rooted in a Ingress-API spec or similar core & pervasive need.

You will install this controller before prometheus-stack so you are proposing change to the this controller chart to keep your ArgoCD happy. It does not look like that from the code but it also does nothing for the someone who installs this controller AFTER prometheus.

I am not contending and actually @Gacko reviews chart related PRs. I am not even a developer. But here is an example of how I do it for local environments

echo "deploying prometheus.."
helm upgrade --install prometheusgrafana kube-prometheus-stack \
    --repo https://prometheus-community.github.io/helm-charts \
    --namespace observability \
    --create-namespace \
    --set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false \
    --set prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false

echo "creating ingress-nginx ns"
kubectl create ns ingress-nginx

echo "creating default-ssl-certificate for ingress-controller"
kubectl -n ingress-nginx create secret tls wildcard.dev.enjoydevops.com \
    --cert ~me/mystuff/myletsencrypt/dev.enjoydevops.com/fullchain1.pem \
    --key ~me/mystuff/myletsencrypt/dev.enjoydevops.com/privkey1.pem

echo "deploying ingress-nginx controller.."
helm upgrade --install ingress-nginx ingress-nginx \
    --repo https://kubernetes.github.io/ingress-nginx \
    --namespace ingress-nginx \
    --set controller.metrics.enabled=true \
    --set controller.metrics.serviceMonitor.enabled=true \
    --set controller.metrics.serviceMonitor.additionalLabels.release="prometheusgrafana" \
    --set controller.service.externalTrafficPolicy=Local \
    --set controller.extraArgs.default-ssl-certificate=ingress-nginx/wildcard.dev.enjoydevops.com

echo "creating ingress for grafana.."
ingressnginxPodName=`kubectl -n ingress-nginx get po | grep -i ingress-nginx-controller | cut -f1 -d" "`
kubectl -n ingress-nginx wait --for=condition=Ready pod/$ingressnginxPodName --timeout 120s
kubectl -n observability create ingress grafana \
    --class nginx \
    --rule grafana.dev.enjoydevops.com/"*"=prometheusgrafana:80,tls

@adberger
Copy link
Contributor Author

First of all, thank you for taking your time to review and describing your concerns.

Argo CD has multiple scenarios where annotations come in handy and heavily relies on them: https://argo-cd.readthedocs.io/en/stable/user-guide/annotations-and-labels/#annotations

But not just Argo CD, Flux (the other GitOps solution for Kubernetes) also uses them, one example would be: https://fluxcd.io/flux/components/kustomize/kustomizations/#prune

There are probably many other use cases, that's what annotations were created for.

I don't see it as my responsibility to look for or give further examples on why the option to set annotations on any resource could be helpful.
It's just happen to be Argo CD for my use case.

The proposal of yours is as you correctly stated for local environments.

@longwuyuan
Copy link
Contributor

@adberger thank you for the updates and comments. Thank you for looking at improving the chart.

@Gacko its just my opinion that adding this kind of integration support, that too for local environments, is not the direction discussed. My opinion is to consider NOT to merge this, even though it seems to add a functionality. Folks can simply deploy prometheus before the controller for the desired goal here.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority labels Aug 24, 2024
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

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

/triage accepted
/kind feature
/priority backlog
/hold

Basically looks good to me, but it's missing tests and documentation. Also we could add them for the service monitor annotations. I'll provide them later.

@Gacko Gacko changed the title Add controller.metrics.prometheusRule.annotations in Helm chart Chart: Add controller.metrics.prometheusRule.annotations. Aug 24, 2024
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 24, 2024
@Gacko Gacko force-pushed the main branch 4 times, most recently from 5065ac1 to e84a8b6 Compare August 26, 2024 19:43
@Gacko
Copy link
Member

Gacko commented Aug 26, 2024

I prepared a PR to add tests for the existing ServiceMonitor and PrometheusRule: #11883

Once this got merged, we can rebase and merge your PR.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 26, 2024
@Gacko
Copy link
Member

Gacko commented Aug 26, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 26, 2024
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adberger, Gacko

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Aug 26, 2024
@Gacko
Copy link
Member

Gacko commented Aug 26, 2024

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 26, 2024
@k8s-ci-robot k8s-ci-robot merged commit 3cde777 into kubernetes:main Aug 26, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/helm Issues or PRs related to helm charts cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants