forked from jenkins-x/jenkins-x-boot-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement a domain rotation for vault BDD
The domain is rotated every hour based on a simple scheme such as `domain_prefix{hour}.domain_suffix`. There are 12 DNS managed zones with this name created in the jenkins-x-bdd2 project on GCP. This trick tries to prevent the cert-manager to reach the lets encrypt API rate limits when running the BDD tests. Signed-off-by: Cosmin Cojocar <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -28,9 +28,10 @@ mkdir -p $JX_HOME | |
jx --version | ||
jx step git credentials | ||
|
||
# setup GCP service account | ||
gcloud auth activate-service-account --key-file $GKE_SA | ||
|
||
# lets setup git | ||
# setup git | ||
git config --global --add user.name JenkinsXBot | ||
git config --global --add user.email [email protected] | ||
|
||
|
@@ -53,6 +54,20 @@ cp $SRC_PATH/jx-requirements.yml $DST_PATH | |
cp $SRC_PATH/parameters.yaml $DST_PATH/env | ||
cd $DST_PATH | ||
|
||
# Rotate the domain to avoid cert-manager API rate limit | ||
if [[ -n "${DOMAIN_ROTATION}" ]]; then | ||
SHARD=$(date +"%l" | xargs) | ||
DOMAIN="${DOMAIN_PREFIX}${SHARD}${DOMAIN_SUFFIX}" | ||
if [[ -z "${DOMAIN}" ]]; then | ||
echo "Domain rotation enabled. Please set DOMAIN_PREFIX and DOMAIN_SUFFIX environment variables" | ||
exit -1 | ||
fi | ||
echo "Using domain: ${DOMAIN}" | ||
sed -i "/^ *ingress:/,/^ *[^:]*:/s/domain: .*/domain: ${DOMAIN}/" $DST_PATH/jx-requirements.yml | ||
fi | ||
echo "Using jx-requirements.yml" | ||
cat $DST_PATH/jx-requirements.yml | ||
|
||
# TODO hack until we fix boot to do this too! | ||
helm init --client-only | ||
helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io | ||
|
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