Skip to content

Latest commit

 

History

History
168 lines (116 loc) · 3.28 KB

outer-loop-ring-deployment.md

File metadata and controls

168 lines (116 loc) · 3.28 KB

PiB outer-loop with Ring Based Deployment

  • PiB includes GitOps Automation that uses cluster metadata for targeted deployments
  • In this lab we will
    • Create the GitOps structure for 15 clusters
    • Add ring metadata to each cluster
    • Add targets based on cluster metadata

Validate cluster identifier and working branch

# by default, MY_BRANCH is set to your lower case GitHub User Name
# the variable is used to uniquely name your clusters
# the value can be overwritten if needed
echo $MY_BRANCH

# make sure your branch is set and pushed remotely
# commands will fail if you are in main branch
git branch --show-current

Create 15 Clusters

Note: we don't actually create the clusters, just the GitOps folders

# start in the base of the repo
cd $PIB_BASE

flt create \
    --gitops-only \
    -g $MY_BRANCH-fleet \
    -c central-tx-atx-101 \
    -c central-tx-dal-101 \
    -c central-tx-hou-101 \
    -c central-tx-ftw-101 \
    -c central-tx-san-101 \
    -c east-ga-atl-101 \
    -c east-fl-mia-101 \
    -c east-al-bham-101 \
    -c east-ms-bil-101 \
    -c east-nc-clt-101 \
    -c west-wa-sea-101 \
    -c west-nv-lv-101 \
    -c west-ca-sd-101 \
    -c west-or-pdx-101 \
    -c west-mt-bose-101

Cluster Metadata Files

ls -alF clusters/*.yaml

cat clusters/central-tx-atx-101.yaml

Update Git Repo

  • flt create generates GitOps files for the cluster

  • CI-CD generates the deployment manifests

    • Wait for CI-CD to complete (usually about 30 seconds)
    # update the git repo after ci-cd completes
    git pull
    

Add Metadata to Clusters

echo "ring: 0" >> clusters/central-tx-atx-101.yaml
echo "ring: 1" >> clusters/central-tx-dal-101.yaml
echo "ring: 2" >> clusters/central-tx-ftw-101.yaml
echo "ring: 3" >> clusters/central-tx-hou-101.yaml
echo "ring: 4" >> clusters/central-tx-san-101.yaml
echo "ring: 0" >> clusters/east-al-bham-101.yaml
echo "ring: 1" >> clusters/east-fl-mia-101.yaml
echo "ring: 2" >> clusters/east-ga-atl-101.yaml
echo "ring: 3" >> clusters/east-ms-bil-101.yaml
echo "ring: 4" >> clusters/east-nc-clt-101.yaml
echo "ring: 0" >> clusters/west-ca-sd-101.yaml
echo "ring: 1" >> clusters/west-mt-bose-101.yaml
echo "ring: 2" >> clusters/west-nv-lv-101.yaml
echo "ring: 3" >> clusters/west-or-pdx-101.yaml
echo "ring: 4" >> clusters/west-wa-sea-101.yaml

git add clusters

Deploy IMDb to ring:0

cd $PIB_BASE/apps/imdb
flt targets clear
flt targets add ring:0
flt targets deploy

# wait for ci-cd to finish
git pull

Add ring:1

cd $PIB_BASE/apps/imdb
flt targets add ring:1
flt targets deploy

# wait for ci-cd to finish
git pull

Add Central Region

cd $PIB_BASE/apps/imdb
flt targets add region:central
flt targets deploy

# wait for ci-cd to finish
git pull

Clean Up

  • Once you are finished with the workshop, you can delete your GitOps resources
# start in the base of the repo
cd $PIB_BASE
git pull

# restore the clusters dir from main
git restore -s main clusters
git add .

# clear imdb targets
cd apps/imdb
flt targets clear

# clear dogs-cats targets
cd ../dogs-cats
flt targets clear

# push changes
flt targets deploy

cd ../..