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

Bump Horizontal Pod Autoscaler apiBase version #6906

Merged
merged 4 commits into from
Jan 11, 2023
Merged

Conversation

aleksfront
Copy link
Contributor

  • Switched to v2 version (introduced in k8s v1.23)
  • Added fallbackApiBases:
fallbackApiBases: [
  "/apis/autoscaling/v2beta2/horizontalpodautoscalers",
  "/apis/autoscaling/v2beta1/horizontalpodautoscalers",
  "/apis/autoscaling/v1/horizontalpodautoscalers",
],
  • Update some types

Now HPAs get loaded using version v2 for newer k8s. And new fields such as behavior and metrics presented:

newer.hpa.apibase.mov

autoscaling:v2

HPAs get loaded using some of the fallback api versions if running older kubernetes:

kube.1.20.hpa.api.version.mov

Fixes #6168
Fixes #6817
Fixes #6827

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
@aleksfront aleksfront added this to the 6.4.0 milestone Jan 11, 2023
@aleksfront aleksfront requested a review from a team as a code owner January 11, 2023 08:14
@aleksfront aleksfront requested review from Iku-turso, jim-docker and Nokel81 and removed request for a team January 11, 2023 08:14
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
@aleksfront aleksfront requested a review from ixrock January 11, 2023 08:54
ixrock
ixrock previously approved these changes Jan 11, 2023
Copy link
Contributor

@ixrock ixrock left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 81 to 92
stabilizationWindowSecond?: number;
selectPolicy?: ScalingPolicySelect;
policies?: HPAScalingPolicy[];
}

type ScalingPolicySelect = string;

interface HPAScalingPolicy {
type: HPAScalingPolicyType;
value: number;
periodSeconds: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: too big indentation within both interfaces (comparing to one above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were tabs instead of spaces. Surprisingly, linter ignores that. Fixed.

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Comment on lines +232 to +237
// Kubernetes < 1.26
fallbackApiBases: [
"/apis/autoscaling/v2beta2/horizontalpodautoscalers",
"/apis/autoscaling/v2beta1/horizontalpodautoscalers",
"/apis/autoscaling/v1/horizontalpodautoscalers",
],
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think these are necessary since the group hasn't changed.

We should be careful though since if a v3 comes out it might change the representation. Though we can add that safety in a future PR.

@Nokel81 Nokel81 merged commit 34e6cf2 into master Jan 11, 2023
@Nokel81 Nokel81 deleted the add-hpa-fallback-apis branch January 11, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants