mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-09 05:29:28 -02:30
Upgrading weave to weave-kube
This commit is contained in:
104
roles/network_plugin/weave/templates/weave-kube.yml.j2
Normal file
104
roles/network_plugin/weave/templates/weave-kube.yml.j2
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: weave-net
|
||||
namespace: {{ system_namespace }}
|
||||
labels:
|
||||
version: {{ weave_version }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: weave-net
|
||||
annotations:
|
||||
scheduler.alpha.kubernetes.io/tolerations: |
|
||||
[
|
||||
{
|
||||
"key": "dedicated",
|
||||
"operator": "Equal",
|
||||
"value": "master",
|
||||
"effect": "NoSchedule"
|
||||
}
|
||||
]
|
||||
spec:
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
containers:
|
||||
- name: weave
|
||||
image: {{ weave_kube_image_repo }}:{{ weave_kube_image_tag }}
|
||||
imagePullPolicy: Always
|
||||
command:
|
||||
- /home/weave/launch.sh
|
||||
env:
|
||||
- name: IPALLOC_RANGE
|
||||
value: {{ kube_pods_subnet }}
|
||||
{% if weave_checkpoint_disable is defined %}
|
||||
- name: CHECKPOINT_DISABLE
|
||||
value: {{ weave_checkpoint_disable }}
|
||||
{% endif %}
|
||||
{% if weave_expect_npc is defined %}
|
||||
- name: EXPECT_NPC
|
||||
value: {{ weave_expect_npc }}
|
||||
{% endif %}
|
||||
{% if weave_kube_peers is defined %}
|
||||
- name: KUBE_PEERS
|
||||
value: {{ weave_kube_peers }}
|
||||
{% endif %}
|
||||
{% if weave_ipalloc_init is defined %}
|
||||
- name: IPALLOC_INIT
|
||||
value: {{ weave_ipalloc_init }}
|
||||
{% endif %}
|
||||
{% if weave_expose_ip is defined %}
|
||||
- name: WEAVE_EXPOSE_IP
|
||||
value: {{ weave_expose_ip }}
|
||||
{% endif %}
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 30
|
||||
httpGet:
|
||||
host: 127.0.0.1
|
||||
path: /status
|
||||
port: 6784
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: weavedb
|
||||
mountPath: /weavedb
|
||||
- name: cni-bin
|
||||
mountPath: /opt
|
||||
- name: cni-bin2
|
||||
mountPath: /host_home
|
||||
- name: cni-conf
|
||||
mountPath: /etc
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ weave_cpu_requests }}
|
||||
memory: {{ weave_memory_requests }}
|
||||
limits:
|
||||
cpu: {{ weave_cpu_limit }}
|
||||
memory: {{ weave_memory_limit }}
|
||||
- name: weave-npc
|
||||
image: {{ weave_npc_image_repo }}:{{ weave_npc_image_tag }}
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ weave_cpu_requests }}
|
||||
memory: {{ weave_memory_requests }}
|
||||
limits:
|
||||
cpu: {{ weave_cpu_limit }}
|
||||
memory: {{ weave_memory_limit }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: weavedb
|
||||
emptyDir: {}
|
||||
- name: cni-bin
|
||||
hostPath:
|
||||
path: /opt
|
||||
- name: cni-bin2
|
||||
hostPath:
|
||||
path: /home
|
||||
- name: cni-conf
|
||||
hostPath:
|
||||
path: /etc
|
||||
@@ -1,7 +0,0 @@
|
||||
WEAVE_DOCKER_ARGS="--memory={{ weave_memory_limit|regex_replace('Mi', 'M') }} --cpu-shares={{ weave_cpu_limit|regex_replace('m', '') }}"
|
||||
WEAVE_PEERS="{% for host in groups['k8s-cluster'] %}{{ hostvars[host]['access_ip'] | default(hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address'])) }}{% if not loop.last %} {% endif %}{% endfor %}"
|
||||
WEAVEPROXY_ARGS="--rewrite-inspect --without-dns"
|
||||
WEAVE_SUBNET="--ipalloc-range {{ kube_pods_subnet }}"
|
||||
{% if weave_password is defined %}
|
||||
WEAVE_PASSWORD="{{ weave_password }}"
|
||||
{% endif %}
|
||||
@@ -1,18 +0,0 @@
|
||||
[Unit]
|
||||
Description=Weave Network
|
||||
Documentation=http://docs.weave.works/weave/latest_release/
|
||||
Wants=docker.socket
|
||||
After=docker.service docker.socket
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/weave.env
|
||||
ExecStartPre=-{{ docker_bin_dir }}/docker rm -f weave
|
||||
ExecStartPre={{ bin_dir }}/weave launch-router \
|
||||
$WEAVE_SUBNET \
|
||||
$WEAVE_PEERS
|
||||
ExecStart={{ docker_bin_dir }}/docker attach weave
|
||||
ExecStop={{ bin_dir }}/weave stop
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,16 +0,0 @@
|
||||
[Unit]
|
||||
Documentation=http://docs.weave.works/
|
||||
Wants=docker.socket weave.service
|
||||
After=docker.service docker.socket weave.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
TimeoutStartSec=0
|
||||
EnvironmentFile=-/etc/weave.%H.env
|
||||
EnvironmentFile=-/etc/weave.env
|
||||
ExecStart={{ bin_dir }}/weave expose
|
||||
ExecStop={{ bin_dir }}/weave hide
|
||||
|
||||
[Install]
|
||||
WantedBy=weave-network.target
|
||||
@@ -1,17 +0,0 @@
|
||||
[Unit]
|
||||
Description=Weave proxy for Docker API
|
||||
Documentation=http://docs.weave.works/
|
||||
Wants=docker.socket
|
||||
After=docker.service docker.socket
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/weave.%H.env
|
||||
EnvironmentFile=-/etc/weave.env
|
||||
ExecStartPre=-{{ docker_bin_dir }}/docker rm -f weaveproxy
|
||||
ExecStartPre={{ bin_dir }}/weave launch-proxy $WEAVEPROXY_ARGS
|
||||
ExecStart={{ docker_bin_dir }}/docker attach weaveproxy
|
||||
Restart=on-failure
|
||||
ExecStop={{ bin_dir }}/weave stop-proxy
|
||||
|
||||
[Install]
|
||||
WantedBy=weave-network.target
|
||||
Reference in New Issue
Block a user