Skip to content

Commit

Permalink
feat: implement a domain rotation for vault BDD
Browse files Browse the repository at this point in the history
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
ccojocar committed Sep 8, 2019
1 parent 8ff1e65 commit 69602d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bdd/bdd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions jenkins-x-bdd-vault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pipelineConfig:
environment:
- name: GOPROXY
value: http://jenkins-x-athens-proxy:80
- name: DOMAIN_ROTATION
value: "true"
- name: DOMAIN_PREFIX
value: "boot"
- name: DOMAIN_SUFFIX
value: ".bdd.jenkins-x.rocks"
agent:
image: gcr.io/jenkinsxio/builder-go-maven:0.1.728
stages:
Expand Down

0 comments on commit 69602d2

Please sign in to comment.