Add a network plugin that duplicates "configureCBR0" functionality
This commit is contained in:
@@ -112,8 +112,8 @@ ADMISSION_CONTROL=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota,Pe
|
||||
# Optional: if set to true kube-up will automatically check for existing resources and clean them up.
|
||||
KUBE_UP_AUTOMATIC_CLEANUP=${KUBE_UP_AUTOMATIC_CLEANUP:-false}
|
||||
|
||||
# OpenContrail networking plugin specific settings
|
||||
NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail, flannel
|
||||
# Networking plugin specific settings.
|
||||
NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail, flannel, kubenet
|
||||
OPENCONTRAIL_TAG="${OPENCONTRAIL_TAG:-R2.20}"
|
||||
OPENCONTRAIL_KUBERNETES_TAG="${OPENCONTRAIL_KUBERNETES_TAG:-master}"
|
||||
OPENCONTRAIL_PUBLIC_SUBNET="${OPENCONTRAIL_PUBLIC_SUBNET:-10.1.0.0/16}"
|
||||
|
20
cluster/saltbase/salt/cni/init.sls
Normal file
20
cluster/saltbase/salt/cni/init.sls
Normal file
@@ -0,0 +1,20 @@
|
||||
/opt/cni:
|
||||
file.directory:
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 755
|
||||
- makedirs: True
|
||||
|
||||
# These are all available CNI network plugins.
|
||||
cni-tar:
|
||||
archive:
|
||||
- extracted
|
||||
- user: root
|
||||
- name: /opt/cni
|
||||
- makedirs: True
|
||||
- source: https://storage.googleapis.com/kubernetes-release/network-plugins/cni-09214926.tar.gz
|
||||
- tar_options: v
|
||||
- source_hash: md5=58f8631f912dd88be6a0920775db7274
|
||||
- archive_format: tar
|
||||
- if_missing: /opt/cni/bin
|
||||
|
@@ -3,5 +3,9 @@
|
||||
{% if pillar.get('e2e_storage_test_environment', '').lower() == 'true' -%}
|
||||
{% set e2e_opts = '-s devicemapper' -%}
|
||||
{% endif -%}
|
||||
DOCKER_OPTS="{{grains_opts}} {{e2e_opts}} --bridge=cbr0 --iptables=false --ip-masq=false --log-level=warn"
|
||||
{% set bridge_opts = "--bridge=cbr0" %}
|
||||
{% if pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
{% set bridge_opts = "" %}
|
||||
{% endif -%}
|
||||
DOCKER_OPTS="{{grains_opts}} {{e2e_opts}} {{bridge_opts}} --iptables=false --ip-masq=false --log-level=warn"
|
||||
DOCKER_NOFILE=1000000
|
||||
|
@@ -14,6 +14,8 @@
|
||||
# This is expected to be a short-term compromise.
|
||||
{% if pillar.get('network_provider', '').lower() == 'flannel' %}
|
||||
{% set allocate_node_cidrs = "--allocate-node-cidrs=false" -%}
|
||||
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
{% set allocate_node_cidrs = "--allocate-node-cidrs=true" -%}
|
||||
{% elif pillar['allocate_node_cidrs'] is defined -%}
|
||||
{% set allocate_node_cidrs = "--allocate-node-cidrs=" + pillar['allocate_node_cidrs'] -%}
|
||||
{% endif -%}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
|
||||
{% set debugging_handlers = "--enable-debugging-handlers=true" -%}
|
||||
|
||||
{% set reconcile_cidr_args = "" -%}
|
||||
{% if grains['roles'][0] == 'kubernetes-master' -%}
|
||||
{% if grains.cloud in ['aws', 'gce', 'vagrant', 'vsphere'] -%}
|
||||
|
||||
@@ -33,7 +34,8 @@
|
||||
# running on the master.
|
||||
{% if grains.kubelet_api_servers is defined -%}
|
||||
{% set api_servers_with_port = "--api-servers=https://" + grains.kubelet_api_servers -%}
|
||||
{% set master_kubelet_args = master_kubelet_args + "--register-schedulable=false --reconcile-cidr=false" -%}
|
||||
{% set master_kubelet_args = master_kubelet_args + "--register-schedulable=false" -%}
|
||||
{% set reconcile_cidr_args = "--reconcile-cidr=false" -%}
|
||||
{% else -%}
|
||||
{% set api_servers_with_port = "" -%}
|
||||
{% endif -%}
|
||||
@@ -116,8 +118,13 @@
|
||||
{% endif -%}
|
||||
|
||||
{% set pod_cidr = "" %}
|
||||
{% if grains['roles'][0] == 'kubernetes-master' and grains.get('cbr-cidr') %}
|
||||
{% set pod_cidr = "--pod-cidr=" + grains['cbr-cidr'] %}
|
||||
{% if grains['roles'][0] == 'kubernetes-master' %}
|
||||
{% if grains.get('cbr-cidr') %}
|
||||
{% set pod_cidr = "--pod-cidr=" + grains['cbr-cidr'] %}
|
||||
{% elif api_servers_with_port == '' and pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
# Kubelet standalone mode needs a PodCIDR since there is no controller-manager
|
||||
{% set pod_cidr = "--pod-cidr=10.76.0.0/16" %}
|
||||
{% endif -%}
|
||||
{% endif %}
|
||||
|
||||
{% set cpu_cfs_quota = "" %}
|
||||
@@ -133,6 +140,11 @@
|
||||
{% set network_plugin = "" -%}
|
||||
{% if pillar.get('network_provider', '').lower() == 'opencontrail' %}
|
||||
{% set network_plugin = "--network-plugin=opencontrail" %}
|
||||
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
{% set network_plugin = "--network-plugin=kubenet" -%}
|
||||
{% if reconcile_cidr_args == '' -%}
|
||||
{% set reconcile_cidr_args = "--reconcile-cidr=true" -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{% set kubelet_port = "" -%}
|
||||
@@ -146,4 +158,4 @@
|
||||
{% endif -%}
|
||||
|
||||
# test_args has to be kept at the end, so they'll overwrite any prior configuration
|
||||
DAEMON_ARGS="{{daemon_args}} {{api_servers_with_port}} {{debugging_handlers}} {{hostname_override}} {{cloud_provider}} {{config}} {{manifest_url}} --allow-privileged={{pillar['allow_privileged']}} {{log_level}} {{cluster_dns}} {{cluster_domain}} {{docker_root}} {{kubelet_root}} {{configure_cbr0}} {{non_masquerade_cidr}} {{cgroup_root}} {{system_container}} {{pod_cidr}} {{ master_kubelet_args }} {{cpu_cfs_quota}} {{network_plugin}} {{kubelet_port}} {{experimental_flannel_overlay}} {{test_args}}"
|
||||
DAEMON_ARGS="{{daemon_args}} {{api_servers_with_port}} {{debugging_handlers}} {{hostname_override}} {{cloud_provider}} {{config}} {{manifest_url}} --allow-privileged={{pillar['allow_privileged']}} {{log_level}} {{cluster_dns}} {{cluster_domain}} {{docker_root}} {{kubelet_root}} {{configure_cbr0}} {{non_masquerade_cidr}} {{cgroup_root}} {{system_container}} {{pod_cidr}} {{ master_kubelet_args }} {{cpu_cfs_quota}} {{network_plugin}} {{kubelet_port}} {{experimental_flannel_overlay}} {{ reconcile_cidr_args }} {{test_args}}"
|
||||
|
@@ -15,6 +15,8 @@ base:
|
||||
- docker
|
||||
{% if pillar.get('network_provider', '').lower() == 'flannel' %}
|
||||
- flannel
|
||||
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
- cni
|
||||
{% endif %}
|
||||
- helpers
|
||||
- cadvisor
|
||||
@@ -46,6 +48,8 @@ base:
|
||||
{% if pillar.get('network_provider', '').lower() == 'flannel' %}
|
||||
- flannel-server
|
||||
- flannel
|
||||
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
|
||||
- cni
|
||||
{% endif %}
|
||||
- kube-apiserver
|
||||
- kube-controller-manager
|
||||
|
@@ -97,8 +97,12 @@ octets=($(echo "$SERVICE_CLUSTER_IP_RANGE" | sed -e 's|/.*||' -e 's/\./ /g'))
|
||||
service_ip=$(echo "${octets[*]}" | sed 's/ /./g')
|
||||
MASTER_EXTRA_SANS="IP:${service_ip},DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.${DNS_DOMAIN},DNS:${MASTER_NAME}"
|
||||
|
||||
NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail, kubenet, etc
|
||||
if [ "${NETWORK_PROVIDER}" == "kubenet" ]; then
|
||||
CLUSTER_IP_RANGE="${CONTAINER_SUBNET}"
|
||||
fi
|
||||
|
||||
# OpenContrail networking plugin specific settings
|
||||
NETWORK_PROVIDER="${NETWORK_PROVIDER:-none}" # opencontrail
|
||||
OPENCONTRAIL_TAG="${OPENCONTRAIL_TAG:-R2.20}"
|
||||
OPENCONTRAIL_KUBERNETES_TAG="${OPENCONTRAIL_KUBERNETES_TAG:-master}"
|
||||
OPENCONTRAIL_PUBLIC_SUBNET="${OPENCONTRAIL_PUBLIC_SUBNET:-10.1.0.0/16}"
|
||||
|
@@ -57,7 +57,9 @@ echo "127.0.0.1 localhost" >> /etc/hosts # enables cmds like 'kubectl get pods'
|
||||
echo "$MASTER_IP $MASTER_NAME" >> /etc/hosts
|
||||
|
||||
# Configure the master network
|
||||
provision-network-master
|
||||
if [ "${NETWORK_PROVIDER}" != "kubenet" ]; then
|
||||
provision-network-master
|
||||
fi
|
||||
|
||||
write-salt-config kubernetes-master
|
||||
|
||||
|
@@ -53,7 +53,9 @@ for (( i=0; i<${#NODE_NAMES[@]}; i++)); do
|
||||
done
|
||||
|
||||
# Configure network
|
||||
provision-network-node
|
||||
if [ "${NETWORK_PROVIDER}" != "kubenet" ]; then
|
||||
provision-network-node
|
||||
fi
|
||||
|
||||
write-salt-config kubernetes-pool
|
||||
|
||||
|
@@ -38,6 +38,7 @@ instance_prefix: '$(echo "$INSTANCE_PREFIX" | sed -e "s/'/''/g")'
|
||||
admission_control: '$(echo "$ADMISSION_CONTROL" | sed -e "s/'/''/g")'
|
||||
enable_cpu_cfs_quota: '$(echo "$ENABLE_CPU_CFS_QUOTA" | sed -e "s/'/''/g")'
|
||||
network_provider: '$(echo "$NETWORK_PROVIDER" | sed -e "s/'/''/g")'
|
||||
cluster_cidr: '$(echo "$CLUSTER_IP_RANGE" | sed -e "s/'/''/g")'
|
||||
opencontrail_tag: '$(echo "$OPENCONTRAIL_TAG" | sed -e "s/'/''/g")'
|
||||
opencontrail_kubernetes_tag: '$(echo "$OPENCONTRAIL_KUBERNETES_TAG" | sed -e "s/'/''/g")'
|
||||
opencontrail_public_subnet: '$(echo "$OPENCONTRAIL_PUBLIC_SUBNET" | sed -e "s/'/''/g")'
|
||||
|
@@ -153,6 +153,7 @@ function echo-kube-env() {
|
||||
echo "NODE_NAMES=(${NODE_NAMES[@]})"
|
||||
echo "NODE_IPS=(${NODE_IPS[@]})"
|
||||
echo "CONTAINER_SUBNET='${CONTAINER_SUBNET}'"
|
||||
echo "CLUSTER_IP_RANGE='${CLUSTER_IP_RANGE}'"
|
||||
echo "MASTER_CONTAINER_SUBNET='${MASTER_CONTAINER_SUBNET}'"
|
||||
echo "NODE_CONTAINER_NETMASKS='${NODE_CONTAINER_NETMASKS[@]}'"
|
||||
echo "NODE_CONTAINER_SUBNETS=(${NODE_CONTAINER_SUBNETS[@]})"
|
||||
|
Reference in New Issue
Block a user