Skip to content

Commit

Permalink
feat: graduate the garbage collection feature
Browse files Browse the repository at this point in the history
This moves the "garbage collection" feature out of experimental and to
be enabled by default.

Signed-off-by: Richard Case <[email protected]>
  • Loading branch information
richardcase committed Apr 26, 2024
1 parent 4c5b811 commit 03de6e2
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 443 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,6 @@ compile-e2e: ## Test e2e compilation
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/unmanaged
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/conformance
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/managed
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/gc_managed
go test -c -o /dev/null -tags=e2e ./test/e2e/suites/gc_unmanaged


.PHONY: docker-pull-e2e-preloads
docker-pull-e2e-preloads: ## Preloads the docker images used for e2e testing and can speed it up
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
containers:
- args:
- "--leader-elect"
- "--feature-gates=EKS=${CAPA_EKS:=true},EKSEnableIAM=${CAPA_EKS_IAM:=false},EKSAllowAddRoles=${CAPA_EKS_ADD_ROLES:=false},EKSFargate=${EXP_EKS_FARGATE:=false},MachinePool=${EXP_MACHINE_POOL:=false},EventBridgeInstanceState=${EVENT_BRIDGE_INSTANCE_STATE:=false},AutoControllerIdentityCreator=${AUTO_CONTROLLER_IDENTITY_CREATOR:=true},BootstrapFormatIgnition=${EXP_BOOTSTRAP_FORMAT_IGNITION:=false},ExternalResourceGC=${EXP_EXTERNAL_RESOURCE_GC:=false},AlternativeGCStrategy=${EXP_ALTERNATIVE_GC_STRATEGY:=false},TagUnmanagedNetworkResources=${TAG_UNMANAGED_NETWORK_RESOURCES:=true},ROSA=${EXP_ROSA:=false}"
- "--feature-gates=EKS=${CAPA_EKS:=true},EKSEnableIAM=${CAPA_EKS_IAM:=false},EKSAllowAddRoles=${CAPA_EKS_ADD_ROLES:=false},EKSFargate=${EXP_EKS_FARGATE:=false},MachinePool=${EXP_MACHINE_POOL:=false},EventBridgeInstanceState=${EVENT_BRIDGE_INSTANCE_STATE:=false},AutoControllerIdentityCreator=${AUTO_CONTROLLER_IDENTITY_CREATOR:=true},BootstrapFormatIgnition=${EXP_BOOTSTRAP_FORMAT_IGNITION:=false},ExternalResourceGC=${CAPA_EXTERNAL_RESOURCE_GC:=true},AlternativeGCStrategy=${EXP_ALTERNATIVE_GC_STRATEGY:=false},TagUnmanagedNetworkResources=${TAG_UNMANAGED_NETWORK_RESOURCES:=true},ROSA=${EXP_ROSA:=false}"
- "--v=${CAPA_LOGLEVEL:=0}"
- "--diagnostics-address=${CAPA_DIAGNOSTICS_ADDRESS:=:8443}"
- "--insecure-diagnostics=${CAPA_INSECURE_DIAGNOSTICS:=false}"
Expand Down
19 changes: 14 additions & 5 deletions docs/book/src/topics/external-resource-gc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# External Resource Garbage Collection

- **Feature status:** Experimental
- **Feature status:** Stable
- **Feature gate (required):** ExternalResourceGC=true

## Overview
Expand All @@ -21,16 +21,25 @@ We will look to support deleting EBS volumes in the future potentially.

