Merge pull request #103001 from zshihang/csi

CSIServiceAccountToken ga
This commit is contained in:
Kubernetes Prow Robot 2021-06-26 19:31:23 -07:00 committed by GitHub
commit a0f9c8c277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 45 additions and 148 deletions

View File

@ -13753,7 +13753,7 @@
"type": "boolean" "type": "boolean"
}, },
"requiresRepublish": { "requiresRepublish": {
"description": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "description": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.",
"type": "boolean" "type": "boolean"
}, },
"storageCapacity": { "storageCapacity": {
@ -13761,7 +13761,7 @@
"type": "boolean" "type": "boolean"
}, },
"tokenRequests": { "tokenRequests": {
"description": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "description": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.",
"items": { "items": {
"$ref": "#/definitions/io.k8s.api.storage.v1.TokenRequest" "$ref": "#/definitions/io.k8s.api.storage.v1.TokenRequest"
}, },

View File

@ -381,9 +381,6 @@ type CSIDriverSpec struct {
// most one token is empty string. To receive a new token after expiry, // most one token is empty string. To receive a new token after expiry,
// RequiresRepublish can be used to trigger NodePublishVolume periodically. // RequiresRepublish can be used to trigger NodePublishVolume periodically.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
// +listType=atomic // +listType=atomic
TokenRequests []TokenRequest TokenRequests []TokenRequest
@ -396,9 +393,6 @@ type CSIDriverSpec struct {
// to NodePublishVolume should only update the contents of the volume. New // to NodePublishVolume should only update the contents of the volume. New
// mount points will not be seen by a running container. // mount points will not be seen by a running container.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
RequiresRepublish *bool RequiresRepublish *bool
} }

View File

@ -60,7 +60,7 @@ func SetDefaults_CSIDriver(obj *storagev1.CSIDriver) {
if len(obj.Spec.VolumeLifecycleModes) == 0 && utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) { if len(obj.Spec.VolumeLifecycleModes) == 0 && utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
obj.Spec.VolumeLifecycleModes = append(obj.Spec.VolumeLifecycleModes, storagev1.VolumeLifecyclePersistent) obj.Spec.VolumeLifecycleModes = append(obj.Spec.VolumeLifecycleModes, storagev1.VolumeLifecyclePersistent)
} }
if obj.Spec.RequiresRepublish == nil && utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) { if obj.Spec.RequiresRepublish == nil {
obj.Spec.RequiresRepublish = new(bool) obj.Spec.RequiresRepublish = new(bool)
*(obj.Spec.RequiresRepublish) = false *(obj.Spec.RequiresRepublish) = false
} }

View File

@ -94,7 +94,6 @@ func TestSetDefaultVolumeBindingMode(t *testing.T) {
func TestSetDefaultCSIDriver(t *testing.T) { func TestSetDefaultCSIDriver(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIServiceAccountToken, true)()
enabled := true enabled := true
disabled := false disabled := false

View File

@ -60,7 +60,7 @@ func SetDefaults_CSIDriver(obj *storagev1beta1.CSIDriver) {
if len(obj.Spec.VolumeLifecycleModes) == 0 && utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) { if len(obj.Spec.VolumeLifecycleModes) == 0 && utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
obj.Spec.VolumeLifecycleModes = append(obj.Spec.VolumeLifecycleModes, storagev1beta1.VolumeLifecyclePersistent) obj.Spec.VolumeLifecycleModes = append(obj.Spec.VolumeLifecycleModes, storagev1beta1.VolumeLifecyclePersistent)
} }
if obj.Spec.RequiresRepublish == nil && utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) { if obj.Spec.RequiresRepublish == nil {
obj.Spec.RequiresRepublish = new(bool) obj.Spec.RequiresRepublish = new(bool)
*(obj.Spec.RequiresRepublish) = false *(obj.Spec.RequiresRepublish) = false
} }

View File

