Commit 539d49e4 authored by Alexandre Vincent's avatar Alexandre Vincent
Browse files

Merge branch 'avincent/horizontal_pod_autoscaling' into 'master'

add possibility of autoscaling. add injection of predeploy templates.

See merge request !253
parents afc2c90a be590f97
Pipeline #70375 failed with stages
in 17 minutes and 32 seconds
......@@ -23,7 +23,9 @@ metadata:
name: {{ .Values.deployment.name }}{{ $nameSuffix }}
{{ include "os-wellbore-ddms.namespace" . | indent 2}}
spec:
{{- if not .Values.isAutoscalingEnabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{ include "os-wellbore-ddms.commonLabels" . | indent 6}}
......
# Copyright 2021 Schlumberger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if .Values.isAutoscalingEnabled }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: os-wellbore-ddms{{ include "os-wellbore-ddms.name-suffix" . }}
namespace: osdu
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: os-wellbore-ddms{{ include "os-wellbore-ddms.name-suffix" . }}
minReplicas: {{ .Values.minReplicaCount }}
maxReplicas: {{ .Values.maxReplicaCount }}
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 150
policies:
- type: Pods
value: 2
periodSeconds: 30
scaleUp:
stabilizationWindowSeconds: 10
# Either add 50% of current pods or 2 pods (whichever is higher) every 10 seconds until the the HPA stabilizes
selectPolicy: Max
policies:
- type: Pods
value: 2
periodSeconds: 10
- type: Percent
value: 50
periodSeconds: 10
{{- end }}
\ No newline at end of file
......@@ -24,9 +24,11 @@ deployment:
keyvaultUrlPropertyName: ENV_KEYVAULT
name: os-wellbore-ddms
replicaCount: 2
nodepool: services
isAutoscalingEnabled: false
maxReplicaCount: 2
minReplicaCount: 2
replicaCount: 2
resources:
limits:
......
......@@ -26,6 +26,10 @@ parameters:
# # TODO: The following templates needs to be injected as parameters
# authenticationTemplate: ${{ getImageTemplate }}
# authenticationTemplateParameters: ${{ getImageTemplateParameters }}
# preDeployTemplates:
# - template: ${{ my_template }}
# parameters: ${{ my_template_params }}
# - ...
# getImageTemplate: ${{ authenticationTemplate }}
# getImageTemplateParameters: ${{ authenticationTemplateParameter }}
......@@ -51,6 +55,11 @@ stages:
- template: steps-define-variables.yaml
- template: ${{ provider.getImageTemplate }}
parameters: ${{ provider.getImageTemplateParameters }}
- ${{ each preDeployTemplate in environment.preDeployTemplates }}:
- template: ${{ preDeployTemplate.template }}
parameters:
${{ each parameter in preDeployTemplate.parameters }}:
${{ parameter.key }}: ${{ parameter.value }}
- template: steps-push-image.yaml
parameters:
azureSubscription: $(SERVICE_CONNECTION_NAME)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment