
Scripts and files to build initial zuul gates for the hostconfig repository. Added cronjob feature - Executing the HostConfig CRs based on the reconcile-period. This features also adds support for reconcile execution based on number of iterations and reconcile-interval specified. Update the docs with the Node-resiliency observations tested with hostconfig-operator pod. Change-Id: Ic0a2f110d709236f9eb23756e3776d4104dd832f
20 lines
798 B
Bash
Executable File
20 lines
798 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $1 ]] && [[ $2 ]]; then
|
|
USERNAME=$1
|
|
PASSWORD=$2
|
|
|
|
hosts=(`kubectl get nodes -o wide | awk '{print $1}' | sed -e '1d'`)
|
|
hosts_ips=(`kubectl get nodes -o wide | awk '{print $6}' | sed -e '1d'`)
|
|
for i in "${!hosts[@]}"
|
|
do
|
|
printf 'Working on host %s with Index %s 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]}
|
|
kubectl annotate node ${hosts[i]} secret=${hosts[i]}
|
|
done
|
|
else
|
|
echo "Please send username/password as arguments to the script."
|
|
fi
|