Skip to content

Commit acb9409

Browse files
committed
Rename a couple fields
1 parent 5a8c499 commit acb9409

File tree

10 files changed

+98
-98
lines changed

10 files changed

+98
-98
lines changed

apis/v1alpha2/nginxproxy_types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ type DeploymentSpec struct {
439439
// Autoscaling defines the configuration for Horizontal Pod Autoscaling.
440440
//
441441
// +optional
442-
Autoscaling *HPASpec `json:"autoscaling,omitempty"`
442+
Autoscaling *AutoscalingSpec `json:"autoscaling,omitempty"`
443443

444444
// Pod defines Pod-specific fields.
445445
//
@@ -475,12 +475,12 @@ type DaemonSetSpec struct {
475475
Patches []Patch `json:"patches,omitempty"`
476476
}
477477

478-
// HPASpec is the configuration for the Horizontal Pod Autoscaling.
478+
// AutoscalingSpec is the configuration for the Horizontal Pod Autoscaling.
479479
//
480480
// +kubebuilder:validation:XValidation:message="minReplicas must be less than or equal to maxReplicas",rule="(!has(self.minReplicas)) || (self.minReplicas <= self.maxReplicas)"
481481
//
482482
//nolint:lll
483-
type HPASpec struct {
483+
type AutoscalingSpec struct {
484484
// Behavior configures the scaling behavior of the target
485485
// in both Up and Down directions (scaleUp and scaleDown fields respectively).
486486
// If not set, the default HPAScalingRules for scale up and scale down are used.
@@ -508,10 +508,10 @@ type HPASpec struct {
508508
// +kubebuilder:validation:Minimum=1
509509
MinReplicas *int32 `json:"minReplicas,omitempty"`
510510

511-
// Templates configures additional metrics options.
511+
// Metrics configures additional metrics options.
512512
//
513513
// +optional
514-
Templates []autoscalingv2.MetricSpec `json:"templates,omitempty"`
514+
Metrics []autoscalingv2.MetricSpec `json:"metrics,omitempty"`
515515

516516
// Maximum number of replicas.
517517
//

apis/v1alpha2/zz_generated.deepcopy.go

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
type: Utilization
3939
averageUtilization: {{ . }}
4040
{{- end }}
41-
{{- with .Values.nginxGateway.autoscaling.templates }}
41+
{{- with .Values.nginxGateway.autoscaling.metrics }}
4242
{{- toYaml . | nindent 4 }}
4343
{{- end }}
4444
{{- with .Values.nginxGateway.autoscaling.behavior }}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ spec:
3232
behavior:
3333
{{- toYaml .Values.nginx.autoscaling.behavior | nindent 10 }}
3434
{{- end }}
35-
{{- if .Values.nginx.autoscaling.templates }}
36-
templates:
37-
{{- toYaml .Values.nginx.autoscaling.templates | nindent 10 }}
35+
{{- if .Values.nginx.autoscaling.metrics }}
36+
metrics:
37+
{{- toYaml .Values.nginx.autoscaling.metrics | nindent 10 }}
3838
{{- end }}
3939
{{- end }}
4040
{{- if .Values.nginx.pod }}

charts/nginx-gateway-fabric/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ nginxGateway:
180180
# value: 2
181181
# periodSeconds: 60
182182
# Custom or additional autoscaling metrics. https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#scaling-on-custom-metrics
183-
# templates:
183+
# metrics:
184184
# - type: Pods
185185
# pods:
186186
# metric:
@@ -251,7 +251,7 @@ nginx:
251251
# value: 2
252252
# periodSeconds: 60
253253
# Custom or additional autoscaling metrics. https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#scaling-on-custom-metrics
254-
# templates:
254+
# metrics:
255255
# - type: Pods
256256
# pods:
257257
# metric:

config/crd/bases/gateway.nginx.org_nginxproxies.yaml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,25 +3709,8 @@ spec:
37093709
format: int32
37103710
minimum: 1
37113711
type: integer
3712-
minReplicas:
3713-
description: Minimum number of replicas.
3714-
format: int32
3715-
minimum: 1
3716-
type: integer
3717-
targetCPUUtilizationPercentage:
3718-
description: Target cpu utilization percentage of HPA.
3719-
format: int32
3720-
maximum: 100
3721-
minimum: 1
3722-
type: integer
3723-
targetMemoryUtilizationPercentage:
3724-
description: Target memory utilization percentage of HPA.
3725-
format: int32
3726-
maximum: 100
3727-
minimum: 1
3728-
type: integer
3729-
templates:
3730-
description: Templates configures additional metrics options.
3712+
metrics:
3713+
description: Metrics configures additional metrics options.
37313714
items:
37323715
description: |-
37333716
MetricSpec specifies how to scale based on a single metric
@@ -4202,6 +4185,23 @@ spec:
42024185
- type
42034186
type: object
42044187
type: array
4188+
minReplicas:
4189+
description: Minimum number of replicas.
4190+
format: int32
4191+
minimum: 1
4192+
type: integer
4193+
targetCPUUtilizationPercentage:
4194+
description: Target cpu utilization percentage of HPA.
4195+
format: int32
4196+
maximum: 100
4197+
minimum: 1
4198+
type: integer
4199+
targetMemoryUtilizationPercentage:
4200+
description: Target memory utilization percentage of HPA.
4201+
format: int32
4202+
maximum: 100
4203+
minimum: 1
4204+
type: integer
42054205
required:
42064206
- enable
42074207
- maxReplicas

deploy/crds.yaml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,25 +4294,8 @@ spec:
42944294
format: int32
42954295
minimum: 1
42964296
type: integer
4297-
minReplicas:
4298-
description: Minimum number of replicas.
4299-
format: int32
4300-
minimum: 1
4301-
type: integer
4302-
targetCPUUtilizationPercentage:
4303-
description: Target cpu utilization percentage of HPA.
4304-
format: int32
4305-
maximum: 100
4306-
minimum: 1
4307-
type: integer
4308-
targetMemoryUtilizationPercentage:
4309-
description: Target memory utilization percentage of HPA.
4310-
format: int32
4311-
maximum: 100
4312-
minimum: 1
4313-
type: integer
4314-
templates:
4315-
description: Templates configures additional metrics options.
4297+
metrics:
4298+
description: Metrics configures additional metrics options.
43164299
items:
43174300
description: |-
43184301
MetricSpec specifies how to scale based on a single metric
@@ -4787,6 +4770,23 @@ spec:
47874770
- type
47884771
type: object
47894772
type: array
4773+
minReplicas:
4774+
description: Minimum number of replicas.
4775+
format: int32
4776+
minimum: 1
4777+
type: integer
4778+
targetCPUUtilizationPercentage:
4779+
description: Target cpu utilization percentage of HPA.
4780+
format: int32
4781+
maximum: 100
4782+
minimum: 1
4783+
type: integer
4784+
targetMemoryUtilizationPercentage:
4785+
description: Target memory utilization percentage of HPA.
4786+
format: int32
4787+
maximum: 100
4788+
minimum: 1
4789+
type: integer
47904790
required:
47914791
- enable
47924792
- maxReplicas

internal/controller/provisioner/objects.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ func (p *NginxProvisioner) buildImage(nProxyCfg *graph.EffectiveNginxProxy) (str
11191119

11201120
func buildNginxDeploymentHPA(
11211121
objectMeta metav1.ObjectMeta,
1122-
autoScaling *ngfAPIv1alpha2.HPASpec,
1122+
autoScaling *ngfAPIv1alpha2.AutoscalingSpec,
11231123
) *autoscalingv2.HorizontalPodAutoscaler {
11241124
if !autoScaling.Enable {
11251125
return nil
@@ -1128,7 +1128,7 @@ func buildNginxDeploymentHPA(
11281128
cpuUtil := autoScaling.TargetCPUUtilizationPercentage
11291129
memUtil := autoScaling.TargetMemoryUtilizationPercentage
11301130

1131-
metricsLen := len(autoScaling.Templates)
1131+
metricsLen := len(autoScaling.Metrics)
11321132
if cpuUtil != nil {
11331133
metricsLen++
11341134
}
@@ -1164,7 +1164,7 @@ func buildNginxDeploymentHPA(
11641164
})
11651165
}
11661166

1167-
metrics = append(metrics, autoScaling.Templates...)
1167+
metrics = append(metrics, autoScaling.Metrics...)
11681168

11691169
return &autoscalingv2.HorizontalPodAutoscaler{
11701170
ObjectMeta: objectMeta,

internal/controller/provisioner/objects_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func TestBuildNginxResourceObjects_NginxProxyConfig(t *testing.T) {
287287
},
288288
Deployment: &ngfAPIv1alpha2.DeploymentSpec{
289289
Replicas: helpers.GetPointer[int32](3),
290-
Autoscaling: &ngfAPIv1alpha2.HPASpec{
290+
Autoscaling: &ngfAPIv1alpha2.AutoscalingSpec{
291291
Enable: true,
292292
MinReplicas: helpers.GetPointer[int32](1),
293293
MaxReplicas: 5,
@@ -438,7 +438,7 @@ func TestBuildNginxResourceObjects_DeploymentReplicasFromHPA(t *testing.T) {
438438
Kubernetes: &ngfAPIv1alpha2.KubernetesSpec{
439439
Deployment: &ngfAPIv1alpha2.DeploymentSpec{
440440
Replicas: nil, // Should be overridden by HPA
441-
Autoscaling: &ngfAPIv1alpha2.HPASpec{Enable: true},
441+
Autoscaling: &ngfAPIv1alpha2.AutoscalingSpec{Enable: true},
442442
},
443443
},
444444
}

internal/controller/provisioner/provisioner_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ func TestRegisterGateway_CleansUpOldHPA(t *testing.T) {
445445
EffectiveNginxProxy: &graph.EffectiveNginxProxy{
446446
Kubernetes: &ngfAPIv1alpha2.KubernetesSpec{
447447
Deployment: &ngfAPIv1alpha2.DeploymentSpec{
448-
Autoscaling: &ngfAPIv1alpha2.HPASpec{
448+
Autoscaling: &ngfAPIv1alpha2.AutoscalingSpec{
449449
Enable: false,
450450
},
451451
},

0 commit comments

Comments
 (0)