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

Switch internal scale type to autoscaling, enable apps/v1 scale subresources #55413

Merged
merged 4 commits into from
Nov 10, 2017

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Nov 9, 2017

xref #49504

  • Switch workload internal scale type to autoscaling.Scale (internal-only change)
  • Enable scale subresources for apps/v1 deployments, replicasets, statefulsets
NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 9, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 9, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 9, 2017
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/kubernetes/pkg/apis/apps"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
Copy link
Contributor

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

@liggitt
Copy link
Member Author

liggitt commented Nov 9, 2017

cc @crimsonfaith91 @DirectXMan12

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 9, 2017
@k8s-github-robot k8s-github-robot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Nov 9, 2017
@liggitt liggitt assigned kow3ns and crimsonfaith91 and unassigned lavalamp Nov 9, 2017
@crimsonfaith91
Copy link
Contributor

crimsonfaith91 commented Nov 9, 2017

@liggitt I think the round-tripping test failed due to different selector type for autoscaling.Scale and extensions.Scale. The selector field is a string for autoscaling.Scale, but it is LabelSelector type for extensions.Scale. Correct me if i am wrong.

@liggitt
Copy link
Member Author

liggitt commented Nov 9, 2017

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.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 9, 2017
@liggitt liggitt changed the title Switch internal scale type to autoscaling Switch internal scale type to autoscaling, enable apps/v1 scale subresources Nov 9, 2017
@liggitt
Copy link
Member Author

liggitt commented Nov 9, 2017

Fixed fuzzing test, added a commit to enable scale subresources for apps/v1

@liggitt
Copy link
Member Author

liggitt commented Nov 9, 2017

cc @kubernetes/sig-apps-api-reviews @kubernetes/api-reviewers

@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Nov 9, 2017
}
if len(selector.MatchExpressions) == 0 {
Copy link
Contributor

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?

Copy link
Member Author

@liggitt liggitt Nov 9, 2017

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
}

Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Member Author

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{}
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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

Copy link
Contributor

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!

@crimsonfaith91
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2017
@k8s-github-robot
Copy link

[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 /approve no-issue

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@liggitt
Copy link
Member Author

liggitt commented Nov 9, 2017

/hold
would like ack on API review

@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 Nov 9, 2017
@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2017
Copy link
Member

@kow3ns kow3ns left a 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.

@liggitt
Copy link
Member Author

liggitt commented Nov 10, 2017

IMO this fixes #49504

this lays the groundwork for it, but until kubectl scale actually uses discovery and scale subresources consistently, that should stay open

Can we add a release note that indicates the app/v1 group uses autoscaling/v1 Scale.

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

@liggitt
Copy link
Member Author

liggitt commented Nov 10, 2017

/hold cancel

@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 Nov 10, 2017
@k8s-github-robot
Copy link

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.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants