Skip to content

Commit f19fa16

Browse files
committed
doc update
1 parent 1e5aa24 commit f19fa16

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

docs/src/topics/vpc.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,38 @@ spec:
6161
6262
Reference to LinodeVPC object is added to LinodeCluster object which then uses the specified VPC to provision resources.
6363
64+
## Lifecycle Management and Adopting Existing VPCs
65+
66+
The provider offers flexible lifecycle management, allowing you to adopt existing VPCs and control whether resources are deleted when their corresponding Kubernetes objects are removed.
67+
68+
### Adopting an Existing VPC
69+
You can instruct the controller to use a pre-existing VPC by specifying its ID in the `LinodeVPCSpec`. The controller will "adopt" this VPC and manage its subnets without creating a new one.
70+
71+
```yaml
72+
---
73+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
74+
kind: LinodeVPC
75+
metadata:
76+
name: my-adopted-vpc
77+
spec:
78+
vpcID: 12345
79+
region: us-sea
80+
# subnets can be defined and will be created within the adopted VPC
81+
subnets:
82+
- label: my-new-subnet-in-adopted-vpc
83+
ipv4: 10.0.3.0/24
84+
```
85+
86+
### Retaining Resources on Deletion
87+
By default, the controller deletes VPCs and subnets from your Linode account when you delete the `LinodeVPC` Kubernetes object. You can prevent this using the `retain` flag.
88+
89+
- **`spec.retain`**: When set to `true` on the `LinodeVPC`, the VPC itself will not be deleted from Linode. This is the default and recommended behavior when adopting an existing VPC.
90+
- **`spec.subnets[].retain`**: When the parent VPC is retained, you can use this flag to control individual subnets. If `retain` is `false` (the default), the subnet will be deleted.
91+
92+
```admonish warning title="Safety Check for Attached Linodes"
93+
The controller includes a critical safety feature: it will **not** delete a subnet if it has any active Linode instances attached to it. The operation will be paused and retried, preventing resource orphaning.
94+
```
95+
6496
### Additional Configuration
6597
By default, the VPC will use the subnet with the `default` label for deploying clusters. To modify this behavior, set the `SUBNET_NAME` environment variable to match the label of the subnet to be used. Make sure the subnet is set up in the LinodeVPC manifest.
6698

@@ -111,3 +143,5 @@ CIDR returned in the output of above command should match with the pod CIDR pres
111143

112144
### Running cilium connectivity tests
113145
One can also run cilium connectivity tests to make sure networking works fine within VPC. Follow the steps defined in [cilium e2e tests](https://docs.cilium.io/en/stable/contributing/testing/e2e/) guide to install cilium binary, set the KUBECONFIG variable and then run `cilium connectivity tests`.
146+
147+
```

internal/controller/linodevpc_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"time"
2525

2626
"github.com/go-logr/logr"
27+
"github.com/linode/linodego"
2728
corev1 "k8s.io/api/core/v1"
2829
apierrors "k8s.io/apimachinery/pkg/api/errors"
2930
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -49,7 +50,6 @@ import (
4950
wrappedruntimereconciler "github.com/linode/cluster-api-provider-linode/observability/wrappers/runtimereconciler"
5051
"github.com/linode/cluster-api-provider-linode/util"
5152
"github.com/linode/cluster-api-provider-linode/util/reconciler"
52-
"github.com/linode/linodego"
5353
)
5454

5555
// LinodeVPCReconciler reconciles a LinodeVPC object

0 commit comments

Comments
 (0)