Scale Up Lower Environments #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scale Up Lower Environments | |
on: | |
schedule: | |
- cron: '0 6 * * 1-5' | |
jobs: | |
scale-up: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
environment: ["poc", "dev"] | |
environment: | |
name: ${{ matrix.environment }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Kubernetes | |
uses: azure/[email protected] | |
with: | |
version: 'v1.26.0' # default is latest stable | |
id: kubectl_install | |
- name: Install Helm | |
uses: azure/[email protected] | |
with: | |
version: 'v3.9.0' | |
id: helm_install | |
- name: Install yq | |
uses: dcarbone/[email protected] | |
with: | |
download-compressed: true | |
version: "v4.35.1" | |
force: true | |
- name: Scaling up Deployments in ${{ matrix.environment }} namespace | |
env: | |
KUBE_NAMESPACE: ${{ secrets.KUBE_NAMESPACE }} | |
KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }} | |
run: | | |
echo "${{ secrets.KUBE_CERT }}" > ca.crt | |
kubectl config set-cluster ${KUBE_CLUSTER} --certificate-authority=./ca.crt --server=https://${KUBE_CLUSTER} | |
kubectl config set-credentials deploy-user --token=${{ secrets.KUBE_TOKEN }} | |
kubectl config set-context ${KUBE_CLUSTER} --cluster=${KUBE_CLUSTER} --user=deploy-user --namespace=${KUBE_NAMESPACE} | |
kubectl config use-context ${KUBE_CLUSTER} | |
kubectl config set-context --current --namespace=${KUBE_NAMESPACE} | |
RELEASE_NAME="alfresco-content-services" | |
LATEST_REVISION=$(helm history "$RELEASE_NAME" --max 1 -o yaml | yq -r '.[0].revision') | |
LATEST_VALUES=$(helm get values "$RELEASE_NAME" --revision "$LATEST_REVISION" -o yaml) | |
kubectl scale deployment alfresco-content-services-alfresco-cs-repository --replicas=$(yq -r '.repository.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-share --replicas=$(yq -r '.share.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-activemq --replicas=$(yq -r '.activemq.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-imagemagick --replicas=$(yq -r '.imagemagick.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-libreoffice --replicas=$(yq -r '.libreoffice.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-pdfrenderer --replicas=$(yq -r '.pdfrenderer.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-tika --replicas=$(yq -r '.tika.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-cs-transform-misc --replicas=$(yq -r '.transformmisc.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-filestore --replicas=$(yq -r '.filestore.replicaCount // 0' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-router --replicas=$(yq -r '.transformrouter.replicaCount // 1' <<< "$LATEST_VALUES") | |
kubectl scale deployment alfresco-content-services-alfresco-search-solr --replicas=$(yq -r '.share.replicaCount // 1' <<< "$LATEST_VALUES") |