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
2 changes: 2 additions & 0 deletions api/v1alpha2/linodemachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ type LinodeMachineStatus struct {
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`

// CloudinitMetadataSupport determines whether to use cloud-init or not.
// Deprecated: Stackscript no longer in use, so this field is not used.
// +kubebuilder:deprecatedversion:warning="CloudinitMetadataSupport is deprecated"
// +optional
// +kubebuilder:default=true
CloudinitMetadataSupport bool `json:"cloudinitMetadataSupport,omitempty"`
Expand Down
2 changes: 0 additions & 2 deletions clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ type LinodeInstanceClient interface {
DeleteInstance(ctx context.Context, linodeID int) error
GetRegion(ctx context.Context, regionID string) (*linodego.Region, error)
GetImage(ctx context.Context, imageID string) (*linodego.Image, error)
CreateStackscript(ctx context.Context, opts linodego.StackscriptCreateOptions) (*linodego.Stackscript, error)
ListStackscripts(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Stackscript, error)
GetType(ctx context.Context, typeID string) (*linodego.LinodeType, error)
}

Expand Down
21 changes: 0 additions & 21 deletions cloud/services/stackscript.sh

This file was deleted.

50 changes: 0 additions & 50 deletions cloud/services/stackscripts.go

This file was deleted.

115 changes: 0 additions & 115 deletions cloud/services/stackscripts_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,9 @@ spec:
type: array
cloudinitMetadataSupport:
default: true
description: CloudinitMetadataSupport determines whether to use cloud-init
or not.
description: |-
CloudinitMetadataSupport determines whether to use cloud-init or not.
Deprecated: Stackscript no longer in use, so this field is not used.
type: boolean
conditions:
description: Conditions defines current service state of the LinodeMachine.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference/out.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `ready` _boolean_ | Ready is true when the provider resource is ready. | false | |
| `addresses` _MachineAddress array_ | Addresses contains the Linode instance associated addresses. | | |
| `cloudinitMetadataSupport` _boolean_ | CloudinitMetadataSupport determines whether to use cloud-init or not. | true | |
| `cloudinitMetadataSupport` _boolean_ | CloudinitMetadataSupport determines whether to use cloud-init or not.<br />Deprecated: Stackscript no longer in use, so this field is not used. | true | |
| `instanceState` _[InstanceStatus](#instancestatus)_ | InstanceState is the state of the Linode instance for this machine. | | |
| `failureReason` _string_ | FailureReason will be set in the event that there is a terminal problem<br />reconciling the Machine and will contain a succinct value suitable<br />for machine interpretation.<br /><br />This field should not be set for transitive errors that a controller<br />faces that are expected to be fixed automatically over<br />time (like service outages), but instead indicate that something is<br />fundamentally wrong with the Machine's spec or the configuration of<br />the controller, and that manual intervention is required. Examples<br />of terminal errors would be invalid combinations of settings in the<br />spec, values that are unsupported by the controller, or the<br />responsible controller itself being critically misconfigured.<br /><br />Any transient errors that occur during the reconciliation of Machines<br />can be added as events to the Machine object and/or logged in the<br />controller's output. | | |
| `failureMessage` _string_ | FailureMessage will be set in the event that there is a terminal problem<br />reconciling the Machine and will contain a more verbose string suitable<br />for logging and human consumption.<br /><br />This field should not be set for transitive errors that a controller<br />faces that are expected to be fixed automatically over<br />time (like service outages), but instead indicate that something is<br />fundamentally wrong with the Machine's spec or the configuration of<br />the controller, and that manual intervention is required. Examples<br />of terminal errors would be invalid combinations of settings in the<br />spec, values that are unsupported by the controller, or the<br />responsible controller itself being critically misconfigured.<br /><br />Any transient errors that occur during the reconciliation of Machines<br />can be added as events to the Machine object and/or logged in the<br />controller's output. | | |
Expand Down
1 change: 0 additions & 1 deletion docs/src/topics/cluster-object-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@ infrastructure Linode via one of the following services:
| Service | Bootstrap Data Limit |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [Metadata](https://techdocs.akamai.com/cloud-computing/docs/overview-of-the-metadata-service) | [65535 bytes](https://techdocs.akamai.com/linode-api/reference/post-linode-instance) |
| [Stackscripts](https://www.linode.com/products/stackscripts/) | [65,535 characters](https://techdocs.akamai.com/linode-api/reference/post-linode-instance) |

These data limits are bypassed when the Cluster Object Store feature is enabled.
6 changes: 0 additions & 6 deletions docs/src/topics/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Make sure to create the token with at least the following read/write permissions
- VPCs
- IPs
- Object Storage
- Stackscripts
- Firewalls
- clusterctl is [installed](https://cluster-api.sigs.k8s.io/user/quick-start#installation)
- Cluster API [management cluster](https://cluster-api.sigs.k8s.io/user/quick-start#install-andor-configure-a-kubernetes-cluster) is created
Expand Down Expand Up @@ -40,11 +39,6 @@ This project uses [linodego](https://github.com/linode/linodego) for Linode API
Please refer to it for more details on environment variables used for client configuration.
```

```admonish warning
For Regions and Images that do not yet support Akamai's cloud-init datasource CAPL will automatically use a stackscript shim
to provision the node. If you are using a custom image ensure the [cloud_init](https://www.linode.com/docs/api/images/#image-create) flag is set correctly on it
```

## Setup management cluster
A clusterAPI management cluster is a kubernetes cluster that is responsible for managing the lifecycle of other child k8s clusters provisioned using Cluster API (CAPI). It serves as a control plane for provisioning, scaling, upgrading and deleting child kubernetes clusters.

Expand Down
12 changes: 2 additions & 10 deletions internal/controller/linodemachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"errors"
"fmt"
"net/http"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -530,27 +529,20 @@ func (r *LinodeMachineReconciler) reconcilePreflightLinodeFirewallCheck(ctx cont
}

func (r *LinodeMachineReconciler) reconcilePreflightMetadataSupportConfigure(ctx context.Context, logger logr.Logger, machineScope *scope.MachineScope) (ctrl.Result, error) {
region, err := machineScope.LinodeClient.GetRegion(ctx, machineScope.LinodeMachine.Spec.Region)
_, err := machineScope.LinodeClient.GetRegion(ctx, machineScope.LinodeMachine.Spec.Region)
if err != nil {
logger.Error(err, fmt.Sprintf("Failed to fetch region %s", machineScope.LinodeMachine.Spec.Region))
return retryIfTransient(err, logger)
}
regionMetadataSupport := slices.Contains(region.Capabilities, linodego.CapabilityMetadata)
imageName := reconciler.DefaultMachineControllerLinodeImage
if machineScope.LinodeMachine.Spec.Image != "" {
imageName = machineScope.LinodeMachine.Spec.Image
}
image, err := machineScope.LinodeClient.GetImage(ctx, imageName)
_, err = machineScope.LinodeClient.GetImage(ctx, imageName)
if err != nil {
logger.Error(err, fmt.Sprintf("Failed to fetch image %s", imageName))
return retryIfTransient(err, logger)
}
imageMetadataSupport := slices.Contains(image.Capabilities, "cloud-init")
machineScope.LinodeMachine.Status.CloudinitMetadataSupport = true
if !imageMetadataSupport || !regionMetadataSupport {
logger.Info("cloud-init metadata support not available", "imageMetadataSupport", imageMetadataSupport, "regionMetadataSupport", regionMetadataSupport)
machineScope.LinodeMachine.Status.CloudinitMetadataSupport = false
}
conditions.Set(machineScope.LinodeMachine, metav1.Condition{
Type: ConditionPreflightMetadataSupportConfigured,
Status: metav1.ConditionTrue,
Expand Down
35 changes: 8 additions & 27 deletions internal/controller/linodemachine_controller_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
)

const (
maxBootstrapDataBytesCloudInit = 16384
maxBootstrapDataBytesStackscript = 65535
vlanIPFormat = "%s/11"
maxBootstrapDataBytesCloudInit = 16384
vlanIPFormat = "%s/11"
)

var (
Expand Down Expand Up @@ -606,24 +605,10 @@
return err
}

if machineScope.LinodeMachine.Status.CloudinitMetadataSupport {
createConfig.Metadata = &linodego.InstanceMetadataOptions{
UserData: b64.StdEncoding.EncodeToString(bootstrapData),
}
} else {
logger.Info("using StackScripts for bootstrapping")
// WARNING: label, region and type are currently supported as cloud-init variables,
// any changes to this could be potentially backwards incompatible and should be noted through a backwards incompatible version update
instanceData := fmt.Sprintf("label: %s\nregion: %s\ntype: %s", machineScope.LinodeMachine.Name, machineScope.LinodeMachine.Spec.Region, machineScope.LinodeMachine.Spec.Type)
createConfig.StackScriptData = map[string]string{
"instancedata": b64.StdEncoding.EncodeToString([]byte(instanceData)),
"userdata": b64.StdEncoding.EncodeToString(bootstrapData),
}
createConfig.StackScriptID, err = services.EnsureStackscript(ctx, machineScope)
if err != nil {
return fmt.Errorf("ensure stackscript: %w", err)
}
createConfig.Metadata = &linodego.InstanceMetadataOptions{
UserData: b64.StdEncoding.EncodeToString(bootstrapData),
}

return nil
}

Expand All @@ -639,12 +624,8 @@
limit int
)

// Determine limits for delivery service, e.g. Metadata vs. Stackscript.
if machineScope.LinodeMachine.Status.CloudinitMetadataSupport {
limit = maxBootstrapDataBytesCloudInit
} else {
limit = maxBootstrapDataBytesStackscript
}
// Determine limits for delivery service
limit = maxBootstrapDataBytesCloudInit

// Determine the delivery mechanism for the bootstrap data based on limits. This informs the formatting of the
// bootstrap data.
Expand All @@ -653,7 +634,7 @@
case size < limit:
return bootstrapdata, nil
// Compromise case (Metadata): Use compression.
case machineScope.LinodeMachine.Status.CloudinitMetadataSupport && gzipCompressionEnabled:
case gzipCompressionEnabled:

Check warning on line 637 in internal/controller/linodemachine_controller_helpers.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/linodemachine_controller_helpers.go#L637

Added line #L637 was not covered by tests
if compressed, err = compressUserData(bootstrapdata); err != nil {
// Break and use the Cluster Object Store workaround on compression failure.
logger.Info(fmt.Sprintf("Failed to compress bootstrap data: %v. Using Cluster Object Store instead.", err))
Expand Down
Loading
Loading