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

Add helm support for custom_cni deployment #10529

Merged
merged 10 commits into from
Nov 15, 2023

Conversation

kukacz
Copy link
Contributor

@kukacz kukacz commented Oct 16, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add option to deploy custom_cni type of network backend using helm chart.

There is already manifest based method of custom network backend deployment implemented. Some backend providers (eg. Cilium) offer helm charts of their applications and prefer those for deployment and following upgrades. This change adds such exclusive option in addition to the existing manifest one.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 16, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 16, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Oct 16, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @kukacz!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 16, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @kukacz. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 16, 2023
@MrFreezeex
Copy link
Member

MrFreezeex commented Oct 16, 2023

Hi @kukacz, thanks for the PR! Could you add a test using this?
You would need to add it in .gitlab-ci/packet.yml and the variables in tests/files/packet_${TEST_NAME}.yml with your preferred CNI/helm chart config.

I think we could have a file inventory/sample/group_vars/k8s_cluster/k8s-net-custom-cni.yml as a small documentation for users.

/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 Oct 16, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 13, 2023
@MrFreezeex
Copy link
Member

MrFreezeex commented Nov 13, 2023

Thanks for the great docs! 🙏 It looks good to me but I think you need to rebase your branch to make the CI happy 🤔. I should be able to trigger the test you added afterwards.

@kukacz
Copy link
Contributor Author

kukacz commented Nov 14, 2023

Thanks for the great docs! 🙏 It looks good to me but I think you need to rebase your branch to make the CI happy 🤔. I should be able to trigger the test you added afterwards.

Thanks @MrFreezeex! Of course, rebased now, basic CI tests passed now. Would you kindly trigger the packet_debian12-custom-cni-helm test for me? I guess I can't start the manual test myself, right?

@MrFreezeex
Copy link
Member

Hmmm it seems that the pipeline for stuck 🤔, could you rebase again or amend last commit/push force to trigger it again. And yes correct I will be able to trigger your test manually.

@kukacz
Copy link
Contributor Author

kukacz commented Nov 14, 2023

@MrFreezeex Sure, rebased from upstream master again (no changes) and force-pushed amended commit. Thanks!

@MrFreezeex
Copy link
Member