> Note: this feature will likely be superseded by an upstream CAPI feature in the future when [this issue](https://github.com/kubernetes-sigs/cluster-api/issues/3075) is resolved.
## Enabling
## Disabling

To enable garbage collection, you must set the `ExternalResourceGC` feature gate to `true` on the controller manager. The easiest way to do this is via an environment variable:
The garbage collection feature is enabled by default. It can be disabled by setting the `ExternalResourceGC` feature gate to `false` on the controller manager. The easiest way to do this is via an environment variable:

```bash
export EXP_EXTERNAL_RESOURCE_GC=true
export CAPA_EXTERNAL_RESOURCE_GC=false
clusterctl init --infrastructure aws
```

> Note: if you enable this feature **ALL** clusters will be marked as requiring garbage collection.
## Enabling Alternative Strategy

The default strategy is to use the AWS resource tagging API. This may not be suitable in all cases and so an alternative strategy can be enabled. The alternative strategy is usually needed in a airgapped environment where the resource tagging API is not available.

To enable the alternative strategy you need to set the `AlternativeGCStrategy` feature gate to `true` on the controller manager. The easiest way to do this is via an environment variable:

```bash
export EXP_ALTERNATIVE_GC_STRATEGY=true
clusterctl init --infrastructure aws
```

## Operations

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/topics/reference/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| EventBridgeInstanceState | EVENT_BRIDGE_INSTANCE_STATE | flase |
| AutoControllerIdentityCreator | AUTO_CONTROLLER_IDENTITY_CREATOR | true |
| BootstrapFormatIgnition | EXP_BOOTSTRAP_FORMAT_IGNITION | false |
| ExternalResourceGC | EXP_EXTERNAL_RESOURCE_GC | false |
| ExternalResourceGC | CAPA_EXTERNAL_RESOURCE_GC | true |
| AlternativeGCStrategy | EXP_ALTERNATIVE_GC_STRATEGY | false |
| TagUnmanagedNetworkResources | TAG_UNMANAGED_NETWORK_RESOURCES | true |
| ROSA | EXP_ROSA | false |
4 changes: 2 additions & 2 deletions feature/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const (

// ExternalResourceGC is used to enable the garbage collection of external resources like NLB/ALB on deletion
// owner: @richardcase
// alpha: v1.5
// beta: v2.5.0
ExternalResourceGC featuregate.Feature = "ExternalResourceGC"

// AlternativeGCStrategy is used to enable garbage collection of external resources to be performed without resource group tagging API. It is usually needed in airgap env when tagging API is not available.
Expand Down Expand Up @@ -104,7 +104,7 @@ var defaultCAPAFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
MachinePool: {Default: true, PreRelease: featuregate.Beta},
AutoControllerIdentityCreator: {Default: true, PreRelease: featuregate.Alpha},
BootstrapFormatIgnition: {Default: false, PreRelease: featuregate.Alpha},
ExternalResourceGC: {Default: false, PreRelease: featuregate.Alpha},
ExternalResourceGC: {Default: true, PreRelease: featuregate.Beta},
AlternativeGCStrategy: {Default: false, PreRelease: featuregate.Alpha},
TagUnmanagedNetworkResources: {Default: true, PreRelease: featuregate.Alpha},
ROSA: {Default: false, PreRelease: featuregate.Alpha},
Expand Down
112 changes: 0 additions & 112 deletions scripts/ci-e2e-eks-gc.sh

This file was deleted.

112 changes: 0 additions & 112 deletions scripts/ci-e2e-gc.sh

This file was deleted.

1 change: 0 additions & 1 deletion test/e2e/data/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ variables:
INIT_WITH_KUBERNETES_VERSION: "v1.25.0"
EXP_BOOTSTRAP_FORMAT_IGNITION: "true"
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
EXP_EXTERNAL_RESOURCE_GC: "true"
GC_WORKLOAD: "../../data/gcworkload.yaml"

intervals:
Expand Down
1 change: 0 additions & 1 deletion test/e2e/data/e2e_eks_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ variables:
CONFORMANCE_CI_ARTIFACTS_KUBERNETES_VERSION: "1.29.1"
IP_FAMILY: "IPv4"
CAPA_LOGLEVEL: "4"
EXP_EXTERNAL_RESOURCE_GC: "true"
GC_WORKLOAD: "../../data/gcworkload.yaml"

intervals:
Expand Down
Loading

0 comments on commit 03de6e2

Please sign in to comment.