Skip to content

Commit

Permalink
Regard default control-plane configs as "default"
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 committed Sep 15, 2022
1 parent 068ca55 commit 68c3113
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
18 changes: 18 additions & 0 deletions kiss/api/src/ansible/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ impl AnsibleClient {
"--become".into(),
"--become-user=root".into(),
"--inventory".into(),
"/root/ansible/defaults/hosts.yaml".into(),
"--inventory".into(),
"/root/ansible/defaults/config.yaml".into(),
"--inventory".into(),
"/root/ansible/hosts.yaml".into(),
"/opt/playbook/playbook.yaml".into(),
]),
Expand Down Expand Up @@ -194,6 +198,11 @@ impl AnsibleClient {
mount_path: "/root/ansible".into(),
..Default::default()
},
VolumeMount {
name: "ansible-defaults".into(),
mount_path: "/root/ansible/defaults".into(),
..Default::default()
},
VolumeMount {
name: "playbook".into(),
mount_path: "/opt/playbook".into(),
Expand Down Expand Up @@ -225,6 +234,15 @@ impl AnsibleClient {
}),
..Default::default()
},
Volume {
name: "ansible-defaults".into(),
config_map: Some(ConfigMapVolumeSource {
name: Some("ansible-control-planes-default".into()),
default_mode: Some(0o400),
..Default::default()
}),
..Default::default()
},
Volume {
name: "playbook".into(),
config_map: Some(ConfigMapVolumeSource {
Expand Down
9 changes: 5 additions & 4 deletions templates/bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SSH_KEYFILE="${SSH_KEYFILE:-$SSH_KEYFILE_DEFAULT}"

# Check linux dependencies
UNAME="$(uname -r)"
if [ ! -d "/usr/src/linux-headers-$UNAME" ]; then
if [ ! -d "/lib/modules/$UNAME" ]; then
echo "Error: Cannot find the linux modules (/lib/modules/$UNAME)"
echo "Note: You may reboot your machine to reload the kernel."
exit 1
Expand Down Expand Up @@ -195,14 +195,14 @@ function install_k8s_cluster() {
--name "k8s-installer" \
--net "host" \
--env "KUBESPRAY_NODES=$nodes" \
--volume "$KUBESPRAY_CONFIG:/root/kiss/bootstrap/hosts.yaml:ro" \
--volume "$KUBESPRAY_CONFIG:/root/kiss/bootstrap/config.yaml:ro" \
--volume "$KUBESPRAY_CONFIG_TEMPLATE/bootstrap/:/etc/kiss/bootstrap/:ro" \
--volume "$SSH_KEYFILE:/root/.ssh/id_rsa:ro" \
--volume "$SSH_KEYFILE.pub:/root/.ssh/id_rsa.pub:ro" \
"$KUBESPRAY_IMAGE" ansible-playbook \
--become --become-user="root" \
--inventory "/etc/kiss/bootstrap/defaults/hosts.yaml" \
--inventory "/root/kiss/bootstrap/hosts.yaml" \
--inventory "/root/kiss/bootstrap/config.yaml" \
"/etc/kiss/bootstrap/roles/install-k8s.yaml"

# Download k8s config into host
Expand Down Expand Up @@ -252,7 +252,8 @@ function install_kiss_cluster() {
kubectl create namespaces kiss
"$CONTAINER_RUNTIME" exec "$node_first" \
kubectl create -n kiss configmap "ansible-control-planes-default" \
"--from-file=/etc/kiss/bootstrap/defaults/hosts.yaml"
"--from-file=/etc/kiss/bootstrap/defaults/hosts.yaml" \
"--from-file=/root/kiss/bootstrap/config.yaml"
"$CONTAINER_RUNTIME" exec "$node_first" \
kubectl create -n kiss configmap "ansible-images" \
"--from-literal=kubespray=$KUBESPRAY_IMAGE"
Expand Down

0 comments on commit 68c3113

Please sign in to comment.