@@ -38,8 +38,7 @@ import (
3838
3939// getAnsibleVarsFrom gets ansible vars from ConfigMap/Secret
4040func getAnsibleVarsFrom (ctx context.Context , helper * helper.Helper , namespace string , ansible * dataplanev1.AnsibleOpts ) (map [string ]interface {}, error ) {
41-
42- var result = make (map [string ]interface {})
41+ result := make (map [string ]interface {})
4342 var value interface {}
4443
4544 for _ , dataSource := range ansible .AnsibleVarsFrom {
@@ -90,7 +89,8 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper,
9089 instance * dataplanev1.OpenStackDataPlaneNodeSet ,
9190 allIPSets map [string ]infranetworkv1.IPSet , dnsAddresses []string ,
9291 containerImages openstackv1.ContainerImages ,
93- netServiceNetMap map [string ]string ) (string , error ) {
92+ netServiceNetMap map [string ]string ,
93+ ) (string , error ) {
9494 inventory := ansible .MakeInventory ()
9595 nodeSetGroup := inventory .AddGroup (instance .Name )
9696 groupVars , err := getAnsibleVarsFrom (ctx , helper , instance .Namespace , & instance .Spec .NodeTemplate .Ansible )
@@ -111,6 +111,23 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper,
111111 // add the NodeSet name variable
112112 nodeSetGroup .Vars ["edpm_nodeset_name" ] = instance .Name
113113
114+ isDisconnected , err := util .IsDisconnectedOCP (ctx , helper )
115+ if err != nil {
116+ return "" , err
117+ }
118+
119+ if isDisconnected {
120+ registryConfig , err := util .GetMCRegistryConf (ctx , helper )
121+ if err != nil {
122+ return "" , err
123+ }
124+ helper .GetLogger ().Info ("disconnected registry was identified via the ImageContentSourcePolicy. Using OCP registry." )
125+
126+ // Use OCP registries.conf for disconnected deployments
127+ nodeSetGroup .Vars ["edpm_podman_registries_conf" ] = registryConfig
128+ nodeSetGroup .Vars ["edpm_podman_disconnected_ocp" ] = isDisconnected
129+ }
130+
114131 // add TLS ansible variable
115132 nodeSetGroup .Vars ["edpm_tls_certs_enabled" ] = instance .Spec .TLSEnabled
116133 if instance .Spec .Tags != nil {
@@ -205,7 +222,8 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper,
205222// populateInventoryFromIPAM populates inventory from IPAM
206223func populateInventoryFromIPAM (
207224 ipSet * infranetworkv1.IPSet , host ansible.Host ,
208- dnsAddresses []string , hostName string ) {
225+ dnsAddresses []string , hostName string ,
226+ ) {
209227 var dnsSearchDomains []string
210228 for _ , res := range ipSet .Status .Reservation {
211229 // Build the vars for ips/routes etc
@@ -243,8 +261,8 @@ func populateInventoryFromIPAM(
243261// set group ansible vars from NodeTemplate
244262func resolveGroupAnsibleVars (template * dataplanev1.NodeTemplate , group * ansible.Group ,
245263 containerImages openstackv1.ContainerImages ,
246- netServiceNetMap map [string ]string ) error {
247-
264+ netServiceNetMap map [string ]string ,
265+ ) error {
248266 if template .Ansible .AnsibleUser != "" {
249267 group .Vars ["ansible_user" ] = template .Ansible .AnsibleUser
250268 }
@@ -320,8 +338,8 @@ func resolveGroupAnsibleVars(template *dataplanev1.NodeTemplate, group *ansible.
320338
321339// set host ansible vars from NodeSection
322340func resolveHostAnsibleVars (node * dataplanev1.NodeSection ,
323- host * ansible.Host , netServiceNetMap map [string ]string ) error {
324-
341+ host * ansible.Host , netServiceNetMap map [string ]string ,
342+ ) error {
325343 if node .Ansible .AnsibleUser != "" {
326344 host .Vars ["ansible_user" ] = node .Ansible .AnsibleUser
327345 }
@@ -344,13 +362,12 @@ func resolveHostAnsibleVars(node *dataplanev1.NodeSection,
344362 host .Vars ["network_servicenet_map" ] = serviceNetMap
345363 }
346364 return nil
347-
348365}
349366
350367// unmarshal raw strings into an ansible vars dictionary
351368func unmarshalAnsibleVars (ansibleVars map [string ]json.RawMessage ,
352- parsedVars map [string ]interface {}) error {
353-
369+ parsedVars map [string ]interface {},
370+ ) error {
354371 for key , val := range ansibleVars {
355372 var v interface {}
356373 err := yaml .Unmarshal (val , & v )
@@ -363,7 +380,8 @@ func unmarshalAnsibleVars(ansibleVars map[string]json.RawMessage,
363380}
364381
365382func buildNetworkVars (networks []infranetworkv1.IPSetNetwork ,
366- netServiceNetMap map [string ]string ) ([]string , map [string ]string ) {
383+ netServiceNetMap map [string ]string ,
384+ ) ([]string , map [string ]string ) {
367385 serviceNetMap := make (map [string ]string )
368386 var nets []string
369387 for _ , network := range networks {
0 commit comments