Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions setup_project_repo.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/bin/bash

mkdir flux kustomize helm

#
# Example useage
#
# default example:
# setup_project_repo.sh
#
# instavote apps:
# setup_project_repo.sh redis
# setup_project_repo.sh results
# setup_project_repo.sh vote
# setup_project_repo.sh worker
#

mkdir -p flux kustomize helm

# main readme is maintained as append, but only run 1x
if [ ! -f "flux/base/README.md" ]; then
cat >> README.md <<EOF
## Deployment Repo

Expand Down Expand Up @@ -86,13 +100,12 @@ You would maintain 3 Different Repos to maintain
* Running Reconciliation for each of the Flux Resource with actual Kubernetes Cluster.

EOF
fi

# Flux
mkdir -p flux/base flux/staging flux/production

cd flux

mkdir base staging production

cat > base/README.md <<EOF
cat > flux/base/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Deployment Manifests which are Synced by Flux to Deploy to a Kubernetes Environment.

Expand All @@ -119,37 +132,39 @@ Image Automation:

EOF

cat > staging/README.md <<EOF
cat > flux/staging/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Kustomize Overlays for staging environemnt to flux sync manifests defined in ../base.
If you add a patch file, ensure you update kustomization.yaml accordingly.
EOF

cat > production/README.md <<EOF
cat > flux/production/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Kustomize Overlays for staging environemnt to manifests flux sync defined in ../base.
If you add a patch file, ensure you update kustomization.yaml accordingly.
EOF


cat > staging/kustomization.yaml <<EOF
cat > flux/staging/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
EOF


cat > production/kustomization.yaml <<EOF
cat > flux/production/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
EOF

# kustomize - arg 1, or example
KUSTOMIZE_BASE="kustomize/${1:-example-project}"
mkdir -p ${KUSTOMIZE_BASE}/base ${KUSTOMIZE_BASE}/staging ${KUSTOMIZE_BASE}/production


cat > base/README.md <<EOF
cat > ${KUSTOMIZE_BASE}/base/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Kubernetes Manifests YAML.

Expand All @@ -166,37 +181,36 @@ In fact it could be any resource that you would apply to kubernetes.

EOF

cat > staging/README.md <<EOF
cat > ${KUSTOMIZE_BASE}/staging/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Kustomize Overlays for staging environemnt to manifests defined in ../base.
If you add a patch file, ensure you update kustomization.yaml accordingly.
EOF

cat > production/README.md <<EOF
cat > ${KUSTOMIZE_BASE}/production/README.md <<EOF
## Kubernetes Deployment Manifests
This path is to add Kustomize Overlays for staging environemnt to manifests defined in ../base.
If you add a patch file, ensure you update kustomization.yaml accordingly.
EOF

cat > staging/kustomization.yaml <<EOF
cat > ${KUSTOMIZE_BASE}/staging/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
EOF


cat > production/kustomization.yaml <<EOF
cat > ${KUSTOMIZE_BASE}/production/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base
EOF

cd ../helm
mkdir charts
# Helm
mkdir -p helm/charts

cat > charts/README.md <<EOF
cat > helm/charts/README.md <<EOF
## Helm Charts
Add your helm charts here.
EOF
Expand Down