@@ -168,7 +168,7 @@ func (p *NginxProvisioner) buildNginxResourceObjects(
168
168
hpaAnnotations := make (map [string ]string )
169
169
if nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations != nil {
170
170
for key , value := range nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations {
171
- hpaAnnotations [string ( key ) ] = string ( value )
171
+ hpaAnnotations [key ] = value
172
172
}
173
173
}
174
174
@@ -919,7 +919,6 @@ func (p *NginxProvisioner) buildImage(nProxyCfg *graph.EffectiveNginxProxy) (str
919
919
func getMetricTargetByType (
920
920
target autoscalingv2.MetricTarget ,
921
921
) autoscalingv2.MetricTarget {
922
-
923
922
switch target .Type {
924
923
case autoscalingv2 .UtilizationMetricType :
925
924
return autoscalingv2.MetricTarget {
@@ -941,7 +940,6 @@ func getMetricTargetByType(
941
940
default :
942
941
return autoscalingv2.MetricTarget {}
943
942
}
944
-
945
943
}
946
944
947
945
func buildNginxDeploymentHPA (
@@ -981,59 +979,58 @@ func buildNginxDeploymentHPA(
981
979
}
982
980
983
981
if autoscalingTemplate != nil {
984
- for _ , addtionalAutoscaling := range * autoscalingTemplate {
985
-
986
- switch addtionalAutoscaling .Type {
982
+ for _ , additionalAutoscaling := range * autoscalingTemplate {
983
+ switch additionalAutoscaling .Type {
987
984
case autoscalingv2 .ResourceMetricSourceType :
988
985
metrics = append (metrics , autoscalingv2.MetricSpec {
989
- Type : addtionalAutoscaling .Type ,
986
+ Type : additionalAutoscaling .Type ,
990
987
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 ),
993
990
},
994
991
})
995
992
996
993
case autoscalingv2 .PodsMetricSourceType :
997
994
metrics = append (metrics , autoscalingv2.MetricSpec {
998
- Type : addtionalAutoscaling .Type ,
995
+ Type : additionalAutoscaling .Type ,
999
996
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 ),
1002
999
},
1003
1000
})
1004
1001
1005
1002
case autoscalingv2 .ContainerResourceMetricSourceType :
1006
1003
metrics = append (metrics , autoscalingv2.MetricSpec {
1007
- Type : addtionalAutoscaling .Type ,
1004
+ Type : additionalAutoscaling .Type ,
1008
1005
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 ,
1012
1009
},
1013
1010
})
1014
1011
1015
1012
case autoscalingv2 .ObjectMetricSourceType :
1016
1013
metrics = append (metrics , autoscalingv2.MetricSpec {
1017
- Type : addtionalAutoscaling .Type ,
1014
+ Type : additionalAutoscaling .Type ,
1018
1015
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 ),
1021
1018
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 ,
1024
1021
},
1025
1022
},
1026
1023
})
1027
1024
1028
1025
case autoscalingv2 .ExternalMetricSourceType :
1029
1026
metrics = append (metrics , autoscalingv2.MetricSpec {
1030
- Type : addtionalAutoscaling .Type ,
1027
+ Type : additionalAutoscaling .Type ,
1031
1028
External : & autoscalingv2.ExternalMetricSource {
1032
1029
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 ,
1035
1032
},
1036
- Target : getMetricTargetByType (addtionalAutoscaling .External .Target ),
1033
+ Target : getMetricTargetByType (additionalAutoscaling .External .Target ),
1037
1034
},
1038
1035
})
1039
1036
}
0 commit comments