From d52a7d28c79c0ce1524710f7925c9aa09cbac6cc Mon Sep 17 00:00:00 2001 From: Artem Silenkov Date: Mon, 26 Sep 2016 22:02:11 +0300 Subject: [PATCH] [kubernetes][app] Modify calico.conf for new version - MTU added as param - Config refactored for calico ge 1.4 - MASTER_IP added Murano spawns VM with MTU set for 1400. We should use use lower setting for calico mesh network. Closes-Bug: #1626999 Change-Id: I77efb3ae2abaf7c2705524b6e8b78e83c30f34e3 --- .../package/Classes/KubernetesGatewayNode.yaml | 5 ++++- .../package/Classes/KubernetesMinionNode.yaml | 5 ++++- .../package/Resources/SetupCalicoNode.template | 5 +++-- .../package/Resources/scripts/10-calico.conf | 11 +++++++---- .../package/Resources/scripts/setupCalicoNode.sh | 8 +++++--- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml index cbf987a..9bba611 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml @@ -59,7 +59,10 @@ Methods: Body: - $._environment.reporter.report($this, 'Setup Calico network on gateway node {0}'.format($.instance.name)) - $resources: new(sys:Resources) - - $template: $resources.yaml('SetupCalicoNode.template').bind(dict(ip => $.getIp())) + - $template: $resources.yaml('SetupCalicoNode.template').bind(dict( + ip => $.getIp(), + masterIp => $._cluster.masterNode.getIp() + )) - $.instance.agent.call($template, $resources) - $._enableCalicoTraffic() diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml index 3da214c..3d0b003 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml @@ -67,7 +67,10 @@ Methods: Body: - $._environment.reporter.report($this, 'Setup Calico network on node {0}'.format($.instance.name)) - $resources: new(sys:Resources) - - $template: $resources.yaml('SetupCalicoNode.template').bind(dict(ip => $.getIp())) + - $template: $resources.yaml('SetupCalicoNode.template').bind(dict( + ip => $.getIp(), + masterIp => $._cluster.masterNode.getIp() + )) - $.instance.agent.call($template, $resources) - $._enableCalicoTraffic() diff --git a/Kubernetes/KubernetesCluster/package/Resources/SetupCalicoNode.template b/Kubernetes/KubernetesCluster/package/Resources/SetupCalicoNode.template index 44cc8c6..1d8bbef 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/SetupCalicoNode.template +++ b/Kubernetes/KubernetesCluster/package/Resources/SetupCalicoNode.template @@ -16,9 +16,10 @@ Name: Setup Calico on Node Parameters: ip: $ip + masterIp: $masterIp Body: | - return setupCalico('{0}'.format(args.ip)).stdout + return setupCalico('{0} {1}'.format(args.ip, args.masterIp)).stdout Scripts: setupCalico: @@ -31,4 +32,4 @@ Scripts: - 10-calico.conf Options: captureStdout: true - captureStderr: true \ No newline at end of file + captureStderr: true diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/10-calico.conf b/Kubernetes/KubernetesCluster/package/Resources/scripts/10-calico.conf index e25c61c..f57c527 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/scripts/10-calico.conf +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/10-calico.conf @@ -1,9 +1,12 @@ { - "name": "calico-k8s-network", + "name": "calico-k8s-net", "type": "calico", - "etcd_authority": "%%MASTER_IP%%:2379", - "log_level": "info", + "mtu": 1360, + "etcd_authority": "%%IP%%:2379", + "kubernetes": { + "k8s_api_root": "http://%%MASTER_IP%%:8080" + }, "ipam": { "type": "calico-ipam" } -} \ No newline at end of file +} diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupCalicoNode.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupCalicoNode.sh index 43061c9..39a9cc8 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupCalicoNode.sh +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupCalicoNode.sh @@ -1,8 +1,9 @@ #!/bin/bash # $1 - IP +# $2 - MASTER_IP -# TODO(asilenlov): we need to refactor this script +# TODO(asilenkov): we need to refactor this script # Install Calico on worker mkdir -p /opt/cni/bin @@ -19,7 +20,8 @@ cp -f systemd/calico-node.service /etc/systemd/system/ systemctl enable calico-node.service mkdir -p /etc/cni/net.d -sed -i.bak "s/%%MASTER_IP%%/$1/g" 10-calico.conf +sed -i.bak "s/%%MASTER_IP%%/$2/g" 10-calico.conf +sed -i.bak "s/%%IP%%/$1/g" 10-calico.conf cp -f 10-calico.conf /etc/cni/net.d -systemctl start calico-node \ No newline at end of file +systemctl start calico-node