@@ -23,20 +23,16 @@ import (
23
23
"github.com/go-logr/logr"
24
24
"github.com/openstack-k8s-operators/lib-common/modules/common"
25
25
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
26
- "github.com/openstack-k8s-operators/lib-common/modules/common/configmap"
27
26
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
28
27
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
29
28
"github.com/openstack-k8s-operators/lib-common/modules/common/job"
30
29
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
31
- "github.com/openstack-k8s-operators/lib-common/modules/common/util"
32
30
testv1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
33
31
"github.com/openstack-k8s-operators/test-operator/pkg/horizontest"
34
- "gopkg.in/yaml.v3"
35
32
batchv1 "k8s.io/api/batch/v1"
36
33
corev1 "k8s.io/api/core/v1"
37
34
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
38
35
ctrl "sigs.k8s.io/controller-runtime"
39
- "sigs.k8s.io/controller-runtime/pkg/client"
40
36
"sigs.k8s.io/controller-runtime/pkg/log"
41
37
)
42
38
@@ -155,7 +151,7 @@ func (r *HorizonTestReconciler) Reconcile(ctx context.Context, req ctrl.Request)
155
151
"workflowStep" : "0" ,
156
152
}
157
153
158
- yamlResult , err := r . EnsureHorizonTestCloudsYAML (ctx , instance , helper , serviceLabels )
154
+ yamlResult , err := EnsureCloudsConfigMapExists (ctx , instance , helper , serviceLabels )
159
155
160
156
if err != nil {
161
157
return yamlResult , err
@@ -272,49 +268,6 @@ func (r *HorizonTestReconciler) SetupWithManager(mgr ctrl.Manager) error {
272
268
Complete (r )
273
269
}
274
270
275
- // Horizon requires password value to be present in clouds.yaml
276
- // This code ensures that we set a default value of 12345678 when
277
- // password value is missing in the clouds.yaml
278
- func (r * HorizonTestReconciler ) EnsureHorizonTestCloudsYAML (ctx context.Context , instance client.Object , helper * helper.Helper , labels map [string ]string ) (ctrl.Result , error ) {
279
- cm , _ , _ := configmap .GetConfigMap (ctx , helper , instance , "openstack-config" , time .Second * 10 )
280
- result := make (map [string ]interface {})
281
-
282
- err := yaml .Unmarshal ([]byte (cm .Data ["clouds.yaml" ]), & result )
283
- if err != nil {
284
- return ctrl.Result {}, err
285
- }
286
-
287
- clouds := result ["clouds" ].(map [string ]interface {})
288
- defaultValue := clouds ["default" ].(map [string ]interface {})
289
- auth := defaultValue ["auth" ].(map [string ]interface {})
290
-
291
- if _ , ok := auth ["password" ].(string ); ! ok {
292
- auth ["password" ] = "12345678"
293
- }
294
-
295
- yamlString , err := yaml .Marshal (result )
296
- if err != nil {
297
- return ctrl.Result {}, err
298
- }
299
-
300
- cms := []util.Template {
301
- {
302
- Name : "horizontest-clouds-config" ,
303
- Namespace : instance .GetNamespace (),
304
- Labels : labels ,
305
- CustomData : map [string ]string {
306
- "clouds.yaml" : string (yamlString ),
307
- },
308
- },
309
- }
310
- err = configmap .EnsureConfigMaps (ctx , helper , instance , cms , nil )
311
- if err != nil {
312
- return ctrl.Result {}, err
313
- }
314
-
315
- return ctrl.Result {}, nil
316
- }
317
-
318
271
func (r * HorizonTestReconciler ) PrepareHorizonTestEnvVars (
319
272
instance * testv1beta1.HorizonTest ,
320
273
) map [string ]env.Setter {
0 commit comments