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: Deploy PodDisruptionBudget with KEDA. #11032

Conversation

StuxxNet
Copy link
Contributor

@StuxxNet StuxxNet commented Feb 27, 2024

What this PR does / why we need it:

Currently we deploy the PDB only if Keda is enabled. This PR tries to address this adding a new entry to the "if" statement to make it consider Keda also.

Types of changes

  • New feature (non-breaking change which adds functionality)

Which issue/s this PR fixes

fixes #10083

How Has This Been Tested?

The testing was done by creating a fresh deployment of the Ingress Nginx in a brand new Kind cluster running Kubernetes 1.29. Below you can see that the corresponding PDB object was created when the values for Keda were passed to the chart:

➜  ingress-nginx git:(feat/ISSUE-10083-add-pdb-when-keda-in-place) ✗ kubectl get pods 
NAME                                        READY   STATUS    RESTARTS   AGE
ingress-nginx-controller-76bf7c9746-h4kmk   1/1     Running   0          12s
ingress-nginx-controller-76bf7c9746-qv82w   1/1     Running   0          15m

➜  ingress-nginx git:(feat/ISSUE-10083-add-pdb-when-keda-in-place) ✗ kubectl get scaledobject
NAME                       SCALETARGETKIND      SCALETARGETNAME            MIN   MAX   TRIGGERS     AUTHENTICATION   READY   ACTIVE   FALLBACK   PAUSED    AGE
ingress-nginx-controller   apps/v1.Deployment   ingress-nginx-controller   2     11    prometheus                    False   False    False      Unknown   15m

➜  ingress-nginx git:(feat/ISSUE-10083-add-pdb-when-keda-in-place) ✗ kubectl get pdb 
NAME                       MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
ingress-nginx-controller   1               N/A               1                     41s

➜  ingress-nginx git:(feat/ISSUE-10083-add-pdb-when-keda-in-place) ✗ kubectl drain kind-control-plane --ignore-daemonsets 
node/kind-control-plane already cordoned
Warning: ignoring DaemonSet-managed Pods: kube-system/kindnet-bbq8w, kube-system/kube-proxy-f9xh7
evicting pod local-path-storage/local-path-provisioner-7577fdbbfb-trlrz
evicting pod default/ingress-nginx-controller-76bf7c9746-j64mh
evicting pod keda/keda-operator-5c77476f9b-jkrdh
evicting pod default/ingress-nginx-controller-76bf7c9746-p6wcn
evicting pod keda/keda-admission-webhooks-6987d68f4c-m4mr2
evicting pod kube-system/coredns-76f75df574-f498s
evicting pod kube-system/coredns-76f75df574-zrx2q
evicting pod keda/keda-operator-metrics-apiserver-7c4675769c-96bht
error when evicting pods/"ingress-nginx-controller-76bf7c9746-p6wcn" -n "default" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
pod/keda-operator-5c77476f9b-jkrdh evicted
pod/keda-admission-webhooks-6987d68f4c-m4mr2 evicted
evicting pod default/ingress-nginx-controller-76bf7c9746-p6wcn
error when evicting pods/"ingress-nginx-controller-76bf7c9746-p6wcn" -n "default" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
pod/coredns-76f75df574-zrx2q evicted
pod/coredns-76f75df574-f498s evicted

Checklist:

  • I've read the CONTRIBUTION guide
  • I have added unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

Copy link

linux-foundation-easycla bot commented Feb 27, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 27, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @StuxxNet!

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 area/helm Issues or PRs related to helm charts 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 Feb 27, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @StuxxNet. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 27, 2024
Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit 17ee81c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/65ef54ae39f1a1000880a1d6

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 27, 2024
@rikatz
Copy link
Contributor

rikatz commented Feb 27, 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 Feb 27, 2024
@StuxxNet StuxxNet force-pushed the feat/ISSUE-10083-add-pdb-when-keda-in-place branch from e12c9d3 to 5f194a7 Compare February 27, 2024 18:38
@Gacko
Copy link
Member

Gacko commented Feb 27, 2024

/assign