@ -142,7 +142,6 @@ func TestSetDefaultVolumeLifecycleModesDisabled(t *testing.T) {
func TestSetDefaultCSIDriver(t *testing.T) { func TestSetDefaultCSIDriver(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIServiceAccountToken, true)()
enabled := true enabled := true
disabled := false disabled := false

View File

@ -577,6 +577,7 @@ const (
// owner: @zshihang // owner: @zshihang
// alpha: v1.20 // alpha: v1.20
// beta: v1.21 // beta: v1.21
// ga: v1.22
// //
// Enable kubelet to pass pod's service account token to NodePublishVolume // Enable kubelet to pass pod's service account token to NodePublishVolume
// call of CSI driver which is mounting volumes for that pod. // call of CSI driver which is mounting volumes for that pod.
@ -760,7 +761,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
ConfigurableFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta}, ConfigurableFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta}, CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta},
CSIStorageCapacity: {Default: true, PreRelease: featuregate.Beta}, CSIStorageCapacity: {Default: true, PreRelease: featuregate.Beta},
CSIServiceAccountToken: {Default: true, PreRelease: featuregate.Beta}, CSIServiceAccountToken: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.23
GenericEphemeralVolume: {Default: true, PreRelease: featuregate.Beta}, GenericEphemeralVolume: {Default: true, PreRelease: featuregate.Beta},
CSIVolumeFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta}, CSIVolumeFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
RuntimeClass: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.23 RuntimeClass: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.23

View File

@ -520,12 +520,11 @@ func AddHandlers(h printers.PrintHandler) {
Name: "StorageCapacity", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["storageCapacity"], Name: "StorageCapacity", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["storageCapacity"],
}) })
} }
if utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) { csiDriverColumnDefinitions = append(csiDriverColumnDefinitions, []metav1.TableColumnDefinition{
csiDriverColumnDefinitions = append(csiDriverColumnDefinitions, []metav1.TableColumnDefinition{ {Name: "TokenRequests", Type: "string", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["tokenRequests"]},
{Name: "TokenRequests", Type: "string", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["tokenRequests"]}, {Name: "RequiresRepublish", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["requiresRepublish"]},
{Name: "RequiresRepublish", Type: "boolean", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["requiresRepublish"]}, }...)
}...)
}
csiDriverColumnDefinitions = append(csiDriverColumnDefinitions, []metav1.TableColumnDefinition{ csiDriverColumnDefinitions = append(csiDriverColumnDefinitions, []metav1.TableColumnDefinition{
{Name: "Modes", Type: "string", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["volumeLifecycleModes"]}, {Name: "Modes", Type: "string", Description: storagev1.CSIDriverSpec{}.SwaggerDoc()["volumeLifecycleModes"]},
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]}, {Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
@ -1419,21 +1418,21 @@ func printCSIDriver(obj *storage.CSIDriver, options printers.GenerateOptions) ([
} }
row.Cells = append(row.Cells, storageCapacity) row.Cells = append(row.Cells, storageCapacity)
} }
if utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) {
tokenRequests := "<unset>" tokenRequests := "<unset>"
if obj.Spec.TokenRequests != nil { if obj.Spec.TokenRequests != nil {
audiences := []string{} audiences := []string{}
for _, t := range obj.Spec.TokenRequests { for _, t := range obj.Spec.TokenRequests {
audiences = append(audiences, t.Audience) audiences = append(audiences, t.Audience)
}
tokenRequests = strings.Join(audiences, ",")
} }
requiresRepublish := false tokenRequests = strings.Join(audiences, ",")
if obj.Spec.RequiresRepublish != nil {
requiresRepublish = *obj.Spec.RequiresRepublish
}
row.Cells = append(row.Cells, tokenRequests, requiresRepublish)
} }
requiresRepublish := false
if obj.Spec.RequiresRepublish != nil {
requiresRepublish = *obj.Spec.RequiresRepublish
}
row.Cells = append(row.Cells, tokenRequests, requiresRepublish)
row.Cells = append(row.Cells, modes, translateTimestampSince(obj.CreationTimestamp)) row.Cells = append(row.Cells, modes, translateTimestampSince(obj.CreationTimestamp))
return []metav1.TableRow{row}, nil return []metav1.TableRow{row}, nil
} }