Ok so the pipeline are not reported in github but actually launched, I triggered your new job but it seems to fail unfortunately :(: https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/5529779199

@MrFreezeex
Copy link
Member

MrFreezeex commented Nov 14, 2023

So now Cilium is crashing unfortunately: https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/5533156698

It shows this in the logs:

==== START logs for container config of pod kube-system/cilium-fhrdq ====
Running
level=info msg=Invoked duration="596.4µs" function="cmd.glob..func36 (build-config.go:32)" subsys=hive
level=info msg=Starting subsys=hive
level=info msg="Establishing connection to apiserver" host="https://10.233.0.1:443" subsys=k8s-client
level=info msg="Connected to apiserver" subsys=k8s-client
level=info msg="Start hook executed" duration=7.484664ms function="client.(*compositeClientset).onStart" subsys=hive
level=info msg="Reading configuration from config-map:kube-system/cilium-config" configSource="config-map:kube-system/cilium-config" subsys=option-resolver
level=info msg="Got 104 config pairs from source" configSource="config-map:kube-system/cilium-config" subsys=option-resolver
level=info msg="Reading configuration from cilium-node-config:kube-system/" configSource="cilium-node-config:kube-system/" subsys=option-resolver
level=info msg="Got 0 config pairs from source" configSource="cilium-node-config:kube-system/" subsys=option-resolver
level=info msg="Start hook executed" duration=7.432645ms function="cmd.(*buildConfig).onStart" subsys=hive
level=info msg=Stopping subsys=hive
level=info msg="Stop hook executed" duration="10.981µs" function="client.(*compositeClientset).onStop" subsys=hive
==== END logs for container config of pod kube-system/cilium-fhrdq ====
==== START logs for container mount-cgroup of pod kube-system/cilium-fhrdq ====
cp: cannot create regular file '/hostbin/cilium-mount': Permission denied
==== END logs for container mount-cgroup of pod kube-system/cilium-fhrdq ====
==== START logs for container apply-sysctl-overwrites of pod kube-system/cilium-fhrdq ====
Request log error: the server rejected our request for an unknown reason (get pods cilium-fhrdq)
==== END logs for container apply-sysctl-overwrites of pod kube-system/cilium-fhrdq ====
==== START logs for container mount-bpf-fs of pod kube-system/cilium-fhrdq ====
Request log error: the server rejected our request for an unknown reason (get pods cilium-fhrdq)
==== END logs for container mount-bpf-fs of pod kube-system/cilium-fhrdq ====
==== START logs for container clean-cilium-state of pod kube-system/cilium-fhrdq ====
Request log error: the server rejected our request for an unknown reason (get pods cilium-fhrdq)
==== END logs for container clean-cilium-state of pod kube-system/cilium-fhrdq ====
==== START logs for container install-cni-binaries of pod kube-system/cilium-fhrdq ====
Request log error: the server rejected our request for an unknown reason (get pods cilium-fhrdq)
==== END logs for container install-cni-binaries of pod kube-system/cilium-fhrdq ====
==== START logs for container cilium-agent of pod kube-system/cilium-fhrdq ====
Request log error: the server rejected our request for an unknown reason (get pods cilium-fhrdq)
==== END logs for container cilium-agent of pod kube-system/cilium-fhrdq ====

BTW adding this: https://github.com/kubernetes-sigs/kubespray/blob/master/tests/files/custom_cni/values.yaml#L11 is probably a good idea but it don't seems to be the reason of cilium failing though...

@kukacz
Copy link
Contributor Author

kukacz commented Nov 15, 2023

Hi @MrFreezeex, it seems that there might be a mount directory ownership issue. Hard to confirm it without access to the tested system. Also, it might be specific to the Debian image or even something else I'm not experiencing in my deployments which are actually using Ubuntu 22.04. And I had no issues deploying there with default chart values.

So now I can try changing the test packet to use Ubuntu image instead Debian, or perhaps apply some force with non-default securityContext.priviledged: true. Do I have an option how to test the change on an environment similar to the CI test one, including the Kubespray configuration used? I mean doing it in my virtual machine or similar, without stressing the CI infra and having to request someone to trigger the manual test for me?

Possibly related: #10499 and cilium/cilium#23838.

@MrFreezeex
Copy link
Member

Thanks for the investigation 🙏. So something have probably changed between Cilium 1.13 and 1.14 as the other version of custom_cni Cilium install 1.13.0 fine. The second issue suggested that /opt/cni/bin should be owned by root as well. I think we could change that, it's in roles/network_plugin/cni/tasks/main.yml. Also please add the CIDR in your value https://github.com/kubernetes-sigs/kubespray/blob/master/tests/files/custom_cni/values.yaml#L11 IIRC you will have issues with the test that check if all the pods are in the correct CIDR if you don't do it.

Copy link
Member

@MrFreezeex MrFreezeex left a comment

Choose a reason for hiding this comment

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

Thanks for the great work! Here is working gitlab CI job: https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/5542894180 :D
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2023
@kukacz
Copy link
Contributor Author

kukacz commented Nov 15, 2023

/assign @chadswen

@chadswen
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chadswen, kukacz, MrFreezeex

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2023
@k8s-ci-robot k8s-ci-robot merged commit f46910e into kubernetes-sigs:master Nov 15, 2023
64 checks passed
@kukacz kukacz deleted the custom-cni-helm branch November 16, 2023 07:35
@yankay yankay mentioned this pull request Dec 25, 2023
pedro-peter pushed a commit to pedro-peter/kubespray that referenced this pull request May 8, 2024
* Add helm support for custom_cni deployment

* Linting correction

* Ansible linting correction

* Add test packet with values

Signed-off-by: Lukáš Kubín <[email protected]>

* Add custom_cni configuration file with comments

Signed-off-by: Lukáš Kubín <[email protected]>

* Default values cleanup

Signed-off-by: Lukáš Kubín <[email protected]>

* Add details to custom_cni configuration file

Signed-off-by: Lukáš Kubín <[email protected]>

* Set correct yaml type of helm values

Signed-off-by: Lukáš Kubín <[email protected]>

* Set CNI filesystem ownership to root

Signed-off-by: Lukáš Kubín <[email protected]>

* Update cilium example parameter name

Signed-off-by: Lukáš Kubín <[email protected]>

---------

Signed-off-by: Lukáš Kubín <[email protected]>
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/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. 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.

4 participants