Add mtu parameter to OOM heat template 87/72987/1
authorGary Wu <gary.i.wu@huawei.com>
Sun, 18 Nov 2018 01:14:38 +0000 (17:14 -0800)
committerGary Wu <gary.i.wu@huawei.com>
Sun, 18 Nov 2018 01:25:57 +0000 (17:25 -0800)
Change-Id: Ia478de1f3484fa9b32fe34cf0ec8a5defe118f2e
Issue-ID: INT-586
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
deployment/heat/onap-oom/k8s_vm_install.sh
deployment/heat/onap-oom/onap-oom.yaml
deployment/heat/onap-oom/parts/onap-oom-1.yaml
deployment/heat/onap-oom/parts/onap-oom-2.yaml
deployment/heat/onap-oom/rancher_vm_entrypoint.sh
deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh

index e5b843e..3e80f8e 100644 (file)
@@ -16,14 +16,22 @@ echo "__docker_version__" > /opt/config/docker_version.txt
 echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
 echo "__rancher_private_ip_addr__" > /opt/config/rancher_private_ip_addr.txt
 echo "__host_private_ip_addr__" > /opt/config/host_private_ip_addr.txt
+echo "__mtu__" > /opt/config/mtu.txt
 
 mkdir -p /etc/docker
 if [ ! -z "__docker_proxy__" ]; then
     cat > /etc/docker/daemon.json <<EOF
 {
+  "mtu": __mtu__,
   "insecure-registries" : ["__docker_proxy__"]
 }
 EOF
+else
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__
+}
+EOF
 fi
 if [ ! -z "__apt_proxy__" ]; then
     cat > /etc/apt/apt.conf.d/30proxy <<EOF
index 4699bca..e6845cc 100644 (file)
@@ -96,6 +96,10 @@ parameters:
     description: Set to "true" if you want to use a RAM disk for /dockerdata-nfs/.
     default: "false"
 
+  mtu:
+    type: number
+    default: 1500
+
 resources:
   random-str:
     type: OS::Heat::RandomString
@@ -217,6 +221,7 @@ resources:
             __helm_version__: { get_param: helm_version }
             __helm_deploy_delay__: { get_param: helm_deploy_delay }
             __use_ramdisk__: { get_param: use_ramdisk }
+            __mtu__: { get_param: mtu }
             __public_net_id__: { get_param: public_net_id }
             __oam_network_cidr__: { get_param: oam_network_cidr }
             __oam_network_id__: { get_resource: oam_network }
@@ -285,6 +290,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_01_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -354,6 +360,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_02_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -423,6 +430,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_03_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -492,6 +500,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_04_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -561,6 +570,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_05_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -630,6 +640,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_06_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -699,6 +710,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_07_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -768,6 +780,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_08_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -837,6 +850,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_09_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -906,6 +920,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_10_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -975,6 +990,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_11_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1044,6 +1060,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [k8s_12_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1113,6 +1130,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [etcd_1_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1182,6 +1200,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [etcd_2_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1251,6 +1270,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [etcd_3_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1320,6 +1340,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [orch_1_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
@@ -1389,6 +1410,7 @@ resources:
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [orch_2_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
index ba3933b..5f117ac 100644 (file)
@@ -93,6 +93,10 @@ parameters:
     description: Set to "true" if you want to use a RAM disk for /dockerdata-nfs/.
     default: "false"
 
+  mtu:
+    type: number
+    default: 1500
+
 resources:
   random-str:
     type: OS::Heat::RandomString
index 34fc0d7..721f3cd 100644 (file)
@@ -32,6 +32,7 @@
                 __rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
                 __rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
                 __host_private_ip_addr__: { get_attr: [${VM_TYPE}_${VM_NUM}_floating_ip, fixed_ip_address] }
+                __mtu__: { get_param: mtu }
               template:
                 get_file: k8s_vm_install.sh
         - path: /opt/k8s_vm_init.sh
index aced5df..bd39963 100644 (file)
@@ -35,6 +35,7 @@ echo "__rancher_agent_version__" > /opt/config/rancher_agent_version.txt
 echo "__kubectl_version__" > /opt/config/kubectl_version.txt
 echo "__helm_version__" > /opt/config/helm_version.txt
 echo "__helm_deploy_delay__" > /opt/config/helm_deploy_delay.txt
+echo "__mtu__" > /opt/config/mtu.txt
 
 cat <<EOF > /opt/config/integration-override.yaml
 __integration_override_yaml__
@@ -50,14 +51,20 @@ sed -i 's/\_\_docker_proxy__/__docker_proxy__/g' /opt/config/integration-overrid
 cp /opt/config/integration-override.yaml /root
 cat /root/integration-override.yaml
 
-echo `hostname -I` `hostname` >> /etc/hosts
 mkdir -p /etc/docker
 if [ ! -z "__docker_proxy__" ]; then
     cat > /etc/docker/daemon.json <<EOF
 {
+  "mtu": __mtu__,
   "insecure-registries" : ["__docker_proxy__"]
 }
 EOF
+else
+    cat > /etc/docker/daemon.json <<EOF
+{
+  "mtu": __mtu__
+}
+EOF
 fi
 if [ ! -z "__apt_proxy__" ]; then
     cat > /etc/apt/apt.conf.d/30proxy<<EOF
@@ -157,7 +164,7 @@ curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
 -X PUT \
 -H 'Accept: application/json' \
 -H 'Content-Type: application/json' \
--d '{"stacks":[{"type":"catalogTemplate", "answers":{"CONSTRAINT_TYPE":"required"}, "name":"kubernetes", "templateVersionId":"library:infra*k8s:52"}, {"type":"catalogTemplate", "name":"network-services", "templateId":"library:infra*network-services"}, {"type":"catalogTemplate", "name":"ipsec", "templateId":"library:infra*ipsec"}, {"type":"catalogTemplate", "name":"healthcheck", "templateId":"library:infra*healthcheck"}]}' \
+-d '{"stacks":[{"type":"catalogTemplate", "answers":{"CONSTRAINT_TYPE":"required"}, "name":"kubernetes", "templateVersionId":"library:infra*k8s:52"}, {"type":"catalogTemplate", "name":"network-services", "templateId":"library:infra*network-services"}, {"type":"catalogTemplate", "name":"ipsec", "templateId":"library:infra*ipsec", "answers":{"MTU":"__mtu__"}}, {"type":"catalogTemplate", "name":"healthcheck", "templateId":"library:infra*healthcheck"}]}' \
 "http://$RANCHER_IP:8080/v2-beta/projecttemplates/$TEMPLATE_ID"
 
 curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X POST -H 'Content-Type: application/json' -d '{ "name":"oom", "projectTemplateId":"'$TEMPLATE_ID'" }' "http://$RANCHER_IP:8080/v2-beta/projects" > project.json
index b9e4f10..61d5f9f 100755 (executable)
@@ -63,6 +63,7 @@ cat <<EOF
             __helm_version__: { get_param: helm_version }
             __helm_deploy_delay__: { get_param: helm_deploy_delay }
             __use_ramdisk__: { get_param: use_ramdisk }
+            __mtu__: { get_param: mtu }
             __public_net_id__: { get_param: public_net_id }
             __oam_network_cidr__: { get_param: oam_network_cidr }
             __oam_network_id__: { get_resource: oam_network }