@@ -20,7 +20,6 @@ package controller
2020import (
2121 "context"
2222 "fmt"
23- "maps"
2423 "net/url"
2524 "sort"
2625 "strconv"
@@ -42,7 +41,6 @@ import (
4241 gophercloud "github.com/gophercloud/gophercloud/v2"
4342 "github.com/gophercloud/gophercloud/v2/openstack/compute/v2/services"
4443 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
45- "github.com/openstack-k8s-operators/lib-common/modules/common/env"
4644 helper "github.com/openstack-k8s-operators/lib-common/modules/common/helper"
4745 "github.com/openstack-k8s-operators/lib-common/modules/common/secret"
4846 "github.com/openstack-k8s-operators/lib-common/modules/common/tls"
@@ -247,88 +245,12 @@ func NewReconcilers(mgr ctrl.Manager, kclient *kubernetes.Clientset) *internalco
247245 })
248246}
249247
250- // generateConfigsGeneric helper function to generate config maps
251- func (r * ReconcilerBase ) generateConfigsGeneric (
252- ctx context.Context , h * helper.Helper ,
253- instance client.Object , configName string , envVars * map [string ]env.Setter ,
254- templateParameters map [string ]any ,
255- extraData map [string ]string , cmLabels map [string ]string ,
256- additionalTemplates map [string ]string ,
257- commonTemplates []string ,
258- templateDir string ,
259- withScripts bool ,
260- ) error {
261- extraTemplates := map [string ]string {
248+ // novaAdditionalTemplates returns the default extra config templates for nova services.
249+ func novaAdditionalTemplates () map [string ]string {
250+ return map [string ]string {
262251 "01-nova.conf" : "/nova/nova.conf" ,
263252 "nova-blank.conf" : "/nova/nova-blank.conf" ,
264253 }
265- if templateDir == "" {
266- return internalcommon .ErrTemplateDirUnset
267- }
268-
269- maps .Copy (extraTemplates , additionalTemplates )
270- cms := []util.Template {
271- {
272- Name : configName ,
273- Namespace : instance .GetNamespace (),
274- Type : util .TemplateTypeConfig ,
275- InstanceType : instance .GetObjectKind ().GroupVersionKind ().Kind ,
276- MultiTemplateDir : templateDir ,
277- ConfigOptions : templateParameters ,
278- Labels : cmLabels ,
279- CustomData : extraData ,
280- Annotations : map [string ]string {},
281- AdditionalTemplate : extraTemplates ,
282- CommonTemplates : commonTemplates ,
283- },
284- }
285- if withScripts {
286- cms = append (cms , util.Template {
287- Name : internalcommon .GetScriptSecretName (instance .GetName ()),
288- Namespace : instance .GetNamespace (),
289- Type : util .TemplateTypeScripts ,
290- InstanceType : instance .GetObjectKind ().GroupVersionKind ().Kind ,
291- MultiTemplateDir : templateDir ,
292- AdditionalTemplate : map [string ]string {},
293- Annotations : map [string ]string {},
294- Labels : cmLabels ,
295- })
296- }
297- return secret .EnsureSecrets (ctx , h , instance , cms , envVars )
298- }
299-
300- // GenerateConfigs helper function to generate config maps
301- func (r * ReconcilerBase ) GenerateConfigs (
302- ctx context.Context , h * helper.Helper ,
303- instance client.Object , configName string , envVars * map [string ]env.Setter ,
304- templateParameters map [string ]any ,
305- extraData map [string ]string , cmLabels map [string ]string ,
306- additionalTemplates map [string ]string ,
307- commonTemplates []string ,
308- templateDir string ,
309- ) error {
310- return r .generateConfigsGeneric (
311- ctx , h , instance , configName , envVars , templateParameters , extraData ,
312- cmLabels , additionalTemplates , commonTemplates , templateDir , false ,
313- )
314- }
315-
316- // GenerateConfigsWithScripts helper function to generate config maps
317- // for service configs and scripts
318- func (r * ReconcilerBase ) GenerateConfigsWithScripts (
319- ctx context.Context , h * helper.Helper ,
320- instance client.Object , envVars * map [string ]env.Setter ,
321- templateParameters map [string ]any ,
322- extraData map [string ]string , cmLabels map [string ]string ,
323- additionalTemplates map [string ]string ,
324- commonTemplates []string ,
325- templateDir string ,
326- ) error {
327- return r .generateConfigsGeneric (
328- ctx , h , instance , internalcommon .GetServiceConfigSecretName (instance .GetName ()),
329- envVars , templateParameters , extraData ,
330- cmLabels , additionalTemplates , commonTemplates , templateDir , true ,
331- )
332254}
333255
334256func getNovaCellCRName (novaCRName string , cellName string ) string {
0 commit comments