@@ -370,7 +370,24 @@ func (r *AutoscalingReconciler) reconcileNormal(
370370 //
371371 // check for required OpenStack secret holding passwords for service/admin user and add hash to the vars map
372372 //
373- ctrlResult , err := r .getSecret (ctx , helper , instance , instance .Spec .Aodh .Secret , instance .Spec .Aodh .PasswordSelectors .AodhService , & configMapVars )
373+ // Associate to PasswordSelectors.Service field a password validator to
374+ // ensure pwd invalid detected patterns are rejected.
375+ validateFields := map [string ]secret.Validator {
376+ instance .Spec .Aodh .PasswordSelectors .AodhService : secret.PasswordValidator {},
377+ }
378+
379+ _ , ctrlResult , err := ensureSecret (
380+ ctx ,
381+ types.NamespacedName {
382+ Namespace : instance .Namespace ,
383+ Name : instance .Spec .Aodh .Secret ,
384+ },
385+ validateFields ,
386+ helper .GetClient (),
387+ & instance .Status .Conditions ,
388+ & configMapVars ,
389+ time .Duration (10 )* time .Second ,
390+ )
374391 if err != nil {
375392 return ctrlResult , err
376393 }
@@ -474,10 +491,29 @@ func (r *AutoscalingReconciler) reconcileNormal(
474491 return ctrl.Result {RequeueAfter : time .Duration (10 ) * time .Second }, nil
475492 }
476493
477- ctrlResult , err = r .getSecret (ctx , helper , instance , * instance .Status .NotificationsURLSecret , "transport_url" , & configMapVars )
494+ // transportURLFields are not pure password fields. We do not associate a
495+ // password validator and we only verify that the entry exists in the
496+ // secret
497+ transportValidateFields := map [string ]secret.Validator {
498+ "transport_url" : secret.NoOpValidator {},
499+ }
500+
501+ _ , ctrlResult , err = ensureSecret (
502+ ctx ,
503+ types.NamespacedName {
504+ Namespace : instance .Namespace ,
505+ Name : * instance .Status .NotificationsURLSecret ,
506+ },
507+ transportValidateFields ,
508+ helper .GetClient (),
509+ & instance .Status .Conditions ,
510+ & configMapVars ,
511+ time .Duration (10 )* time .Second ,
512+ )
478513 if err != nil {
479514 return ctrlResult , err
480515 }
516+
481517 // run check TransportURL secret - end
482518
483519 //
@@ -875,29 +911,6 @@ func (r *AutoscalingReconciler) getAutoscalingHeat(
875911 return heat , err
876912}
877913
878- // getSecret - get the specified secret, and add its hash to envVars
879- func (r * AutoscalingReconciler ) getSecret (ctx context.Context , h * helper.Helper , instance * telemetryv1.Autoscaling , secretName string , expectedField string , envVars * map [string ]env.Setter ) (ctrl.Result , error ) {
880- secretHash , result , err := ensureSecret (
881- ctx ,
882- types.NamespacedName {Namespace : instance .Namespace , Name : secretName },
883- []string {
884- expectedField ,
885- },
886- h .GetClient (),
887- & instance .Status .Conditions ,
888- time .Duration (10 )* time .Second ,
889- )
890- if err != nil {
891- return result , err
892- }
893-
894- // Add a prefix to the var name to avoid accidental collision with other non-secret
895- // vars. The secret names themselves will be unique.
896- (* envVars )["secret-" + secretName ] = env .SetValue (secretHash )
897-
898- return ctrl.Result {}, nil
899- }
900-
901914func (r * AutoscalingReconciler ) transportURLCreateOrUpdate (
902915 ctx context.Context ,
903916 instance * telemetryv1.Autoscaling ,
0 commit comments