Skip to content

Commit

Permalink
Topology update (#213)
Browse files Browse the repository at this point in the history
* Update topology constraints and remove rollouts
  • Loading branch information
m-ondracek-tric authored Sep 16, 2024
1 parent 2f5aef3 commit 5147b70
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 171 deletions.
2 changes: 1 addition & 1 deletion Charts/qtest-mgr/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ icon: https://images.g2crowd.com/uploads/product/image/social_landscape/social_l
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 1.7.3
version: 1.8.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
20 changes: 16 additions & 4 deletions Charts/qtest-mgr/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ spec:
{{ toYaml .Values.podLabels | nindent 8 }}
{{- end}}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down Expand Up @@ -244,11 +248,7 @@ metadata:
{{ $key }}: {{ $value }}
{{- end }}
spec:
{{- if .Values.rollouts.enabled }}
replicas: 0
{{- else }}
replicas: {{ .Values.autoscaling.minReplicas.poller }}
{{- end }}
revisionHistoryLimit: 3
selector:
matchLabels:
Expand All @@ -275,6 +275,10 @@ spec:
{{ toYaml .Values.podLabels | nindent 8 }}
{{- end}}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down Expand Up @@ -478,6 +482,10 @@ spec:
{{ toYaml .Values.podLabels | nindent 8 }}
{{- end}}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down Expand Up @@ -681,6 +689,10 @@ spec:
{{ toYaml .Values.podLabels | nindent 8 }}
{{- end}}
spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down
161 changes: 16 additions & 145 deletions Charts/qtest-mgr/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{{- if .Values.autoscaling.enabled }}
{{- if .Values.rollouts.enabled -}}
{{- $targetType := ternary "Rollout" "Deployment" .Values.rollouts.enabled -}}
{{- $targetSuffix := ternary "rollout" "deployment" .Values.rollouts.enabled -}}
{{- $targetApiVersion := ternary "argoproj.io/v1alpha1" "apps/v1" .Values.rollouts.enabled -}}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-ui-rollout
name: mgr-ui-{{ $targetSuffix }}
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
name: mgr-ui-rollout
apiVersion: {{ $targetApiVersion }}
kind: {{ $targetType }}
name: mgr-ui-{{ $targetSuffix }}
minReplicas: {{ .Values.autoscaling.minReplicas.ui }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.ui }}
metrics:
Expand All @@ -36,15 +38,15 @@ spec:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-api-rollout
name: mgr-api-{{ $targetSuffix }}
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
name: mgr-api-rollout
apiVersion: {{ $targetApiVersion }}
kind: {{ $targetType }}
name: mgr-api-{{ $targetSuffix }}
minReplicas: {{ .Values.autoscaling.minReplicas.api }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.api }}
metrics:
Expand All @@ -68,47 +70,15 @@ spec:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-poller-rollout
name: mgr-notification-{{ $targetSuffix }}
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
name: mgr-poller-rollout
minReplicas: {{ .Values.autoscaling.minReplicas.poller }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.poller }}
metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-notification-rollout
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
name: mgr-notification-rollout
apiVersion: {{ $targetApiVersion }}
kind: {{ $targetType }}
name: mgr-notification-{{ $targetSuffix }}
minReplicas: {{ .Values.autoscaling.minReplicas.notification }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.notification }}
metrics:
Expand All @@ -128,73 +98,8 @@ spec:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end -}}
{{- else }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-ui-deployment
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mgr-ui-deployment
minReplicas: {{ .Values.autoscaling.minReplicas.ui }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.ui }}
metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
---
{{ if not .Values.testconductor.environment.singleInstance }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-api-deployment
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mgr-api-deployment
minReplicas: {{ .Values.autoscaling.minReplicas.api }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.api }}
metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
---
{{- end -}}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
Expand Down Expand Up @@ -226,38 +131,4 @@ spec:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mgr-notification-deployment
namespace: {{ .Values.namespace.name }}
labels:
{{- include "qtest-mgr.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mgr-notification-deployment
minReplicas: {{ .Values.autoscaling.minReplicas.notification }}
maxReplicas: {{ .Values.autoscaling.maxReplicas.notification }}
metrics:
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
21 changes: 0 additions & 21 deletions Charts/qtest-mgr/templates/rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,6 @@ spec:
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: mgr-poller-rollout
namespace: {{ .Values.namespace.name }}
spec:
replicas: {{ .Values.autoscaling.minReplicas.poller }}
revisionHistoryLimit: 3
workloadRef:
apiVersion: apps/v1
kind: Deployment
name: mgr-poller-deployment
strategy:
{{- with .Values.rollouts.strategy -}}
{{- toYaml . | nindent 4 }}
{{- end }}
steps:
{{- with .Values.rollouts.steps -}}
{{- toYaml . | nindent 8 }}
{{- end }}
---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: mgr-notification-rollout
namespace: {{ .Values.namespace.name }}
Expand Down
1 change: 1 addition & 0 deletions Charts/qtest-mgr/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ startupSslProbe:
nodeSelector: {}
tolerations: []
affinity: {}
topologySpreadConstraints: {}
### qtest-launch ###################################################
qtest-launch:
enabled: false
Expand Down

0 comments on commit 5147b70

Please sign in to comment.