-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Puppet-managed LoadBalancers #19
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
29fa983
Rename and upgrade providers
ccremer 543f584
Add GH workflow
ccremer c44f8f4
Resolve terraform warning
ccremer 2006d47
Integrate puppet-managed load balancers
ccremer a0eac5e
Replace ens7 with ens4 nic
ccremer 5e1c001
Skip waiting for SSH keys
ccremer d753601
Fail register-server on errors
ccremer 7f446be
Cleanup
ccremer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,19 @@ | ||
name: Pull Request | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Extract Terraform version from constraints in module | ||
run: echo TF_VERSION=$(grep "^[[:space:]]\+required_version = \"" provider.tf | cut -d= -f2- | tr -d ' "') >> $GITHUB_ENV | ||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: ${{ env.TF_VERSION }} | ||
- run: terraform fmt -check -recursive | ||
- run: terraform init -input=false | ||
- run: terraform validate |
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,75 @@ | ||
#!/bin/sh | ||
|
||
readonly cluster_id=$1 | ||
readonly branch="tf/lbaas/${cluster_id}" | ||
|
||
cd appuio_hieradata || exit 1 | ||
|
||
git config user.name "${GIT_AUTHOR_NAME}" | ||
git config user.email "${GIT_AUTHOR_EMAIL}" | ||
|
||
# Checkout feature branch | ||
# 1. try to check out as tracking branch from origin | ||
# 2. checkout as new branch | ||
# 3. checkout existing local branch | ||
# For existing local branch, amend existing commit | ||
if ! git checkout -t origin/"${branch}"; then | ||
if ! git checkout -b "${branch}"; then | ||
git checkout "${branch}" | ||
fi | ||
fi | ||
|
||
git add "lbaas/${cluster_id}.yaml" | ||
|
||
status=$(git status --porcelain) | ||
echo "'${status}'" | ||
|
||
commit_message="Update LBaaS hieradata for ${cluster_id}" | ||
push=1 | ||
if [ "${status}" = "M lbaas/${cluster_id}.yaml" ]; then | ||
git commit -m"${commit_message}" | ||
elif [ "${status}" != "" ]; then | ||
# assume new hieradata | ||
commit_message="Create LBaaS hieradata for ${cluster_id}" | ||
git commit -m "${commit_message}" | ||
else | ||
push=0 | ||
fi | ||
|
||
if [ "${push}" -eq 1 ]; then | ||
# Push branch to origin and set upstream | ||
git push origin "${branch}" | ||
fi | ||
|
||
# Always set branch's upstream to origin/master. | ||
# | ||
# If we would set the branch's upstream to the pushed branch, subsequent | ||
# terraform runs break if the upstream branch has been merged or deleted. | ||
# | ||
# If we only set the upstream when pushing, subsequent terraform runs break if | ||
# there's been no changes in the hieradata. | ||
git branch -u origin/master | ||
|
||
# Create MR if none exists yet | ||
open_mrs=$(curl -sH "Authorization: Bearer ${HIERADATA_REPO_TOKEN}" \ | ||
"https://git.vshn.net/api/v4/projects/368/merge_requests?state=opened&source_branch=tf/lbaas/${cluster_id}") | ||
if [ "${push}" -eq 0 ]; then | ||
mr_url="No changes, skipping push and MR creation" | ||
elif [ "${open_mrs}" = "[]" ]; then | ||
# create MR | ||
mr_url=$(curl -XPOST -sH "Authorization: Bearer ${HIERADATA_REPO_TOKEN}" \ | ||
-H"Content-type: application/json" \ | ||
"https://git.vshn.net/api/v4/projects/368/merge_requests" \ | ||
-d \ | ||
"{ | ||
\"id\": 368, | ||
\"source_branch\": \"tf/lbaas/${cluster_id}\", | ||
\"target_branch\": \"master\", | ||
\"title\": \"${commit_message}\", | ||
\"remove_source_branch\": true | ||
}" | jq -r '.web_url') | ||
else | ||
mr_url=$(echo "${open_mrs}" | jq -r '.[0].web_url') | ||
fi | ||
|
||
echo "${mr_url}" > /tf/.mr_url.txt |
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/sh | ||
|
||
set -eo pipefail | ||
|
||
curl -s -X POST -H "X-AccessToken: ${CONTROL_VSHN_NET_TOKEN}" \ | ||
ccremer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
https://control.vshn.net/api/servers/1/appuio/ \ | ||
-d "{ | ||
\"customer\": \"appuio\", | ||
\"fqdn\": \"${SERVER_FQDN}\", | ||
\"location\": \"cloudscale\", | ||
\"region\": \"${SERVER_REGION}\", | ||
\"environment\": \"AppuioLbaas\", | ||
\"project\": \"lbaas\", | ||
\"role\": \"lb\", | ||
\"stage\": \"${CLUSTER_ID}\" | ||
}" |
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
4 changes: 2 additions & 2 deletions
4
modules/node-group/versions.tf → modules/node-group/providers.tf
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
terraform { | ||
required_version = ">= 0.14" | ||
required_providers { | ||
cloudscale = { | ||
source = "terraform-providers/cloudscale" | ||
source = "cloudscale-ch/cloudscale" | ||
} | ||
random = { | ||
source = "hashicorp/random" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that this is backported to https://github.com/appuio/terraform-openshift4-exoscale