Skip to content

Commit

Permalink
feat: allow user to use a branch of their deploy repo
Browse files Browse the repository at this point in the history
Allow the user to use a branch of their deploy repo for templating out
the configs.
  • Loading branch information
cardoe committed Apr 12, 2024
1 parent f4fc4a6 commit dd1e41e
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/components/argo-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
targetRevision: ${UC_REPO_REF}
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: secret-argo-sso-argo.yaml
destination:
Expand Down
2 changes: 1 addition & 1 deletion apps/components/dexidp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
ref: values
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: 'secret-*-sso-dex.yaml'
ref: secrets
Expand Down
2 changes: 1 addition & 1 deletion apps/components/ironic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
- $secrets/secrets/${DEPLOY_NAME}/secret-openstack.yaml
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: 'secret-ironic-*.yaml'
ref: secrets
Expand Down
2 changes: 1 addition & 1 deletion apps/components/keystone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
- $secrets/helm-configs/${DEPLOY_NAME}/keystone.yaml
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: 'secret-keystone-*.yaml'
ref: secrets
Expand Down
2 changes: 1 addition & 1 deletion apps/components/mariadb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
targetRevision: ${UC_REPO_REF}
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: secret-mariadb.yaml
destination:
Expand Down
2 changes: 1 addition & 1 deletion apps/components/nautobot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
value: ${DEPLOY_NAME}-cluster-issuer
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: 'secret-nautobot*.yaml'
exclude: secret-nautobot-sso-dex.yaml
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/cert-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
installCRDs: true
- repoURL: ${UC_DEPLOY_GIT_URL}
path: secrets/${DEPLOY_NAME}/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
directory:
include: cluster-issuer.yaml
destination:
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/ingress-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
targetRevision: ${UC_REPO_REF}
ref: values
- repoURL: ${UC_DEPLOY_GIT_URL}
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
ref: secrets
destination:
server: "https://kubernetes.default.svc"
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/mariadb-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
source:
repoURL: https://github.com/rackerlabs/understack.git
path: operators/mariadb-operator/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
destination:
server: "https://kubernetes.default.svc"
namespace: mariadb-operator
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/messaging-topology-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
source:
repoURL: https://github.com/rackerlabs/understack.git
path: operators/messaging-topology-operator/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
destination:
server: "https://kubernetes.default.svc"
namespace: rabbitmq-system
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/postgres-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
source:
repoURL: https://github.com/rackerlabs/understack.git
path: operators/postgres-operator/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
destination:
server: "https://kubernetes.default.svc"
namespace: postgres-operator
Expand Down
2 changes: 1 addition & 1 deletion apps/operators/rabbitmq-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
source:
repoURL: https://github.com/rackerlabs/understack.git
path: operators/rabbitmq-operator/
targetRevision: HEAD
targetRevision: ${UC_DEPLOY_REF}
destination:
server: "https://kubernetes.default.svc"
namespace: rabbitmq-system
Expand Down
3 changes: 3 additions & 0 deletions docs/gitops-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ UC_DEPLOY_EMAIL="my@email"
The `UC_REPO` and `UC_DEPLOY` variables are local paths on your machine to where
these two repos have been cloned.

Optional variables of `UC_REPO_REF` and `UC_DEPLOY_REF` can be defined which
can be set to any valid git reference in their respective repos (e.g. branch or tag or commit).

#### Deployment Name

The `DEPLOY_NAME` variable contains the name that you'll refer to your
Expand Down
3 changes: 2 additions & 1 deletion scripts/gitops-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ usage() {

template() {
local subvars
subvars="\$DNS_ZONE \$UC_DEPLOY_GIT_URL \$UC_REPO_REF \$DEPLOY_NAME"
subvars="\$DNS_ZONE \$UC_DEPLOY_GIT_URL \$UC_REPO_REF \$UC_DEPLOY_REF \$DEPLOY_NAME"
cat "$1" | envsubst "${subvars}" > "$2"
}

Expand Down Expand Up @@ -48,6 +48,7 @@ export DNS_ZONE
export UC_DEPLOY_GIT_URL
export DEPLOY_NAME
export UC_REPO_REF="${UC_REPO_REF:-HEAD}"
export UC_DEPLOY_REF="${UC_DEPLOY_REF:-HEAD}"

for part in operators components; do
echo "Creating ${part} configs"
Expand Down

0 comments on commit dd1e41e

Please sign in to comment.