Merge "[kubernetes][app] Modify calico.conf for new version"

This commit is contained in:
Jenkins 2016-09-27 08:48:32 +00:00 committed by Gerrit Code Review
commit 7403acc7b1
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