From 48ba5020a28d7f8e5a8e23dff0b847b56014482b Mon Sep 17 00:00:00 2001 From: Chris Henzie Date: Tue, 11 May 2021 17:44:21 -0700 Subject: [PATCH] ReadWriteOncePod PV access mode and feature gate --- pkg/apis/core/types.go | 3 +++ pkg/features/kube_features.go | 7 +++++++ staging/src/k8s.io/api/core/v1/types.go | 3 +++ 3 files changed, 13 insertions(+) diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index 3fdc87977a6..57f31639f1c 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -511,6 +511,9 @@ const ( ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany" // can be mounted in read/write mode to many hosts ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany" + // can be mounted read/write mode to exactly 1 pod + // cannot be used in combination with other access modes + ReadWriteOncePod PersistentVolumeAccessMode = "ReadWriteOncePod" ) // PersistentVolumePhase defines the phase in which a PV is diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index ebdd3e62890..74bd8e6878b 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -727,6 +727,12 @@ const ( // // Enables the PodSecurity admission plugin PodSecurity featuregate.Feature = "PodSecurity" + + // owner: @chrishenzie + // alpha: v1.22 + // + // Enables usage of the ReadWriteOncePod PersistentVolume access mode. + ReadWriteOncePod featuregate.Feature = "ReadWriteOncePod" ) func init() { @@ -836,6 +842,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS ExpandedDNSConfig: {Default: false, PreRelease: featuregate.Alpha}, SeccompDefault: {Default: false, PreRelease: featuregate.Alpha}, PodSecurity: {Default: false, PreRelease: featuregate.Alpha}, + ReadWriteOncePod: {Default: false, PreRelease: featuregate.Alpha}, // inherited features from generic apiserver, relisted here to get a conflict if it is changed // unintentionally on either side: diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index c5ceea7d697..3f6a6211b21 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -560,6 +560,9 @@ const ( ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany" // can be mounted in read/write mode to many hosts ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany" + // can be mounted in read/write mode to exactly 1 pod + // cannot be used in combination with other access modes + ReadWriteOncePod PersistentVolumeAccessMode = "ReadWriteOncePod" ) type PersistentVolumePhase string