move network-environment template into node role, required by kubelet

This commit is contained in:
Smaine Kahlouch 2015-12-29 12:10:49 +01:00 committed by ant31
parent e378f4fb14
commit c9d9ccf025
4 changed files with 11 additions and 14 deletions

View file

@ -46,10 +46,3 @@
register: calico_token register: calico_token
when: kube_network_plugin == "calico" when: kube_network_plugin == "calico"
delegate_to: "{{ groups['kube-master'][0] }}" delegate_to: "{{ groups['kube-master'][0] }}"
- name: tokens | Add KUBE_AUTH_TOKEN for calico
lineinfile:
regexp: "^KUBE_AUTH_TOKEN=.*$"
line: "KUBE_AUTH_TOKEN={{ calico_token.content|b64decode }}"
dest: "/etc/network-environment"
when: kube_network_plugin == "calico"

View file

@ -42,6 +42,9 @@
src: manifests/kube-proxy.manifest.j2 src: manifests/kube-proxy.manifest.j2
dest: "{{ kube_manifest_dir }}/kube-proxy.manifest" dest: "{{ kube_manifest_dir }}/kube-proxy.manifest"
- name: Write network-environment
template: src=network-environment.j2 dest=/etc/network-environment mode=640
- name: Enable kubelet - name: Enable kubelet
service: service:
name: kubelet name: kubelet

View file

@ -13,11 +13,12 @@ KUBERNETES_MASTER={{ hostvars[groups['kube-master'][0]]['ip'] | default(hostvars
# Location of etcd cluster used by Calico. By default, this uses the etcd # Location of etcd cluster used by Calico. By default, this uses the etcd
# instance running on the Kubernetes Master # instance running on the Kubernetes Master
{% if inventory_hostname in groups['etcd'] %}
ETCD_AUTHORITY="127.0.0.1:2379" ETCD_AUTHORITY="127.0.0.1:2379"
{% else %} #{% if inventory_hostname in groups['etcd'] %}
ETCD_AUTHORITY="127.0.0.1:23799" #ETCD_AUTHORITY="127.0.0.1:2379"
{% endif %} #{% else %}
#ETCD_AUTHORITY="127.0.0.1:23799"
#{% endif %}
# The kubernetes-apiserver location - used by the calico plugin # The kubernetes-apiserver location - used by the calico plugin
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %} {% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
@ -28,3 +29,6 @@ KUBE_API_ROOT=https://{{ hostvars[groups['kube-master'][0]]['ip'] | default(host
{% else %} {% else %}
FLANNEL_ETCD_PREFIX="--etcd-prefix=/{{ cluster_name }}/network" FLANNEL_ETCD_PREFIX="--etcd-prefix=/{{ cluster_name }}/network"
{% endif %} {% endif %}
{% if calico_token is defined | default('') %}
KUBE_AUTH_TOKEN={{ calico_token.content|b64decode }}
{% endif %}

View file

@ -4,9 +4,6 @@
when: ( kube_network_plugin is defined and kube_network_plugin == "calico" and kube_network_plugin == "flannel" ) or when: ( kube_network_plugin is defined and kube_network_plugin == "calico" and kube_network_plugin == "flannel" ) or
kube_network_plugin is not defined kube_network_plugin is not defined
- name: Write network-environment
template: src=network-environment.j2 dest=/etc/network-environment mode=640
- include: flannel.yml - include: flannel.yml
when: kube_network_plugin == "flannel" when: kube_network_plugin == "flannel"