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
23 changes: 15 additions & 8 deletions .golangci-kal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@ linters:
type: "module"
description: Kube API LInter lints Kube like APIs based on API conventions and best practices.
settings:
linters:
# TODO: remove linters from this list as we add support from them
disable:
# integers linter will force type change from int to int32/int64, we are going to wait for v1beta1 to enable this
- "integers"
# optionalfields requires changing fields to pointers in a way that might be hard to support in a backwards compatible way
- "optionalfields"
lintersConfig: { }
linters: {}
lintersConfig:
optionalfields:
pointers:
preference: WhenRequired
exclusions:
rules:
- path-except: "^api/"
linters:
- kubeapilinter
# integers linter will force type change from int to int32/int64, we are going to wait for v1beta1 to enable this
- path: "api/v1alpha2/*"
text: "integers"
linters:
- kubeapilinter
# optionalfields requires changing fields to pointers in a way that might be hard to support in a backwards compatible way
- path: "api/v1alpha2/*"
text: "optionalfields"
linters:
- kubeapilinter
issues:
max-issues-per-linter: 0
max-same-issues: 0
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ CLUSTERCTL_VERSION ?= v1.11.2
CRD_REF_DOCS_VERSION ?= v0.2.0
KUBECTL_VERSION ?= v1.34.0
KUBEBUILDER_VERSION ?= v3.15.1
ENVTEST_VERSION ?= release-0.22
CONTROLLER_TOOLS_VERSION ?= v0.19.0
TILT_VERSION ?= 0.35.2
KIND_VERSION ?= 0.30.0
Expand Down Expand Up @@ -451,7 +452,7 @@ $(CHAINSAW): $(CACHE_BIN)
.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(CACHE_BIN)
GOBIN=$(CACHE_BIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
GOBIN=$(CACHE_BIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION)

.phony: golangci-lint
golangci-lint: $(GOLANGCI_LINT)
Expand Down
4 changes: 3 additions & 1 deletion api/v1alpha2/linodemachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,9 @@ 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.
//
// Deprecated: stackscript are no longer in use, so this field is not used.
//
// +kubebuilder:deprecatedversion:warning="CloudinitMetadataSupport is deprecated"
// +optional
// +kubebuilder:default=true
Expand Down
8 changes: 6 additions & 2 deletions api/v1alpha2/linodeobjectstoragekey_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ type LinodeObjectStorageKeySpec struct {
GeneratedSecret `json:"generatedSecret"`

// secretType instructs the controller what type of secret to generate containing access key details.
// Deprecated: Use generatedSecret.type.
//
// Deprecated: secretType is no longer supported, Use generatedSecret.type.
//
// +kubebuilder:validation:Enum=Opaque;addons.cluster.x-k8s.io/resource-set
// +kubebuilder:deprecatedversion:warning="secretType deprecated by generatedSecret.type"
// +optional
SecretType corev1.SecretType `json:"secretType,omitempty"`

// secretDataFormat instructs the controller how to format the data stored in the secret containing access key details.
// Deprecated: Use generatedSecret.format.
//
// Deprecated: secretDataFormat is no longer supported, please use generatedSecret.format.
//
// +kubebuilder:deprecatedversion:warning="secretDataFormat deprecated by generatedSecret.format"
// +optional
SecretDataFormat map[string]string `json:"secretDataFormat,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,8 @@ spec:
default: true
description: |-
cloudinitMetadataSupport determines whether to use cloud-init or not.
Deprecated: Stackscript no longer in use, so this field is not used.

Deprecated: stackscript are no longer in use, so this field is not used.
type: boolean
conditions:
description: conditions define the current service state of the LinodeMachine.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ spec:
type: string
description: |-
secretDataFormat instructs the controller how to format the data stored in the secret containing access key details.
Deprecated: Use generatedSecret.format.

Deprecated: secretDataFormat is no longer supported, please use generatedSecret.format.
type: object
secretType:
description: |-
secretType instructs the controller what type of secret to generate containing access key details.
Deprecated: Use generatedSecret.type.

Deprecated: secretType is no longer supported, Use generatedSecret.type.
enum:
- Opaque
- addons.cluster.x-k8s.io/resource-set
Expand Down
6 changes: 3 additions & 3 deletions docs/src/reference/out.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ _Appears in:_
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#condition-v1-meta) array_ | conditions define the current service state of the LinodeMachine. | | |
| `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.<br />Deprecated: Stackscript no longer in use, so this field is not used. | true | |
| `cloudinitMetadataSupport` _boolean_ | cloudinitMetadataSupport determines whether to use cloud-init or not.<br />Deprecated: stackscript are 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 />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 />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 />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 />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 Expand Up @@ -982,8 +982,8 @@ _Appears in:_
| `credentialsRef` _[SecretReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#secretreference-v1-core)_ | credentialsRef is a reference to a Secret that contains the credentials to use for generating access keys.<br />If not supplied, then the credentials of the controller will be used. | | |
| `keyGeneration` _integer_ | keyGeneration may be modified to trigger a rotation of the access key. | 0 | |
| `generatedSecret` _[GeneratedSecret](#generatedsecret)_ | generatedSecret configures the Secret to generate containing access key details. | | |
| `secretType` _[SecretType](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#secrettype-v1-core)_ | secretType instructs the controller what type of secret to generate containing access key details.<br />Deprecated: Use generatedSecret.type. | | Enum: [Opaque addons.cluster.x-k8s.io/resource-set] <br /> |
| `secretDataFormat` _object (keys:string, values:string)_ | secretDataFormat instructs the controller how to format the data stored in the secret containing access key details.<br />Deprecated: Use generatedSecret.format. | | |
| `secretType` _[SecretType](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#secrettype-v1-core)_ | secretType instructs the controller what type of secret to generate containing access key details.<br />Deprecated: secretType is no longer supported, Use generatedSecret.type. | | Enum: [Opaque addons.cluster.x-k8s.io/resource-set] <br /> |
| `secretDataFormat` _object (keys:string, values:string)_ | secretDataFormat instructs the controller how to format the data stored in the secret containing access key details.<br />Deprecated: secretDataFormat is no longer supported, please use generatedSecret.format. | | |


#### LinodeObjectStorageKeyStatus
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 10 additions & 0 deletions internal/controller/linodemachine_controller_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,16 @@ func linodeMachineSpecToInstanceCreateConfig(machineSpec infrav1alpha2.LinodeMac
SubnetID: iface.SubnetID,
IPRanges: iface.IPRanges,
}
if iface.IPv4 != nil {
var NAT1to1 *string
if iface.IPv4.NAT1To1 != "" {
NAT1to1 = &iface.IPv4.NAT1To1
}
interfaces[idx].IPv4 = &linodego.VPCIPv4{
VPC: iface.IPv4.VPC,
NAT1To1: NAT1to1,
}
}
}
instCreateOpts.Interfaces = interfaces
// If Interfaces are specified, the InterfaceGeneration must be GenerationLegacyConfig
Expand Down
4 changes: 4 additions & 0 deletions internal/controller/linodemachine_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2596,6 +2596,7 @@ var _ = Describe("machine in VPC", Label("machine", "VPC"), Ordered, func() {
Interfaces: []infrav1alpha2.InstanceConfigInterfaceCreateOptions{
{
Purpose: linodego.InterfacePurposeVPC,
IPv4: &infrav1alpha2.VPCIPv4{NAT1To1: "any"},
Primary: false,
},
{
Expand Down Expand Up @@ -2649,6 +2650,9 @@ var _ = Describe("machine in VPC", Label("machine", "VPC"), Ordered, func() {
Purpose: linodego.InterfacePurposeVPC,
Primary: false,
SubnetID: ptr.To(1),
IPv4: &linodego.VPCIPv4{
NAT1To1: ptr.To("any"),
},
},
{
Purpose: linodego.InterfacePurposePublic,
Expand Down
8 changes: 0 additions & 8 deletions internal/webhook/v1alpha2/linodeobjectstoragekey_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,5 @@ func (d *LinodeObjectStorageKeyDefaulter) Default(ctx context.Context, obj runti
key.Spec.Namespace = key.Namespace
}

// Support deprecated fields when specified and updated fields are empty.
if key.Spec.SecretType != "" && key.Spec.Type == "" {
key.Spec.Type = key.Spec.SecretType
}
if len(key.Spec.SecretDataFormat) > 0 && len(key.Spec.Format) == 0 {
key.Spec.Format = key.Spec.SecretDataFormat
}

return nil
}
Loading