From 9b768e863d6c4a07d2caac357a7d6d05dd35f3e9 Mon Sep 17 00:00:00 2001 From: Bharat Kunwar Date: Fri, 26 Jul 2019 12:41:57 +0000 Subject: [PATCH] Add network config to stabilise multi-NIC scenario When there is more than one NIC attached to an instance, openstack cloud provider returns a random InternalIP back to the host resulting in instability with API server which only talks to a default interface. This patch incorporates the changes made in https://github.com/kubernetes/cloud-provider-openstack/pull/444 which enables OpenStack Cloud Controller Manager (OCCM) to respect the `internal-network-name` in cloud-config file which ensures that InternalIP remains stable. Uses a separate cloud-config file for OCCM to ensure in-tree Cinder volumes remain compatible. Conflicts: magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh magnum/drivers/k8s_fedora_atomic_v1/templates/kubemaster.yaml Change-Id: Idfa52ed2d512e7dc383a556371e896205dd542f9 Story: 2005333 Task: 30271 (cherry picked from commit 425fb0fa3232216de60f840c6aad58051a92300e) --- .../fragments/kube-apiserver-to-kubelet-role.sh | 2 +- .../fragments/write-heat-params-master.yaml | 1 + .../kubernetes/fragments/write-kube-os-config.sh | 12 +++++++++++- .../k8s_fedora_atomic_v1/templates/kubemaster.yaml | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh b/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh index 3e3038ee0f..9a9eba3d3c 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh @@ -292,7 +292,7 @@ spec: command: - /bin/openstack-cloud-controller-manager - --v=2 - - --cloud-config=/etc/kubernetes/cloud-config + - --cloud-config=/etc/kubernetes/cloud-config-occm - --cluster-name=${CLUSTER_UUID} - --use-service-account-credentials=true - --bind-address=127.0.0.1 diff --git a/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml index dd98cba9c6..1cbfd58e1e 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml +++ b/magnum/drivers/common/templates/kubernetes/fragments/write-heat-params-master.yaml @@ -29,6 +29,7 @@ write_files: ETCD_DISCOVERY_URL="$ETCD_DISCOVERY_URL" USERNAME="$USERNAME" PASSWORD="$PASSWORD" + CLUSTER_NETWORK="$CLUSTER_NETWORK" CLUSTER_SUBNET="$CLUSTER_SUBNET" TLS_DISABLED="$TLS_DISABLED" KUBE_DASHBOARD_ENABLED="$KUBE_DASHBOARD_ENABLED" diff --git a/magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh b/magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh index 30a884fd3f..978003de24 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/write-kube-os-config.sh @@ -10,7 +10,7 @@ if [ -n "${TRUST_ID}" ]; then # Generate a the configuration for Kubernetes services # to talk to OpenStack Neutron and Cinder - cat > ${KUBE_OS_CLOUD_CONFIG} < $KUBE_OS_CLOUD_CONFIG # Provide optional region parameter if it's set. if [ -n "${REGION_NAME}" ]; then @@ -36,4 +38,12 @@ EOF # backwards compatibility, some apps may expect this file from previous magnum versions. cp ${KUBE_OS_CLOUD_CONFIG} /etc/kubernetes/kube_openstack_config + + # Append additional networking config to config file provided to openstack + # cloud controller manager (not supported by in-tree Cinder). + cat > ${KUBE_OS_CLOUD_CONFIG}-occm <