Backport of CSL-13047: fix for segmentation fault or SIGSEGV with consul-cni network plugin's code on 1.9.1 into release/1.7.x #5074
+311
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is copy auto-generated from #5062 to be assessed for backporting due to the inclusion of the label backport/1.7.x.
🚨
Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.
The person who merged in the original PR is:
@vdinesh4738
This person should resolve the merge-conflict(s) by either:
Manually completing the cherry picks into this branch
Creating a new branch and manually cherry-picking all commits being backported
merge conflict error: POST https://api.github.com/repos/hashicorp/consul-k8s/merges: 409 Merge conflict []
The below text is copied from the body of the original PR.
Provided fix for the segmentation fault or SIGSEGV with consul-cni network plugin's code, which is common across the platform till date on Multus cni extension.
Background:
As per jira, when we enable cni and Multus, and then deploy the application with the api-resource 'network-attachment-definition' annotation like 'k8s.v1.cni.cncf.io/networks': '[{"namespace": "consul", "name":"consul-consul-cni"}]' is attached to the application pod, the application pod fails to come up at pod init with error in
Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create pod network sandbox. (more detailed in the jira: https://hashicorp.atlassian.net/browse/CSL-13047
Root cause:
Creation of client with unavailable Kubeconfig or with the wrong Kubeconfig file name causing nil pointer dereference.
Fix:
Created the function to looks/fetch the latest Kubeconfig file and creates client.
Validation:
With the cni and Multus enabled: we update the iptables in the pod network ns.
With this fix : App is up and running and the iptables are updated in the pod network ns.