Skip to content

Commit

Permalink
Merge pull request #13 from wallarm/release/v0.6.4
Browse files Browse the repository at this point in the history
release: v0.6.4
  • Loading branch information
Andrey MrEcco Burindin authored Aug 18, 2021
2 parents 090c912 + ecad707 commit 14a96c7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion helm/api-firewall/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: api-firewall
version: 0.6.2
version: 0.6.4
description: Wallarm OpenAPI-based API Firewall
keywords:
- wallarm
Expand Down
15 changes: 15 additions & 0 deletions helm/api-firewall/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,18 @@ Return the appropriate apiVersion for Ingress kind of objects.
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for HorizontalPodAutoscaler kind of objects.
*/}}
{{- define "horizontalPodAutoscaler.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "autoscaling/v2beta2/HorizontalPodAutoscaler" -}}
{{- print "autoscaling/v2beta2" -}}
{{- else -}}
{{- if .Capabilities.APIVersions.Has "autoscaling/v2beta1/HorizontalPodAutoscaler" -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- fail "Kubernetes Autoscaling API ti old. You need to upgrade your cluster for using this feature" -}}
{{- end -}}
{{- end -}}
{{- end -}}
17 changes: 17 additions & 0 deletions helm/api-firewall/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ spec:
name: {{ template "api-firewall.fullname" . }}
minReplicas: {{ .Values.apiFirewall.autoscaling.minReplicas }}
maxReplicas: {{ .Values.apiFirewall.autoscaling.maxReplicas }}
{{ if .Capabilities.APIVersions.Has "autoscaling/v2beta2/HorizontalPodAutoscaler" -}}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.apiFirewall.autoscaling.targetCPUUtilizationPercentage }}
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.apiFirewall.autoscaling.targetMemoryUtilizationPercentage }}
{{ else -}}
{{ if .Capabilities.APIVersions.Has "autoscaling/v2beta1/HorizontalPodAutoscaler" -}}
metrics:
- type: Resource
resource:
Expand All @@ -25,4 +40,6 @@ spec:
resource:
name: memory
targetAverageUtilization: {{ .Values.apiFirewall.autoscaling.targetMemoryUtilizationPercentage }}
{{ end -}}
{{ end -}}
{{- end }}
2 changes: 1 addition & 1 deletion helm/api-firewall/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ apiFirewall:
image:
registry: ""
name: "wallarm/api-firewall"
tag: "v0.6.2"
tag: "v0.6.4"
pullPolicy: IfNotPresent

## Array of private container registry credentials
Expand Down

0 comments on commit 14a96c7

Please sign in to comment.