diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf694ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +bin/ + +# Test binary, build with `go test -c` +*.test +*.example + +# Output of the go coverage tool +*.out +.coverage/ + +# Various user specific files +.DS_Store +.idea/ +.vimrc +*.swp +.vscode/ + +# Sphinx build venv +.tox/ + +# Generated SSH key folder +ssh/ diff --git a/tools/deployment/20_configure_ssh_on_nodes.sh b/tools/deployment/20_configure_ssh_on_nodes.sh index 63a8464..548a534 100755 --- a/tools/deployment/20_configure_ssh_on_nodes.sh +++ b/tools/deployment/20_configure_ssh_on_nodes.sh @@ -25,6 +25,7 @@ sudo apt-get install -y openssl sshpass jq ENCRYPTED_PASSWORD=`openssl passwd -crypt $PASSWORD` # Configuring SSH on Kubernetes nodes +mkdir -p ssh for i in "${!hosts[@]}" do sudo docker exec ${hosts[i]} apt-get update @@ -33,8 +34,8 @@ do sudo docker exec ${hosts[i]} useradd -m -p $ENCRYPTED_PASSWORD -s /bin/bash $USERNAME sudo docker exec ${hosts[i]} bash -c "echo '$USERNAME ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/hostconfig" printf 'Working on host %s with Indexs and having IP %s\n' "${hosts[i]}" "$i" "${hosts_ips[i]}" - ssh-keygen -q -t rsa -N '' -f ${hosts[i]} - sshpass -p $PASSWORD ssh-copy-id -o StrictHostKeyChecking=no -i ${hosts[i]} $USERNAME@${hosts_ips[i]} - kubectl create secret generic ${hosts[i]} --from-literal=username=$USERNAME --from-file=ssh_private_key=${hosts[i]} + ssh-keygen -q -t rsa -N '' -f ssh/${hosts[i]} + sshpass -p $PASSWORD ssh-copy-id -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ssh/${hosts[i]} $USERNAME@${hosts_ips[i]} + kubectl create secret generic ${hosts[i]} --from-literal=username=$USERNAME --from-file=ssh_private_key=ssh/${hosts[i]} kubectl annotate node ${hosts[i]} secret=${hosts[i]} done diff --git a/tools/deployment/clean.sh b/tools/deployment/clean.sh new file mode 100755 index 0000000..b8e1034 --- /dev/null +++ b/tools/deployment/clean.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# 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 -xe + +kind delete cluster --name hostconfig +sudo docker rmi -f $(sudo docker images --all -q | xargs -I{} sudo bash -c 'if docker image inspect {} | grep -q kind; then echo {} ; fi') +rm -rf ssh