From 5ca09f16f8cd06c68c63b6084ec5f8ad9e3fea74 Mon Sep 17 00:00:00 2001 From: Artem Tiumentcev Date: Thu, 9 Feb 2017 18:22:25 +0300 Subject: [PATCH] Fixed issue re-setup the network Then you scale nodes down or up, network re-setup Change-Id: Iad68e5e7a7c3d197576aec980943aff40d4c2b50 --- .../Classes/KubernetesGatewayNode.yaml | 31 ++++++++++++------- .../package/Classes/KubernetesMinionNode.yaml | 31 ++++++++++++------- .../package/Resources/RemoveMinion.template | 2 +- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml index 9bba611..8e8f309 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesGatewayNode.yaml @@ -57,22 +57,29 @@ Methods: setupCalico: 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(), - masterIp => $._cluster.masterNode.getIp() - )) - - $.instance.agent.call($template, $resources) - - $._enableCalicoTraffic() + - If: not $.getAttr(calicoSetup, false) + Then: + - $._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(), + masterIp => $._cluster.masterNode.getIp() + )) + - $.instance.agent.call($template, $resources) + - $._enableCalicoTraffic() + - $.setAttr(calicoSetup, true) + setupFlannel: Body: - - $._environment.reporter.report($this, 'Setup Flannel network on gateway node {0}'.format($.instance.name)) - - $resources: new(sys:Resources) - - $template: $resources.yaml('SetupFlannelNode.template') - - $.instance.agent.call($template, $resources) + - If: not $.getAttr(flannelSetup, false) + Then: + - $._environment.reporter.report($this, 'Setup Flannel network on gateway node {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('SetupFlannelNode.template') + - $.instance.agent.call($template, $resources) + - $.setAttr(flannelSetup, true) setupNode: diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml index c49e014..3cfb8f6 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml @@ -65,22 +65,29 @@ Methods: setupCalico: 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(), - masterIp => $._cluster.masterNode.getIp() - )) - - $.instance.agent.call($template, $resources) - - $._enableCalicoTraffic() + - If: not $.getAttr(calicoSetup, false) + Then: + - $._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(), + masterIp => $._cluster.masterNode.getIp() + )) + - $.instance.agent.call($template, $resources) + - $._enableCalicoTraffic() + - $.setAttr(calicoSetup, true) + setupFlannel: Body: - - $._environment.reporter.report($this, 'Setup Flannel network on node {0}'.format($.instance.name)) - - $resources: new(sys:Resources) - - $template: $resources.yaml('SetupFlannelNode.template') - - $.instance.agent.call($template, $resources) + - If: not $.getAttr(flannelSetup, false) + Then: + - $._environment.reporter.report($this, 'Setup Flannel network on node {0}'.format($.instance.name)) + - $resources: new(sys:Resources) + - $template: $resources.yaml('SetupFlannelNode.template') + - $.instance.agent.call($template, $resources) + - $.setAttr(flannelSetup, true) setupNode: diff --git a/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template b/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template index 82851f1..012e534 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template +++ b/Kubernetes/KubernetesCluster/package/Resources/RemoveMinion.template @@ -18,7 +18,7 @@ Parameters: nodeId: $nodeId Body: | - removeMinion(args.nodeId) + removeMinion('{0}'.format(args.nodeId)) Scripts: removeMinion: