@@ -168,7 +168,7 @@ func (p *NginxProvisioner) buildNginxResourceObjects(
168168 hpaAnnotations := make (map [string ]string )
169169 if nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations != nil {
170170 for key , value := range nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations {
171- hpaAnnotations [string ( key ) ] = string ( value )
171+ hpaAnnotations [key ] = value
172172 }
173173 }
174174
@@ -919,7 +919,6 @@ func (p *NginxProvisioner) buildImage(nProxyCfg *graph.EffectiveNginxProxy) (str
919919func getMetricTargetByType (
920920 target autoscalingv2.MetricTarget ,
921921) autoscalingv2.MetricTarget {
922-
923922 switch target .Type {
924923 case autoscalingv2 .UtilizationMetricType :
925924 return autoscalingv2.MetricTarget {
@@ -941,7 +940,6 @@ func getMetricTargetByType(
941940 default :
942941 return autoscalingv2.MetricTarget {}
943942 }
944-
945943}
946944
947945func buildNginxDeploymentHPA (
@@ -981,59 +979,58 @@ func buildNginxDeploymentHPA(
981979 }
982980
983981 if autoscalingTemplate != nil {
984- for _ , addtionalAutoscaling := range * autoscalingTemplate {
985-
986- switch addtionalAutoscaling .Type {
982+ for _ , additionalAutoscaling := range * autoscalingTemplate {
983+ switch additionalAutoscaling .Type {
987984 case autoscalingv2 .ResourceMetricSourceType :
988985 metrics = append (metrics , autoscalingv2.MetricSpec {
989- Type : addtionalAutoscaling .Type ,
986+ Type : additionalAutoscaling .Type ,
990987 Resource : & autoscalingv2.ResourceMetricSource {
991- Name : addtionalAutoscaling .Resource .Name ,
992- Target : getMetricTargetByType (addtionalAutoscaling .Resource .Target ),
988+ Name : additionalAutoscaling .Resource .Name ,
989+ Target : getMetricTargetByType (additionalAutoscaling .Resource .Target ),
993990 },
994991 })
995992
996993 case autoscalingv2 .PodsMetricSourceType :
997994 metrics = append (metrics , autoscalingv2.MetricSpec {
998- Type : addtionalAutoscaling .Type ,
995+ Type : additionalAutoscaling .Type ,
999996 Pods : & autoscalingv2.PodsMetricSource {
1000- Metric : addtionalAutoscaling .Pods .Metric ,
1001- Target : getMetricTargetByType (addtionalAutoscaling .Pods .Target ),
997+ Metric : additionalAutoscaling .Pods .Metric ,
998+ Target : getMetricTargetByType (additionalAutoscaling .Pods .Target ),
1002999 },
10031000 })
10041001
10051002 case autoscalingv2 .ContainerResourceMetricSourceType :
10061003 metrics = append (metrics , autoscalingv2.MetricSpec {
1007- Type : addtionalAutoscaling .Type ,
1004+ Type : additionalAutoscaling .Type ,
10081005 ContainerResource : & autoscalingv2.ContainerResourceMetricSource {
1009- Name : addtionalAutoscaling .ContainerResource .Name ,
1010- Target : getMetricTargetByType (addtionalAutoscaling .ContainerResource .Target ),
1011- Container : addtionalAutoscaling .ContainerResource .Container ,
1006+ Name : additionalAutoscaling .ContainerResource .Name ,
1007+ Target : getMetricTargetByType (additionalAutoscaling .ContainerResource .Target ),
1008+ Container : additionalAutoscaling .ContainerResource .Container ,
10121009 },
10131010 })
10141011
10151012 case autoscalingv2 .ObjectMetricSourceType :
10161013 metrics = append (metrics , autoscalingv2.MetricSpec {
1017- Type : addtionalAutoscaling .Type ,
1014+ Type : additionalAutoscaling .Type ,
10181015 Object : & autoscalingv2.ObjectMetricSource {
1019- DescribedObject : addtionalAutoscaling .Object .DescribedObject ,
1020- Target : getMetricTargetByType (addtionalAutoscaling .Object .Target ),
1016+ DescribedObject : additionalAutoscaling .Object .DescribedObject ,
1017+ Target : getMetricTargetByType (additionalAutoscaling .Object .Target ),
10211018 Metric : autoscalingv2.MetricIdentifier {
1022- Name : addtionalAutoscaling .Object .Metric .Name ,
1023- Selector : addtionalAutoscaling .Object .Metric .Selector ,
1019+ Name : additionalAutoscaling .Object .Metric .Name ,
1020+ Selector : additionalAutoscaling .Object .Metric .Selector ,
10241021 },
10251022 },
10261023 })
10271024
10281025 case autoscalingv2 .ExternalMetricSourceType :
10291026 metrics = append (metrics , autoscalingv2.MetricSpec {
1030- Type : addtionalAutoscaling .Type ,
1027+ Type : additionalAutoscaling .Type ,
10311028 External : & autoscalingv2.ExternalMetricSource {
10321029 Metric : autoscalingv2.MetricIdentifier {
1033- Name : addtionalAutoscaling .External .Metric .Name ,
1034- Selector : addtionalAutoscaling .External .Metric .Selector ,
1030+ Name : additionalAutoscaling .External .Metric .Name ,
1031+ Selector : additionalAutoscaling .External .Metric .Selector ,
10351032 },
1036- Target : getMetricTargetByType (addtionalAutoscaling .External .Target ),
1033+ Target : getMetricTargetByType (additionalAutoscaling .External .Target ),
10371034 },
10381035 })
10391036 }
0 commit comments