Skip to content

Commit 0753cd1

Browse files
committed
add poc for hpa
Signed-off-by: Greg Nyahay <greg.nyahay@anchore.com>
1 parent 7730d60 commit 0753cd1

42 files changed

Lines changed: 1526 additions & 216 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

stable/enterprise/templates/analyzer_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
spec:
1111
selector:
1212
matchLabels: {{- include "enterprise.common.matchLabels" (merge (dict "component" $component) .) | nindent 6 }}
13+
{{- if not .Values.analyzer.autoscaling.enabled }}
1314
replicas: {{ .Values.analyzer.replicaCount }}
15+
{{- end }}
1416
strategy: {{- include "enterprise.common.deploymentStrategy" . | nindent 4 }}
1517
template:
1618
metadata:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.analyzer.autoscaling.enabled }}
2+
{{- $component := "analyzer" -}}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "enterprise.analyzer.fullname" . }}
7+
namespace: {{ .Release.Namespace }}
8+
labels: {{- include "enterprise.common.labels" (merge (dict "component" $component) .) | nindent 4 }}
9+
annotations: {{- include "enterprise.common.annotations" (merge (dict "component" $component) .) | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
name: {{ template "enterprise.analyzer.fullname" . }}
15+
minReplicas: {{ .Values.analyzer.autoscaling.minReplicas }}
16+
maxReplicas: {{ .Values.analyzer.autoscaling.maxReplicas }}
17+
metrics:
18+
{{- if .Values.analyzer.autoscaling.targetCPUUtilizationPercentage }}
19+
- type: Resource
20+
resource:
21+
name: cpu
22+
target:
23+
type: Utilization
24+
averageUtilization: {{ .Values.analyzer.autoscaling.targetCPUUtilizationPercentage }}
25+
{{- end }}
26+
{{- if .Values.analyzer.autoscaling.targetMemoryUtilizationPercentage }}
27+
- type: Resource
28+
resource:
29+
name: memory
30+
target:
31+
type: Utilization
32+
averageUtilization: {{ .Values.analyzer.autoscaling.targetMemoryUtilizationPercentage }}
33+
{{- end }}
34+
{{- end }}

stable/enterprise/templates/api_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
spec:
1111
selector:
1212
matchLabels: {{- include "enterprise.common.matchLabels" (merge (dict "component" $component) .) | nindent 6 }}
13+
{{- if not .Values.api.autoscaling.enabled }}
1314
replicas: {{ .Values.api.replicaCount }}
15+
{{- end }}
1416
strategy: {{- include "enterprise.common.deploymentStrategy" . | nindent 4 }}
1517
template:
1618
metadata:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.api.autoscaling.enabled }}
2+
{{- $component := "api" -}}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "enterprise.api.fullname" . }}
7+
namespace: {{ .Release.Namespace }}
8+
labels: {{- include "enterprise.common.labels" (merge (dict "component" $component) .) | nindent 4 }}
9+
annotations: {{- include "enterprise.common.annotations" (merge (dict "component" $component) .) | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
name: {{ template "enterprise.api.fullname" . }}
15+
minReplicas: {{ .Values.api.autoscaling.minReplicas }}
16+
maxReplicas: {{ .Values.api.autoscaling.maxReplicas }}
17+
metrics:
18+
{{- if .Values.api.autoscaling.targetCPUUtilizationPercentage }}
19+
- type: Resource
20+
resource:
21+
name: cpu
22+
target:
23+
type: Utilization
24+
averageUtilization: {{ .Values.api.autoscaling.targetCPUUtilizationPercentage }}
25+
{{- end }}
26+
{{- if .Values.api.autoscaling.targetMemoryUtilizationPercentage }}
27+
- type: Resource
28+
resource:
29+
name: memory
30+
target:
31+
type: Utilization
32+
averageUtilization: {{ .Values.api.autoscaling.targetMemoryUtilizationPercentage }}
33+
{{- end }}
34+
{{- end }}

stable/enterprise/templates/catalog_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
spec:
1111
selector:
1212
matchLabels: {{- include "enterprise.common.matchLabels" (merge (dict "component" $component) .) | nindent 6 }}
13+
{{- if not .Values.catalog.autoscaling.enabled }}
1314
replicas: {{ .Values.catalog.replicaCount }}
15+
{{- end }}
1416
strategy: {{- include "enterprise.common.deploymentStrategy" . | nindent 4 }}
1517
template:
1618
metadata:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.catalog.autoscaling.enabled }}
2+
{{- $component := "catalog" -}}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "enterprise.catalog.fullname" . }}
7+
namespace: {{ .Release.Namespace }}
8+
labels: {{- include "enterprise.common.labels" (merge (dict "component" $component) .) | nindent 4 }}
9+
annotations: {{- include "enterprise.common.annotations" (merge (dict "component" $component) .) | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
name: {{ template "enterprise.catalog.fullname" . }}
15+
minReplicas: {{ .Values.catalog.autoscaling.minReplicas }}
16+
maxReplicas: {{ .Values.catalog.autoscaling.maxReplicas }}
17+
metrics:
18+
{{- if .Values.catalog.autoscaling.targetCPUUtilizationPercentage }}
19+
- type: Resource
20+
resource:
21+
name: cpu
22+
target:
23+
type: Utilization
24+
averageUtilization: {{ .Values.catalog.autoscaling.targetCPUUtilizationPercentage }}
25+
{{- end }}
26+
{{- if .Values.catalog.autoscaling.targetMemoryUtilizationPercentage }}
27+
- type: Resource
28+
resource:
29+
name: memory
30+
target:
31+
type: Utilization
32+
averageUtilization: {{ .Values.catalog.autoscaling.targetMemoryUtilizationPercentage }}
33+
{{- end }}
34+
{{- end }}

stable/enterprise/templates/datasyncer_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
spec:
1111
selector:
1212
matchLabels: {{- include "enterprise.common.matchLabels" (merge (dict "component" $component) .) | nindent 6 }}
13+
{{- if not .Values.dataSyncer.autoscaling.enabled }}
1314
replicas: {{ .Values.dataSyncer.replicaCount }}
15+
{{- end }}
1416
strategy: {{- include "enterprise.common.deploymentStrategy" . | nindent 4 }}
1517
template:
1618
metadata:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.dataSyncer.autoscaling.enabled }}
2+
{{- $component := "dataSyncer" -}}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "enterprise.dataSyncer.fullname" . }}
7+
namespace: {{ .Release.Namespace }}
8+
labels: {{- include "enterprise.common.labels" (merge (dict "component" $component) .) | nindent 4 }}
9+
annotations: {{- include "enterprise.common.annotations" (merge (dict "component" $component) .) | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
name: {{ template "enterprise.dataSyncer.fullname" . }}
15+
minReplicas: {{ .Values.dataSyncer.autoscaling.minReplicas }}
16+
maxReplicas: {{ .Values.dataSyncer.autoscaling.maxReplicas }}
17+
metrics:
18+
{{- if .Values.dataSyncer.autoscaling.targetCPUUtilizationPercentage }}
19+
- type: Resource
20+
resource:
21+
name: cpu
22+
target:
23+
type: Utilization
24+
averageUtilization: {{ .Values.dataSyncer.autoscaling.targetCPUUtilizationPercentage }}
25+
{{- end }}
26+
{{- if .Values.dataSyncer.autoscaling.targetMemoryUtilizationPercentage }}
27+
- type: Resource
28+
resource:
29+
name: memory
30+
target:
31+
type: Utilization
32+
averageUtilization: {{ .Values.dataSyncer.autoscaling.targetMemoryUtilizationPercentage }}
33+
{{- end }}
34+
{{- end }}

stable/enterprise/templates/notifications_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
spec:
1111
selector:
1212
matchLabels: {{- include "enterprise.common.matchLabels" (merge (dict "component" $component) .) | nindent 6 }}
13+
{{- if not .Values.notifications.autoscaling.enabled }}
1314
replicas: {{ .Values.notifications.replicaCount }}
15+
{{- end }}
1416
strategy: {{- include "enterprise.common.deploymentStrategy" . | nindent 4 }}
1517
template:
1618
metadata:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if .Values.notifications.autoscaling.enabled }}
2+
{{- $component := "notifications" -}}
3+
apiVersion: autoscaling/v2
4+
kind: HorizontalPodAutoscaler
5+
metadata:
6+
name: {{ template "enterprise.notifications.fullname" . }}
7+
namespace: {{ .Release.Namespace }}
8+
labels: {{- include "enterprise.common.labels" (merge (dict "component" $component) .) | nindent 4 }}
9+
annotations: {{- include "enterprise.common.annotations" (merge (dict "component" $component) .) | nindent 4 }}
10+
spec:
11+
scaleTargetRef:
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
name: {{ template "enterprise.notifications.fullname" . }}
15+
minReplicas: {{ .Values.notifications.autoscaling.minReplicas }}
16+
maxReplicas: {{ .Values.notifications.autoscaling.maxReplicas }}
17+
metrics:
18+
{{- if .Values.notifications.autoscaling.targetCPUUtilizationPercentage }}
19+
- type: Resource
20+
resource:
21+
name: cpu
22+
target:
23+
type: Utilization
24+
averageUtilization: {{ .Values.notifications.autoscaling.targetCPUUtilizationPercentage }}
25+
{{- end }}
26+
{{- if .Values.notifications.autoscaling.targetMemoryUtilizationPercentage }}
27+
- type: Resource
28+
resource:
29+
name: memory
30+
target:
31+
type: Utilization
32+
averageUtilization: {{ .Values.notifications.autoscaling.targetMemoryUtilizationPercentage }}
33+
{{- end }}
34+
{{- end }}

0 commit comments

Comments
 (0)