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

Populate ClusterIPs on read #95894

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

thockin
Copy link
Member

@thockin thockin commented Oct 27, 2020

Old stored services will not have the clusterIPs field when read back
without this.

This includes some renaming for clarity and expanded comments, and a new
test for default on read.

/kind bug
/kind api-change

Services will now have a `clusterIPs` field to go with `clusterIP`.  `clusterIPs[0]` is a synonym for `clusterIP` and will be syncronized on create and update operations.

/sig network

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/network Categorizes an issue or PR as relevant to SIG Network. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 27, 2020
@thockin
Copy link
Member Author

thockin commented Oct 27, 2020

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 27, 2020
@thockin thockin added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Oct 27, 2020
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 27, 2020
@fejta-bot
Copy link

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.

@thockin
Copy link
Member Author

thockin commented Oct 27, 2020

/retest

@thockin
Copy link
Member Author

thockin commented Oct 27, 2020

Rebase and push to retrigger tests.

svcreg.NormalizeClusterIPs(nil, service)

// The rest of this does not apply unless dual-stack is enabled.
if !utilfeature.DefaultFeatureGate.Enabled(features.IPv6DualStack) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gate should be on defaultOnRead(..) first thing. Instead of for-each-item-on-list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is whether we expect clusterIPs to have a value when the gate is disabled? Based on the logic in dropServiceDisabledFields(), I assumed that was your intention:

if !utilfeature.DefaultFeatureGate.Enabled(features.IPv6DualStack) && !strategy.serviceDualStackFieldsInUse(oldSvc) {
        newSvc.Spec.IPFamilies = nil
        newSvc.Spec.IPFamilyPolicy = nil
        if len(newSvc.Spec.ClusterIPs) > 1 {
            newSvc.Spec.ClusterIPs = newSvc.Spec.ClusterIPs[0:1]
        }
    }

If we leave that as-is, then we really need to populate it on read (regardless of the gate). If we don't populate on read (when gated off), we should just set it to nil when writing. It either always has a value or never. But lots of internal logic depends on it having a value, so this seemed cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes. I missed that one.

@khenidak
Copy link
Contributor

/retest

one small change requested, but otherwise i think we are good.

@thockin
Copy link
Member Author

thockin commented Oct 28, 2020

/retest

@thockin
Copy link
Member Author

thockin commented Oct 28, 2020

rebased

@thockin thockin force-pushed the svc-default-on-read branch 2 times, most recently from a13c930 to cae8801 Compare October 28, 2020 19:34
@aojea
Copy link
Member

aojea commented Oct 28, 2020

/test pull-kubernetes-e2e-azure-dualstack
/test pull-kubernetes-e2e-iptables-azure-dualstack
/test pull-kubernetes-e2e-kind-ipvs-dual-canary
/test pull-kubernetes-e2e-kind-dual-canary

the unit test errors are legit, didn' t look if it is the test or the code
--- FAIL: TestServiceDefaultOnRead (4.94s)
--- FAIL: TestServiceDefaultOnRead/not_Service_or_ServiceList (0.17s)
storage_test.go:443: unexpected success

@khenidak
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 29, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: khenidak, thockin

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

Old stored services will not have the `clusterIPs` field when read back
without this.

This includes some renaming for clarity and expanded comments, and a new
test for default on read.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2020
@thockin
Copy link
Member Author

thockin commented Oct 30, 2020

rebased, will need new lgtm

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Oct 30, 2020

@thockin: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kind-dual-canary cae880164b2df056dfb089f9efe7d5ca334f1500 link /test pull-kubernetes-e2e-kind-dual-canary

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@thockin
Copy link
Member Author

thockin commented Oct 30, 2020

/retest

@aojea
Copy link
Member

aojea commented Oct 30, 2020

rebased, will need new lgtm

/lgtm

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 kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants