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

Allow CRD /scale labelSelectors to be under either status or spec #78234

Merged
merged 4 commits into from May 28, 2019

Conversation

@roycaihw
Copy link
Member

commented May 23, 2019

What type of PR is this?
/kind api-change

What this PR does / why we need it:
Remove restriction "labelSelectorPath must be under .status". Previously the server expects the custom controller to convert arbitrary CR Spec.Selector to the serialized, version-agnostic query form that is required for ScaleStatus.Selector. Now we allow the path to be under either .status or .spec, which enables the cases for users to manually input the serialized query form under spec.

Note that the server doesn't understand CR Spec.Selector schema, so this means users may need to manually convert Spec.Selector to ScaleStatus.Selector (if Spec.Selector is a complex selector struct).

Which issue(s) this PR fixes:

Fixes #66688
xref #67824, #69257

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Custom resources definitions using the scale subresource can have the `.spec.subresources.scale.labelSelectorPath` value as a JSONPath under either `.status` or `.spec`.

/sig api-machinery
cc @DirectXMan12 @enisoc @hex108 @liggitt @nikhita @sttts

@fejta-bot

This comment has been minimized.

Copy link

commented May 23, 2019

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 23, 2019

/retest

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 23, 2019

/assign @sttts

// Must be set to work with HPA.
// The field pointed by this JSON path must be a string field (not a complex selector struct) and contain
// a serialized, version-agnostic label query over objects that should match the replicas count.

This comment has been minimized.

Copy link
@sttts

sttts May 24, 2019

Contributor

why version agnostic?

This comment has been minimized.

Copy link
@roycaihw

roycaihw May 24, 2019

Author Member

the "version" here is not CR version but Spec.Selector version (schema). Spec.Selector schema varies across different objects and API versions, and ScaleStatus.Selector is intended to abstract away the different forms of Spec.Selector

I copied the word from #66688 (comment):

where in your Status do you report to us the serialized, version-agnostic form of your Spec.Selector

Spec.SerializedVersionAgnosticSelector which is in the format required for ScaleStatus.Selector

I can phrase it as "spec-selector-schema-agnostic". Other suggestions are welcome

This comment has been minimized.

Copy link
@liggitt

liggitt May 25, 2019

Member

maybe something like

The field pointed by this JSON path must be a string field (not a complex selector struct) which contains a serialized label selector in string form.

@roycaihw roycaihw force-pushed the roycaihw:crd-scale-label-selector branch from df03b2c to 0e98741 May 24, 2019

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 24, 2019

/retest

1 similar comment
@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 24, 2019

/retest

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 25, 2019

the test failure happens when the kubectl e2e test and crd openapi publishing test run in parallel. #78194 didn't catch this error because these two tests didn't happen to run at the same time

kubectl downloads openapi spec and evaluate schemas across the entire cluster (including the ones published by other tests). In this case the published schema is of array type with no item and fails the validation in kubectl

@sttts do we need to re-introduce https://github.com/kubernetes/kubernetes/pull/77554/files#diff-3c4a34afddbbbdd10ef27fb056228fd9L77?

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 25, 2019

/retest

the e2e flake is unrelated to this PR. Mitigation in #78326. I'm looking at fixing kube-openapi validation

@sttts

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

/approve
/lgtm

/assign @liggitt

for api review.

@liggitt

This comment has been minimized.

Copy link
Member

commented May 27, 2019

/lgtm
/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, roycaihw, sttts

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

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 27, 2019

/hold

applying the api doc suggestion in #78234 (comment)

roycaihw added some commits May 27, 2019

@roycaihw roycaihw force-pushed the roycaihw:crd-scale-label-selector branch from 0e98741 to 63e2bb5 May 27, 2019

@k8s-ci-robot k8s-ci-robot removed the lgtm label May 27, 2019

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 27, 2019

/hold cancel

updated the api doc as suggested. @liggitt @sttts could one of you re-tag this PR? Thanks

@liggitt

This comment has been minimized.

Copy link
Member

commented May 27, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label May 27, 2019

@roycaihw

This comment has been minimized.

Copy link
Member Author

commented May 27, 2019

/retest

1 similar comment
@liggitt

This comment has been minimized.

Copy link
Member

commented May 27, 2019

/retest

@fejta-bot

This comment has been minimized.

Copy link

commented May 28, 2019

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@liggitt

This comment has been minimized.

Copy link
Member

commented May 28, 2019

/retest

@liggitt liggitt added this to the v1.15 milestone May 28, 2019

@k8s-ci-robot k8s-ci-robot merged commit 6a5fa6c into kubernetes:master May 28, 2019

20 checks passed

cla/linuxfoundation roycaihw authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

superlime added a commit to superlime/kubernetes that referenced this pull request Jun 3, 2019

Allow CRD /scale labelSelectors to be under either status or spec (ku…
…bernetes#78234)

* apiextensions API doc: allow labelSelectorPath to be under .status or .spec

* apiextensions validation: allow labelSelectorPath to be under .status or .spec

* test

* generated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.