aboutsummaryrefslogtreecommitdiffstats
path: root/deployment
diff options
context:
space:
mode:
Diffstat (limited to 'deployment')
-rw-r--r--deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json422
-rw-r--r--deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json11
-rw-r--r--deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh54
-rw-r--r--deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh190
-rw-r--r--deployment/heat/onap-oom/k8s_vm_entrypoint.sh3
-rw-r--r--deployment/heat/onap-oom/onap-oom.yaml50
-rw-r--r--deployment/heat/onap-oom/parts/onap-oom-1.yaml34
-rw-r--r--deployment/heat/onap-oom/parts/onap-oom-2.yaml1
-rw-r--r--deployment/heat/onap-oom/rancher_vm_entrypoint.sh47
-rwxr-xr-xdeployment/heat/onap-oom/scripts/deploy.sh57
-rwxr-xr-xdeployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh11
11 files changed, 844 insertions, 36 deletions
diff --git a/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json b/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json
new file mode 100644
index 000000000..79dda59e8
--- /dev/null
+++ b/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json
@@ -0,0 +1,422 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "centosOSVersion": {
+ "type": "string",
+ "defaultValue": "16.04.0-LTS",
+ "allowedValues": [
+ "12.04.5-LTS","14.04.5-LTS","15.10","16.04.0-LTS"
+ ],
+ "metadata": {
+ "description": "The OS"
+ }
+ },
+ "numberOfVms": {
+ "type": "int",
+ "defaultValue": 5,
+ "minValue": 1,
+ "maxValue": 15,
+ "metadata": {
+ "description": "Number of VMs to provision"
+ }
+ },
+ "privateIPAddress": {
+ "type": "string",
+ "defaultValue": "10.0.0.2",
+ "metadata": {
+ "description": "Static Private IP will be assigned to the machine"
+ }
+ },
+ "masterScriptName": {
+ "type": "string",
+ "metadata": {
+ "description": "entrypoint script name for k8s master"
+ }
+ },
+ "nodeScriptName": {
+ "type": "string",
+ "metadata": {
+ "description": "entrypoint script name for k8s node"
+ }
+ },
+ "vmSize": {
+ "type": "string",
+ "defaultValue": "Standard_D14_v2",
+ "allowedValues": [
+ "Standard_E8_v3",
+ "Standard_E2_v3",
+ "Standard_D1",
+ "Standard_D16s_v3",
+ "Standard_D4_v2",
+ "Standard_D32s_v3",
+ "Standard_E16_v3",
+ "Standard_D14_v2",
+ "Standard_D13_v2",
+ "Standard_E64_v3"
+ ],
+ "metadata": {
+ "description": "VM size"
+ }
+ },
+ "dnslabel": {
+ "type": "string",
+ "metadata": {
+ "description": "Unique DNS label to assign DNS name"
+ }
+ }
+
+ },
+ "variables": {
+ "dnsLabelPrefix": "[concat('dns-',uniquestring(resourceGroup().id))]",
+ "customData": [ "userdata.txt" ],
+ "vmName": "[concat('k8s-host-', substring(uniquestring(resourceGroup().id),0,4))]",
+ "adminUsername": "[concat('ubuntu')]",
+ "adminPassword": "Qwertyuiop@@1",
+ "sshKeyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5zrmH1dHgXbNwP2qbNVySScnFVcEP25HBd2VJu2PiJLDhwgHj44Lj9ZvLyRFCetqd8CAKnLV5qy37rwaCtlH/t8Qb36cUGPhegxpF2++uTY0b6K7Zb6hEMBNw3J1z+GU7OoVwZJhsNAw4t8/7WWmJA4Owo99TJkEKvhCYjBCLoC5sIvG/lJsaFIG8A5MjnBlwgSZ3FsUU+aY1KYZUztodkyv7laDMOinwSvJggKrCugsqZdVo5bhmcSFbqrZa/a/wgqeok+79W0/DLh5Tlf7By46ASDKGnFlwDshPu++I3KMU3eRz0rJLOKeIUCz7k80X0WJ6BrSS7l+IrpDXV1M5 ubuntu@aria",
+ "storageAccountName": "[concat('salinuxvm', substring(uniquestring(resourceGroup().id),0,4))]",
+ "imagePublisher": "Canonical",
+ "imageOffer": "UbuntuServer",
+ "nicName": "[concat('VMNic-',variables('vmName'))]",
+ "dnsPrefix": "[concat(variables('dnsLabelPrefix'),'-',substring(uniquestring(resourceGroup().id),0,4))]",
+ "addressPrefix": "10.0.0.0/16",
+ "subnetName": "Subnet",
+ "subnetPrefix": "10.0.0.0/24",
+ "storageAccountType": "Standard_LRS",
+ "publicIPAddressType": "Dynamic",
+ "publicIPAddressName": "nicLoop100",
+ "virtualNetworkName": "[concat('VNET-',variables('vmName'))]",
+ "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets/', variables('virtualNetworkName'), variables('subnetName'))]",
+ "networkSecurityGroupName": "[concat(variables('vmName'), '_obrien_local_nsg')]",
+ "sshKeyPathRoot": "[concat('/root/','/.ssh/authorized_keys')]",
+ "sshKeyPath": "[concat('/home/',variables('adminUsername'),'/.ssh/authorized_keys')]",
+ "availabilitySetName": "[concat('availabilitySet-',substring(uniquestring(resourceGroup().id),0,4))]"
+ },
+ "resources": [
+ {
+ "type": "Microsoft.Compute/availabilitySets",
+ "name": "[variables('availabilitySetName')]",
+ "apiVersion": "2016-04-30-preview",
+ "location": "[resourceGroup().location]",
+ "properties": {
+ "managed": true,
+ "platformFaultDomainCount": 3,
+ "platformUpdateDomainCount": 3
+ }
+ },
+ {
+ "type": "Microsoft.Storage/storageAccounts",
+ "name": "[variables('storageAccountName')]",
+ "apiVersion": "2017-06-01",
+ "location": "[resourceGroup().location]",
+ "sku": {
+ "name": "[variables('storageAccountType')]"
+ },
+ "kind": "Storage",
+ "properties": {}
+ },
+ {
+ "apiVersion": "2017-03-01",
+ "type": "Microsoft.Network/networkSecurityGroups",
+ "name": "[variables('networkSecurityGroupName')]",
+ "location": "[resourceGroup().location]",
+ "tags": {
+ "displayName": "NSG"
+ },
+ "properties": {
+ "securityRules": [
+ {
+ "name": "SSHAllowAny",
+ "properties": {
+ "description": "SSHAllowAny",
+ "protocol": "TCP",
+ "sourcePortRange": "*",
+ "destinationPortRange": "22",
+ "sourceAddressPrefix": "*",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 100,
+ "direction": "Inbound"
+ }
+ },
+ {
+ "name": "DockerAllowAny",
+ "properties": {
+ "description": "DockerAllowAny",
+ "protocol": "TCP",
+ "sourcePortRange": "*",
+ "destinationPortRange": "2376",
+ "sourceAddressPrefix": "*",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 110,
+ "direction": "Inbound"
+ }
+ },
+ {
+ "name": "port500-UdpAllowAny",
+ "properties": {
+ "description": "port500-udpAllowAny",
+ "protocol": "UDP",
+ "sourcePortRange": "*",
+ "destinationPortRange": "500",
+ "sourceAddressPrefix": "*",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 120,
+ "direction": "Inbound"
+ }
+ },
+ {
+ "name": "port4500-UdpAllowAny",
+ "properties": {
+ "description": "port4500-udpAllowAny",
+ "protocol": "UDP",
+ "sourcePortRange": "*",
+ "destinationPortRange": "4500",
+ "sourceAddressPrefix": "*",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 130,
+ "direction": "Inbound"
+ }
+ },
+
+ {
+ "name": "port_10249-10255_172",
+ "properties": {
+ "description": "port_10249-10255_172",
+ "protocol": "*",
+ "sourcePortRange": "*",
+ "destinationPortRange": "10249-10255",
+ "sourceAddressPrefix": "*",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 140,
+ "direction": "Inbound"
+ }
+ },
+ {
+ "name": "in-rule",
+ "properties": {
+ "description": "All in",
+ "protocol": "Tcp",
+ "sourcePortRange": "*",
+ "destinationPortRange": "*",
+ "sourceAddressPrefix": "Internet",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 170,
+ "direction": "Inbound"
+ }
+ },
+ {
+ "name": "block-8080",
+ "properties": {
+ "description": "block-8080",
+ "protocol": "Tcp",
+ "sourcePortRange": "8080",
+ "destinationPortRange": "*",
+ "sourceAddressPrefix": "Internet",
+ "destinationAddressPrefix": "*",
+ "access": "Deny",
+ "priority": 104,
+ "direction": "Outbound"
+ }
+ },
+ {
+ "name": "out-rule",
+ "properties": {
+ "description": "All out",
+ "protocol": "Tcp",
+ "sourcePortRange": "*",
+ "destinationPortRange": "*",
+ "sourceAddressPrefix": "Internet",
+ "destinationAddressPrefix": "*",
+ "access": "Allow",
+ "priority": 110,
+ "direction": "Outbound"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "apiVersion": "2017-04-01",
+ "type": "Microsoft.Network/virtualNetworks",
+ "name": "[variables('virtualNetworkName')]",
+ "location": "[resourceGroup().location]",
+ "dependson": [
+ "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
+ ],
+ "properties": {
+ "addressSpace": {
+ "addressPrefixes": [
+ "[variables('addressPrefix')]"
+ ]
+ },
+ "subnets": [
+ {
+ "name": "[variables('subnetName')]",
+ "properties": {
+ "addressPrefix": "[variables('subnetPrefix')]",
+ "networkSecurityGroup": {
+ "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "apiVersion": "2017-08-01",
+ "type": "Microsoft.Network/networkInterfaces",
+ "name": "[concat(variables('nicName'), copyindex())]",
+ "location": "[resourceGroup().location]",
+ "copy": {
+ "name": "nicLoop",
+ "count": "[parameters('numberOfVms')]"
+ },
+ "dependsOn": [
+ "[resourceId('Microsoft.Network/publicIPAddresses/', concat('nicLoop',copyIndex(100)))]",
+ "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
+ ],
+ "properties": {
+ "ipConfigurations": [
+ {
+ "name": "ipconfig1",
+ "properties": {
+ "privateIPAllocationMethod": "Static",
+ "privateIPAddress": "[concat(parameters('privateIPAddress'),copyindex())]",
+ "publicIPAddress": {
+ "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat('nicLoop',copyIndex(100)))]"
+ },
+ "subnet": {
+ "id": "[variables('subnetRef')]"
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "apiVersion": "2017-04-01",
+ "type": "Microsoft.Network/publicIPAddresses",
+ "name": "[concat('nicLoop',copyIndex(100))]",
+ "location": "[resourceGroup().location]",
+ "copy": {
+ "name": "nicLoop",
+ "count": "[parameters('numberOfVms')]"
+ },
+ "properties": {
+ "publicIPAllocationMethod": "Dynamic",
+ "dnsSettings": {
+ "domainNameLabel": "[concat(variables('vmName'),parameters('dnslabel'), copyIndex(1000))]"
+ }
+ }
+ },
+ {
+ "apiVersion": "2017-03-30",
+ "type": "Microsoft.Compute/virtualMachines",
+ "name": "[concat(variables('vmName'), copyindex())]",
+ "copy": {
+ "name": "virtualMachineLoop",
+ "count": "[parameters('numberOfVms')]"
+ },
+ "location": "[resourceGroup().location]",
+ "dependsOn": [
+ "nicLoop",
+ "[concat('Microsoft.Compute/availabilitySets/',variables('availabilitySetName'))]"
+ ],
+ "properties": {
+ "hardwareProfile": {
+ "vmSize": "[parameters('vmSize')]"
+ },
+ "availabilitySet": {
+ "id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
+ },
+ "osProfile": {
+ "computerName": "[concat(variables('vmName'), copyindex())]",
+ "adminUsername": "[variables('adminUsername')]",
+ "adminPassword": "[variables('adminPassword')]",
+ "linuxConfiguration": {
+ "disablePasswordAuthentication": false,
+ "ssh": {
+ "publicKeys": [
+ {
+ "path": "[variables('sshKeyPath')]",
+ "keyData": "[variables('sshKeyData')]"
+ }
+ ]
+ }
+ }
+ },
+ "storageProfile": {
+ "imageReference": {
+ "publisher": "[variables('imagePublisher')]",
+ "offer": "[variables('imageOffer')]",
+ "sku": "[parameters('centosOSVersion')]",
+ "version": "latest"
+ },
+ "osDisk": {
+ "diskSizeGB": 127,
+ "createOption": "FromImage"
+ }
+ },
+ "networkProfile": {
+ "networkInterfaces": [
+ {
+ "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'),copyindex()))]"
+ }
+ ]
+ },
+ "diagnosticsProfile": {
+ "bootDiagnostics": {
+ "enabled": true,
+ "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
+ }
+ }
+ }
+ },
+ {
+ "apiVersion": "2015-06-15",
+ "type": "Microsoft.Compute/virtualMachines/extensions",
+ "name": "[concat(variables('vmName'), '0','/onap')]",
+ "location": "[resourceGroup().location]",
+ "dependsOn": ["virtualMachineLoop"],
+ "properties": {
+ "publisher": "Microsoft.Azure.Extensions",
+ "type": "CustomScript",
+ "typeHandlerVersion": "2.0",
+ "autoUpgradeMinorVersion": true,
+ "settings": {
+ "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-rancher-server.sh;hb=refs/heads/master" ],
+ "commandToExecute": "[concat('./' , parameters('masterScriptName'),' ',reference(variables('publicIPAddressName')).dnsSettings.fqdn,' ',parameters('privateIPAddress'),' ',parameters('numberOfVms'))]"
+ }
+ }
+ },
+ {
+ "apiVersion": "2015-06-15",
+ "type": "Microsoft.Compute/virtualMachines/extensions",
+ "name": "[concat(variables('vmName'), copyindex(1),'/onap')]",
+ "copy": {
+ "name": "virtualMachineExtnLoop",
+ "count": "[sub(parameters('numberOfVms'),1)]"
+ },
+ "location": "[resourceGroup().location]",
+ "dependsOn": [
+ "virtualMachineLoop"
+ ],
+ "properties": {
+ "publisher": "Microsoft.Azure.Extensions",
+ "type": "CustomScript",
+ "typeHandlerVersion": "2.0",
+ "autoUpgradeMinorVersion": true,
+ "settings": {
+ "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-k8s-node.sh;hb=refs/heads/master" ],
+ "commandToExecute": "[concat('./' , parameters('nodeScriptName'),' ',concat(parameters('privateIPAddress'),'0'))]"
+ }
+ }
+ }
+ ]
+}
diff --git a/deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json b/deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json
new file mode 100644
index 000000000..081ef7ffc
--- /dev/null
+++ b/deployment/Azure_ARM_Template/arm_cluster_deploy_parameters.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "numberOfVms": { "value": 12 },
+ "vmSize": { "value": "Standard_D4_v2" },
+ "masterScriptName": { "value": "azure-rancher-server.sh" },
+ "nodeScriptName": { "value": "azure-k8s-node.sh" },
+ "dnslabel": { "value": "ranchercluster" }
+ }
+}
diff --git a/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh b/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh
new file mode 100644
index 000000000..919d14806
--- /dev/null
+++ b/deployment/Azure_ARM_Template/scripts/azure-k8s-node.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+DOCKER_VERSION=17.03
+KUBECTL_VERSION=1.8.10
+HELM_VERSION=2.9.1
+
+# setup root access - default login: oom/oom - comment out to restrict access too ssh key only
+sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+service sshd restart
+echo -e "oom\noom" | passwd root
+
+apt-get update
+curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh
+mkdir -p /etc/systemd/system/docker.service.d/
+cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
+[Service]
+ExecStart=
+ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001
+EOF
+systemctl daemon-reload
+systemctl restart docker
+apt-mark hold docker-ce
+
+#IP_ADDY=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
+#HOSTNAME=`hostname`
+
+#echo "$IP_ADDY $HOSTNAME" >> /etc/hosts
+
+docker login -u docker -p docker nexus3.onap.org:10001
+
+sudo apt-get install make -y
+
+sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
+sudo chmod +x ./kubectl
+sudo mv ./kubectl /usr/local/bin/kubectl
+sudo mkdir ~/.kube
+wget http://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo tar -zxvf helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo mv linux-amd64/helm /usr/local/bin/helm
+
+# install nfs
+sudo apt-get install nfs-common -y
+
+MASTER_IP=$1
+
+#Create NFS directory
+sudo mkdir -p /dockerdata-nfs
+
+#Mount the remote NFS directory to the local one
+sudo mount $MASTER_IP:/dockerdata-nfs /dockerdata-nfs/
+echo "$MASTER_IP:/dockerdata-nfsĀ /dockerdata-nfs nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0" | sudo tee -a /etc/fstab
+
+exit 0
diff --git a/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh b/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh
new file mode 100644
index 000000000..1c4373c4d
--- /dev/null
+++ b/deployment/Azure_ARM_Template/scripts/azure-rancher-server.sh
@@ -0,0 +1,190 @@
+#!/bin/bash
+
+set -x
+
+DOCKER_VERSION=17.03
+RANCHER_VERSION=1.6.14
+KUBECTL_VERSION=1.8.10
+HELM_VERSION=2.9.1
+
+# setup root access - default login: oom/oom - comment out to restrict access too ssh key only
+sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
+service sshd restart
+echo -e "oom\noom" | passwd root
+
+apt-get update
+curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh
+mkdir -p /etc/systemd/system/docker.service.d/
+cat > /etc/systemd/system/docker.service.d/docker.conf << EOF
+[Service]
+ExecStart=
+ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001
+EOF
+systemctl daemon-reload
+systemctl restart docker
+apt-mark hold docker-ce
+
+#IP_ADDY=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'`
+#HOSTNAME=`hostname`
+
+#echo "$IP_ADDY $HOSTNAME" >> /etc/hosts
+
+docker login -u docker -p docker nexus3.onap.org:10001
+
+sudo apt-get install make -y
+
+sudo docker run -d --restart=unless-stopped -p 8080:8080 --name rancher_server rancher/server:v$RANCHER_VERSION
+sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/v$KUBECTL_VERSION/bin/linux/amd64/kubectl
+sudo chmod +x ./kubectl
+sudo mv ./kubectl /usr/local/bin/kubectl
+sudo mkdir ~/.kube
+wget http://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo tar -zxvf helm-v${HELM_VERSION}-linux-amd64.tar.gz
+sudo mv linux-amd64/helm /usr/local/bin/helm
+
+# nfs server
+sudo apt-get install nfs-kernel-server -y
+
+sudo mkdir -p /nfs_share
+sudo chown nobody:nogroup /nfs_share/
+
+
+sudo mkdir -p /dockerdata-nfs
+sudo chmod 777 -R /dockerdata-nfs
+sudo chown nobody:nogroup /dockerdata-nfs/
+
+NFS_EXP="*(rw,sync,no_root_squash,no_subtree_check) "
+
+echo "/dockerdata-nfs "$NFS_EXP | sudo tee -a /etc/exports
+
+#Restart the NFS service
+sudo exportfs -a
+sudo systemctl restart nfs-kernel-server
+
+echo "wait before installing rancher server"
+sleep 60
+
+# Create ONAP environment on rancher and register the nodes...
+SERVER=$1
+PRIVATE_IP=$2
+NODE_COUNT=$3
+
+echo "SERVER: ${SERVER}"
+echo "PRIVATE_IP: ${PRIVATE_IP}"
+echo "NODE_COUNT: ${NODE_COUNT}"
+#install sshpass to login to the k8s nodes to run rancher agent
+sudo apt-get install sshpass
+
+# create kubernetes environment on rancher using cli
+RANCHER_CLI_VER=0.6.7
+KUBE_ENV_NAME='onap'
+wget https://releases.rancher.com/cli/v${RANCHER_CLI_VER}/rancher-linux-amd64-v${RANCHER_CLI_VER}.tar.gz
+sudo tar -zxvf rancher-linux-amd64-v${RANCHER_CLI_VER}.tar.gz
+sudo cp rancher-v${RANCHER_CLI_VER}/rancher .
+sudo chmod +x ./rancher
+
+sudo apt install jq -y
+echo "wait for rancher server container to finish - 3 min"
+sleep 60
+echo "2 more min"
+sleep 60
+echo "1 min left"
+sleep 60
+echo "get public and private tokens back to the rancher server so we can register the client later"
+API_RESPONSE=`curl -s 'http://$SERVER:8080/v2-beta/apikey' -d '{"type":"apikey","accountId":"1a1","name":"autoinstall","description":"autoinstall","created":null,"kind":null,"removeTime":null,"removed":null,"uuid":null}'`
+# Extract and store token
+echo "API_RESPONSE: $API_RESPONSE"
+KEY_PUBLIC=`echo $API_RESPONSE | jq -r .publicValue`
+KEY_SECRET=`echo $API_RESPONSE | jq -r .secretValue`
+echo "publicValue: $KEY_PUBLIC secretValue: $KEY_SECRET"
+
+export RANCHER_URL=http://${SERVER}:8080
+export RANCHER_ACCESS_KEY=$KEY_PUBLIC
+export RANCHER_SECRET_KEY=$KEY_SECRET
+./rancher env ls
+echo "wait 60 sec for rancher environments can settle before we create the onap kubernetes one"
+sleep 60
+
+echo "Creating kubernetes environment named ${KUBE_ENV_NAME}"
+./rancher env create -t kubernetes $KUBE_ENV_NAME > kube_env_id.json
+PROJECT_ID=$(<kube_env_id.json)
+echo "env id: $PROJECT_ID"
+export RANCHER_HOST_URL=http://${SERVER}:8080/v1/projects/$PROJECT_ID
+echo "you should see an additional kubernetes environment usually with id 1a7"
+./rancher env ls
+# optionally disable cattle env
+
+# add host registration url
+# https://github.com/rancher/rancher/issues/2599
+# wait for REGISTERING to ACTIVE
+echo "sleep 60 to wait for REG to ACTIVE"
+./rancher env ls
+sleep 30
+echo "check on environments again before registering the URL response"
+./rancher env ls
+sleep 30
+REG_URL_RESPONSE=`curl -X POST -u $KEY_PUBLIC:$KEY_SECRET -H 'Accept: application/json' -H 'ContentType: application/json' -d '{"name":"$SERVER"}' "http://$SERVER:8080/v1/projects/$PROJECT_ID/registrationtokens"`
+echo "REG_URL_RESPONSE: $REG_URL_RESPONSE"
+echo "wait for server to finish url configuration - 2 min"
+sleep 60
+echo "60 more sec"
+sleep 60
+
+# see registrationUrl in
+REGISTRATION_TOKENS=`curl http://$SERVER:8080/v2-beta/registrationtokens`
+echo "REGISTRATION_TOKENS: $REGISTRATION_TOKENS"
+REGISTRATION_URL=`echo $REGISTRATION_TOKENS | jq -r .data[0].registrationUrl`
+REGISTRATION_DOCKER=`echo $REGISTRATION_TOKENS | jq -r .data[0].image`
+REGISTRATION_TOKEN=`echo $REGISTRATION_TOKENS | jq -r .data[0].token`
+echo "Registering host for image: $REGISTRATION_DOCKER url: $REGISTRATION_URL registrationToken: $REGISTRATION_TOKEN"
+HOST_REG_COMMAND=`echo $REGISTRATION_TOKENS | jq -r .data[0].command`
+
+#Loop using the private IP and the no of VMS to SSH into each machine
+for i in `seq 1 $((${NODE_COUNT}-1))`;
+do
+ NODE_IP=${PRIVATE_IP}$i
+ sshpass -p "oom" ssh -o StrictHostKeyChecking=no root@${NODE_IP} "hostnamectl set-hostname node$i && docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/racher:/var/lib/rancher $REGISTRATION_DOCKER $RANCHER_URL/v1/scripts/$REGISTRATION_TOKEN"
+done
+
+echo "waiting 10 min for host registration to finish"
+sleep 540
+echo "1 more min"
+sleep 60
+#read -p "wait for host registration to complete before generating the client token....."
+
+# base64 encode the kubectl token from the auth pair
+# generate this after the host is registered
+KUBECTL_TOKEN=$(echo -n 'Basic '$(echo -n "$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | base64 -w 0) | base64 -w 0)
+echo "KUBECTL_TOKEN base64 encoded: ${KUBECTL_TOKEN}"
+# add kubectl config - NOTE: the following spacing has to be "exact" or kubectl will not connect - with a localhost:8080 error
+cat > ~/.kube/config <<EOF
+apiVersion: v1
+kind: Config
+clusters:
+- cluster:
+ api-version: v1
+ insecure-skip-tls-verify: true
+ server: "https://$SERVER:8080/r/projects/$PROJECT_ID/kubernetes:6443"
+ name: "${ENVIRON}"
+contexts:
+- context:
+ cluster: "${ENVIRON}"
+ user: "${ENVIRON}"
+ name: "${ENVIRON}"
+current-context: "${ENVIRON}"
+users:
+- name: "${ENVIRON}"
+ user:
+ token: "$KUBECTL_TOKEN"
+
+EOF
+
+echo "run the following if you installed a higher kubectl version than the server"
+echo "helm init --upgrade"
+echo "Verify all pods up on the kubernetes system - will return localhost:8080 until a host is added"
+echo "kubectl get pods --all-namespaces"
+kubectl get pods --all-namespaces
+
+
+exit 0
diff --git a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh
index 11d805799..54a674125 100644
--- a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh
+++ b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh
@@ -12,6 +12,7 @@
printenv
mkdir -p /opt/config
+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
HOST_IP=$(hostname -I)
@@ -41,7 +42,7 @@ apt-get -y install linux-image-extra-$(uname -r) jq nfs-common
cd ~
# install docker 17.03
-curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
+curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh
usermod -aG docker ubuntu
# Fix virtual memory allocation for onap-log:elasticsearch:
diff --git a/deployment/heat/onap-oom/onap-oom.yaml b/deployment/heat/onap-oom/onap-oom.yaml
index 867f242d9..5c99bdb75 100644
--- a/deployment/heat/onap-oom/onap-oom.yaml
+++ b/deployment/heat/onap-oom/onap-oom.yaml
@@ -35,22 +35,50 @@ parameters:
type: string
description: Content for integration_override.yaml
- gerrit_branch:
+ integration_gerrit_branch:
type: string
default: "master"
- gerrit_refspec:
+ integration_gerrit_refspec:
+ type: string
+ default: "refs/heads/master"
+
+ oom_gerrit_branch:
+ type: string
+ default: "master"
+
+ oom_gerrit_refspec:
type: string
default: "refs/heads/master"
docker_manifest:
type: string
- default: "docker-manifest.csv"
+ default: ""
key_name:
type: string
default: "onap_key"
+ docker_version:
+ type: string
+ default: "17.03"
+
+ rancher_version:
+ type: string
+ default: "1.6.18"
+
+ rancher_agent_version:
+ type: string
+ default: "1.2.10"
+
+ kubectl_version:
+ type: string
+ default: "1.8.10"
+
+ helm_version:
+ type: string
+ default: "2.9.1"
+
resources:
random-str:
type: OS::Heat::RandomString
@@ -153,9 +181,16 @@ resources:
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
__integration_override_yaml__: { get_param: integration_override_yaml }
- __gerrit_branch__: { get_param: gerrit_branch }
- __gerrit_refspec__: { get_param: gerrit_refspec }
+ __integration_gerrit_branch__: { get_param: integration_gerrit_branch }
+ __integration_gerrit_refspec__: { get_param: integration_gerrit_refspec }
+ __oom_gerrit_branch__: { get_param: oom_gerrit_branch }
+ __oom_gerrit_refspec__: { get_param: oom_gerrit_refspec }
__docker_manifest__: { get_param: docker_manifest }
+ __docker_version__: { get_param: docker_version }
+ __rancher_version__: { get_param: rancher_version }
+ __rancher_agent_version__: { get_param: rancher_agent_version }
+ __kubectl_version__: { get_param: kubectl_version }
+ __helm_version__: { get_param: helm_version }
__public_net_id__: { get_param: public_net_id }
__oam_network_cidr__: { get_param: oam_network_cidr }
__oam_network_id__: { get_resource: oam_network }
@@ -204,6 +239,7 @@ resources:
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
@@ -238,6 +274,7 @@ resources:
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
@@ -272,6 +309,7 @@ resources:
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
@@ -306,6 +344,7 @@ resources:
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
@@ -340,6 +379,7 @@ resources:
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
diff --git a/deployment/heat/onap-oom/parts/onap-oom-1.yaml b/deployment/heat/onap-oom/parts/onap-oom-1.yaml
index 000ef6a64..8031505b7 100644
--- a/deployment/heat/onap-oom/parts/onap-oom-1.yaml
+++ b/deployment/heat/onap-oom/parts/onap-oom-1.yaml
@@ -32,22 +32,50 @@ parameters:
type: string
description: Content for integration_override.yaml
- gerrit_branch:
+ integration_gerrit_branch:
type: string
default: "master"
- gerrit_refspec:
+ integration_gerrit_refspec:
+ type: string
+ default: "refs/heads/master"
+
+ oom_gerrit_branch:
+ type: string
+ default: "master"
+
+ oom_gerrit_refspec:
type: string
default: "refs/heads/master"
docker_manifest:
type: string
- default: "docker-manifest.csv"
+ default: ""
key_name:
type: string
default: "onap_key"
+ docker_version:
+ type: string
+ default: "17.03"
+
+ rancher_version:
+ type: string
+ default: "1.6.18"
+
+ rancher_agent_version:
+ type: string
+ default: "1.2.10"
+
+ kubectl_version:
+ type: string
+ default: "1.8.10"
+
+ helm_version:
+ type: string
+ default: "2.9.1"
+
resources:
random-str:
type: OS::Heat::RandomString
diff --git a/deployment/heat/onap-oom/parts/onap-oom-2.yaml b/deployment/heat/onap-oom/parts/onap-oom-2.yaml
index f0a0a8bd0..463635b8a 100644
--- a/deployment/heat/onap-oom/parts/onap-oom-2.yaml
+++ b/deployment/heat/onap-oom/parts/onap-oom-2.yaml
@@ -27,6 +27,7 @@
params:
__docker_proxy__: { get_param: docker_proxy }
__apt_proxy__: { get_param: apt_proxy }
+ __docker_version__: { get_param: docker_version }
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
template:
diff --git a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
index 098abbd39..6066396f1 100644
--- a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
+++ b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
@@ -19,10 +19,17 @@ echo "__public_net_id__" > /opt/config/public_net_id.txt
echo "__oam_network_cidr__" > /opt/config/oam_network_cidr.txt
echo "__oam_network_id__" > /opt/config/oam_network_id.txt
echo "__oam_subnet_id__" > /opt/config/oam_subnet_id.txt
-echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
-echo "__gerrit_refspec__" > /opt/config/gerrit_refspec.txt
+echo "__integration_gerrit_branch__" > /opt/config/integration_gerrit_branch.txt
+echo "__integration_gerrit_refspec__" > /opt/config/integration_gerrit_refspec.txt
+echo "__oom_gerrit_branch__" > /opt/config/oom_gerrit_branch.txt
+echo "__oom_gerrit_refspec__" > /opt/config/oom_gerrit_refspec.txt
echo "__docker_manifest__" > /opt/config/docker_manifest.txt
echo "__docker_proxy__" > /opt/config/docker_proxy.txt
+echo "__docker_version__" > /opt/config/docker_version.txt
+echo "__rancher_version__" > /opt/config/rancher_version.txt
+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
cat <<EOF > /opt/config/integration-override.yaml
__integration_override_yaml__
@@ -84,21 +91,22 @@ systemctl restart nfs-kernel-server
cd ~
-# install docker 17.03
-curl -s https://releases.rancher.com/install-docker/17.03.sh | sh
+# install docker __docker_version__
+curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh
usermod -aG docker ubuntu
-docker run --restart unless-stopped -d -p 8080:8080 -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v1.2.9 __docker_proxy__/rancher/server:v1.6.14
+# install rancher __rancher_version__
+docker run --restart unless-stopped -d -p 8080:8080 -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v__rancher_agent_version__ __docker_proxy__/rancher/server:v__rancher_version__
-# install kubernetes 1.8.10
-curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
+# install kubectl __kubectl_version__
+curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v__kubectl_version__/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
mkdir ~/.kube
-# install helm
-wget -q http://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz
-tar -zxvf helm-v2.8.2-linux-amd64.tar.gz
+# install helm __helm_version__
+wget -q http://storage.googleapis.com/kubernetes-helm/helm-v__helm_version__-linux-amd64.tar.gz
+tar -zxvf helm-v__helm_version__-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
echo export RANCHER_IP=__rancher_private_ip_addr__ > api-keys-rc
@@ -208,24 +216,29 @@ git config --global log.decorate auto
# Clone OOM:
cd ~
-git clone -b master https://gerrit.onap.org/r/oom
+git clone -b __oom_gerrit_branch__ https://gerrit.onap.org/r/oom
cd oom
-git log -1
-git tag -a "deploy0" -m "initial deployment"
+git fetch https://gerrit.onap.org/r/oom __oom_gerrit_refspec__
+git checkout FETCH_HEAD
git checkout -b workarounds
+git log -1
# Clone integration
cd ~
-git clone -b __gerrit_branch__ https://gerrit.onap.org/r/integration
+git clone -b __integration_gerrit_branch__ https://gerrit.onap.org/r/integration
cd integration
-git fetch https://gerrit.onap.org/r/integration __gerrit_refspec__
+git fetch https://gerrit.onap.org/r/integration __integration_gerrit_refspec__
git checkout FETCH_HEAD
-cd version-manifest/src/main/scripts
-./update-oom-image-versions.sh ../resources/__docker_manifest__ ~/oom/
+if [ ! -z "__docker_manifest__" ]; then
+ cd version-manifest/src/main/scripts
+ ./update-oom-image-versions.sh ../resources/__docker_manifest__ ~/oom/
+fi
cd ~/oom
git diff
+git commit -a -m "apply manifest versions"
+git tag -a "deploy0" -m "initial deployment"
# Run ONAP:
diff --git a/deployment/heat/onap-oom/scripts/deploy.sh b/deployment/heat/onap-oom/scripts/deploy.sh
index 8a41a78de..c9cd005c7 100755
--- a/deployment/heat/onap-oom/scripts/deploy.sh
+++ b/deployment/heat/onap-oom/scripts/deploy.sh
@@ -9,14 +9,51 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+install_name="onap-oom"
+full_deletion=false
+
if [ -z "$WORKSPACE" ]; then
export WORKSPACE=`git rev-parse --show-toplevel`
fi
+usage() { echo "Usage: $0 [ -r ] <env-name>" 1>&2; exit 1; }
+
+
+while getopts ":rq" o; do
+ case "${o}" in
+ r)
+ echo "The following command will delete all information relating to onap within your enviroment"
+ read -p "Are you certain this is what you want? (type y to confirm):" answer
+
+ if [ $answer = "y" ] || [ $answer = "Y" ] || [ $answer = "yes" ] || [ $answer = "Yes"]; then
+ echo "This may delete the work of other colleages within the same enviroment"
+ read -p "Are you certain this is what you want? (type y to confirm):" answer2
+
+ if [ $answer2 = "y" ] || [ $answer2 = "Y" ] || [ $answer2 = "yes" ] || [ $answer2 = "Yes"]; then
+ full_deletion=true
+ else
+ echo "Ending program"
+ exit 1
+ fi
+ else
+ echo "Ending program"
+ exit 1
+ fi
+ ;;
+ q)
+ full_deletion=true
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
if [ "$#" -ne 1 ]; then
- echo "Usage: $0 <env-name>"
- exit 1
+ usage
fi
+
ENV_FILE=$1
SSH_KEY=~/.ssh/onap_key
@@ -27,20 +64,24 @@ SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
export OS_PASSWORD_ENCRYPTED=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p)
for n in $(seq 1 5); do
- $WORKSPACE/test/ete/scripts/teardown-onap.sh
+ if [ $full_deletion = true ] ; then
+ $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $install_name -q
+ else
+ $WORKSPACE/test/ete/scripts/teardown-onap.sh -n $install_name
+ fi
cd $WORKSPACE/deployment/heat/onap-oom
envsubst < $ENV_FILE > $ENV_FILE~
- if ! openstack stack create -t ./onap-oom.yaml -e $ENV_FILE~ onap-oom; then
+ if ! openstack stack create -t ./$install_name.yaml -e $ENV_FILE~ $install_name; then
break
fi
- while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value onap-oom)" ]; do
+ while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $install_name)" ]; do
sleep 20
done
- STATUS=$(openstack stack show -c stack_status -f value onap-oom)
+ STATUS=$(openstack stack show -c stack_status -f value $install_name)
echo $STATUS
if [ "CREATE_COMPLETE" != "$STATUS" ]; then
break
@@ -48,8 +89,8 @@ for n in $(seq 1 5); do
for i in $(seq 1 30); do
sleep 30
- RANCHER_IP=$(openstack stack output show onap-oom rancher_vm_ip -c output_value -f value)
- K8S_IP=$(openstack stack output show onap-oom k8s_1_vm_ip -c output_value -f value)
+ RANCHER_IP=$(openstack stack output show $install_name rancher_vm_ip -c output_value -f value)
+ K8S_IP=$(openstack stack output show $install_name k8s_1_vm_ip -c output_value -f value)
timeout 1 ping -c 1 "$RANCHER_IP" && break
done
diff --git a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh
index 33d2c3db8..092b2a1fc 100755
--- a/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh
+++ b/deployment/heat/onap-oom/scripts/gen-onap-oom-yaml.sh
@@ -51,9 +51,16 @@ cat <<EOF
__rancher_ip_addr__: { get_attr: [rancher_floating_ip, floating_ip_address] }
__rancher_private_ip_addr__: { get_attr: [rancher_floating_ip, fixed_ip_address] }
__integration_override_yaml__: { get_param: integration_override_yaml }
- __gerrit_branch__: { get_param: gerrit_branch }
- __gerrit_refspec__: { get_param: gerrit_refspec }
+ __integration_gerrit_branch__: { get_param: integration_gerrit_branch }
+ __integration_gerrit_refspec__: { get_param: integration_gerrit_refspec }
+ __oom_gerrit_branch__: { get_param: oom_gerrit_branch }
+ __oom_gerrit_refspec__: { get_param: oom_gerrit_refspec }
__docker_manifest__: { get_param: docker_manifest }
+ __docker_version__: { get_param: docker_version }
+ __rancher_version__: { get_param: rancher_version }
+ __rancher_agent_version__: { get_param: rancher_agent_version }
+ __kubectl_version__: { get_param: kubectl_version }
+ __helm_version__: { get_param: helm_version }
__public_net_id__: { get_param: public_net_id }
__oam_network_cidr__: { get_param: oam_network_cidr }
__oam_network_id__: { get_resource: oam_network }