Skip to content

Commit c68a6c3

Browse files
authored
[deprecation] Deprecate stackscript (#724)
* Deleted stackscript code * Updated linodemachine controller helpers * Updated linodemachine controller * Updated tests
1 parent 15be027 commit c68a6c3

15 files changed

+20
-506
lines changed

api/v1alpha2/linodemachine_types.go

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ type LinodeMachineStatus struct {
172172
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
173173

174174
// CloudinitMetadataSupport determines whether to use cloud-init or not.
175+
// Deprecated: Stackscript no longer in use, so this field is not used.
176+
// +kubebuilder:deprecatedversion:warning="CloudinitMetadataSupport is deprecated"
175177
// +optional
176178
// +kubebuilder:default=true
177179
CloudinitMetadataSupport bool `json:"cloudinitMetadataSupport,omitempty"`

clients/clients.go

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ type LinodeInstanceClient interface {
5353
DeleteInstance(ctx context.Context, linodeID int) error
5454
GetRegion(ctx context.Context, regionID string) (*linodego.Region, error)
5555
GetImage(ctx context.Context, imageID string) (*linodego.Image, error)
56-
CreateStackscript(ctx context.Context, opts linodego.StackscriptCreateOptions) (*linodego.Stackscript, error)
57-
ListStackscripts(ctx context.Context, opts *linodego.ListOptions) ([]linodego.Stackscript, error)
5856
GetType(ctx context.Context, typeID string) (*linodego.LinodeType, error)
5957
}
6058

cloud/services/stackscript.sh

-21
This file was deleted.

cloud/services/stackscripts.go

-50
This file was deleted.

cloud/services/stackscripts_test.go

-115
This file was deleted.

config/crd/bases/infrastructure.cluster.x-k8s.io_linodemachines.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ spec:
456456
type: array
457457
cloudinitMetadataSupport:
458458
default: true
459-
description: CloudinitMetadataSupport determines whether to use cloud-init
460-
or not.
459+
description: |-
460+
CloudinitMetadataSupport determines whether to use cloud-init or not.
461+
Deprecated: Stackscript no longer in use, so this field is not used.
461462
type: boolean
462463
conditions:
463464
description: Conditions defines current service state of the LinodeMachine.

docs/src/reference/out.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ _Appears in:_
638638
| --- | --- | --- | --- |
639639
| `ready` _boolean_ | Ready is true when the provider resource is ready. | false | |
640640
| `addresses` _MachineAddress array_ | Addresses contains the Linode instance associated addresses. | | |
641-
| `cloudinitMetadataSupport` _boolean_ | CloudinitMetadataSupport determines whether to use cloud-init or not. | true | |
641+
| `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 | |
642642
| `instanceState` _[InstanceStatus](#instancestatus)_ | InstanceState is the state of the Linode instance for this machine. | | |
643643
| `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. | | |
644644
| `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. | | |

docs/src/topics/cluster-object-store.md

-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,5 @@ infrastructure Linode via one of the following services:
103103
| Service | Bootstrap Data Limit |
104104
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
105105
| [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) |
106-
| [Stackscripts](https://www.linode.com/products/stackscripts/) | [65,535 characters](https://techdocs.akamai.com/linode-api/reference/post-linode-instance) |
107106

108107
These data limits are bypassed when the Cluster Object Store feature is enabled.

docs/src/topics/getting-started.md

-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Make sure to create the token with at least the following read/write permissions
1212
- VPCs
1313
- IPs
1414
- Object Storage
15-
- Stackscripts
1615
- Firewalls
1716
- clusterctl is [installed](https://cluster-api.sigs.k8s.io/user/quick-start#installation)
1817
- Cluster API [management cluster](https://cluster-api.sigs.k8s.io/user/quick-start#install-andor-configure-a-kubernetes-cluster) is created
@@ -40,11 +39,6 @@ This project uses [linodego](https://github.com/linode/linodego) for Linode API
4039
Please refer to it for more details on environment variables used for client configuration.
4140
```
4241

43-
```admonish warning
44-
For Regions and Images that do not yet support Akamai's cloud-init datasource CAPL will automatically use a stackscript shim
45-
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
46-
```
47-
4842
## Setup management cluster
4943
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.
5044

internal/controller/linodemachine_controller.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"errors"
2222
"fmt"
2323
"net/http"
24-
"slices"
2524
"strings"
2625
"time"
2726

@@ -530,27 +529,20 @@ func (r *LinodeMachineReconciler) reconcilePreflightLinodeFirewallCheck(ctx cont
530529
}
531530

532531
func (r *LinodeMachineReconciler) reconcilePreflightMetadataSupportConfigure(ctx context.Context, logger logr.Logger, machineScope *scope.MachineScope) (ctrl.Result, error) {
533-
region, err := machineScope.LinodeClient.GetRegion(ctx, machineScope.LinodeMachine.Spec.Region)
532+
_, err := machineScope.LinodeClient.GetRegion(ctx, machineScope.LinodeMachine.Spec.Region)
534533
if err != nil {
535534
logger.Error(err, fmt.Sprintf("Failed to fetch region %s", machineScope.LinodeMachine.Spec.Region))
536535
return retryIfTransient(err, logger)
537536
}
538-
regionMetadataSupport := slices.Contains(region.Capabilities, linodego.CapabilityMetadata)
539537
imageName := reconciler.DefaultMachineControllerLinodeImage
540538
if machineScope.LinodeMachine.Spec.Image != "" {
541539
imageName = machineScope.LinodeMachine.Spec.Image
542540
}
543-
image, err := machineScope.LinodeClient.GetImage(ctx, imageName)
541+
_, err = machineScope.LinodeClient.GetImage(ctx, imageName)
544542
if err != nil {
545543
logger.Error(err, fmt.Sprintf("Failed to fetch image %s", imageName))
546544
return retryIfTransient(err, logger)
547545
}
548-
imageMetadataSupport := slices.Contains(image.Capabilities, "cloud-init")
549-
machineScope.LinodeMachine.Status.CloudinitMetadataSupport = true
550-
if !imageMetadataSupport || !regionMetadataSupport {
551-
logger.Info("cloud-init metadata support not available", "imageMetadataSupport", imageMetadataSupport, "regionMetadataSupport", regionMetadataSupport)
552-
machineScope.LinodeMachine.Status.CloudinitMetadataSupport = false
553-
}
554546
conditions.Set(machineScope.LinodeMachine, metav1.Condition{
555547
Type: ConditionPreflightMetadataSupportConfigured,
556548
Status: metav1.ConditionTrue,

internal/controller/linodemachine_controller_helpers.go

+8-27
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ import (
5555
)
5656

5757
const (
58-
maxBootstrapDataBytesCloudInit = 16384
59-
maxBootstrapDataBytesStackscript = 65535
60-
vlanIPFormat = "%s/11"
58+
maxBootstrapDataBytesCloudInit = 16384
59+
vlanIPFormat = "%s/11"
6160
)
6261

6362
var (
@@ -606,24 +605,10 @@ func setUserData(ctx context.Context, machineScope *scope.MachineScope, createCo
606605
return err
607606
}
608607

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

@@ -639,12 +624,8 @@ func resolveBootstrapData(ctx context.Context, machineScope *scope.MachineScope,
639624
limit int
640625
)
641626

642-
// Determine limits for delivery service, e.g. Metadata vs. Stackscript.
643-
if machineScope.LinodeMachine.Status.CloudinitMetadataSupport {
644-
limit = maxBootstrapDataBytesCloudInit
645-
} else {
646-
limit = maxBootstrapDataBytesStackscript
647-
}
627+
// Determine limits for delivery service
628+
limit = maxBootstrapDataBytesCloudInit
648629

649630
// Determine the delivery mechanism for the bootstrap data based on limits. This informs the formatting of the
650631
// bootstrap data.
@@ -653,7 +634,7 @@ func resolveBootstrapData(ctx context.Context, machineScope *scope.MachineScope,
653634
case size < limit:
654635
return bootstrapdata, nil
655636
// Compromise case (Metadata): Use compression.
656-
case machineScope.LinodeMachine.Status.CloudinitMetadataSupport && gzipCompressionEnabled:
637+
case gzipCompressionEnabled:
657638
if compressed, err = compressUserData(bootstrapdata); err != nil {
658639
// Break and use the Cluster Object Store workaround on compression failure.
659640
logger.Info(fmt.Sprintf("Failed to compress bootstrap data: %v. Using Cluster Object Store instead.", err))

0 commit comments

Comments
 (0)