-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Switch internal scale type to autoscaling, enable apps/v1 scale subresources #55413
Switch internal scale type to autoscaling, enable apps/v1 scale subresources #55413
Conversation
64fd8f9
to
7aff354
Compare
pkg/apis/apps/v1beta1/conversion.go
Outdated
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
"k8s.io/kubernetes/pkg/apis/apps" | ||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for the alias
7aff354
to
348b994
Compare
348b994
to
88ac9c6
Compare
88ac9c6
to
2bcc412
Compare
@liggitt I think the round-tripping test failed due to different |
it's not because it's a different type, it's because the fuzzed data is an invalid selector. making a custom fuzzer now that only allows valid selectors. |
2bcc412
to
cccbf62
Compare
Fixed fuzzing test, added a commit to enable scale subresources for apps/v1 |
cc @kubernetes/sig-apps-api-reviews @kubernetes/api-reviewers |
} | ||
if len(selector.MatchExpressions) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to handle the case when len(selector.MatchExpressions) != 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, if MatchExpressions
is non-empty, then MatchLabels
is insufficient to express the full selector, and we should not set it.
This is the same logic as before, only setting out.Selector = in.Selector.MatchLabels
when MatchExpressions is zero-length:
if in.Selector.MatchExpressions == nil || len(in.Selector.MatchExpressions) == 0 {
out.Selector = in.Selector.MatchLabels
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks!
@@ -42,44 +42,6 @@ const ( | |||
SysctlsPodSecurityPolicyAnnotationKey string = "security.alpha.kubernetes.io/sysctls" | |||
) | |||
|
|||
// describes the attributes of a scale subresource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to verify - removing these will not break backward compatibility, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, as seen by there being zero changes in the openapi/swagger schemas (only apps/v1 additions), or external API types, or client-go methods.
@@ -58,7 +60,7 @@ var _ = rest.Patcher(&ScaleREST{}) | |||
|
|||
// New creates a new Scale object | |||
func (r *ScaleREST) New() runtime.Object { | |||
return &extensions.Scale{} | |||
return &autoscaling.Scale{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liggitt IMO we should not change any codes in pkg/registry/extensions/controller/storage
directory as it is relevant to replication controller, which is v1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not an option, the internal extensions.Scale
type is going away. This has no external API implications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this is only used for /apis/extensions/v1beta1/namespaces/ns/replicationcontrollers/rc/scale
, which is not how replication controllers should be scaled. The /api/v1/namespaces/ns/replicationcontrollers/rc/scale
API is the v1 scale subresource for replication controllers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted! didn't know about that, thanks for pointing it out!
/lgtm |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: crimsonfaith91, liggitt No associated issue. Update pull-request body to add a reference to an issue, or get approval with The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/hold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
IMO this fixes #49504
Can we add a release note that indicates the app/v1 group uses autoscaling/v1 Scale.
this lays the groundwork for it, but until
I can... since apps/v1 is new in this release, I figured we'd combine release notes for all the apps/v1 stuff into a single note, not per-PR |
/hold cancel |
Automatic merge from submit-queue (batch tested with PRs 53047, 54861, 55413, 55395, 55308). If you want to cherry-pick this change to another branch, please follow the instructions here. |
xref #49504