@@ -576,6 +576,17 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
576576 deployment .Status .BmhRefHashes [instance .Name ] != instance .Status .BmhRefHash ) {
577577 continue
578578 }
579+
580+ hasAnsibleVarsFromChanged , err := checkAnsibleVarsFromChanged (ctx , helper , instance , deployment .Status .ConfigMapHashes , deployment .Status .SecretHashes )
581+
582+ if err != nil {
583+ return isNodeSetDeploymentReady , isNodeSetDeploymentRunning , isNodeSetDeploymentFailed , failedDeploymentName , err
584+ }
585+
586+ if hasAnsibleVarsFromChanged {
587+ continue
588+ }
589+
579590 isNodeSetDeploymentReady = true
580591 for k , v := range deployment .Status .ConfigMapHashes {
581592 instance .Status .ConfigMapHashes [k ] = v
@@ -911,3 +922,49 @@ func (r *OpenStackDataPlaneNodeSetReconciler) GetSpecConfigHash(instance *datapl
911922 }
912923 return configHash , nil
913924}
925+
926+ // checkAnsibleVarsFromChanged computes current hashes for ConfigMaps/Secrets
927+ // referenced in AnsibleVarsFrom and compares them with deployed hashes.
928+ // Returns true if any content has changed, false otherwise.
929+ func checkAnsibleVarsFromChanged (
930+ ctx context.Context ,
931+ helper * helper.Helper ,
932+ instance * dataplanev1.OpenStackDataPlaneNodeSet ,
933+ deployedConfigMapHashes map [string ]string ,
934+ deployedSecretHashes map [string ]string ,
935+ ) (bool , error ) {
936+ currentConfigMapHashes := make (map [string ]string )
937+ currentSecretHashes := make (map [string ]string )
938+
939+ namespace := instance .Namespace
940+
941+ // Process NodeTemplate level AnsibleVarsFrom
942+ if err := deployment .ProcessAnsibleVarsFrom (ctx , helper , namespace , currentConfigMapHashes , currentSecretHashes , instance .Spec .NodeTemplate .Ansible .AnsibleVarsFrom ); err != nil {
943+ return false , err
944+ }
945+
946+ // Process individual Node level AnsibleVarsFrom
947+ for _ , node := range instance .Spec .Nodes {
948+ if err := deployment .ProcessAnsibleVarsFrom (ctx , helper , namespace , currentConfigMapHashes , currentSecretHashes , node .Ansible .AnsibleVarsFrom ); err != nil {
949+ return false , err
950+ }
951+ }
952+
953+ // Compare current ConfigMap hashes with deployed hashes
954+ for name , currentHash := range currentConfigMapHashes {
955+ if deployedHash , exists := deployedConfigMapHashes [name ]; ! exists || deployedHash != currentHash {
956+ helper .GetLogger ().Info ("ConfigMap content changed" , "configMap" , name )
957+ return true , nil
958+ }
959+ }
960+
961+ // Compare current Secret hashes with deployed hashes
962+ for name , currentHash := range currentSecretHashes {
963+ if deployedHash , exists := deployedSecretHashes [name ]; ! exists || deployedHash != currentHash {
964+ helper .GetLogger ().Info ("Secret content changed" , "secret" , name )
965+ return true , nil
966+ }
967+ }
968+
969+ return false , nil
970+ }
0 commit comments