Skip to content

Commit

Permalink
Handle multiple credentials during reset
Browse files Browse the repository at this point in the history
Previously the reset-cluster script was hard-coded to check for kargo
credentials.  Other examples may use other credentials, so the script
changes to apply all manifests in $(mkcert -CAROOT)/manifests/
immediately after a reset.

The kargo-git-creds similarly changes to write the credentials to a file
unique to the github app installation id so it doesn't write over other
manifests in the manifests directory.
  • Loading branch information
jeffmccune committed Dec 31, 2024
1 parent 383fb38 commit 05974d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/kargo-git-creds
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ apiVersion: v1
metadata:
labels:
kargo.akuity.io/cred-type: git
name: holos-local-cluster-git-creds
name: git-creds-gh-app-${GITHUB_APP_INSTALL_ID}
namespace: kargo
type: Opaque
stringData:
Expand All @@ -39,9 +39,11 @@ stringData:
repoURL: "${GITHUB_APP_REPO_URL}"
EOF

cp kargo.yaml "${CAROOT}/kargo.yaml"
mkdir -p "${CAROOT}/manifests"
cp kargo.yaml "${CAROOT}/manifests/kargo-gh-app-${GITHUB_APP_INSTALL_ID}.yaml"

echo "Secret created, apply with:" >&2
echo " kubectl apply -f '${CAROOT}/kargo.yaml'" >&2
echo >&2
echo ' kubectl apply -f "$(mkcert -CAROOT)/manifests"' >&2
echo >&2
echo "The reset-cluster script will automatically apply this secret going forward." >&2
4 changes: 4 additions & 0 deletions scripts/reset-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ kubectl apply --server-side=true -n cert-manager -f "${CAROOT}/local-ca.yaml"
if [[ -f "${CAROOT}/kargo.yaml" ]]; then
kubectl apply --server-side=true -f "${CAROOT}/kargo.yaml" --force-conflicts
fi
# Additional manifests to apply after a reset. Useful for credentials
if [[ -d "${CAROOT}/manifests" ]]; then
kubectl apply --server-side=true -f "${CAROOT}/manifests" --force-conflicts
fi

0 comments on commit 05974d1

Please sign in to comment.