@Gacko
Copy link
Member

Gacko commented Feb 27, 2024

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 27, 2024
@Gacko
Copy link
Member

Gacko commented Feb 27, 2024

/retitle Chart: Deploy PodDisruptionBudget with KEDA.

@k8s-ci-robot k8s-ci-robot changed the title Deploy PodDisruptionBudget if Keda is enabled Chart: Deploy PodDisruptionBudget with KEDA. Feb 27, 2024
value: RELEASE-NAME-ingress-nginx-controller
- equal:
path: spec.minAvailable
value: 1
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
value: 1
value: 1

Copy link
Member

Choose a reason for hiding this comment

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

This suggestions adds the requite line feed at the end of the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also this was addressed in the last commit where the file was renamed :)

value: RELEASE-NAME-ingress-nginx-controller
- equal:
path: spec.minAvailable
value: 1
Copy link
Member

Choose a reason for hiding this comment

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

This suggestions adds the requite line feed at the end of the file.

Copy link
Member

Choose a reason for hiding this comment

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

Could you please rename the file to charts/ingress-nginx/tests/controller-poddisruptionbudget_test.yaml. We used to have them named like the resources they are testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey! May you please check if the naming is correct now? :D

@@ -0,0 +1,22 @@
suite: Controller > Keda > PDB
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
suite: Controller > Keda > PDB
suite: Controller > PodDisruptionBudget

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also addressed!

StuxxNet and others added 2 commits March 11, 2024 19:59
…yaml

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
….yaml

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 11, 2024
@StuxxNet
Copy link
Contributor Author

@Gacko Hey! Thanks for the review. Indeed it looks way much simple now than it was before. Thanks for it! I just accepted the proposed changes :D

@Gacko
Copy link
Member

Gacko commented Mar 11, 2024

/unhold
/approve
/cherry-pick release-1.10

Thanks a lot for your contribution and the nice collaboration! :)

@k8s-infra-cherrypick-robot

@Gacko: once the present PR merges, I will cherry-pick it on top of release-1.10 in a new PR and assign it to you.

In response to this:

/unhold
/approve
/cherry-pick release-1.10

Thanks a lot for your contribution and the nice collaboration! :)

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.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Mar 11, 2024
@Gacko
Copy link
Member

Gacko commented Mar 11, 2024

/kind bug
/priority backlog
/triage accepted

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 11, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

Comment for clarification

{{- if .Values.controller.autoscaling.enabled }}
{{- $replicas = .Values.controller.autoscaling.minReplicas }}
{{- else if .Values.controller.keda.enabled }}
{{- $replicas = .Values.controller.keda.minReplicas }}
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need to add some docs for this?

What if the user enable both by mistake?
Can we try to use the OR instead or that does not work?

/hold for clarification

Copy link
Member

Choose a reason for hiding this comment

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

Hm, yeah, I get your point. HPA and KEDA being mutually exclusive always was a problem and looking at the particular resource templates, we are not even preventing that in there.

So right now what you see above is pretty close the best we can get without making the conditions too complex and unreadable.

I created an issue for improving and aligning that everywhere. But for now, I'd just go on and merge this PR. Aligning all these conditions is out of scope here.

Copy link
Member

Choose a reason for hiding this comment

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

That's the issue I created: #10814

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2024
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

Sgtm
/approve
/lgtm
/unhold

Thanks for this change!

Thanks @Gacko for the clarification

@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 Mar 11, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, Gacko, StuxxNet

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 merged commit b5c4476 into kubernetes:main Mar 11, 2024
17 checks passed
@k8s-infra-cherrypick-robot

@Gacko: new pull request created: #11105

In response to this:

/unhold
/approve
/cherry-pick release-1.10

Thanks a lot for your contribution and the nice collaboration! :)

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.

@StuxxNet StuxxNet deleted the feat/ISSUE-10083-add-pdb-when-keda-in-place branch March 11, 2024 22:11
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/bug Categorizes issue or PR as related to a bug. 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/M Denotes a PR that changes 30-99 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.

Helm Chart should support PDB with Keda
6 participants