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

Validate kube-proxy options #53780

Merged
merged 1 commit into from Nov 15, 2017

Conversation

m1093782566
Copy link
Contributor

@m1093782566 m1093782566 commented Oct 12, 2017

What this PR does / why we need it:

Validate ipvs proxy options

Which issue this PR fixes : fixes #53852

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. 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 Oct 12, 2017
@m1093782566
Copy link
Contributor Author

/sig network

/area kube-proxy

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. area/kube-proxy labels Oct 12, 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 Oct 12, 2017
@k8s-ci-robot k8s-ci-robot assigned thockin and unassigned therc Oct 12, 2017
// the system's kernel or iptables versions are insufficient, this always falls back to the
// userspace proxy.
type ProxyMode string

const (
ProxyModeUserspace ProxyMode = "userspace"
ProxyModeIPTables ProxyMode = "iptables"
ProxyModeIPVS ProxyMode = "ipvs"
Copy link
Contributor

Choose a reason for hiding this comment

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

For your reference, #53860 also add IPVS and Kernelspace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

k8s-github-robot pushed a commit that referenced this pull request Oct 30, 2017
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

validate ipvs scheduler

**What this PR does / why we need it**:

validate ipvs scheduler options

**Which issue this PR fixes**: 

closes #53975

**Special notes for your reviewer**:

It depends on work of #53780.

**Release note**:

```release-note
NONE
```

/sig network

/area kube-proxy
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 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 Oct 30, 2017
@m1093782566
Copy link
Contributor Author

/retest

@m1093782566
Copy link
Contributor Author

m1093782566 commented Nov 3, 2017

/cc @xiangpengzhao for review :)

@xiangpengzhao
Copy link
Contributor

@m1093782566 so sorry for not noticing this PR when I trying to improve test coverage for kube-proxy validation in #54848. For the IPVS part, this PR is more reasonable than that one.

@m1093782566
Copy link
Contributor Author

@xiangpengzhao

Never mind. I think you did good job :)

Copy link
Contributor

@xiangpengzhao xiangpengzhao left a comment

Choose a reason for hiding this comment

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

just two nits. otherwise LGTM.

}
}

func TestValidateKubeProxyIPVSScheduler(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test case can be removed here since it's already added in #54848 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem.

allErrs = append(allErrs, field.Invalid(fldPath.Child("SyncPeriod"), config.SyncPeriod, "must be greater than 0"))
}

if config.MinSyncPeriod.Duration < 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 check if MinSyncPeriod > SyncPeriod ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a nice finding!

I think we can check MinSyncPeriod > SyncPeriod in validation although currently it's already checked in proxier.go. Let's change it to see if anyone object to it?

Copy link
Contributor

Choose a reason for hiding this comment

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

although currently it's already checked in proxier.go

IMO, it's better validating earlier than later :)

@m1093782566 m1093782566 changed the title Validate ipvs proxy options Validate kube-proxy options Nov 3, 2017
@m1093782566
Copy link
Contributor Author

@xiangpengzhao

Comments are fixed now, PTAL. Thanks!

@@ -87,6 +87,30 @@ func validateKubeProxyIPTablesConfiguration(config componentconfig.KubeProxyIPTa
allErrs = append(allErrs, field.Invalid(fldPath.Child("MinSyncPeriod"), config.MinSyncPeriod, "must be greater than or equal to 0"))
}

if config.MinSyncPeriod.Duration > config.SyncPeriod.Duration {
Copy link
Contributor

Choose a reason for hiding this comment

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

why checking this both here and L108?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an interesting finding :)

Because both iptables and ipvs proxy has the SyncPeriod and MinSyncPeriod - they don't share the same SyncPeriod and MinSyncPeriod.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to validate them both in iptables and ipvs mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! I didn't notice this :)

@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 7, 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 7, 2017
Copy link
Contributor

@xiangpengzhao xiangpengzhao left a comment

Choose a reason for hiding this comment

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

please fix the dup code caused by rebase.

@@ -20,6 +20,191 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ClientConnectionConfiguration contains details for constructing a client.
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be removed from this file as #53645 is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

@@ -163,6 +163,7 @@ const (
ProxyModeUserspace ProxyMode = "userspace"
ProxyModeIPTables ProxyMode = "iptables"
ProxyModeIPVS ProxyMode = "ipvs"
ProxyModeIPVS ProxyMode = "ipvs"
Copy link
Contributor

Choose a reason for hiding this comment

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

dup of L165

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch! Done.

@k8s-github-robot k8s-github-robot removed the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Nov 7, 2017
@xiangpengzhao
Copy link
Contributor

CI is still unhappy due to

I1107 09:23:00.377] pkg/proxy/apis/kubeproxyconfig/validation/validation.go:97:48: undefined: componentconfig
I1107 09:23:00.378] pkg/proxy/apis/kubeproxyconfig/validation/validation.go:112:56: undefined: componentconfig

I guess this is also introduced by rebase. Sorry for the pain caused by #53645. It hurts a lot of PRs.

Copy link
Contributor

@xiangpengzhao xiangpengzhao left a comment

Choose a reason for hiding this comment

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

just a nit now.

return allErrs
}

func validateKubeProxyIPVSConfiguration(config componentconfig.KubeProxyIPVSConfiguration, fldPath *field.Path) field.ErrorList {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/componentconfig/kubeproxyconfig
and other places it appears.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure.

@m1093782566
Copy link
Contributor Author

CI is happy now :)

@thockin
Copy link
Member

thockin commented Nov 14, 2017

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

[APPROVALNOTIFIER] This PR is APPROVED

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

Associated issue: 53852

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

@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 14, 2017
@m1093782566
Copy link
Contributor Author

/retest

1 similar comment
@m1093782566
Copy link
Contributor Author

/retest

@fejta-bot
Copy link

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

Review the full test history for this PR.

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 15, 2017

@m1093782566: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-unit c7071ed link /test pull-kubernetes-unit
pull-kubernetes-e2e-gce c7071ed link /test pull-kubernetes-e2e-gce

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.

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 53780, 55663, 55321, 52421, 55659). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 5e17893 into kubernetes:master Nov 15, 2017
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. area/kube-proxy cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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/network Categorizes an issue or PR as relevant to SIG Network. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should validate ipvs proxy options
9 participants