Update network-plugins to use portmap plugin (#1763)
Portmap allow to use hostPort with CNI plugins. Should fix #1675
This commit is contained in:
parent
d9879d8026
commit
6ec45b10f1
7 changed files with 70 additions and 48 deletions
|
@ -15,8 +15,8 @@
|
|||
|
||||
- name: Calico | Write Calico cni config
|
||||
template:
|
||||
src: "cni-calico.conf.j2"
|
||||
dest: "/etc/cni/net.d/10-calico.conf"
|
||||
src: "cni-calico.conflist.j2"
|
||||
dest: "/etc/cni/net.d/10-calico.conflist"
|
||||
owner: kube
|
||||
|
||||
- name: Calico | Create calico certs directory
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "calico-k8s-network",
|
||||
{% if cloud_provider is defined %}
|
||||
"nodename": "{{ calico_kubelet_name.stdout }}",
|
||||
{% else %}
|
||||
"nodename": "{{ ansible_hostname }}",
|
||||
{% endif %}
|
||||
"type": "calico",
|
||||
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
||||
"etcd_cert_file": "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem",
|
||||
"etcd_key_file": "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem",
|
||||
"etcd_ca_cert_file": "{{ etcd_cert_dir }}/ca.pem",
|
||||
"log_level": "info",
|
||||
"ipam": {
|
||||
"type": "calico-ipam"
|
||||
},
|
||||
{% if enable_network_policy %}
|
||||
"policy": {
|
||||
"type": "k8s"
|
||||
},
|
||||
{% endif %}
|
||||
{% if calico_mtu is defined and calico_mtu is number %}
|
||||
"mtu": {{ calico_mtu }},
|
||||
{% endif %}
|
||||
"kubernetes": {
|
||||
"kubeconfig": "{{ kube_config_dir }}/node-kubeconfig.yaml"
|
||||
}
|
||||
}
|
39
roles/network_plugin/calico/templates/cni-calico.conflist.j2
Normal file
39
roles/network_plugin/calico/templates/cni-calico.conflist.j2
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": "cni0",
|
||||
"cniVersion":"0.3.1",
|
||||
"plugins":[
|
||||
{
|
||||
{% if cloud_provider is defined %}
|
||||
"nodename": "{{ calico_kubelet_name.stdout }}",
|
||||
{% else %}
|
||||
"nodename": "{{ ansible_hostname }}",
|
||||
{% endif %}
|
||||
"type": "calico",
|
||||
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
||||
"etcd_cert_file": "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem",
|
||||
"etcd_key_file": "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem",
|
||||
"etcd_ca_cert_file": "{{ etcd_cert_dir }}/ca.pem",
|
||||
"log_level": "info",
|
||||
"ipam": {
|
||||
"type": "calico-ipam"
|
||||
},
|
||||
{% if enable_network_policy %}
|
||||
"policy": {
|
||||
"type": "k8s"
|
||||
},
|
||||
{% endif %}
|
||||
{% if calico_mtu is defined and calico_mtu is number %}
|
||||
"mtu": {{ calico_mtu }},
|
||||
{% endif %}
|
||||
"kubernetes": {
|
||||
"kubeconfig": "{{ kube_config_dir }}/node-kubeconfig.yaml"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type":"portmap",
|
||||
"capabilities":{
|
||||
"portMappings":true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
- name: Canal | Write Canal cni config
|
||||
template:
|
||||
src: "cni-canal.conf.j2"
|
||||
dest: "/etc/cni/net.d/10-canal.conf"
|
||||
src: "cni-canal.conflist.j2"
|
||||
dest: "/etc/cni/net.d/10-canal.conflist"
|
||||
owner: kube
|
||||
|
||||
- name: Canal | Create canal certs directory
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "canal-k8s-network",
|
||||
"type": "flannel",
|
||||
"delegate": {
|
||||
"type": "calico",
|
||||
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
||||
"log_level": "info",
|
||||
"policy": {
|
||||
"type": "k8s"
|
||||
},
|
||||
"kubernetes": {
|
||||
"kubeconfig": "{{ kube_config_dir }}/node-kubeconfig.yaml"
|
||||
}
|
||||
}
|
||||
}
|
26
roles/network_plugin/canal/templates/cni-canal.conflist.j2
Normal file
26
roles/network_plugin/canal/templates/cni-canal.conflist.j2
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "cni0",
|
||||
"cniVersion":"0.3.1",
|
||||
"plugins":[
|
||||
{
|
||||
"type": "flannel",
|
||||
"delegate": {
|
||||
"type": "calico",
|
||||
"etcd_endpoints": "{{ etcd_access_addresses }}",
|
||||
"log_level": "info",
|
||||
"policy": {
|
||||
"type": "k8s"
|
||||
},
|
||||
"kubernetes": {
|
||||
"kubeconfig": "{{ kube_config_dir }}/node-kubeconfig.yaml"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type":"portmap",
|
||||
"capabilities":{
|
||||
"portMappings":true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -10,7 +10,7 @@ metadata:
|
|||
data:
|
||||
cni-conf.json: |
|
||||
{
|
||||
"name":"cbr0",
|
||||
"name":"cni0",
|
||||
"cniVersion":"0.3.1",
|
||||
"plugins":[
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue