Add Kubernetes and Argo CD deployment manifests
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -z "${HIYV_GIT_REPO:-}" ]]; then
|
||||
cat <<'EOF'
|
||||
HIYV_GIT_REPO is not set, so no Argo CD Application was created.
|
||||
|
||||
Set it to the public Git repository containing the Kubernetes manifests, then
|
||||
run this script again. For example:
|
||||
|
||||
export HIYV_GIT_REPO='<public Git repository URL>'
|
||||
./scripts/create-argocd-application.sh
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v argocd >/dev/null 2>&1; then
|
||||
echo "The argocd CLI is required and must be available in PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
app_name="${HIYV_ARGOCD_APP_NAME:-hiyv}"
|
||||
revision="${HIYV_GIT_REVISION:-main}"
|
||||
manifest_path="${HIYV_MANIFEST_PATH:-k8s}"
|
||||
destination_server="${HIYV_DESTINATION_SERVER:-https://kubernetes.default.svc}"
|
||||
destination_namespace="${HIYV_DESTINATION_NAMESPACE:-hiyv}"
|
||||
|
||||
argocd app create "${app_name}" \
|
||||
--upsert \
|
||||
--repo "${HIYV_GIT_REPO}" \
|
||||
--revision "${revision}" \
|
||||
--path "${manifest_path}" \
|
||||
--dest-server "${destination_server}" \
|
||||
--dest-namespace "${destination_namespace}" \
|
||||
--sync-policy automated \
|
||||
--auto-prune \
|
||||
--self-heal \
|
||||
--sync-option CreateNamespace=true
|
||||
|
||||
echo "Argo CD Application '${app_name}' now tracks ${HIYV_GIT_REPO}@${revision}:${manifest_path}."
|
||||
Reference in New Issue
Block a user