[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
This commit is contained in:
Artem Silenkov 2016-09-26 22:02:11 +03:00
parent 7fcb75dfe5
commit d52a7d28c7
5 changed files with 23 additions and 11 deletions

View File

@ -59,7 +59,10 @@ Methods:
Body: Body:
- $._environment.reporter.report($this, 'Setup Calico network on gateway node {0}'.format($.instance.name)) - $._environment.reporter.report($this, 'Setup Calico network on gateway node {0}'.format($.instance.name))
- $resources: new(sys:Resources) - $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) - $.instance.agent.call($template, $resources)
- $._enableCalicoTraffic() - $._enableCalicoTraffic()

View File

@ -67,7 +67,10 @@ Methods:
Body: Body:
- $._environment.reporter.report($this, 'Setup Calico network on node {0}'.format($.instance.name)) - $._environment.reporter.report($this, 'Setup Calico network on node {0}'.format($.instance.name))
- $resources: new(sys:Resources) - $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) - $.instance.agent.call($template, $resources)
- $._enableCalicoTraffic() - $._enableCalicoTraffic()

View File

@ -16,9 +16,10 @@ Name: Setup Calico on Node
Parameters: Parameters:
ip: $ip ip: $ip
masterIp: $masterIp
Body: | Body: |
return setupCalico('{0}'.format(args.ip)).stdout return setupCalico('{0} {1}'.format(args.ip, args.masterIp)).stdout
Scripts: Scripts:
setupCalico: setupCalico:
@ -31,4 +32,4 @@ Scripts:
- 10-calico.conf - 10-calico.conf
Options: Options:
captureStdout: true captureStdout: true
captureStderr: true captureStderr: true

View File

@ -1,9 +1,12 @@
{ {
"name": "calico-k8s-network", "name": "calico-k8s-net",
"type": "calico", "type": "calico",
"etcd_authority": "%%MASTER_IP%%:2379", "mtu": 1360,
"log_level": "info", "etcd_authority": "%%IP%%:2379",
"kubernetes": {
"k8s_api_root": "http://%%MASTER_IP%%:8080"
},
"ipam": { "ipam": {
"type": "calico-ipam" "type": "calico-ipam"
} }
} }

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# $1 - IP # $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 # Install Calico on worker
mkdir -p /opt/cni/bin mkdir -p /opt/cni/bin
@ -19,7 +20,8 @@ cp -f systemd/calico-node.service /etc/systemd/system/
systemctl enable calico-node.service systemctl enable calico-node.service
mkdir -p /etc/cni/net.d 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 cp -f 10-calico.conf /etc/cni/net.d
systemctl start calico-node systemctl start calico-node