@@ -75,6 +75,7 @@ type agentTemplateData struct {
7575 PublicKeyPEM string
7676 PrivateKeyPEM string
7777 WorkflowType workflow.AgentWorkflowType
78+ CaBundleMount string
7879}
7980
8081// Name returns the human-friendly name of the asset.
@@ -238,6 +239,8 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
238239 }
239240 a .CPUArch = * osImage .CPUArchitecture
240241
242+ caBundleMount := defineCABundleMount (registriesConfig , registryCABundle )
243+
241244 agentTemplateData := getTemplateData (
242245 clusterName ,
243246 agentManifests .GetPullSecretData (),
@@ -253,7 +256,8 @@ func (a *Ignition) Generate(dependencies asset.Parents) error {
253256 imageTypeISO ,
254257 keyPairAsset .PrivateKey ,
255258 keyPairAsset .PublicKey ,
256- agentWorkflow .Workflow )
259+ agentWorkflow .Workflow ,
260+ caBundleMount )
257261
258262 err = bootstrap .AddStorageFiles (& config , "/" , "agent/files" , agentTemplateData )
259263 if err != nil {
@@ -368,7 +372,8 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
368372 proxy * v1beta1.Proxy ,
369373 imageTypeISO ,
370374 privateKey , publicKey string ,
371- workflow workflow.AgentWorkflowType ) * agentTemplateData {
375+ workflow workflow.AgentWorkflowType ,
376+ caBundleMount string ) * agentTemplateData {
372377 return & agentTemplateData {
373378 ServiceProtocol : "http" ,
374379 PullSecret : pullSecret ,
@@ -387,6 +392,7 @@ func getTemplateData(name, pullSecret, releaseImageList, releaseImage,
387392 PrivateKeyPEM : privateKey ,
388393 PublicKeyPEM : publicKey ,
389394 WorkflowType : workflow ,
395+ CaBundleMount : caBundleMount ,
390396 }
391397}
392398
@@ -480,6 +486,19 @@ func addMirrorData(config *igntypes.Config, registriesConfig *mirror.RegistriesC
480486 }
481487}
482488
489+ func defineCABundleMount (registriesConfig * mirror.RegistriesConf , registryCABundle * mirror.CaBundle ) string {
490+ // By default, the current host CA bundle is used (it will also contain eventually a user CA bundle, if
491+ // defined in the AdditionalTrustBundle field of install-config.yaml).
492+ hostSourceCABundle := "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
493+
494+ // If mirror registry is configured and the user provided a bundle, then let's mount just the user one.
495+ if len (registriesConfig .MirrorConfig ) > 0 && registryCABundle .File != nil && len (registryCABundle .File .Data ) > 0 {
496+ hostSourceCABundle = registryCABundlePath
497+ }
498+
499+ return fmt .Sprintf ("-v %s:/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:z" , hostSourceCABundle )
500+ }
501+
483502// Creates a file named with a host's MAC address. The desired hostname
484503// is the file's content. The files are read by a systemd service that
485504// sets the hostname using "hostnamectl set-hostname" when the ISO boots.
0 commit comments