forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix kube-router config generation (kubernetes-sigs#5531)
Signed-off-by: Arthur Outhenin-Chalandre <[email protected]>
- Loading branch information
1 parent
47991f7
commit 6b89d63
Showing
6 changed files
with
112 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: reset_kube_router | ||
command: /bin/true | ||
notify: | ||
- docker | delete kube-router containers | ||
- containerd | delete kube-router containers | ||
|
||
- name: docker | delete kube-router containers | ||
shell: "docker ps -af name=k8s_POD_kube-router* -q | xargs --no-run-if-empty docker rm -f" | ||
register: docker_kube_router_remove | ||
until: docker_kube_router_remove is succeeded | ||
retries: 5 | ||
when: container_manager in ["docker"] | ||
|
||
- name: containerd | delete kube-router containers | ||
shell: 'crictl pods --name kube-router* -q | xargs -I% --no-run-if-empty bash -c "crictl stopp % && crictl rmp %"' | ||
register: crictl_kube_router_remove | ||
until: crictl_kube_router_remove is succeeded | ||
retries: 5 | ||
when: container_manager in ["crio", "containerd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
roles/network_plugin/kube-router/templates/cni-conf.json.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name":"kubernetes", | ||
"cniVersion": "0.2.0", | ||
"type":"bridge", | ||
"bridge":"kube-bridge", | ||
"isDefaultGateway":true, | ||
{% if kube_router_support_hairpin_mode %} | ||
"hairpinMode":true, | ||
{% endif %} | ||
"ipam": { | ||
"type":"host-local" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
roles/network_plugin/kube-router/templates/kubeconfig.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
clusterCIDR: {{ kube_pods_subnet }} | ||
clusters: | ||
- name: cluster | ||
cluster: | ||
certificate-authority: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | ||
server: {{ kube_apiserver_endpoint }} | ||
users: | ||
- name: kube-router | ||
user: | ||
tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
contexts: | ||
- context: | ||
cluster: cluster | ||
user: kube-router | ||
name: kube-router-context | ||
current-context: kube-router-context |