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

HPA: Remove controller.autoscaling.apiVersion, use capabilites instead. #392

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

Gacko
Copy link
Member

@Gacko Gacko commented Jan 18, 2023

Tests on workload clusters (not always required)

For changes in the chart, chart templates, and ingress controller container images, I executed the following tests
to verify them working in live enviromnents:

Test / Provider AWS Azure KVM
Upgrade from previous version
Existing Ingress resources are reconciled correctly
Fresh install
Fresh Ingress resources are reconciled correctly

Testing was done using hello-world-app.

Hint for KVM:

kubectl port-forward -n kube-system svc/nginx-ingress-controller-app 8080:80
ingress_domain=host.configured.in.ingress; curl --connect-to "$ingress_domain:80:127.0.0.1:8080" "http://$ingress_domain" -v

@Gacko Gacko requested a review from a team as a code owner January 18, 2023 13:22
@Gacko Gacko changed the title HPA: Remove controller.autoscaling.apiVersion, use capabilites inst… HPA: Remove controller.autoscaling.apiVersion, use capabilites instead. Jan 18, 2023
Copy link
Contributor

@mcharriere mcharriere left a comment

Choose a reason for hiding this comment

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

amazing


apiVersion: {{ .Values.controller.autoscaling.apiVersion }}
{{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) (not .Values.controller.keda.enabled) -}}
apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (semverCompare ">=1.23.0-0" .Capabilities.KubeVersion.Version) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could still check for .Values.controller.autoscaling.apiVersion first. And instead of checking .Capabilities.KubeVersion.Version maybe use .Capabilities.APIVersions.Has "autoscaling/v2". See for example in upstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this makes sense because the rest of the template is already made up for autoscaling/v2beta2 or higher and not working with autoscaling/v2beta1 or even autoscaling/v1. So even if you could override it, it would not work due to the .spec.

Copy link
Member Author

Choose a reason for hiding this comment

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

Regarding Capabilities.APIVersions.Has: Yeah, I know. But I just sticked to most of the other manifests, they are still using the hard coded comparison.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I was thinking about the alignment with upstream. There the setting for .Values.controller.autoscaling.apiVersion is documented and customers might be confused when we differ.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding Capabilities.APIVersions.Has: You want to know the apiVersion, so you should just ask for the apiVersion :) Since upstream also uses this, they should be fine when we request a PR. But I am not to opinionated about this..

Copy link
Member Author

Choose a reason for hiding this comment

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

I will also drop the support for this field in my PR to upstream, I guess. As said, I don't think there is a real value addition for now. Also never saw this way of determining the API version before. 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

Totally agree, should be dropped from upstream, so ok all good here for me. Regarding apiVersion check: Kubernetes installations with same version might still differ in provided api-resources and versions because of the feature gates. I guess that's why Helm provides this check and I think it should be best practice. But I don't want to block if you hesitate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh! Yeah, you're right! Gonna use the Has. Thank you so much! :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you very much for working on this PR! :)

@Gacko
Copy link
Member Author

Gacko commented Jan 18, 2023

I tested this on AWS 18.1.1 and AWS 17.4.4. So both Kubernetes version, 1.22 and 1.23.

@Gacko Gacko enabled auto-merge (squash) January 18, 2023 16:08
@Gacko
Copy link
Member Author

Gacko commented Jan 18, 2023

Gonna release app version v2.22.1 after this got merged.

@Gacko Gacko merged commit 5ffc2af into main Jan 18, 2023
@Gacko Gacko deleted the fix/remove-hpa-api-version branch January 18, 2023 16:12
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.

3 participants