Skip to content

Commit 94eaa04

Browse files
committed
Code Review
1 parent 62bfa27 commit 94eaa04

File tree

9 files changed

+7
-46
lines changed

9 files changed

+7
-46
lines changed

apis/v1alpha2/nginxproxy_types.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,8 @@ type HPASpec struct {
449449
// +optional
450450
TargetMemoryUtilizationPercentage *int32 `json:"targetMemoryUtilizationPercentage,omitempty"`
451451

452-
// Annotation for Horizontal Pod Autoscaler
453-
// Annotations is an unstructured key value map stored with a resource that may be
454-
// set by external tools to store and retrieve arbitrary metadata. They are not
455-
// queryable and should be preserved when modifying objects.
456-
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
457-
//
458-
// +optional
459-
HPAAnnotations map[string]string `json:"hpaAnnotations,omitempty"`
460-
461452
// Minimum number of replicas.
462-
MinReplicas int32 `json:"minReplicas"`
453+
MinReplicas *int32 `json:"minReplicas"`
463454

464455
// Maximum number of replicas.
465456
MaxReplicas int32 `json:"maxReplicas"`

apis/v1alpha2/zz_generated.deepcopy.go

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

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ spec:
1818
{{- if .Values.nginx.autoscaling.enabled }}
1919
autoscaling:
2020
enabled: {{ .Values.nginx.autoscaling.enabled }}
21-
{{- if .Values.nginx.autoscaling.hpaAnnotations }}
22-
hpaAnnotations:
23-
{{- toYaml .Values.nginx.autoscaling.hpaAnnotations | nindent 10 }}
24-
{{- end }}
2521
minReplicas: {{ .Values.nginx.autoscaling.minReplicas }}
2622
maxReplicas: {{ .Values.nginx.autoscaling.maxReplicas }}
2723
{{- if .Values.nginx.autoscaling.targetCPUUtilizationPercentage }}

charts/nginx-gateway-fabric/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ nginx:
234234
autoscaling:
235235
# Enable or disable Horizontal Pod Autoscaler
236236
enabled: false
237-
# hpaAnnotations: {}
238237
# minReplicas: 1
239238
# maxReplicas: 11
240239
# targetCPUUtilizationPercentage: 50

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4101,16 +4101,6 @@ spec:
41014101
enabled:
41024102
description: Enable or disable Horizontal Pod Autoscaler
41034103
type: boolean
4104-
hpaAnnotations:
4105-
additionalProperties:
4106-
type: string
4107-
description: |-
4108-
Annotation for Horizontal Pod Autoscaler
4109-
Annotations is an unstructured key value map stored with a resource that may be
4110-
set by external tools to store and retrieve arbitrary metadata. They are not
4111-
queryable and should be preserved when modifying objects.
4112-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
4113-
type: object
41144104
maxReplicas:
41154105
description: Maximum number of replicas.
41164106
format: int32

deploy/crds.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,16 +4686,6 @@ spec:
46864686
enabled:
46874687
description: Enable or disable Horizontal Pod Autoscaler
46884688
type: boolean
4689-
hpaAnnotations:
4690-
additionalProperties:
4691-
type: string
4692-
description: |-
4693-
Annotation for Horizontal Pod Autoscaler
4694-
Annotations is an unstructured key value map stored with a resource that may be
4695-
set by external tools to store and retrieve arbitrary metadata. They are not
4696-
queryable and should be preserved when modifying objects.
4697-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
4698-
type: object
46994689
maxReplicas:
47004690
description: Maximum number of replicas.
47014691
format: int32

internal/controller/provisioner/eventloop.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func newEventLoop(
8181
k8spredicate.And(
8282
k8spredicate.GenerationChangedPredicate{},
8383
nginxResourceLabelPredicate,
84-
predicate.RestartDeploymentAnnotationPredicate{},
8584
),
8685
),
8786
},

internal/controller/provisioner/objects.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,6 @@ func buildNginxDeploymentHPA(
943943
objectMeta metav1.ObjectMeta,
944944
autoScaling ngfAPIv1alpha2.HPASpec,
945945
) *autoscalingv2.HorizontalPodAutoscaler {
946-
objectMeta.Annotations = autoScaling.HPAAnnotations
947-
948946
if !autoScaling.Enabled {
949947
return nil
950948
}
@@ -1002,7 +1000,7 @@ func buildNginxDeploymentHPA(
10021000
Kind: "Deployment",
10031001
Name: objectMeta.Name,
10041002
},
1005-
MinReplicas: &autoScaling.MinReplicas,
1003+
MinReplicas: autoScaling.MinReplicas,
10061004
MaxReplicas: autoScaling.MaxReplicas,
10071005
Metrics: metrics,
10081006
Behavior: autoScaling.Behavior,

internal/controller/provisioner/objects_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func TestBuildNginxResourceObjects_NginxProxyConfig(t *testing.T) {
282282
Replicas: helpers.GetPointer[int32](3),
283283
Autoscaling: ngfAPIv1alpha2.HPASpec{
284284
Enabled: true,
285-
MinReplicas: 1,
285+
MinReplicas: helpers.GetPointer[int32](1),
286286
MaxReplicas: 5,
287287
TargetMemoryUtilizationPercentage: helpers.GetPointer[int32](60),
288288
},

0 commit comments

Comments
 (0)