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

Kubeadm Networking Configuration E2E Tests #80259

Merged

Conversation

Arvinderpal
Copy link
Contributor

@Arvinderpal Arvinderpal commented Jul 17, 2019

What type of PR is this?
/kind feature

What this PR does / why we need it:

Currently, kubeadm e2e tests don't check any of the networking configuration values. This PR adds 2 new e2e_kubeadm tests for network configurations:

  • podSubnet check: if a podSubnet is specified in kubeadm-config
    then the e2e test will check that pod-cidrs of individual nodes
    fall within this range.
  • serviceSubnet check: if a serviceSubnet is specified in
    kubeadm-config then the e2e test will check that the kubernetes
    service created in the default namespace got a service IP
    from the configured range.

Special notes for your reviewer:

There will be follow up dual-stack tests as that feature lands in master. These tests are however single-stack (either IPv4 or IPv6) only.
To run just these tests: make test-e2e-kubeadm FOCUS=setup-networking

Does this PR introduce a user-facing change?:
NONE

@k8s-ci-robot
Copy link
Contributor

@Arvinderpal: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 17, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @Arvinderpal. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/kubeadm area/test sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 17, 2019
@k8s-ci-robot k8s-ci-robot requested review from kad and timothysc July 17, 2019 17:04
@Arvinderpal
Copy link
Contributor Author

Arvinderpal commented Jul 17, 2019

@fabriziopandini @neolit123 @yastij @aojea
These are single-stack tests. I put them into a separate PR. Please let me know if this approach is sound. I will add similar dual-stack tests as that feature is completed.

@yastij
Copy link
Member

yastij commented Jul 17, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 17, 2019
@Arvinderpal Arvinderpal force-pushed the kubeadm-e2e-networking-config branch from 6caaef8 to 1ec0290 Compare July 17, 2019 17:22
@yastij
Copy link
Member

yastij commented Jul 17, 2019

/assign @neolit123 @yastij

@neolit123
Copy link
Member

thanks @Arvinderpal
please poke us for review once the CI tests pass.

/assign @fabriziopandini @neolit123

test/e2e_kubeadm/networking_test.go Outdated Show resolved Hide resolved
test/e2e_kubeadm/networking_test.go Outdated Show resolved Hide resolved
test/e2e_kubeadm/networking_test.go Show resolved Hide resolved
test/e2e_kubeadm/networking_test.go Show resolved Hide resolved
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

@Arvinderpal thanks for taking care of improving kubeadm e2e test coverage!

The PR goes definitely in the right direction, but I would like to check with you/other reviewers if:

  • we can make detection of cluster settings more robust (or set clear expectations)
  • make this test verify kubeadm behavior directly, without going through the indirection of other components responsible for applying network settings to node/services

test/e2e_kubeadm/networking_test.go Show resolved Hide resolved
test/e2e_kubeadm/networking_test.go Show resolved Hide resolved
d := cc["networking"].(map[interface{}]interface{})
if ps, ok := d["podSubnet"]; ok {
// Check that the pod CIDR allocated to the node(s) is within the kubeadm-config podCIDR.
nodes, err := f.ClientSet.CoreV1().Nodes().List(metav1.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

This test is checking kubeadm behaviour indirectly, and I'm wondering if instead we should test the kubeadm bit more specifically

Kubeadm only responsibility for networking is to pass the settings to the control plane components (in this case, to translate podSubnet into cluster-cidr, allocate-node-cidrs and node-cidr-mask-size flags for the controller manager)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you have in mind?
I followed this approach based on what I saw in other tests.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for not being clear.
I think we should have a test that checks kubeadm assigns the expected value to cluster-cidr, allocate-node-cidrs and node-cidr-mask-size (in addition or in replacement to the current test)

Copy link
Contributor Author

@Arvinderpal Arvinderpal Jul 23, 2019

Choose a reason for hiding this comment

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

@fabriziopandini
allocate-node-cidrs is internal to controller-manager and is not exposed, so I don't see any way to verify that.
node-cidr-mask-size is calcuated by kubeadm (see func calcNodeCidrSize). There are some issues with verifying it:

  1. This func currently assumes IPv4 (assigns /24 to IPv6 -- a known problem).
  2. We'll need to change this func to support dual-stack, so node-cidr-mask-size will actually become a slice.
  3. node-cidr-mask-size is not written to kubeadm config, so we'll have to duplicate this func in the e2e tests in order to verify it.
  4. calcNodeCidrSize is unit tested already.
    Because of these reasons, I would prefer not to add e2e tests for this. Perhaps when dual-stack changes land, we can revisit this.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I got your point and I don't want to block on this.
However, I think this test is useful and doable reading the args in the controller-manager pod, so please add an item on the umbrella issue: "implement a test that checks kubeadm assigns the expected value to cluster-cidr, allocate-node-cidrs and node-cidr-mask-size (in addition or in replacement to the current test"

@Arvinderpal
Copy link
Contributor Author

@fabriziopandini @yastij Thank you for you feedback. Please see my comments.

test/e2e_kubeadm/BUILD Outdated Show resolved Hide resolved
@Arvinderpal Arvinderpal force-pushed the kubeadm-e2e-networking-config branch from 1ec0290 to bbe1866 Compare July 18, 2019 20:13
@aojea
Copy link
Member

aojea commented Jul 20, 2019

xref #79033

@Arvinderpal Arvinderpal force-pushed the kubeadm-e2e-networking-config branch from bbe1866 to b81b246 Compare July 23, 2019 14:09
@Arvinderpal Arvinderpal force-pushed the kubeadm-e2e-networking-config branch from b81b246 to a500078 Compare July 24, 2019 21:56
@fabriziopandini
Copy link
Member

@Arvinderpal thanks for the update; please update the umbrella issue as suggested
/approve
I leave to @rosti / @neolit123 / @yastij final lgtm

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 25, 2019
@Arvinderpal
Copy link
Contributor Author

@Arvinderpal thanks for the update; please update the umbrella issue as suggested
/approve
I leave to @rosti / @neolit123 / @yastij final lgtm

@fabriziopandini I have created a new umbrella issue for these e2e tests since they are not directly related to the dual-stack work. kubernetes/kubeadm#1686
As requested, I have added tasks for the other config values that you want tested.

Copy link
Contributor

@rosti rosti left a comment

Choose a reason for hiding this comment

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

Thanks @Arvinderpal !
Apart from the incomplete dual stack test, this looks good.

})
})
})
Context("dual-stack [Feature:IPv6DualStack]", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's omit this test case from this PR and add it instead in its entirety in #79033.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

 * podSubnet check: if a podSubnet is specified in kubeadm-config
   then the e2e test will check that pod-cidrs of individual nodes
   fall within this range.
 * serviceSubnet check: if a serviceSubnet is specified in
   kubeadm-config then the e2e test will check that the kubernetes
   service created in the default namespace got a service IP
   from the configured range.
@Arvinderpal Arvinderpal force-pushed the kubeadm-e2e-networking-config branch from a500078 to ca3bdfd Compare July 27, 2019 14:56
@Arvinderpal
Copy link
Contributor Author

@rosti / @neolit123 / @yastij I think this PR can be merged. I have addressed all the comments.

@neolit123
Copy link
Member

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 28, 2019
Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/priority backlog
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 28, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Arvinderpal, fabriziopandini, neolit123

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

@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.

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

@k8s-ci-robot k8s-ci-robot merged commit c1d2ac4 into kubernetes:master Jul 29, 2019
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/kubeadm area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

10 participants