internal/blueprint: add ignition customizations

This allows a user to configure the system via `edge-simplified-installer`
using an ignition configuration specified in the blueprint.

This ignition config can be embedded in the ISO as a Base64
encoded file (ignition.embedded.data) or as a file
containing the URL where the ignition config file is served
(ignition.embedded.url).

The user can also instead specify an URL serving an ignition
config file that will passed as a karg and be fetched at first
boot (ignition.firstboot.url).

Signed-off-by: Irene Diez <idiez@redhat.com>
This commit is contained in:
Irene Diez 2022-11-11 16:00:49 +01:00 committed by Tom Gundersen
parent 81a5ff1bf6
commit 2f2ef709cd

View file

@ -23,6 +23,21 @@ type Customizations struct {
InstallationDevice string `json:"installation_device,omitempty" toml:"installation_device,omitempty"`
FDO *FDOCustomization `json:"fdo,omitempty" toml:"fdo,omitempty"`
OpenSCAP *OpenSCAPCustomization `json:"openscap,omitempty" toml:"openscap,omitempty"`
Ignition *IgnitionCustomization `json:"ignition,omitempty" toml:"ignition,omitempty"`
}
type IgnitionCustomization struct {
Embedded *EmbeddedIgnitionCustomization `json:"embedded,omitempty" toml:"embedded,omitempty"`
FirstBoot *FirstBootIgnitionCustomization `json:"firstboot,omitempty" toml:"firstboot,omitempty"`
}
type EmbeddedIgnitionCustomization struct {
ProvisioningURL string `json:"url,omitempty" toml:"url,omitempty"`
Data64 string `json:"data,omitempty" toml:"data,omitempty"`
}
type FirstBootIgnitionCustomization struct {
ProvisioningURL string `json:"url,omitempty" toml:"url"`
}
type FDOCustomization struct {
@ -390,3 +405,25 @@ func (c *Customizations) GetOpenSCAP() *OpenSCAPCustomization {
func (f *FDOCustomization) HasFDO() bool {
return f != nil
}
func (c *Customizations) GetIgnition() *IgnitionCustomization {
if c == nil {
return nil
}
return c.Ignition
}
func (c *IgnitionCustomization) HasIgnition() bool {
return c != nil
}
func (c *EmbeddedIgnitionCustomization) CheckEmbeddedIgnition() error {
if c == nil {
return nil
}
if c.Data64 != "" && c.ProvisioningURL != "" {
t := reflect.TypeOf(*c)
return &CustomizationError{fmt.Sprintf("'%s' and '%s' are not allowed at the same time", t.Field(0).Name, t.Field(1).Name)}
}
return nil
}