View File

@ -56,10 +56,6 @@ func (csiDriverStrategy) PrepareForCreate(ctx context.Context, obj runtime.Objec
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) { if !utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
csiDriver.Spec.FSGroupPolicy = nil csiDriver.Spec.FSGroupPolicy = nil
} }
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) {
csiDriver.Spec.TokenRequests = nil
csiDriver.Spec.RequiresRepublish = nil
}
} }
func (csiDriverStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { func (csiDriverStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
@ -100,14 +96,6 @@ func (csiDriverStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.
!utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) { !utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
newCSIDriver.Spec.FSGroupPolicy = nil newCSIDriver.Spec.FSGroupPolicy = nil
} }
if oldCSIDriver.Spec.TokenRequests == nil &&
!utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) {
newCSIDriver.Spec.TokenRequests = nil
}
if oldCSIDriver.Spec.RequiresRepublish == nil &&
!utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) {
newCSIDriver.Spec.RequiresRepublish = nil
}
// Any changes to the mutable fields increment the generation number. // Any changes to the mutable fields increment the generation number.
if !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.TokenRequests, newCSIDriver.Spec.TokenRequests) || !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.RequiresRepublish, newCSIDriver.Spec.RequiresRepublish) { if !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.TokenRequests, newCSIDriver.Spec.TokenRequests) || !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.RequiresRepublish, newCSIDriver.Spec.RequiresRepublish) {

View File

@ -92,10 +92,9 @@ func TestCSIDriverPrepareForCreate(t *testing.T) {
requiresRepublish := true requiresRepublish := true
tests := []struct { tests := []struct {
name string name string
withCapacity bool withCapacity bool
withInline bool withInline bool
withServiceAccountToken bool
}{ }{
{ {
name: "inline enabled", name: "inline enabled",
@ -113,21 +112,12 @@ func TestCSIDriverPrepareForCreate(t *testing.T) {
name: "capacity disabled", name: "capacity disabled",
withCapacity: false, withCapacity: false,
}, },
{
name: "serviceAccountToken enabled",
withServiceAccountToken: true,
},
{
name: "serviceAccountToken disabled",
withServiceAccountToken: false,
},
} }
for _, test := range tests { for _, test := range tests {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIStorageCapacity, test.withCapacity)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIStorageCapacity, test.withCapacity)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, test.withInline)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, test.withInline)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIServiceAccountToken, test.withServiceAccountToken)()
csiDriver := &storage.CSIDriver{ csiDriver := &storage.CSIDriver{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
@ -167,21 +157,6 @@ func TestCSIDriverPrepareForCreate(t *testing.T) {
t.Errorf("VolumeLifecycleModes not stripped: %v", csiDriver.Spec) t.Errorf("VolumeLifecycleModes not stripped: %v", csiDriver.Spec)
} }
} }
if test.withServiceAccountToken {
if csiDriver.Spec.TokenRequests == nil {
t.Errorf("TokenRequests modified: %v", csiDriver.Spec)
}
if csiDriver.Spec.RequiresRepublish == nil {
t.Errorf("RequiresRepublish modified: %v", csiDriver.Spec)
}
} else {
if csiDriver.Spec.TokenRequests != nil {
t.Errorf("TokenRequests stripped: %v", csiDriver.Spec)
}
if csiDriver.Spec.RequiresRepublish != nil {
t.Errorf("RequiresRepublish stripped: %v", csiDriver.Spec)
}
}
}) })
} }
} }
@ -227,7 +202,6 @@ func TestCSIDriverPrepareForUpdate(t *testing.T) {
enabled := true enabled := true
disabled := false disabled := false
gcp := "gcp" gcp := "gcp"
vault := "vault"
driverWithCapacityEnabled := &storage.CSIDriver{ driverWithCapacityEnabled := &storage.CSIDriver{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
@ -253,29 +227,19 @@ func TestCSIDriverPrepareForUpdate(t *testing.T) {
RequiresRepublish: &enabled, RequiresRepublish: &enabled,
}, },
} }
driverWithServiceAccountTokenVault := &storage.CSIDriver{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
},
Spec: storage.CSIDriverSpec{
TokenRequests: []storage.TokenRequest{{Audience: vault}},
RequiresRepublish: &enabled,
},
}
resultPersistent := []storage.VolumeLifecycleMode{storage.VolumeLifecyclePersistent} resultPersistent := []storage.VolumeLifecycleMode{storage.VolumeLifecyclePersistent}
tests := []struct { tests := []struct {
name string name string
old, update *storage.CSIDriver old, update *storage.CSIDriver
csiStorageCapacityEnabled bool csiStorageCapacityEnabled bool
csiInlineVolumeEnabled bool csiInlineVolumeEnabled bool
csiServiceAccountTokenEnabled bool wantCapacity *bool
wantCapacity *bool wantModes []storage.VolumeLifecycleMode
wantModes []storage.VolumeLifecycleMode wantTokenRequests []storage.TokenRequest
wantTokenRequests []storage.TokenRequest wantRequiresRepublish *bool
wantRequiresRepublish *bool wantGeneration int64
wantGeneration int64
}{ }{
{ {
name: "capacity feature enabled, before: none, update: enabled", name: "capacity feature enabled, before: none, update: enabled",
@ -316,25 +280,9 @@ func TestCSIDriverPrepareForUpdate(t *testing.T) {
wantModes: resultPersistent, wantModes: resultPersistent,
}, },
{ {
name: "service account token feature enabled, before: none, update: audience=gcp", name: "service account token feature enabled, before: none, update: audience=gcp",
csiServiceAccountTokenEnabled: true,
old: driverWithNothing,
update: driverWithServiceAccountTokenGCP,
wantTokenRequests: []storage.TokenRequest{{Audience: gcp}},
wantRequiresRepublish: &enabled,
wantGeneration: 1,
},
{
name: "service account token feature disabled, before: none, update: audience=gcp",
old: driverWithNothing, old: driverWithNothing,
update: driverWithServiceAccountTokenGCP, update: driverWithServiceAccountTokenGCP,
wantTokenRequests: nil,
wantRequiresRepublish: nil,
},
{
name: "service account token feature disabled, before: audience=vault, update: audience=gcp",
old: driverWithServiceAccountTokenVault,
update: driverWithServiceAccountTokenGCP,
wantTokenRequests: []storage.TokenRequest{{Audience: gcp}}, wantTokenRequests: []storage.TokenRequest{{Audience: gcp}},
wantRequiresRepublish: &enabled, wantRequiresRepublish: &enabled,
wantGeneration: 1, wantGeneration: 1,
@ -345,7 +293,6 @@ func TestCSIDriverPrepareForUpdate(t *testing.T) {
t.Run(test.name, func(t *testing.T) { t.Run(test.name, func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIStorageCapacity, test.csiStorageCapacityEnabled)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIStorageCapacity, test.csiStorageCapacityEnabled)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, test.csiInlineVolumeEnabled)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, test.csiInlineVolumeEnabled)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIServiceAccountToken, test.csiServiceAccountTokenEnabled)()
csiDriver := test.update.DeepCopy() csiDriver := test.update.DeepCopy()
Strategy.PrepareForUpdate(ctx, csiDriver, test.old) Strategy.PrepareForUpdate(ctx, csiDriver, test.old)

View File

@ -229,13 +229,11 @@ func (c *csiMountMgr) SetUpAt(dir string, mounterArgs volume.MounterArgs) error
} }
// Inject pod service account token into volume attributes // Inject pod service account token into volume attributes
if utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) { serviceAccountTokenAttrs, err := c.podServiceAccountTokenAttrs()
serviceAccountTokenAttrs, err := c.podServiceAccountTokenAttrs() if err != nil {
if err != nil { return volumetypes.NewTransientOperationFailure(log("mounter.SetUpAt failed to get service accoount token attributes: %v", err))
return volumetypes.NewTransientOperationFailure(log("mounter.SetUpAt failed to get service accoount token attributes: %v", err))
}
volAttribs = mergeMap(volAttribs, serviceAccountTokenAttrs)
} }
volAttribs = mergeMap(volAttribs, serviceAccountTokenAttrs)
err = csi.NodePublishVolume( err = csi.NodePublishVolume(
ctx, ctx,

View File

@ -938,7 +938,6 @@ func TestIsCorruptedDir(t *testing.T) {
} }
func TestPodServiceAccountTokenAttrs(t *testing.T) { func TestPodServiceAccountTokenAttrs(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIServiceAccountToken, true)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIInlineVolume, true)()
scheme := runtime.NewScheme() scheme := runtime.NewScheme()
utilruntime.Must(pkgauthenticationv1.RegisterDefaults(scheme)) utilruntime.Must(pkgauthenticationv1.RegisterDefaults(scheme))

View File

@ -339,9 +339,6 @@ func (p *csiPlugin) CanSupport(spec *volume.Spec) bool {
} }
func (p *csiPlugin) RequiresRemount(spec *volume.Spec) bool { func (p *csiPlugin) RequiresRemount(spec *volume.Spec) bool {
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIServiceAccountToken) {
return false
}
if p.csiDriverLister == nil { if p.csiDriverLister == nil {
return false return false
} }

View File

@ -182,9 +182,6 @@ message CSIDriverSpec {
// most one token is empty string. To receive a new token after expiry, // most one token is empty string. To receive a new token after expiry,
// RequiresRepublish can be used to trigger NodePublishVolume periodically. // RequiresRepublish can be used to trigger NodePublishVolume periodically.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
// +listType=atomic // +listType=atomic
repeated TokenRequest tokenRequests = 6; repeated TokenRequest tokenRequests = 6;
@ -197,9 +194,6 @@ message CSIDriverSpec {
// to NodePublishVolume should only update the contents of the volume. New // to NodePublishVolume should only update the contents of the volume. New
// mount points will not be seen by a running container. // mount points will not be seen by a running container.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
optional bool requiresRepublish = 7; optional bool requiresRepublish = 7;
} }

View File

@ -381,9 +381,6 @@ type CSIDriverSpec struct {
// most one token is empty string. To receive a new token after expiry, // most one token is empty string. To receive a new token after expiry,
// RequiresRepublish can be used to trigger NodePublishVolume periodically. // RequiresRepublish can be used to trigger NodePublishVolume periodically.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
// +listType=atomic // +listType=atomic
TokenRequests []TokenRequest `json:"tokenRequests,omitempty" protobuf:"bytes,6,opt,name=tokenRequests"` TokenRequests []TokenRequest `json:"tokenRequests,omitempty" protobuf:"bytes,6,opt,name=tokenRequests"`
@ -396,9 +393,6 @@ type CSIDriverSpec struct {
// to NodePublishVolume should only update the contents of the volume. New // to NodePublishVolume should only update the contents of the volume. New
// mount points will not be seen by a running container. // mount points will not be seen by a running container.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
RequiresRepublish *bool `json:"requiresRepublish,omitempty" protobuf:"varint,7,opt,name=requiresRepublish"` RequiresRepublish *bool `json:"requiresRepublish,omitempty" protobuf:"varint,7,opt,name=requiresRepublish"`
} }

View File

@ -54,8 +54,8 @@ var map_CSIDriverSpec = map[string]string{
"volumeLifecycleModes": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta.\n\nThis field is immutable.", "volumeLifecycleModes": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future. This field is beta.\n\nThis field is immutable.",
"storageCapacity": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field is immutable.\n\nThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.", "storageCapacity": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field is immutable.\n\nThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.",
"fsGroupPolicy": "Defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field is beta, and is only honored by servers that enable the CSIVolumeFSGroupPolicy feature gate.\n\nThis field is immutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.", "fsGroupPolicy": "Defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field is beta, and is only honored by servers that enable the CSIVolumeFSGroupPolicy feature gate.\n\nThis field is immutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.",
"tokenRequests": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "tokenRequests": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.",
"requiresRepublish": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "requiresRepublish": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.",
} }
func (CSIDriverSpec) SwaggerDoc() map[string]string { func (CSIDriverSpec) SwaggerDoc() map[string]string {

View File

@ -184,9 +184,6 @@ message CSIDriverSpec {
// most one token is empty string. To receive a new token after expiry, // most one token is empty string. To receive a new token after expiry,
// RequiresRepublish can be used to trigger NodePublishVolume periodically. // RequiresRepublish can be used to trigger NodePublishVolume periodically.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
// +listType=atomic // +listType=atomic
repeated TokenRequest tokenRequests = 6; repeated TokenRequest tokenRequests = 6;
@ -199,9 +196,6 @@ message CSIDriverSpec {
// to NodePublishVolume should only update the contents of the volume. New // to NodePublishVolume should only update the contents of the volume. New
// mount points will not be seen by a running container. // mount points will not be seen by a running container.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
optional bool requiresRepublish = 7; optional bool requiresRepublish = 7;
} }

View File

@ -402,9 +402,6 @@ type CSIDriverSpec struct {
// most one token is empty string. To receive a new token after expiry, // most one token is empty string. To receive a new token after expiry,
// RequiresRepublish can be used to trigger NodePublishVolume periodically. // RequiresRepublish can be used to trigger NodePublishVolume periodically.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
// +listType=atomic // +listType=atomic
TokenRequests []TokenRequest `json:"tokenRequests,omitempty" protobuf:"bytes,6,opt,name=tokenRequests"` TokenRequests []TokenRequest `json:"tokenRequests,omitempty" protobuf:"bytes,6,opt,name=tokenRequests"`
@ -417,9 +414,6 @@ type CSIDriverSpec struct {
// to NodePublishVolume should only update the contents of the volume. New // to NodePublishVolume should only update the contents of the volume. New
// mount points will not be seen by a running container. // mount points will not be seen by a running container.
// //
// This is a beta feature and only available when the
// CSIServiceAccountToken feature is enabled.
//
// +optional // +optional
RequiresRepublish *bool `json:"requiresRepublish,omitempty" protobuf:"varint,7,opt,name=requiresRepublish"` RequiresRepublish *bool `json:"requiresRepublish,omitempty" protobuf:"varint,7,opt,name=requiresRepublish"`
} }

View File

@ -54,8 +54,8 @@ var map_CSIDriverSpec = map[string]string{
"volumeLifecycleModes": "VolumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.\n\nThis field is immutable.", "volumeLifecycleModes": "VolumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism. The other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume. For more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.\n\nThis field is immutable.",
"storageCapacity": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field is immutable.\n\nThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.", "storageCapacity": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field is immutable.\n\nThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.",
"fsGroupPolicy": "Defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field is beta, and is only honored by servers that enable the CSIVolumeFSGroupPolicy feature gate.\n\nThis field is immutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.", "fsGroupPolicy": "Defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details. This field is beta, and is only honored by servers that enable the CSIVolumeFSGroupPolicy feature gate.\n\nThis field is immutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.",
"tokenRequests": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "tokenRequests": "TokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.",
"requiresRepublish": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.\n\nThis is a beta feature and only available when the CSIServiceAccountToken feature is enabled.", "requiresRepublish": "RequiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.",
} }
func (CSIDriverSpec) SwaggerDoc() map[string]string { func (CSIDriverSpec) SwaggerDoc() map[string]string {