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
Promote APF API to v1 #121089
Promote APF API to v1 #121089
Conversation
Skipping CI for Draft Pull Request. |
/ok-to-test |
c787a3d
to
61e067b
Compare
/ok-to-test |
/ok-to-test |
I had to rebase on top of #118886, the only change due to the rebase was:
|
@@ -86,8 +98,16 @@ func TestValidateAPIPriorityAndFairness(t *testing.T) { | |||
if errs := validateAPIPriorityAndFairness(options); len(errs) > 0 { | |||
errMessageGot = errs[0].Error() | |||
} | |||
if !strings.Contains(errMessageGot, test.errShouldContain) { | |||
t.Errorf("Expected error message to contain: %q, but got: %q", test.errShouldContain, errMessageGot) |
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.
this test was always broken, strings.Contains(errMessageGot, "")
is always true
, it's fixed below.
pkg/apis/flowcontrol/types.go
Outdated
@@ -419,6 +419,10 @@ type LimitedPriorityLevelConfiguration struct { | |||
// Bigger numbers mean a larger nominal concurrency limit, | |||
// at the expense of every other priority level. | |||
// This field has a default value of 30. | |||
// | |||
// Setting this field to zero allows for the construction of a |
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.
can we say "supports" rather than "allows"? I think "allows" suggests that this is all that is needed to make that jail, and this is not true.
errExpected: nil, | ||
}, | ||
{ | ||
name: "v1beta3, feature enabled, update, zero value, existing has non-zero, error expected", |
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.
typo: it should be "no error expected"
@@ -340,10 +348,11 @@ func ValidateFlowSchemaCondition(condition *flowcontrol.FlowSchemaCondition, fld | |||
} | |||
|
|||
// ValidatePriorityLevelConfiguration validates priority-level-configuration. | |||
func ValidatePriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration, requestGV schema.GroupVersion) field.ErrorList { | |||
func ValidatePriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration, requestGV schema.GroupVersion, opts PriorityLevelValidationOptions) field.ErrorList { |
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.
We want to make sure the annotation used to indicate a zero value that should not be defaulted in v1beta3 never makes it through conversion to any other versions. To do that, check for and forbid the annotation here.
// set the annotation to an empty string: | ||
// "flowcontrol.k8s.io/concurrency-shares-defaults-to-zero": "" | ||
// | ||
PriorityLevelConcurrencyShareDefaultKey = "flowcontrol.k8s.io/concurrency-shares-defaults-to-zero" |
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.
This annotation is specific to v1beta3... we no longer serve or store in v1beta1 or v1beta2, so we don't have to worry about round-tripping zero values to those, and we don't want this annotation to be used in v1 (see comment about forbidding it in validation after we've converted to the internal version). I'd suggest putting v1beta3 in the annotation key and documenting it is only for use in v1beta3.
Also, "defaults-to-zero" isn't quite right, when this annotation is present we don't default zero.
I'd suggest flowcontrol.k8s.io/v1beta3-preserve-zero-concurrency-shares
API bits are really close. One comment on the name of the conversion annotation, and making sure the annotation doesn't escape conversion in validation. As a fast follow to this PR (e.g. ~tomorrow), an e2e test for each type that walks through exercising discovery and CRUD of every verb / endpoint for both APIs is needed. All GA APIs are expected to be exercised by conformance tests by default unless there is a compelling reason they should not be included in conformance. https://apisnoop.cncf.io/conformance-progress shows the progress of adding conformance tests for existing GA APIs. An example that runs through verbs / operations for PV / PVC is at https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/persistent_volumes.go#L417-L655 Getting that written / merged ~tomorrow would let it soak and get promoted to conformance by test freeze November 15th. |
The changes are in this commit - b8cd792 |
/test pull-kubernetes-e2e-gce |
/lgtm |
LGTM label has been added. Git tree hash: 0e03c5ccb9f8b7b1555618569059ab31d2309e2b
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, tkashem 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 |
Changelog suggestion -The flowcontrol.apiserver.k8s.io/v1beta3 FlowSchema and PriorityLevelConfiguration APIs has been promoted to flowcontrol.apiserver.k8s.io/v1, with the following changes:
-* PriorityLevelConfiguration: the `.spec.limited.nominalConcurrencyShares` field defaults to `30` only if the field is omitted (v1beta3 also defaulted an explicit `0` value to `30`). Specifying an explicit `0` value is not allowed in the `v1` version in v1.29 to ensure compatibility with 1.28 API servers. In v1.30, explicit `0` values will be allowed in this field in the `v1` API.
-The flowcontrol.apiserver.k8s.io/v1beta3 APIs are deprecated and will no longer be served in v1.32. All existing objects are available via the `v1` APIs. Transition clients and manifests to use the `v1` APIs before upgrading to v1.32.
+The flowcontrol.apiserver.k8s.io/v1beta3 FlowSchema and PriorityLevelConfiguration APIs have been promoted to flowcontrol.apiserver.k8s.io/v1, with the following changes:
+* PriorityLevelConfiguration: the `.spec.limited.nominalConcurrencyShares` field defaults to `30` only if the field is omitted (v1beta3 also defaulted an explicit `0` value to `30`). Specifying an explicit `0` value is not allowed in the `v1` version in v1.29 to ensure compatibility with 1.28 API servers. In v1.30, explicit `0` values will be admitted.
+
+Deprecated the flowcontrol.apiserver.k8s.io/v1beta3 API group. These deprecated APIs will no longer be served in Kubernetes v1.32. All existing API priority and fairness objects are available via the `v1` APIs. Transition clients and manifests to use the `v1` APIs before upgrading to v1.32. How does that sound? (please see following text for context) Do we need to support someone dumping a PriorityLevelConfiguration to YAML using flowcontrol.apiserver.k8s.io/v1beta3 and then to round-trip that object back to the API server? If we do, v1.30 would need to allow explicit |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: