Skip to content

Commit 1e1a296

Browse files
committed
Code Review & HPA event handler
1 parent f686a2d commit 1e1a296

File tree

21 files changed

+724
-25
lines changed

21 files changed

+724
-25
lines changed

apis/v1alpha2/nginxproxy_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ type DeploymentSpec struct {
432432
// +optional
433433
Replicas *int32 `json:"replicas,omitempty"`
434434

435-
// Horizontal Pod Autoscaling.
435+
// Autoscaling defines the configuration for Horizontal Pod Autoscaling.
436436
//
437437
// +optional
438438
Autoscaling HPASpec `json:"autoscaling"`
@@ -471,6 +471,8 @@ type DaemonSetSpec struct {
471471
// +kubebuilder:validation:XValidation:message="CPU utilization must be between 1 and 100",rule="!has(self.targetCPUUtilizationPercentage) || (self.targetCPUUtilizationPercentage >= 1 && self.targetCPUUtilizationPercentage <= 100)"
472472
// +kubebuilder:validation:XValidation:message="memory utilization must be between 1 and 100",rule="!has(self.targetMemoryUtilizationPercentage) || (self.targetMemoryUtilizationPercentage >= 1 && self.targetMemoryUtilizationPercentage <= 100)"
473473
//
474+
// HPASpec is the configuration for the Horizontal Pod Autoscaling.
475+
//
474476
//nolint:lll
475477
type HPASpec struct {
476478
// Behavior configures the scaling behavior of the target

charts/nginx-gateway-fabric/templates/clusterrole.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ rules:
88
- apiGroups:
99
- ""
1010
- apps
11+
{{- if or .Values.nginx.autoscaling.enabled .Values.nginxGateway.autoscaling.enabled }}
1112
- autoscaling
13+
{{- end }}
1214
resources:
1315
- secrets
1416
- configmaps
1517
- serviceaccounts
1618
- services
1719
- deployments
1820
- daemonsets
21+
{{- if or .Values.nginx.autoscaling.enabled .Values.nginxGateway.autoscaling.enabled }}
1922
- horizontalpodautoscalers
23+
{{- end }}
2024
verbs:
2125
- create
2226
- update

charts/nginx-gateway-fabric/templates/hpa.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{{- if and (eq .Values.nginxGateway.kind "deployment") .Values.nginxGateway.autoscaling.enabled -}}
2-
apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (.Capabilities.APIVersions.Has "autoscaling/v2") }}
1+
{{- if and (eq .Values.nginxGateway.kind "deployment") .Values.nginxGateway.autoscaling.enabled (.Capabilities.APIVersions.Has "autoscaling/v2") -}}
2+
apiVersion: autoscaling/v2
33
kind: HorizontalPodAutoscaler
44
metadata:
55
{{- with .Values.nginxGateway.autoscaling.annotations }}

0 commit comments

Comments
 (0)