Skip to content

Commit 3119045

Browse files
[feat] add support for disk encryption (#423)
* add support for disk encryption * fix cilium's broken links
1 parent 0095cc6 commit 3119045

File tree

9 files changed

+40
-12
lines changed

9 files changed

+40
-12
lines changed

api/v1alpha1/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha2/linodemachine_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ type LinodeMachineSpec struct {
7474
// DataDisks is a map of any additional disks to add to an instance,
7575
// The sum of these disks + the OSDisk must not be more than allowed on a linodes plan
7676
DataDisks map[string]*InstanceDisk `json:"dataDisks,omitempty"`
77+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
78+
// +kubebuilder:validation:Enum=enabled;disabled
79+
// DiskEncryption determines if the disks of the instance should be encrypted.
80+
DiskEncryption string `json:"diskEncryption,omitempty"`
7781

7882
// CredentialsRef is a reference to a Secret that contains the credentials
7983
// to use for provisioning this machine. If not supplied then these

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,16 @@ spec:
521521
DataDisks is a map of any additional disks to add to an instance,
522522
The sum of these disks + the OSDisk must not be more than allowed on a linodes plan
523523
type: object
524+
diskEncryption:
525+
description: DiskEncryption determines if the disks of the instance
526+
should be encrypted.
527+
enum:
528+
- enabled
529+
- disabled
530+
type: string
531+
x-kubernetes-validations:
532+
- message: Value is immutable
533+
rule: self == oldSelf
524534
firewallID:
525535
type: integer
526536
x-kubernetes-validations:

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,16 @@ spec:
386386
DataDisks is a map of any additional disks to add to an instance,
387387
The sum of these disks + the OSDisk must not be more than allowed on a linodes plan
388388
type: object
389+
diskEncryption:
390+
description: DiskEncryption determines if the disks of the
391+
instance should be encrypted.
392+
enum:
393+
- enabled
394+
- disabled
395+
type: string
396+
x-kubernetes-validations:
397+
- message: Value is immutable
398+
rule: self == oldSelf
389399
firewallID:
390400
type: integer
391401
x-kubernetes-validations:

controller/linodemachine_controller_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ var _ = Describe("create", Label("machine", "create"), func() {
107107
UID: "12345",
108108
},
109109
Spec: infrav1alpha2.LinodeMachineSpec{
110-
InstanceID: ptr.To(0),
111-
Type: "g6-nanode-1",
112-
Image: rutil.DefaultMachineControllerLinodeImage,
110+
InstanceID: ptr.To(0),
111+
Type: "g6-nanode-1",
112+
Image: rutil.DefaultMachineControllerLinodeImage,
113+
DiskEncryption: string(linodego.InstanceDiskEncryptionEnabled),
113114
},
114115
}
115116
reconciler = &LinodeMachineReconciler{
@@ -141,7 +142,7 @@ var _ = Describe("create", Label("machine", "create"), func() {
141142
getRegion := mockLinodeClient.EXPECT().
142143
GetRegion(ctx, gomock.Any()).
143144
After(listInst).
144-
Return(&linodego.Region{Capabilities: []string{"Metadata"}}, nil)
145+
Return(&linodego.Region{Capabilities: []string{linodego.CapabilityMetadata, linodego.CapabilityDiskEncryption}}, nil)
145146
getImage := mockLinodeClient.EXPECT().
146147
GetImage(ctx, gomock.Any()).
147148
After(getRegion).
@@ -227,7 +228,7 @@ var _ = Describe("create", Label("machine", "create"), func() {
227228
getRegion := mockLinodeClient.EXPECT().
228229
GetRegion(ctx, gomock.Any()).
229230
After(listInst).
230-
Return(&linodego.Region{Capabilities: []string{"Metadata"}}, nil)
231+
Return(&linodego.Region{Capabilities: []string{linodego.CapabilityMetadata, linodego.CapabilityDiskEncryption}}, nil)
231232
getImage := mockLinodeClient.EXPECT().
232233
GetImage(ctx, gomock.Any()).
233234
After(getRegion).
@@ -309,7 +310,7 @@ var _ = Describe("create", Label("machine", "create"), func() {
309310
getRegion := mockLinodeClient.EXPECT().
310311
GetRegion(ctx, gomock.Any()).
311312
After(listInst).
312-
Return(&linodego.Region{Capabilities: []string{"Metadata"}}, nil)
313+
Return(&linodego.Region{Capabilities: []string{linodego.CapabilityMetadata, linodego.CapabilityDiskEncryption}}, nil)
313314
getImage := mockLinodeClient.EXPECT().
314315
GetImage(ctx, gomock.Any()).
315316
After(getRegion).
@@ -460,7 +461,7 @@ var _ = Describe("create", Label("machine", "create"), func() {
460461
getRegion := mockLinodeClient.EXPECT().
461462
GetRegion(ctx, gomock.Any()).
462463
After(listInst).
463-
Return(&linodego.Region{Capabilities: []string{"Metadata"}}, nil)
464+
Return(&linodego.Region{Capabilities: []string{linodego.CapabilityMetadata, linodego.CapabilityDiskEncryption}}, nil)
464465
getImage := mockLinodeClient.EXPECT().
465466
GetImage(ctx, gomock.Any()).
466467
After(getRegion).

docs/src/topics/addons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ kubectl label cluster $CLUSTER_NAME cni=$CLUSTER_NAME-cilium --overwrite
5656
Cilium will then be automatically installed via CAAPH into the labeled cluster.
5757

5858
#### Enabled Features
59-
By default, Cilium's [BGP Control Plane](https://docs.cilium.io/en/stable/network/bgp-control-plane/)
59+
By default, Cilium's [BGP Control Plane](https://docs.cilium.io/en/stable/network/bgp-control-plane/bgp-control-plane/)
6060
is enabled when using Cilium as the CNI.
6161

6262
## CCM

docs/src/topics/flavors/cilium-bgp-lb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Cilium BGP Load-Balancing
22

33
This flavor creates special labeled worker nodes for ingress which leverage Cilium's
4-
[BGP Control Plane](https://docs.cilium.io/en/stable/network/bgp-control-plane/)
4+
[BGP Control Plane](https://docs.cilium.io/en/stable/network/bgp-control-plane/bgp-control-plane/)
55
and [LB IPAM](https://docs.cilium.io/en/stable/network/lb-ipam/) support.
66

77
With this flavor, Services exposed via `type: LoadBalancer` automatically get

docs/src/topics/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export LINODE_MACHINE_TYPE=g6-standard-2
3232
For Regions and Images that do not yet support Akamai's cloud-init datasource CAPL will automatically use a stackscript shim
3333
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
3434
```
35-
```admonish warning
36-
By default, clusters are provisioned within VPC. For Regions which do not have [VPC support](https://www.linode.com/docs/products/networking/vpc/#availability) yet, use the [VPCLess](./flavors/vpcless.md) flavor to have clusters provisioned.
37-
```
35+
~~~admonish warning
36+
By default, clusters are provisioned within VPC with disk encryption enabled. For Regions which do not have [VPC support](https://www.linode.com/docs/products/networking/vpc/#availability) yet, use the [VPCLess](./flavors/vpcless.md) flavor to have clusters provisioned. For disabling disk encryption, set `spec.template.spec.diskEncryption=disabled` in your generated LinodeMachineTemplate resources when creating a CAPL cluster.
37+
~~~
3838

3939
## Install CAPL on your management cluster
4040
```admonish warning

templates/infra/linodeMachineTemplate.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ spec:
99
image: ${LINODE_OS:="linode/ubuntu22.04"}
1010
type: ${LINODE_CONTROL_PLANE_MACHINE_TYPE}
1111
region: ${LINODE_REGION}
12+
# diskEncryption: disabled
1213
interfaces:
1314
- purpose: public
1415
authorizedKeys:
@@ -25,6 +26,7 @@ spec:
2526
image: ${LINODE_OS:="linode/ubuntu22.04"}
2627
type: ${LINODE_MACHINE_TYPE}
2728
region: ${LINODE_REGION}
29+
# diskEncryption: disabled
2830
interfaces:
2931
- purpose: public
3032
authorizedKeys:

0 commit comments

Comments
 (0)