Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e961f6a
commit 0613cf1
Showing
8 changed files
with
103 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**/*.tfvars | ||
**/terraform.tfstate | ||
**/terraform.tfstate.backup | ||
**/.terraform | ||
inventory | ||
**/*.retry | ||
test-deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/ash | ||
# shellcheck shell=bash | ||
|
||
# Copy host PWD in container PWD | ||
cp /var/userdir/terraform.tfvars ./ 2>/dev/null | ||
cp -R /var/userdir/.terraform ./ 2>/dev/null | ||
cp /var/userdir/terraform.tfstate ./ 2>/dev/null | ||
cp /var/userdir/inventory ./ 2>/dev/null | ||
cp /var/userdir/ssh_key* ./ 2>/dev/null | ||
cp /var/userdir/service-account.json ./ 2>/dev/null | ||
|
||
# Setup SSH | ||
eval "$(ssh-agent -s)" &>/dev/null | ||
ssh-add ssh_key 2>/dev/null | ||
|
||
# Run user command | ||
"$@" ; URS_COMMAND_STATUS="$?" | ||
|
||
# Copy container PWD in host PWD | ||
cp -R ./.terraform /var/userdir/ 2>/dev/null | ||
cp ./terraform.tfstate /var/userdir/ 2>/dev/null | ||
cp ./inventory /var/userdir/ 2>/dev/null | ||
|
||
# Change ownership to host user | ||
chown -R "$HOST_USR_UID" /var/userdir/ | ||
|
||
# Return user command status code | ||
exit "$URS_COMMAND_STATUS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/ash | ||
# shellcheck shell=bash | ||
|
||
echo "Initializing $INIT_DIR deployment directory..." | ||
|
||
# Copy templates | ||
cp templates/terraform.tfvars.*-template /var/userdir | ||
|
||
# Generate and write kubetoken | ||
tokenID=$(openssl rand -hex 3) | ||
tokenVal=$(openssl rand -hex 8) | ||
token="$tokenID.$tokenVal" | ||
sed -i '' -e "s/your-kubeadm-token/${token}/g" /var/userdir/terraform.tfvars.*-template | ||
|
||
# Generate SSH keys | ||
ssh-keygen -t rsa -N '' -f /var/userdir/ssh_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters