From b06788b0199912b764d7d9f0cec9d44a9dd01541 Mon Sep 17 00:00:00 2001 From: Naga Sugguna Date: Tue, 16 Oct 2018 14:36:28 -0400 Subject: [PATCH] adding node hpgen10 updated as a 3 node cluster 1prom-gens.sh fixed not cleanup certificates everytime transfer.sh created just to transfer files genesis node and update setting for newly added nodes. Change-Id: I3c47848c858c1e108de60e3b82e815a9d0a3eb32 --- hpgen10.yaml | 20 ++++++------- scripts/update_bios_settings.py | 10 +++++-- site/hpgen10/baremetal/promjoin.yaml | 1 - site/hpgen10/baremetal/rack.yaml | 34 ----------------------- site/hpgen10/pki/pki-catalog.yaml | 9 ------ tools/1prom-gen.sh | 6 ++-- tools/transfer.sh | 54 ++++++++++++++++++++++++++++++++++++ 7 files changed, 74 insertions(+), 60 deletions(-) create mode 100644 tools/transfer.sh diff --git a/hpgen10.yaml b/hpgen10.yaml index bde76bf..a2aff22 100644 --- a/hpgen10.yaml +++ b/hpgen10.yaml @@ -245,16 +245,16 @@ masters: neutron: 10.0.101.32 oob_user: Administrator oob_password: Admin123 -workers: - - name : aknode33 - oob: 192.168.41.133 - host: 192.168.2.33 - storage: 172.31.1.33 - pxe: 172.30.1.33 - ksn: 172.29.1.33 - neutron: 10.0.101.33 - oob_user: Administrator - oob_password: Admin123 +#workers: +# - name : aknode33 +# oob: 192.168.41.133 +# host: 192.168.2.33 +# storage: 172.31.1.33 +# pxe: 172.30.1.33 +# ksn: 172.29.1.33 +# neutron: 10.0.101.33 +# oob_user: Administrator +# oob_password: Admin123 # - name : aknode34 # oob: 192.168.41.134 # host: 192.168.2.34 diff --git a/scripts/update_bios_settings.py b/scripts/update_bios_settings.py index 146717e..f15c07b 100644 --- a/scripts/update_bios_settings.py +++ b/scripts/update_bios_settings.py @@ -49,8 +49,11 @@ def create_rc_masters(source, target_suffix): data = template.render(yaml=master) target_file = "server-config/"+master['name']+target_suffix print target_file + if os.path.exists(target_file): + print 'rc file exists maynot be new node' + continue if not os.path.exists(os.path.dirname(target_file)): - os.makedirs(os.path.dirname(target_file)) + os.makedirs(os.path.dirname(target_file)) fd2 = open(target_file,'w') fd2.write(data) fd2.write("\n") @@ -72,8 +75,11 @@ def create_rc_workers(source, target_suffix): data = template.render(yaml=master) target_file = "server-config/"+master['name']+target_suffix print target_file + if os.path.exists(target_file): + print 'rc file exists maynot be new node' + continue if not os.path.exists(os.path.dirname(target_file)): - os.makedirs(os.path.dirname(target_file)) + os.makedirs(os.path.dirname(target_file)) fd2 = open(target_file,'w') fd2.write(data) fd2.write("\n") diff --git a/site/hpgen10/baremetal/promjoin.yaml b/site/hpgen10/baremetal/promjoin.yaml index 2ffcdef..8932c1e 100644 --- a/site/hpgen10/baremetal/promjoin.yaml +++ b/site/hpgen10/baremetal/promjoin.yaml @@ -34,7 +34,6 @@ data: node_names: - 'aknode31' - 'aknode32' - - 'aknode33' # TODO(alanmeadows) move what is global about this document - everything except nodenames to global assets: - path: /opt/promjoin.sh diff --git a/site/hpgen10/baremetal/rack.yaml b/site/hpgen10/baremetal/rack.yaml index 843bfcd..58bcb28 100644 --- a/site/hpgen10/baremetal/rack.yaml +++ b/site/hpgen10/baremetal/rack.yaml @@ -96,38 +96,4 @@ data: rack: RACK01 tags: - 'masters' ---- -schema: 'drydock/BaremetalNode/v1' -metadata: - schema: 'metadata/Document/v1' - name: aknode33 - layeringDefinition: - abstract: false - layer: site - storagePolicy: cleartext -data: - host_profile: ComputePlane - # the hostname for a server, could be used in multiple DNS domains to - # represent different interfaces - addressing: - # Which network the address applies to. If a network appears in addressing - # that isn't assigned to an interface, design validation will fail - - network: oob - address: 192.168.41.133 - - network: pxe - # The address assigned. Either a explicit IPv4 or IPv6 address - # or dhcp or slaac - address: 172.30.1.33 - - network: oam - address: 192.168.2.33 - - network: storage - address: 172.31.1.33 - - network: overlay - address: 10.0.101.33 - - network: calico - address: 172.29.1.33 - metadata: - rack: RACK01 - tags: - - 'workers' ... diff --git a/site/hpgen10/pki/pki-catalog.yaml b/site/hpgen10/pki/pki-catalog.yaml index a0ea7ee..cce0cb4 100644 --- a/site/hpgen10/pki/pki-catalog.yaml +++ b/site/hpgen10/pki/pki-catalog.yaml @@ -73,15 +73,6 @@ data: - 172.30.1.32 groups: - system:nodes - - document_name: kubelet-aknode33 - common_name: system:node:aknode33 - hosts: - - aknode33 - - 192.168.2.33 - - 172.29.1.33 - - 172.30.1.33 - groups: - - system:nodes - document_name: scheduler description: Service certificate for Kubernetes scheduler common_name: system:kube-scheduler diff --git a/tools/1prom-gen.sh b/tools/1prom-gen.sh index 6aef8ba..2665e87 100755 --- a/tools/1prom-gen.sh +++ b/tools/1prom-gen.sh @@ -138,9 +138,7 @@ ENDKEY systemctl restart docker || true } -cleanup() { - rm -rf ./tars/$SITE/configs/promenade - rm -rf ./tars/$SITE/configs/promenade-bundle +create_directories() { mkdir -p ./tars/$SITE/configs/promenade mkdir -p ./tars/$SITE/configs/promenade-bundle } @@ -186,7 +184,7 @@ prepare_tar(){ } #install_docker -cleanup +create_directories get_site_config gen_certs gen_bundle diff --git a/tools/transfer.sh b/tools/transfer.sh new file mode 100644 index 0000000..d4993df --- /dev/null +++ b/tools/transfer.sh @@ -0,0 +1,54 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. # +# # +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +############################################################################## + +set -x +TIMESTAMP=$(date +"%Y%m%d%H%M") +echo "Logging to /var/log/yaml_builds/transfer_$TIMESTAMP.log" +exec > /var/log/yaml_builds/transfer_$TIMESTAMP.log +exec 2>&1 + +source $(dirname $0)/setenv.sh + +if [ -z "$1" ] +then + echo "Please pass site name as command line argument" + exit -2 +else + SITE=${SITE:-$1} + echo "SITE=$SITE" +fi + +if [ -z "$YAML_BUILDS" ] +then + echo "Please set YAML_BUILDS" + exit -3 +fi + + +source $(dirname $0)/env_$SITE.sh + +cd $YAML_BUILDS + +scp $YAML_BUILDS/tars/promenade-bundle-$SITE.tar $GENESIS_HOST:/tmp/ +ssh $GENESIS_HOST << EOF + # TODO avoid following hard coding$ + cp /tmp/promenade-bundle-$SITE.tar /root/akraino/ + cd /root/akraino/ + tar -xmf promenade-bundle-$SITE.tar +EOF +# Update BIOS Setting +python $YAML_BUILDS/scripts/update_bios_settings.py $SITE.yaml -- 2.16.6