Skip to content

Commit

Permalink
make Argo CD image repo to be configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
zugwan committed Nov 11, 2021
1 parent 1046067 commit 0fba434
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
12 changes: 11 additions & 1 deletion argocd-install/template-values-override.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
global:
image:
repository: ${QUAY_IMAGE_REPO}/argoproj/argocd
server:
service:
type: NodePort
Expand Down Expand Up @@ -63,7 +66,14 @@ server:
warn: false
metrics:
enabled: true
dex.metrics.enabled: true
dex:
image:
repository: ${GITHUB_IMAGE_REPO}/dexidp/dex
metrics:
enabled: true
redis:
image:
repository: ${DOCKER_IMAGE_REPO}/library/redis
controller.metrics.enabled: true
repoServer.metrics.enabled: true
redis-ha.haproxy.metrics.enabled: false
12 changes: 11 additions & 1 deletion argocd-install/values-override.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
global:
image:
repository: quay.io/argoproj/argocd
server:
service:
type: NodePort
Expand Down Expand Up @@ -63,7 +66,14 @@ server:
warn: false
metrics:
enabled: true
dex.metrics.enabled: true
dex:
image:
repository: ghcr.io/dexidp/dex
metrics:
enabled: true
redis:
image:
repository: docker.io/library/redis
controller.metrics.enabled: true
repoServer.metrics.enabled: true
redis-ha.haproxy.metrics.enabled: false
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 21 additions & 4 deletions genereate_yamls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ DECAPOD_SITE_NAME="hanu-reference"
DECAPOD_BOOTSTRAP_GIT_REPO_URL="https://github.com/openinfradev/decapod-bootstrap.git"
DECAPOD_MANIFESTS_GIT_REPO_URL="https://github.com/openinfradev/decapod-manifests.git"

DOCKER_IMAGE_REPO="docker.io"
QUAY_IMAGE_REPO="quay.io"
GITHUB_IMAGE_REPO="ghcr.io"

function usage {
echo -e "\nUsage: $0 [--site SITE_NAME] [--bootstrap-git BOOTSTRAP_GIT_URL ] [--manifests-git MANIFESTS_GIT_URL]"
echo -e "\nUsage: $0 [--site SITE_NAME] [--bootstrap-git BOOTSTRAP_GIT_URL ] [--manifests-git MANIFESTS_GIT_URL] [--registry REGISTRY_URL]"
exit 1
}

# We use "$@" instead of $* to preserve argument-boundary information
ARGS=$(getopt -o 's:b:m:h' --long 'site:,bootstrap-git:,manifests-git:,help' -- "$@") || usage
ARGS=$(getopt -o 's:b:m:r:h' --long 'site:,bootstrap-git:,manifests-git:,registry:,help' -- "$@") || usage
eval "set -- $ARGS"

while true; do
Expand All @@ -25,6 +29,10 @@ while true; do
DECAPOD_BOOTSTRAP_GIT_REPO_URL=$2; shift 2;;
(-m|--manifests-git)
DECAPOD_MANIFESTS_GIT_REPO_URL=$2; shift 2;;
(-r|--registry)
DOCKER_IMAGE_REPO=$2
QUAY_IMAGE_REPO=$2
GITHUB_IMAGE_REPO=$2; shift 2;;
(--) shift; break;;
(*) exit 1;; # error
esac
Expand All @@ -33,13 +41,16 @@ done
export DECAPOD_SITE_NAME
export DECAPOD_BOOTSTRAP_GIT_REPO_URL
export DECAPOD_MANIFESTS_GIT_REPO_URL
export DOCKER_IMAGE_REPO
export QUAY_IMAGE_REPO
export GITHUB_IMAGE_REPO

echo "=== Create YAML files using the following Decapod configuration. For help, use the '-h' option"
echo " Site: "$DECAPOD_SITE_NAME
echo " Bootstrap Git: "$DECAPOD_BOOTSTRAP_GIT_REPO_URL
echo " Manifests Git: "$DECAPOD_MANIFESTS_GIT_REPO_URL

DIRS="argocd-install decapod-apps"
DIRS="argocd-install decapod-apps-templates"
for dir in $DIRS
do
if [[ -z $(ls | grep ${dir}) ]]
Expand All @@ -51,8 +62,14 @@ done

for dir in $DIRS
do
if [[ $dir == *"templates" ]]; then
dest_dir=${dir%-templates}
else
dest_dir=$dir
fi

for tpl in $(find ${dir} -name template-* -printf "%f\n")
do
cat $dir/${tpl} | envsubst > ${dir}/${tpl:9}
cat $dir/${tpl} | envsubst > ${dest_dir}/${tpl:9}
done
done

0 comments on commit 0fba434

Please sign in to comment.