Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/v1beta2/awsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ type CloudInit struct {
// For more information on Ignition configuration, see https://coreos.github.io/butane/specs/
type Ignition struct {
// Version defines which version of Ignition will be used to generate bootstrap data.
// Defaults to `2.3` if storageType is set to `ClusterObjectStore`.
// It will be ignored if storageType is set to `UnencryptedUserData`, as the userdata defines its own version.
//
// +optional
// +kubebuilder:default="2.3"
// +kubebuilder:validation:Enum="2.3";"3.0";"3.1";"3.2";"3.3";"3.4"
Version string `json:"version,omitempty"`

Expand Down
4 changes: 3 additions & 1 deletion api/v1beta2/awsmachine_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ func (*awsMachineWebhook) Default(_ context.Context, obj runtime.Object) error {
r.Spec.CloudInit.SecureSecretsBackend = SecretBackendSecretsManager
}

if r.ignitionEnabled() && r.Spec.Ignition.Version == "" {
// Defaults the version field if StorageType is not set to `UnencryptedUserData`.
// When using `UnencryptedUserData` the version field is ignored because the userdata defines its version itself.
if r.ignitionEnabled() && r.Spec.Ignition.Version == "" && r.Spec.Ignition.StorageType != IgnitionStorageTypeOptionUnencryptedUserData {
r.Spec.Ignition.Version = DefaultIgnitionVersion
}
if r.ignitionEnabled() && r.Spec.Ignition.StorageType == "" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1001,9 +1001,10 @@ spec:
type: array
type: object
version:
default: "2.3"
description: Version defines which version of Ignition will be
used to generate bootstrap data.
description: |-
Version defines which version of Ignition will be used to generate bootstrap data.
Defaults to `2.3` if storageType is set to `ClusterObjectStore`.
It will be ignored if storageType is set to `UnencryptedUserData`, as the userdata defines its own version.
enum:
- "2.3"
- "3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,9 +822,10 @@ spec:
type: array
type: object
version:
default: "2.3"
description: Version defines which version of Ignition will be
used to generate bootstrap data.
description: |-
Version defines which version of Ignition will be used to generate bootstrap data.
Defaults to `2.3` if storageType is set to `ClusterObjectStore`.
It will be ignored if storageType is set to `UnencryptedUserData`, as the userdata defines its own version.
enum:
- "2.3"
- "3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,9 +741,10 @@ spec:
type: array
type: object
version:
default: "2.3"
description: Version defines which version of Ignition
will be used to generate bootstrap data.
description: |-
Version defines which version of Ignition will be used to generate bootstrap data.
Defaults to `2.3` if storageType is set to `ClusterObjectStore`.
It will be ignored if storageType is set to `UnencryptedUserData`, as the userdata defines its own version.
enum:
- "2.3"
- "3.0"
Expand Down
4 changes: 3 additions & 1 deletion exp/api/v1beta2/awsmachinepool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ func (*AWSMachinePoolWebhook) Default(ctx context.Context, obj runtime.Object) e
r.Spec.DefaultInstanceWarmup.Duration = 300 * time.Second
}

if r.ignitionEnabled() && r.Spec.Ignition.Version == "" {
// Defaults the version field if StorageType is not set to `UnencryptedUserData`.
// When using `UnencryptedUserData` the version field is ignored because the userdata defines its version itself.
if r.ignitionEnabled() && r.Spec.Ignition.Version == "" && r.Spec.Ignition.StorageType != infrav1.IgnitionStorageTypeOptionUnencryptedUserData {
r.Spec.Ignition.Version = infrav1.DefaultIgnitionVersion
}
if r.ignitionEnabled() && r.Spec.Ignition.StorageType == "" {
Expand Down
7 changes: 5 additions & 2 deletions pkg/cloud/services/ec2/launchtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ func (s *Service) ReconcileLaunchTemplate(
}

var ignitionStorageType = infrav1.DefaultMachinePoolIgnitionStorageType
var ignitionVersion = infrav1.DefaultIgnitionVersion
if ignition := ignitionScope.Ignition(); ignition != nil {
ignitionStorageType = ignition.StorageType
ignitionVersion = ignition.Version
}

var userDataForLaunchTemplate []byte
if bootstrapDataFormat == "ignition" && ignitionStorageType == infrav1.IgnitionStorageTypeOptionClusterObjectStore {
var ignitionVersion = infrav1.DefaultIgnitionVersion
if ignition := ignitionScope.Ignition(); ignition != nil {
ignitionVersion = ignition.Version
}

if s3Scope.Bucket() == nil {
return errors.New("using Ignition with `AWSMachinePool.spec.ignition.storageType=ClusterObjectStore` " +
"requires a cluster wide object storage configured at `AWSCluster.spec.s3Bucket`")
Expand Down