Skip to content

Commit

Permalink
Merge pull request #600 from dappforce/feat/adjust-action-pipeline
Browse files Browse the repository at this point in the history
chore: add hpa for both main and test.
  • Loading branch information
iv1310 authored Mar 14, 2024
2 parents 11c4061 + f863995 commit 6ef99d3
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/actions/common-cd-setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ runs:
shell: bash
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ inputs.k8s_input }}

- name: Remove HPA
if: github.ref == 'refs/heads/main'
shell: bash
run: |
[[ "${{ inputs.app_input }}" == "main" ]] && kubectl delete hpa -n sub-back mainnet-grillchat --ignore-not-found=true || kubectl delete hpa -n sub-back grillchat --ignore-not-found=true
- name: Add feature name
if: startsWith(github.ref, 'refs/heads/deploy/')
shell: bash
Expand All @@ -66,4 +72,12 @@ runs:
shell: bash
run: |
sed -i 's|<IMAGE>|'${{ env.image }}'|' $GITHUB_WORKSPACE/deployment/${{ inputs.app_input }}/deployment.yaml
kubectl apply -f $GITHUB_WORKSPACE/deployment/${{ inputs.app_input }}/
kubectl apply -f $GITHUB_WORKSPACE/deployment/${{ inputs.app_input }}/all.yaml
kubectl apply -f $GITHUB_WORKSPACE/deployment/${{ inputs.app_input }}/deployment.yaml
- name: Add HPA
if: github.ref == 'refs/heads/main'
shell: bash
run: |
[[ "${{ inputs.app_input }}" == "main" ]] && kubectl rollout status -n sub-back deployment/mainnet-grillchat || kubectl rollout status -n sub-back deployment/grillchat
kubectl apply -f $GITHUB_WORKSPACE/deployment/${{ inputs.app_input }}/hpa.yaml
27 changes: 27 additions & 0 deletions deployment/main/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
creationTimestamp: null
name: mainnet-grillchat
namespace: sub-back
spec:
maxReplicas: 3
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mainnet-grillchat
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 90
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 96
27 changes: 27 additions & 0 deletions deployment/test/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
creationTimestamp: null
name: grillchat
namespace: sub-back
spec:
maxReplicas: 3
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: grillchat
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 90
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 96

0 comments on commit 6ef99d3

Please sign in to comment.