-
Notifications
You must be signed in to change notification settings - Fork 107
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
[release-4.12] OCPBUGS-15527: Prevent partially filled HPA behaviors from crashing kube-controller-manager #1887
[release-4.12] OCPBUGS-15527: Prevent partially filled HPA behaviors from crashing kube-controller-manager #1887
Conversation
The description in the autoscaling API for the HorizontalPodAutoscaler suggests that HorizontalPodAutoscalerSpec's Behavior field (and its ScaleUp and ScaleDown members) are optional. And that if not supplied, defaults will be used. That's true if the entire Behavior is nil because, we go through "normalizeDesiredReplicas" instead of "normalizeDesiredReplicasWithBehaviors", but if the structure is only partially supplied, leaving some members nil, it results in nil dereferences when we end up going though normalizeDesiredReplicasWithBehaviors. So we end up in a situation where: - If Behavior is entirely absent (nil) we use defaults (good) - If Behavior is partially specified we panic (very bad) - If stabilizationWindowSeconds is nil in either ScaleUp or Scaledown, we panic (also very bad) In general, this only happens with pre-v2 HPA objects because v2 does properly fill in the default values. This commit prevents the panic by using the defaulters to ensure that unpopulated fields in the behavior objects get filled in with their defaults before they are used, so they can safely be dereferenced by later code that performs calculations on them.
@jkyros: An error was encountered searching for bug OCPBUGS-15527 on the Jira server at https://issues.redhat.com/. No known errors were detected, please see the full error message for details. Full error message.
You do not have the permission to see the specified issue.: request failed. Please analyze the request body for more details. Status code: 403:
Please contact an administrator to resolve this issue, then request a bug refresh with In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
@jkyros: the contents of this pull request could be automatically validated. The following commits are valid:
Comment |
@jkyros: This pull request references Jira Issue OCPBUGS-15527, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/jira refresh |
@jkyros: This pull request references Jira Issue OCPBUGS-15527, which is valid. The bug has been moved to the POST state. 6 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
@jkyros: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/label qe-approved |
@jkyros: An error was encountered searching for dependent bug OCPBUGS-12210 for bug OCPBUGS-15527 on the Jira server at https://issues.redhat.com/. No known errors were detected, please see the full error message for details. Full error message.
You do not have the permission to see the specified issue.: request failed. Please analyze the request body for more details. Status code: 401:
Please contact an administrator to resolve this issue, then request a bug refresh with In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/lgtm |
@jkyros: This pull request references Jira Issue OCPBUGS-15527, which is valid. 6 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
/approve |
/refresh |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, jkyros, joelsmith 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 |
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, jkyros, joelsmith 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 |
9946c63
into
openshift:release-4.12
@jkyros: Jira Issue OCPBUGS-15527: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-15527 has been moved to the MODIFIED state. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[ART PR BUILD NOTIFIER] This PR has been included in build openshift-enterprise-pod-container-v4.12.0-202403042037.p0.g9946c63.assembly.stream.el8 for distgit openshift-enterprise-pod. |
Fix included in accepted release 4.12.0-0.nightly-2024-03-05-025545 |
This is a manual backport of #1876.
It looks like we probably also need to take it back through 4.11 even though we originally weren't intending to.(Manual backport because
TestMultipleHPAs
doesn't exist in 4.12 so it looks like a collision)