Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add autoscaling to oracle api #170

Merged
merged 4 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
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
21 changes: 14 additions & 7 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pushing
run: docker push ${{ env.NAME }}

builds:
name: Builds
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -132,7 +132,10 @@ jobs:
file: backend/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=1 -p BUILD=snapshot-${{ github.event.number }}
parameters:
-p MIN_REPLICAS=1
-p MAX_REPLICAS=1
-p BUILD=snapshot-${{ github.event.number }}
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
Expand All @@ -144,12 +147,16 @@ jobs:
-p REACT_APP_KC_URL=https://test.loginproxy.gov.bc.ca/auth
-p REACT_APP_KC_REALM=standard
-p REACT_APP_KC_CLIENT_ID=seed-planning-test-4296
-p MIN_REPLICAS=1 -p MAX_REPLICAS=1
-p MIN_REPLICAS=1
-p MAX_REPLICAS=1
- name: oracle-api
file: oracle-api/openshift.deploy.yml
overwrite: true
verification_path: "actuator/health"
parameters: -p NR_SPAR_ORACLE_API_VERSION=snapshot-${{ github.event.number }}
parameters:
-p NR_SPAR_ORACLE_API_VERSION=snapshot-${{ github.event.number }}
-p MIN_REPLICAS=1
craigyu marked this conversation as resolved.
Show resolved Hide resolved
-p MAX_REPLICAS=1
steps:
- uses: bcgov-nr/action-deployer-openshift@v1.0.4
with:
Expand All @@ -161,9 +168,9 @@ jobs:
penetration_test: false
verification_path: ${{ matrix.verification_path}}
parameters:
-p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }}
${{ matrix.parameters }}
-p ZONE=${{ github.event.number }}
-p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/${{ matrix.name }}:${{ github.event.number }}${{ matrix.parameters }}

# tests-api:
# name: API Tests
Expand Down
2 changes: 1 addition & 1 deletion backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@ objects:
name: cpu
target:
type: Utilization
averageUtilization: 100
averageUtilization: 80
2 changes: 1 addition & 1 deletion frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ objects:
name: cpu
target:
type: Utilization
averageUtilization: 100
averageUtilization: 80
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
Expand Down
24 changes: 24 additions & 0 deletions oracle-api/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ parameters:
- name: KEYCLOAK_REALM_URL
description: Keycloak realm address
value: https://test.loginproxy.gov.bc.ca/auth/realms/standard
- name: MIN_REPLICAS
description: The minimum amount of replicas for the horizontal pod autoscaler.
value: "3"
- name: MAX_REPLICAS
description: The maximum amount of replicas for the horizontal pod autoscaler.
value: "5"
objects:
- apiVersion: v1
kind: ImageStream
Expand Down Expand Up @@ -180,3 +186,21 @@ objects:
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}-${ZONE}-${COMPONENT}
minReplicas: ${{MIN_REPLICAS}}
maxReplicas: ${{MAX_REPLICAS}}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80