Promote HonorPVReclaimPolicy to beta and enable it by default

This commit is contained in:
carlory 2024-05-13 16:07:44 +08:00
parent c7c4039093
commit 4058178b8c
16 changed files with 37 additions and 45 deletions

View File

@ -18,12 +18,12 @@ package persistentvolume
import (
"errors"
"testing"
utilfeature "k8s.io/apiserver/pkg/util/feature"
featuregatetesting "k8s.io/component-base/featuregate/testing"
"k8s.io/klog/v2/ktesting"
"k8s.io/kubernetes/pkg/features"
"testing"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
@ -598,13 +598,16 @@ func TestProvisionSync(t *testing.T) {
//
// Some limit of calls in enforced to prevent endless loops.
func TestProvisionMultiSync(t *testing.T) {
// Default enable the HonorPVReclaimPolicy feature gate.
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.HonorPVReclaimPolicy, true)
_, ctx := ktesting.NewTestContext(t)
tests := []controllerTest{
{
// Provision a volume with binding
name: "12-1 - successful provision",
initialVolumes: novolumes,
expectedVolumes: newVolumeArray("pvc-uid12-1", "1Gi", "uid12-1", "claim12-1", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classGold, volume.AnnBoundByController, volume.AnnDynamicallyProvisioned),
expectedVolumes: volumesWithFinalizers(newVolumeArray("pvc-uid12-1", "1Gi", "uid12-1", "claim12-1", v1.VolumeBound, v1.PersistentVolumeReclaimDelete, classGold, volume.AnnBoundByController, volume.AnnDynamicallyProvisioned), []string{volume.PVDeletionInTreeProtectionFinalizer}),
initialClaims: newClaimArray("claim12-1", "uid12-1", "1Gi", "", v1.ClaimPending, &classGold),
expectedClaims: newClaimArray("claim12-1", "uid12-1", "1Gi", "pvc-uid12-1", v1.ClaimBound, &classGold, volume.AnnBoundByController, volume.AnnBindCompleted, volume.AnnStorageProvisioner, volume.AnnBetaStorageProvisioner),
expectedEvents: noevents,

View File

@ -255,8 +255,9 @@ const (
HPAScaleToZero featuregate.Feature = "HPAScaleToZero"
// owner: @deepakkinni @xing-yang
// kep: https://kep.k8s.io/2680
// kep: https://kep.k8s.io/2644
// alpha: v1.23
// beta: v1.31
//
// Honor Persistent Volume Reclaim Policy when it is "Delete" irrespective of PV-PVC
// deletion ordering.
@ -1012,7 +1013,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
HPAContainerMetrics: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
HonorPVReclaimPolicy: {Default: false, PreRelease: featuregate.Alpha},
HonorPVReclaimPolicy: {Default: true, PreRelease: featuregate.Beta},
ImageMaximumGCAge: {Default: true, PreRelease: featuregate.Beta},

View File

@ -698,18 +698,6 @@ func (m *mockCSIDriver) PrepareTest(ctx context.Context, f *framework.Framework)
Verbs: []string{"get", "list"},
})
}
if m.enableHonorPVReclaimPolicy && strings.HasPrefix(item.Name, "external-provisioner-runner") {
// The update verb is needed for testing the HonorPVReclaimPolicy feature gate.
// The feature gate is an alpha stage and is not enabled by default, so the verb
// is not added to the default rbac manifest.
// TODO: Remove this when the feature gate is promoted to beta or stable, and the
// verb is added to the default rbac manifest in the external-provisioner.
item.Rules = append(item.Rules, rbacv1.PolicyRule{
APIGroups: []string{""},
Resources: []string{"persistentvolumes"},
Verbs: []string{"update"},
})
}
}
return nil

View File

@ -1,5 +1,5 @@
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-attacher/raw/v4.5.0/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.13
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-attacher/raw/v4.6.1/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.14
# by ./update-hostpath.sh
#
# This YAML file contains all RBAC objects that are necessary to run external

View File

@ -1,5 +1,5 @@
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-health-monitor/raw/v0.11.0/deploy/kubernetes/external-health-monitor-controller/rbac.yaml
# for csi-driver-host-path release-1.13
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-health-monitor/raw/v0.12.1/deploy/kubernetes/external-health-monitor-controller/rbac.yaml
# for csi-driver-host-path release-1.14
# by ./update-hostpath.sh
#
# This YAML file contains all RBAC objects that are necessary to run external

View File

@ -1,5 +1,5 @@
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-provisioner/raw/v4.0.0/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.13
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-provisioner/raw/v5.0.1/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.14
# by ./update-hostpath.sh
#
# This YAML file contains all RBAC objects that are necessary to run external
@ -32,7 +32,7 @@ rules:
# verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
verbs: ["get", "list", "watch", "create", "patch", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]

View File

@ -1,5 +1,5 @@
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-resizer/raw/v1.10.0/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.13
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-resizer/raw/v1.11.1/deploy/kubernetes//rbac.yaml
# for csi-driver-host-path release-1.14
# by ./update-hostpath.sh
#
# This YAML file contains all RBAC objects that are necessary to run external

View File

@ -1,5 +1,5 @@
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-snapshotter/raw/v7.0.1/deploy/kubernetes/csi-snapshotter/rbac-csi-snapshotter.yaml
# for csi-driver-host-path release-1.13
# Do not edit, downloaded from https://github.com/kubernetes-csi/external-snapshotter/raw/v8.0.1/deploy/kubernetes/csi-snapshotter/rbac-csi-snapshotter.yaml
# for csi-driver-host-path release-1.14
# by ./update-hostpath.sh
#
# Together with the RBAC file for external-provisioner, this YAML file

View File

@ -1,4 +1,4 @@
The files in this directory are exact copies of "kubernetes-latest" in
https://github.com/kubernetes-csi/csi-driver-host-path/tree/release-1.13/deploy/
https://github.com/kubernetes-csi/csi-driver-host-path/tree/release-1.14/deploy/
Do not edit manually. Run ./update-hostpath.sh to refresh the content.

View File

@ -219,7 +219,7 @@ spec:
serviceAccountName: csi-hostpathplugin-sa
containers:
- name: hostpath
image: registry.k8s.io/sig-storage/hostpathplugin:v1.13.0
image: registry.k8s.io/sig-storage/hostpathplugin:v1.14.0
args:
- "--drivername=hostpath.csi.k8s.io"
- "--v=5"
@ -262,7 +262,7 @@ spec:
name: dev-dir
- name: csi-external-health-monitor-controller
image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.11.0
image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.12.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"
@ -276,7 +276,7 @@ spec:
mountPath: /csi
- name: node-driver-registrar
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.0
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.1
args:
- --v=5
- --csi-address=/csi/csi.sock
@ -310,7 +310,7 @@ spec:
- --health-port=9898
- name: csi-attacher
image: registry.k8s.io/sig-storage/csi-attacher:v4.5.0
image: registry.k8s.io/sig-storage/csi-attacher:v4.6.1
args:
- --v=5
- --csi-address=/csi/csi.sock
@ -324,7 +324,7 @@ spec:
name: socket-dir
- name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v4.0.0
image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.1
args:
- -v=5
- --csi-address=/csi/csi.sock
@ -340,7 +340,7 @@ spec:
name: socket-dir
- name: csi-resizer
image: registry.k8s.io/sig-storage/csi-resizer:v1.10.0
image: registry.k8s.io/sig-storage/csi-resizer:v1.11.1
args:
- -v=5
- -csi-address=/csi/csi.sock
@ -354,7 +354,7 @@ spec:
name: socket-dir
- name: csi-snapshotter
image: registry.k8s.io/sig-storage/csi-snapshotter:v7.0.1
image: registry.k8s.io/sig-storage/csi-snapshotter:v8.0.1
args:
- -v=5
- --csi-address=/csi/csi.sock

View File

@ -66,7 +66,7 @@ spec:
topologyKey: kubernetes.io/hostname
containers:
- name: socat
image: registry.k8s.io/sig-storage/hostpathplugin:v1.13.0
image: registry.k8s.io/sig-storage/hostpathplugin:v1.14.0
command:
- socat
args:

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock
containers:
- name: csi-attacher
image: registry.k8s.io/sig-storage/csi-attacher:v4.5.0
image: registry.k8s.io/sig-storage/csi-attacher:v4.6.1
args:
- --v=5
- --csi-address=$(ADDRESS)

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock
containers:
- name: csi-resizer
image: registry.k8s.io/sig-storage/csi-resizer:v1.10.0
image: registry.k8s.io/sig-storage/csi-resizer:v1.11.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock
containers:
- name: csi-snapshotter
image: registry.k8s.io/sig-storage/csi-snapshotter:v7.0.1
image: registry.k8s.io/sig-storage/csi-snapshotter:v8.0.1
args:
- "--v=5"
- "--csi-address=$(ADDRESS)"

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock
containers:
- name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v4.0.0
image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.1
args:
- "--csi-address=$(ADDRESS)"
# Topology support is needed for the pod rescheduling test
@ -34,7 +34,7 @@ spec:
- mountPath: /csi
name: socket-dir
- name: driver-registrar
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.0
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.1
args:
- --v=5
- --csi-address=/csi/csi.sock
@ -53,7 +53,7 @@ spec:
- mountPath: /registration
name: registration-dir
- name: mock
image: registry.k8s.io/sig-storage/hostpathplugin:v1.13.0
image: registry.k8s.io/sig-storage/hostpathplugin:v1.14.0
args:
- "--drivername=mock.storage.k8s.io"
- "--nodeid=$(KUBE_NODE_NAME)"

View File

@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-mock
containers:
- name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v4.0.0
image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.1
args:
- "--csi-address=$(ADDRESS)"
# Topology support is needed for the pod rescheduling test
@ -35,7 +35,7 @@ spec:
- mountPath: /csi
name: socket-dir
- name: driver-registrar
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.0
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.10.1
args:
- --v=5
- --csi-address=/csi/csi.sock
@ -53,7 +53,7 @@ spec:
- mountPath: /registration
name: registration-dir
- name: mock
image: registry.k8s.io/sig-storage/hostpathplugin:v1.13.0
image: registry.k8s.io/sig-storage/hostpathplugin:v1.14.0
args:
- -v=5
- -nodeid=$(KUBE_NODE_NAME)