[release-4.9] Bug 2047676: UPSTREAM: <carry>: Give warning when ipFamilyPolicy implicitly set#1151
[release-4.9] Bug 2047676: UPSTREAM: <carry>: Give warning when ipFamilyPolicy implicitly set#1151andreaskaris wants to merge 1 commit intoopenshift:release-4.9from
Conversation
|
@andreaskaris: No Bugzilla bug is referenced in the title of this pull request. DetailsIn 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 kubernetes/test-infra repository. |
|
@andreaskaris: the contents of this pull request could not be automatically validated. The following commits could not be validated and must be approved by a top-level approver:
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: andreaskaris The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
9af7840 to
280e190
Compare
|
@andreaskaris: the contents of this pull request could not be automatically validated. The following commits could not be validated and must be approved by a top-level approver:
Comment |
|
@andreaskaris: No Bugzilla bug is referenced in the title of this pull request. DetailsIn 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 kubernetes/test-infra repository. |
In kube 1.21 and 1.22 (OCP 4.8 and 4.9), the apiserver would default the value of `ipFamilyPolicy` to `RequireDualStack` if you created a Service with two `ipFamilies` or two `clusterIPs` but no explicitly specified `ipFamilyPolicy`. In 1.23/4.10, you must explicitly specify either PreferDualStack or RequireDualStack for DualStack services. Emit a warning in 4.8 and 4.9 to raise awareness about the upcoming API changes. OpenShift 4.8 and 4.9 only, BZ 2045576
280e190 to
feb195e
Compare
|
@andreaskaris: the contents of this pull request could not be automatically validated. The following commits could not be validated and must be approved by a top-level approver:
Comment |
|
@andreaskaris: No Bugzilla bug is referenced in the title of this pull request. DetailsIn 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 kubernetes/test-infra repository. |
2 similar comments
|
@andreaskaris: No Bugzilla bug is referenced in the title of this pull request. DetailsIn 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 kubernetes/test-infra repository. |
|
@andreaskaris: No Bugzilla bug is referenced in the title of this pull request. DetailsIn 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 kubernetes/test-infra repository. |
|
@andreaskaris: This pull request references Bugzilla bug 2045576, which is invalid:
Comment DetailsIn 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 kubernetes/test-infra repository. |
|
@andreaskaris: This pull request references Bugzilla bug 2047676, which is invalid:
Comment DetailsIn 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 kubernetes/test-infra repository. |
1 similar comment
|
@andreaskaris: This pull request references Bugzilla bug 2047676, which is invalid:
Comment DetailsIn 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 kubernetes/test-infra repository. |
|
/bugzilla refresh |
|
@andreaskaris: This pull request references Bugzilla bug 2047676, which is invalid:
Comment DetailsIn 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 kubernetes/test-infra repository. |
|
/retest-required |
|
@andreaskaris: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
| // tryDefaultValidateServiceClusterIPFields will set service.Spec.IPFamilyPolicy before the webhooks have a chance to inspect | ||
| // it. Therefore, we implement this downstream only warning message in OpenShift's kube-apiserver. | ||
| // Carry this change forward only in 4.8 and 4.9 and drop this for all other versions. | ||
| func warnDualStackIPFamilyPolicy(ctx context.Context, service *api.Service) { |
|
@andreaskaris please see Stefan comments, we can pursue this approach, but I still need to verify what is the best place to put the wanings, the Service REST in this version has 2 layers. Another important thing, we should add a good release note and docs about the issue explaining it with examples so we can easily refer users to them, something like will work in 4.8 and 4.9, for 4.10 onwards is mandatory to add the |
| "without explicitly setting Service.Spec.IPFamilyPolicy is deprecated. " + | ||
| "This operation will fail starting with Red Hat OpenShift Platform 4.10. " + | ||
| "Make sure to set IPFamilyPolicy to PreferDualStack or RequireDualStack when configuring DualStack services." | ||
| klog.Warningf(msg) |
There was a problem hiding this comment.
I think we should remove the klog here, it is not adding much value here since there is no actionable action
|
Thanks for the detailed feedback! I can't reopen this here because I had force-pushed something to the branch in the meantime. The follow-up is here: #1170 |
UPSTREAM: : Give warning when ipFamilyPolicy implicitly set
In kube 1.21 and 1.22 (OCP 4.8 and 4.9), the apiserver would default
the value of
ipFamilyPolicytoRequireDualStackif you created aService with two
ipFamiliesor twoclusterIPsbut no explicitlyspecified
ipFamilyPolicy. In 1.23/4.10, you must explicitly specifyeither PreferDualStack or RequireDualStack for DualStack services.
Emit a warning in 4.8 and 4.9 to raise awareness about the upcoming
API changes.
OpenShift 4.8 and 4.9 only, BZ 2047676
What type of PR is this?
What this PR does / why we need it:
Warn users about an upcoming breaking API change.
Which issue(s) this PR fixes:
Fixes BZ 2045576
Special notes for your reviewer:
I initially thought I could write a (mutating) admission controller for release 4.9/4.8 to warn users loudly about the upcoming breaking change in OCP 4.10 if the user tried to create a DualStack service in a way which would be invalid starting with 4.10.
I tested it against an upstream OVN kind setup on Kubernetes 1.20, and it turns out that, no matter if I use a validating or a mutating webhook, the field
service.Spec.IPFamilyPolicyis set by Kubernetes toIPFamilyPolicyRequireDualStackbefore the webhooks are called.My initial idea was to return something like ...
... if
len(service.Spec.ClusterIPs) == 2 || len(service.Spec.IPFamilies) == 2and if theipfamilypolicy == nil.However, for this service here which will be invalid starting with Kubernetes 1.23:
What I end up getting is this, even with a mutating webhook. Note How K8s apiserver sets
"ipFamilyPolicy":"RequireDualStackbefore any of the webhooks is called:So, given that something within the Api Server sets service.Spec.IPFamilyPolicy and only after that it calls any of the admission webhooks, using a webhook to generate a warning does not work.
Instead, I am proposing that we introduce a tiny change in openshift/kubernetes downstream and that we generate the warning directly inside the API server.
Does this PR introduce a user-facing change?
Yes.
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: