-
Notifications
You must be signed in to change notification settings - Fork 1.5k
baremetal: send full ignition to masters #4359
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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,9 @@ type config struct { | |
| IronicUsername string `json:"ironic_username"` | ||
| IronicPassword string `json:"ironic_password"` | ||
|
|
||
| IgnitionURL string `json:"ignition_url,omitempty"` | ||
| IgnitionURLCACert string `json:"ignition_url_ca_cert,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 +39,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) { | ||
| bootstrapOSImage, err := cache.DownloadImageFile(bootstrapOSImage) | ||
| if err != nil { | ||
| return nil, errors.Wrap(err, "failed to use cached bootstrap libvirt image") | ||
|
|
@@ -155,6 +160,13 @@ func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridg | |
| }) | ||
| } | ||
|
|
||
| var masterIgn igntypes.Config | ||
| if err := json.Unmarshal([]byte(ignition), &masterIgn); err != nil { | ||
| return nil, err | ||
| } | ||
| ignitionURL := masterIgn.Ignition.Config.Merge[0].Source | ||
| ignitionURLCACert := masterIgn.Ignition.Security.TLS.CertificateAuthorities[0].Source | ||
|
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. terraform-provider-ignition currently expects just the base64 encoded cert, but this passes the entire dataurl - we need to strip the dataurl prefix here until/unless we rework the provider to accept the full dataurl |
||
|
|
||
| cfg := &config{ | ||
| LibvirtURI: libvirtURI, | ||
| BootstrapProvisioningIP: bootstrapProvisioningIP, | ||
|
|
@@ -167,6 +179,8 @@ func TFVars(libvirtURI, bootstrapProvisioningIP, bootstrapOSImage, externalBridg | |
| DriverInfos: driverInfos, | ||
| RootDevices: rootDevices, | ||
| InstanceInfos: instanceInfos, | ||
| IgnitionURL: *ignitionURL, | ||
| IgnitionURLCACert: *ignitionURLCACert, | ||
| } | ||
|
|
||
| return json.MarshalIndent(cfg, "", " ") | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
So we're extracting the merge out of the stub ignition: what happens to user customizations? Does the ignition from MCS contain them? I know there were some discussions about that but I haven't followed the progress.
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.
Yes, this is just a minor rework of extracting the URL and CA cert. Regarding user customizations, the current idea is to compare the original stub with any user customizations and, if they are different, the installer will create the appropriate machineconfig manifest for the change. This way when MCO becomes active, the final rendered ignition will contain the user's modification. This PR will go to work as usual and pass the URL and cert to the TF provider, which will extract the rendered ignition.
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.
Forgot to mention that there will be another PR that will be responsible for creating the machineconfig to reconcile any changes to the stub ignition.
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.
Any customizations should be accessible via the MCS rendered config if we rebase this on #4413