Skip to content

Commit

Permalink
external-provisioner changes to support PV Deletion protection finalizer
Browse files Browse the repository at this point in the history
Signed-off-by: Deepak Kinni <[email protected]>
  • Loading branch information
Deepak Kinni committed Nov 9, 2021
1 parent 7ae6146 commit d76f26e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Following table reflects the head of this branch.
| CSIMigration | Beta | On | [Migrating in-tree volume plugins to CSI](https://kubernetes.io/docs/concepts/storage/volumes/#csi-migration). | No |
| CSIStorageCapacity | Beta | On | Publish [capacity information](https://kubernetes.io/docs/concepts/storage/volumes/#storage-capacity) for the Kubernetes scheduler. | No |
| ReadWriteOncePod | Alpha | Off | [Single pod access mode for PersistentVolumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes). | No |
| HonorPVReclaimPolicy| Alpha |Off | [Honor the PV reclaim policy](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2644-honor-pv-reclaim-policy) | No

All other external-provisioner features and the external-provisioner itself is considered GA and fully supported.

Expand Down
5 changes: 5 additions & 0 deletions cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
goflag "flag"
"fmt"
"github.com/kubernetes-csi/external-provisioner/pkg/features"
"math/rand"
"net/http"
"os"
Expand Down Expand Up @@ -359,6 +360,10 @@ func main() {
controller.NodesLister(nodeLister),
}

if utilfeature.DefaultFeatureGate.Enabled(features.HonorPVReclaimPolicy) {
provisionerOptions = append(provisionerOptions, controller.AddFinalizer(true))
}

if supportsMigrationFromInTreePluginName != "" {
provisionerOptions = append(provisionerOptions, controller.AdditionalProvisionerNames([]string{supportsMigrationFromInTreePluginName}))
}
Expand Down
11 changes: 10 additions & 1 deletion pkg/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ const (
// alpha: v0.4
// beta: v1.2
Topology featuregate.Feature = "Topology"

// owner: @deepakkinni @xing-yang
// kep: http://kep.k8s.io/2680
// alpha: v1.23
//
// Honor Persistent Volume Reclaim Policy when it is "Delete" irrespective of PV-PVC
// deletion ordering.
HonorPVReclaimPolicy featuregate.Feature = "HonorPVReclaimPolicy"
)

func init() {
Expand All @@ -35,5 +43,6 @@ func init() {
// defaultKubernetesFeatureGates consists of all known feature keys specific to external-provisioner.
// To add a new feature, define a key for it above and add it here.
var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
Topology: {Default: false, PreRelease: featuregate.GA},
Topology: {Default: false, PreRelease: featuregate.GA},
HonorPVReclaimPolicy: {Default: false, PreRelease: featuregate.Alpha},
}

0 comments on commit d76f26e

Please sign in to comment.