-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
baremetal: send full ignition to masters #4427
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import ( | |
"path" | ||
"strings" | ||
|
||
igntypes "github.com/coreos/ignition/v2/config/v3_1/types" | ||
|
||
"github.com/metal3-io/baremetal-operator/pkg/bmc" | ||
"github.com/metal3-io/baremetal-operator/pkg/hardware" | ||
"github.com/openshift/installer/pkg/tfvars/internal/cache" | ||
|
@@ -25,6 +27,10 @@ type config struct { | |
IronicUsername string `json:"ironic_username"` | ||
IronicPassword string `json:"ironic_password"` | ||
|
||
MasterIgnitionURL string `json:"master_ignition_url,omitempty"` | ||
MasterIgnitionURLCACert string `json:"master_ignition_url_ca_cert,omitempty"` | ||
MasterIgnitionURLHeaders map[string]string `json:"master_ignition_url_headers,omitempty"` | ||
|
||
// Data required for control plane deployment - several maps per host, because of terraform's limitations | ||
Hosts []map[string]interface{} `json:"hosts"` | ||
RootDevices []map[string]interface{} `json:"root_devices"` | ||
|
@@ -34,7 +40,7 @@ type config struct { | |
} | ||
|
||
// TFVars generates bare metal specific Terraform variables. | ||
func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridge, externalMAC, provisioningBridge, provisioningMAC string, platformHosts []*baremetal.Host, image, ironicUsername, ironicPassword string) ([]byte, error) { | ||
func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridge, externalMAC, provisioningBridge, provisioningMAC string, platformHosts []*baremetal.Host, image, ironicUsername, ironicPassword, ignition string) ([]byte, error) { | ||
hardys marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was still hoping to get this changed from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I can push a follow-up PR to make that consistent |
||
bootstrapOSImage, err := cache.DownloadImageFile(bootstrapOSImage) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to use cached bootstrap libvirt image") | ||
|
@@ -156,18 +162,43 @@ func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridg | |
}) | ||
} | ||
|
||
var masterIgn igntypes.Config | ||
if err := json.Unmarshal([]byte(ignition), &masterIgn); err != nil { | ||
return nil, err | ||
} | ||
if len(masterIgn.Ignition.Config.Merge) == 0 { | ||
return nil, errors.Wrap(err, "Empty Merge section in master pointer ignition") | ||
} | ||
ignitionURL := *masterIgn.Ignition.Config.Merge[0].Source | ||
if len(masterIgn.Ignition.Security.TLS.CertificateAuthorities) == 0 { | ||
return nil, errors.Wrap(err, "Empty CertificateAuthorities section in master pointer ignition") | ||
} | ||
ignitionURLCACert := strings.TrimPrefix( | ||
*masterIgn.Ignition.Security.TLS.CertificateAuthorities[0].Source, | ||
"data:text/plain;charset=utf-8;base64,") | ||
// To return the same version as the stub config, the MCS requires a | ||
// header, otherwise we get 2.2.0, e.g: | ||
// "Accept: application/vnd.coreos.ignition+json; version=3.1.0" | ||
ignitionURLHeaders := map[string]string{ | ||
"Accept": fmt.Sprintf("application/vnd.coreos.ignition+json;version=%s", | ||
masterIgn.Ignition.Version), | ||
} | ||
|
||
cfg := &config{ | ||
LibvirtURI: libvirtURI, | ||
BootstrapProvisioningIP: bootstrapProvisioningIP, | ||
BootstrapOSImage: bootstrapOSImage, | ||
IronicUsername: ironicUsername, | ||
IronicPassword: ironicPassword, | ||
Hosts: hosts, | ||
Bridges: bridges, | ||
Properties: properties, | ||
DriverInfos: driverInfos, | ||
RootDevices: rootDevices, | ||
InstanceInfos: instanceInfos, | ||
LibvirtURI: libvirtURI, | ||
BootstrapProvisioningIP: bootstrapProvisioningIP, | ||
BootstrapOSImage: bootstrapOSImage, | ||
IronicUsername: ironicUsername, | ||
IronicPassword: ironicPassword, | ||
Hosts: hosts, | ||
Bridges: bridges, | ||
Properties: properties, | ||
DriverInfos: driverInfos, | ||
RootDevices: rootDevices, | ||
InstanceInfos: instanceInfos, | ||
MasterIgnitionURL: ignitionURL, | ||
MasterIgnitionURLCACert: ignitionURLCACert, | ||
MasterIgnitionURLHeaders: ignitionURLHeaders, | ||
} | ||
|
||
return json.MarshalIndent(cfg, "", " ") | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion around the naming. These didn't need to change, as you correctly stated that there is already context in the path. You can leave it as is or change it back: Your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@staebler since CI passed I'm fine to leave it with the master prefix - it also makes it slightly more explicit when debugging and looking at the tfvars directly I guess