ignition

package
v0.0.0-...-c53fdc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToAppendix

func ConvertToAppendix(file *igntypes.File)

ConvertToAppendix converts the contents of an ignition file to an appendix. In ignition config spec v2 the `Append` boolean value was used to denote whether the `Contents` field was an appendix or not. It was also permitted to define multiple file configs (appendix or not) that would be merged/overwritten sequentially in the order of the json data, which made them non-deterministic. In spec v3 this has changed with only one config allowed for each file config, and `Append` now being a list of objects that are being appended to `Contents`, with the `Contents` field itself never being an appendix. This function moves an ignition file's `Contents` object into the `Append` list. Since the resulting ignition file of this function has an empty `Contents` field, `Overwrite` must be set to false, per the spec. The output is an ignition file config that will write a new file with only the appendix contents in the case of a file not already existing on disk, or append the appendix contents to a file already existing.

func ConvertToRawExtension

func ConvertToRawExtension(config igntypes.Config) (runtime.RawExtension, error)

ConvertToRawExtension converts and ignition config to a RawExtension containing the ignition as raw bytes

func FileFromBytes

func FileFromBytes(path string, username string, mode int, contents []byte) igntypes.File

FileFromBytes creates an ignition-config file with the given contents.

func FileFromString

func FileFromString(path string, username string, mode int, contents string) igntypes.File

FileFromString creates an ignition-config file with the given contents.

func FilesFromAsset

func FilesFromAsset(pathPrefix string, username string, mode int, asset asset.WritableAsset) []igntypes.File

FilesFromAsset creates ignition files for each of the files in the specified asset.

func Marshal

func Marshal(input interface{}) ([]byte, error)

Marshal is a helper function to use the marshaler function from "github.com/clarketm/json". It supports zero values of structs with the omittempty annotation. In effect this excludes empty pointer struct fields from the marshaled data, instead of inserting nil values into them. This is necessary for ignition configs to pass openAPI validation on fields that are not supposed to contain nil pointers, but e.g. strings. It can be used as a dropin replacement for "encoding/json".Marshal

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL