@@ -166,42 +166,30 @@ func (p *NginxProvisioner) buildNginxResourceObjects(
166
166
167
167
objects = append (objects , service , deployment )
168
168
169
- if hpa := p .buildHPAIfEnabled (objectMeta , nProxyCfg ); hpa != nil {
169
+ if hpa := p .buildHPA (objectMeta , nProxyCfg ); hpa != nil {
170
170
objects = append (objects , hpa )
171
171
}
172
172
173
173
return objects , err
174
174
}
175
175
176
- func autoscalingEnabled (dep * ngfAPIv1alpha2.DeploymentSpec ) bool {
176
+ func isAutoscalingEnabled (dep * ngfAPIv1alpha2.DeploymentSpec ) bool {
177
177
return dep != nil && dep .Autoscaling .Enabled
178
178
}
179
179
180
- func cloneHPAAnnotationMap (src map [string ]string ) map [string ]string {
181
- if src == nil {
182
- return nil
183
- }
184
- annotations := make (map [string ]string , len (src ))
185
- for k , v := range src {
186
- annotations [k ] = v
187
- }
188
- return annotations
189
- }
190
-
191
- func (p * NginxProvisioner ) buildHPAIfEnabled (
180
+ func (p * NginxProvisioner ) buildHPA (
192
181
objectMeta metav1.ObjectMeta ,
193
182
nProxyCfg * graph.EffectiveNginxProxy ,
194
183
) client.Object {
195
184
if nProxyCfg == nil || nProxyCfg .Kubernetes == nil {
196
185
return nil
197
186
}
198
187
199
- if ! autoscalingEnabled (nProxyCfg .Kubernetes .Deployment ) {
188
+ if ! isAutoscalingEnabled (nProxyCfg .Kubernetes .Deployment ) {
200
189
return nil
201
190
}
202
191
203
- hpaAnnotations := cloneHPAAnnotationMap (nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations )
204
- objectMeta .Annotations = hpaAnnotations
192
+ objectMeta .Annotations = nProxyCfg .Kubernetes .Deployment .Autoscaling .HPAAnnotations
205
193
206
194
return buildNginxDeploymentHPA (objectMeta , nProxyCfg )
207
195
}
0 commit comments