diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json
index e93aae3fdde..cad4c42c2f0 100644
--- a/api/openapi-spec/swagger.json
+++ b/api/openapi-spec/swagger.json
@@ -80871,6 +80871,10 @@
"reclaimPolicy": {
"description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
"type": "string"
+ },
+ "volumeBindingMode": {
+ "description": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature.",
+ "type": "string"
}
},
"x-kubernetes-group-version-kind": [
@@ -81098,6 +81102,10 @@
"reclaimPolicy": {
"description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
"type": "string"
+ },
+ "volumeBindingMode": {
+ "description": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature.",
+ "type": "string"
}
},
"x-kubernetes-group-version-kind": [
diff --git a/api/swagger-spec/storage.k8s.io_v1.json b/api/swagger-spec/storage.k8s.io_v1.json
index 17fd1fa5ec1..5757f49f5c9 100644
--- a/api/swagger-spec/storage.k8s.io_v1.json
+++ b/api/swagger-spec/storage.k8s.io_v1.json
@@ -814,6 +814,10 @@
"allowVolumeExpansion": {
"type": "boolean",
"description": "AllowVolumeExpansion shows whether the storage class allow volume expand"
+ },
+ "volumeBindingMode": {
+ "$ref": "v1.VolumeBindingMode",
+ "description": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature."
}
}
},
@@ -1059,6 +1063,10 @@
"id": "v1.PersistentVolumeReclaimPolicy",
"properties": {}
},
+ "v1.VolumeBindingMode": {
+ "id": "v1.VolumeBindingMode",
+ "properties": {}
+ },
"v1.WatchEvent": {
"id": "v1.WatchEvent",
"required": [
diff --git a/api/swagger-spec/storage.k8s.io_v1beta1.json b/api/swagger-spec/storage.k8s.io_v1beta1.json
index 552e6ea63b4..21af56a87bb 100644
--- a/api/swagger-spec/storage.k8s.io_v1beta1.json
+++ b/api/swagger-spec/storage.k8s.io_v1beta1.json
@@ -814,6 +814,10 @@
"allowVolumeExpansion": {
"type": "boolean",
"description": "AllowVolumeExpansion shows whether the storage class allow volume expand"
+ },
+ "volumeBindingMode": {
+ "$ref": "v1beta1.VolumeBindingMode",
+ "description": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature."
}
}
},
@@ -1059,6 +1063,10 @@
"id": "v1.PersistentVolumeReclaimPolicy",
"properties": {}
},
+ "v1beta1.VolumeBindingMode": {
+ "id": "v1beta1.VolumeBindingMode",
+ "properties": {}
+ },
"v1.WatchEvent": {
"id": "v1.WatchEvent",
"required": [
diff --git a/docs/api-reference/storage.k8s.io/v1/definitions.html b/docs/api-reference/storage.k8s.io/v1/definitions.html
index 9ec5ddddff9..a8b980f1f74 100755
--- a/docs/api-reference/storage.k8s.io/v1/definitions.html
+++ b/docs/api-reference/storage.k8s.io/v1/definitions.html
@@ -996,6 +996,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
any
diff --git a/docs/api-reference/storage.k8s.io/v1beta1/definitions.html b/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
index 854ed1b64a8..57732f5aa64 100755
--- a/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
+++ b/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
@@ -958,6 +958,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
boolean |
false |
+
+volumeBindingMode |
+VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature. |
+false |
+v1beta1.VolumeBindingMode |
+ |
+
@@ -1227,6 +1234,10 @@ When an object is created, the system will populate this list with the current s
v1.PersistentVolumeReclaimPolicy
+
+
+
v1beta1.VolumeBindingMode
+
v1.APIResource
diff --git a/hack/.golint_failures b/hack/.golint_failures
index 64049a4ef4c..8014e1ea08d 100644
--- a/hack/.golint_failures
+++ b/hack/.golint_failures
@@ -71,10 +71,8 @@ pkg/apis/settings
pkg/apis/settings/v1alpha1
pkg/apis/storage
pkg/apis/storage/util
-pkg/apis/storage/v1
pkg/apis/storage/v1/util
pkg/apis/storage/v1alpha1
-pkg/apis/storage/v1beta1
pkg/apis/storage/v1beta1/util
pkg/auth/authorizer/abac
pkg/capabilities
diff --git a/pkg/apis/storage/types.go b/pkg/apis/storage/types.go
index 5a9024a70f9..e44b327d381 100644
--- a/pkg/apis/storage/types.go
+++ b/pkg/apis/storage/types.go
@@ -65,6 +65,13 @@ type StorageClass struct {
// for all PVs created from this storageclass.
// +optional
AllowVolumeExpansion *bool
+
+ // VolumeBindingMode indicates how PersistentVolumeClaims should be
+ // provisioned and bound. When unset, VolumeBindingImmediate is used.
+ // This field is alpha-level and is only honored by servers that enable
+ // the VolumeScheduling feature.
+ // +optional
+ VolumeBindingMode *VolumeBindingMode
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -187,3 +194,18 @@ type VolumeError struct {
// +optional
Message string
}
+
+// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
+type VolumeBindingMode string
+
+const (
+ // VolumeBindingImmediate indicates that PersistentVolumeClaims should be
+ // immediately provisioned and bound.
+ VolumeBindingImmediate VolumeBindingMode = "Immediate"
+
+ // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
+ // should not be provisioned and bound until the first Pod is created that
+ // references the PeristentVolumeClaim. The volume provisioning and
+ // binding will occur during Pod scheduing.
+ VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
+)
diff --git a/pkg/apis/storage/util/BUILD b/pkg/apis/storage/util/BUILD
index 297c1df9b02..490e8372149 100644
--- a/pkg/apis/storage/util/BUILD
+++ b/pkg/apis/storage/util/BUILD
@@ -3,13 +3,22 @@ package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
+ "go_test",
)
go_library(
name = "go_default_library",
- srcs = ["helpers.go"],
+ srcs = [
+ "helpers.go",
+ "util.go",
+ ],
importpath = "k8s.io/kubernetes/pkg/apis/storage/util",
- deps = ["//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library"],
+ deps = [
+ "//pkg/apis/storage:go_default_library",
+ "//pkg/features:go_default_library",
+ "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
+ ],
)
filegroup(
@@ -24,3 +33,14 @@ filegroup(
srcs = [":package-srcs"],
tags = ["automanaged"],
)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["util_test.go"],
+ importpath = "k8s.io/kubernetes/pkg/apis/storage/util",
+ library = ":go_default_library",
+ deps = [
+ "//pkg/apis/storage:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
+ ],
+)
diff --git a/pkg/apis/storage/util/util.go b/pkg/apis/storage/util/util.go
new file mode 100644
index 00000000000..9d134043563
--- /dev/null
+++ b/pkg/apis/storage/util/util.go
@@ -0,0 +1,30 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package util
+
+import (
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/apis/storage"
+ "k8s.io/kubernetes/pkg/features"
+)
+
+// DropDisabledAlphaFields removes disabled fields from the StorageClass object.
+func DropDisabledAlphaFields(class *storage.StorageClass) {
+ if !utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
+ class.VolumeBindingMode = nil
+ }
+}
diff --git a/pkg/apis/storage/util/util_test.go b/pkg/apis/storage/util/util_test.go
new file mode 100644
index 00000000000..d75b2455865
--- /dev/null
+++ b/pkg/apis/storage/util/util_test.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package util
+
+import (
+ "testing"
+
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/apis/storage"
+)
+
+func TestDropAlphaFields(t *testing.T) {
+ bindingMode := storage.VolumeBindingWaitForFirstConsumer
+
+ // Test that field gets dropped when feature gate is not set
+ class := &storage.StorageClass{
+ VolumeBindingMode: &bindingMode,
+ }
+ DropDisabledAlphaFields(class)
+ if class.VolumeBindingMode != nil {
+ t.Errorf("VolumeBindingMode field didn't get dropped: %+v", class.VolumeBindingMode)
+ }
+
+ // Test that field does not get dropped when feature gate is set
+ class = &storage.StorageClass{
+ VolumeBindingMode: &bindingMode,
+ }
+ if err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=true"); err != nil {
+ t.Fatalf("Failed to set feature gate for VolumeScheduling: %v", err)
+ }
+ DropDisabledAlphaFields(class)
+ if class.VolumeBindingMode != &bindingMode {
+ t.Errorf("VolumeBindingMode field got unexpectantly modified: %+v", class.VolumeBindingMode)
+ }
+ if err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=false"); err != nil {
+ t.Fatalf("Failed to disable feature gate for VolumeScheduling: %v", err)
+ }
+}
diff --git a/pkg/apis/storage/v1/BUILD b/pkg/apis/storage/v1/BUILD
index e9ce505c90f..aeb7e17d2a7 100644
--- a/pkg/apis/storage/v1/BUILD
+++ b/pkg/apis/storage/v1/BUILD
@@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
+ "go_test",
)
go_library(
@@ -18,11 +19,13 @@ go_library(
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/storage:go_default_library",
+ "//pkg/features:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/api/storage/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
],
)
@@ -41,3 +44,16 @@ filegroup(
],
tags = ["automanaged"],
)
+
+go_test(
+ name = "go_default_xtest",
+ srcs = ["defaults_test.go"],
+ importpath = "k8s.io/kubernetes/pkg/apis/storage/v1_test",
+ deps = [
+ "//pkg/api/legacyscheme:go_default_library",
+ "//pkg/apis/storage/install:go_default_library",
+ "//vendor/k8s.io/api/storage/v1:go_default_library",
+ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
+ ],
+)
diff --git a/pkg/apis/storage/v1/defaults.go b/pkg/apis/storage/v1/defaults.go
index 2e7c51c632e..6f574f4867c 100644
--- a/pkg/apis/storage/v1/defaults.go
+++ b/pkg/apis/storage/v1/defaults.go
@@ -20,6 +20,8 @@ import (
"k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/runtime"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/features"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
@@ -31,4 +33,9 @@ func SetDefaults_StorageClass(obj *storagev1.StorageClass) {
obj.ReclaimPolicy = new(v1.PersistentVolumeReclaimPolicy)
*obj.ReclaimPolicy = v1.PersistentVolumeReclaimDelete
}
+
+ if obj.VolumeBindingMode == nil && utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
+ obj.VolumeBindingMode = new(storagev1.VolumeBindingMode)
+ *obj.VolumeBindingMode = storagev1.VolumeBindingImmediate
+ }
}
diff --git a/pkg/apis/storage/v1/defaults_test.go b/pkg/apis/storage/v1/defaults_test.go
new file mode 100644
index 00000000000..4fb6304f773
--- /dev/null
+++ b/pkg/apis/storage/v1/defaults_test.go
@@ -0,0 +1,81 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1_test
+
+import (
+ "reflect"
+ "testing"
+
+ storagev1 "k8s.io/api/storage/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/api/legacyscheme"
+ _ "k8s.io/kubernetes/pkg/apis/storage/install"
+)
+
+func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
+ codec := legacyscheme.Codecs.LegacyCodec(storagev1.SchemeGroupVersion)
+ data, err := runtime.Encode(codec, obj)
+ if err != nil {
+ t.Errorf("%v\n %#v", err, obj)
+ return nil
+ }
+ obj2, err := runtime.Decode(codec, data)
+ if err != nil {
+ t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
+ return nil
+ }
+ obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object)
+ err = legacyscheme.Scheme.Convert(obj2, obj3, nil)
+ if err != nil {
+ t.Errorf("%v\nSource: %#v", err, obj2)
+ return nil
+ }
+ return obj3
+}
+
+func TestSetDefaultVolumeBindingMode(t *testing.T) {
+ class := &storagev1.StorageClass{}
+
+ // When feature gate is disabled, field should not be defaulted
+ output := roundTrip(t, runtime.Object(class)).(*storagev1.StorageClass)
+ if output.VolumeBindingMode != nil {
+ t.Errorf("Expected VolumeBindingMode to not be defaulted, got: %+v", output.VolumeBindingMode)
+ }
+
+ class = &storagev1.StorageClass{}
+
+ err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=true")
+ if err != nil {
+ t.Fatalf("Failed to enable feature gate for VolumeScheduling: %v", err)
+ }
+
+ // When feature gate is enabled, field should be defaulted
+ defaultMode := storagev1.VolumeBindingImmediate
+ output = roundTrip(t, runtime.Object(class)).(*storagev1.StorageClass)
+ outMode := output.VolumeBindingMode
+ if outMode == nil {
+ t.Errorf("Expected VolumeBindingMode to be defaulted to: %+v, got: nil", defaultMode)
+ } else if *outMode != defaultMode {
+ t.Errorf("Expected VolumeBindingMode to be defaulted to: %+v, got: %+v", defaultMode, outMode)
+ }
+
+ err = utilfeature.DefaultFeatureGate.Set("VolumeScheduling=false")
+ if err != nil {
+ t.Fatalf("Failed to disable feature gate for VolumeScheduling: %v", err)
+ }
+}
diff --git a/pkg/apis/storage/v1/util/helpers.go b/pkg/apis/storage/v1/util/helpers.go
index 62c27ccfc19..d0d5ad7ba99 100644
--- a/pkg/apis/storage/v1/util/helpers.go
+++ b/pkg/apis/storage/v1/util/helpers.go
@@ -16,7 +16,9 @@ limitations under the License.
package util
-import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
// IsDefaultStorageClassAnnotation represents a StorageClass annotation that
// marks a class as the default StorageClass
diff --git a/pkg/apis/storage/v1/zz_generated.conversion.go b/pkg/apis/storage/v1/zz_generated.conversion.go
index 94e78e305f1..1e63af36e67 100644
--- a/pkg/apis/storage/v1/zz_generated.conversion.go
+++ b/pkg/apis/storage/v1/zz_generated.conversion.go
@@ -52,6 +52,7 @@ func autoConvert_v1_StorageClass_To_storage_StorageClass(in *v1.StorageClass, ou
out.ReclaimPolicy = (*core.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
out.MountOptions = *(*[]string)(unsafe.Pointer(&in.MountOptions))
out.AllowVolumeExpansion = (*bool)(unsafe.Pointer(in.AllowVolumeExpansion))
+ out.VolumeBindingMode = (*storage.VolumeBindingMode)(unsafe.Pointer(in.VolumeBindingMode))
return nil
}
@@ -67,6 +68,7 @@ func autoConvert_storage_StorageClass_To_v1_StorageClass(in *storage.StorageClas
out.ReclaimPolicy = (*core_v1.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
out.MountOptions = *(*[]string)(unsafe.Pointer(&in.MountOptions))
out.AllowVolumeExpansion = (*bool)(unsafe.Pointer(in.AllowVolumeExpansion))
+ out.VolumeBindingMode = (*v1.VolumeBindingMode)(unsafe.Pointer(in.VolumeBindingMode))
return nil
}
diff --git a/pkg/apis/storage/v1beta1/BUILD b/pkg/apis/storage/v1beta1/BUILD
index b734d4d6d0d..368302812eb 100644
--- a/pkg/apis/storage/v1beta1/BUILD
+++ b/pkg/apis/storage/v1beta1/BUILD
@@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
+ "go_test",
)
go_library(
@@ -18,11 +19,13 @@ go_library(
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/storage:go_default_library",
+ "//pkg/features:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/api/storage/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
],
)
@@ -41,3 +44,16 @@ filegroup(
],
tags = ["automanaged"],
)
+
+go_test(
+ name = "go_default_xtest",
+ srcs = ["defaults_test.go"],
+ importpath = "k8s.io/kubernetes/pkg/apis/storage/v1beta1_test",
+ deps = [
+ "//pkg/api/legacyscheme:go_default_library",
+ "//pkg/apis/storage/install:go_default_library",
+ "//vendor/k8s.io/api/storage/v1beta1:go_default_library",
+ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
+ "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library",
+ ],
+)
diff --git a/pkg/apis/storage/v1beta1/defaults.go b/pkg/apis/storage/v1beta1/defaults.go
index e50599bf273..97dbff2f378 100644
--- a/pkg/apis/storage/v1beta1/defaults.go
+++ b/pkg/apis/storage/v1beta1/defaults.go
@@ -20,6 +20,8 @@ import (
"k8s.io/api/core/v1"
storagev1beta1 "k8s.io/api/storage/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/features"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
@@ -31,4 +33,9 @@ func SetDefaults_StorageClass(obj *storagev1beta1.StorageClass) {
obj.ReclaimPolicy = new(v1.PersistentVolumeReclaimPolicy)
*obj.ReclaimPolicy = v1.PersistentVolumeReclaimDelete
}
+
+ if obj.VolumeBindingMode == nil && utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
+ obj.VolumeBindingMode = new(storagev1beta1.VolumeBindingMode)
+ *obj.VolumeBindingMode = storagev1beta1.VolumeBindingImmediate
+ }
}
diff --git a/pkg/apis/storage/v1beta1/defaults_test.go b/pkg/apis/storage/v1beta1/defaults_test.go
new file mode 100644
index 00000000000..34aff74b8e0
--- /dev/null
+++ b/pkg/apis/storage/v1beta1/defaults_test.go
@@ -0,0 +1,81 @@
+/*
+Copyright 2017 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package v1beta1_test
+
+import (
+ "reflect"
+ "testing"
+
+ storagev1beta1 "k8s.io/api/storage/v1beta1"
+ "k8s.io/apimachinery/pkg/runtime"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
+ "k8s.io/kubernetes/pkg/api/legacyscheme"
+ _ "k8s.io/kubernetes/pkg/apis/storage/install"
+)
+
+func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
+ codec := legacyscheme.Codecs.LegacyCodec(storagev1beta1.SchemeGroupVersion)
+ data, err := runtime.Encode(codec, obj)
+ if err != nil {
+ t.Errorf("%v\n %#v", err, obj)
+ return nil
+ }
+ obj2, err := runtime.Decode(codec, data)
+ if err != nil {
+ t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
+ return nil
+ }
+ obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object)
+ err = legacyscheme.Scheme.Convert(obj2, obj3, nil)
+ if err != nil {
+ t.Errorf("%v\nSource: %#v", err, obj2)
+ return nil
+ }
+ return obj3
+}
+
+func TestSetDefaultVolumeBindingMode(t *testing.T) {
+ class := &storagev1beta1.StorageClass{}
+
+ // When feature gate is disabled, field should not be defaulted
+ output := roundTrip(t, runtime.Object(class)).(*storagev1beta1.StorageClass)
+ if output.VolumeBindingMode != nil {
+ t.Errorf("Expected VolumeBindingMode to not be defaulted, got: %+v", output.VolumeBindingMode)
+ }
+
+ class = &storagev1beta1.StorageClass{}
+
+ err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=true")
+ if err != nil {
+ t.Fatalf("Failed to enable feature gate for VolumeScheduling: %v", err)
+ }
+
+ // When feature gate is enabled, field should be defaulted
+ defaultMode := storagev1beta1.VolumeBindingImmediate
+ output = roundTrip(t, runtime.Object(class)).(*storagev1beta1.StorageClass)
+ outMode := output.VolumeBindingMode
+ if outMode == nil {
+ t.Errorf("Expected VolumeBindingMode to be defaulted to: %+v, got: nil", defaultMode)
+ } else if *outMode != defaultMode {
+ t.Errorf("Expected VolumeBindingMode to be defaulted to: %+v, got: %+v", defaultMode, outMode)
+ }
+
+ err = utilfeature.DefaultFeatureGate.Set("VolumeScheduling=false")
+ if err != nil {
+ t.Fatalf("Failed to disable feature gate for VolumeScheduling: %v", err)
+ }
+}
diff --git a/pkg/apis/storage/v1beta1/zz_generated.conversion.go b/pkg/apis/storage/v1beta1/zz_generated.conversion.go
index 98f3da43beb..9637b2ea494 100644
--- a/pkg/apis/storage/v1beta1/zz_generated.conversion.go
+++ b/pkg/apis/storage/v1beta1/zz_generated.conversion.go
@@ -52,6 +52,7 @@ func autoConvert_v1beta1_StorageClass_To_storage_StorageClass(in *v1beta1.Storag
out.ReclaimPolicy = (*core.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
out.MountOptions = *(*[]string)(unsafe.Pointer(&in.MountOptions))
out.AllowVolumeExpansion = (*bool)(unsafe.Pointer(in.AllowVolumeExpansion))
+ out.VolumeBindingMode = (*storage.VolumeBindingMode)(unsafe.Pointer(in.VolumeBindingMode))
return nil
}
@@ -67,6 +68,7 @@ func autoConvert_storage_StorageClass_To_v1beta1_StorageClass(in *storage.Storag
out.ReclaimPolicy = (*v1.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
out.MountOptions = *(*[]string)(unsafe.Pointer(&in.MountOptions))
out.AllowVolumeExpansion = (*bool)(unsafe.Pointer(in.AllowVolumeExpansion))
+ out.VolumeBindingMode = (*v1beta1.VolumeBindingMode)(unsafe.Pointer(in.VolumeBindingMode))
return nil
}
diff --git a/pkg/apis/storage/validation/validation.go b/pkg/apis/storage/validation/validation.go
index 4ffc7108808..e9f66e938e8 100644
--- a/pkg/apis/storage/validation/validation.go
+++ b/pkg/apis/storage/validation/validation.go
@@ -46,6 +46,7 @@ func ValidateStorageClass(storageClass *storage.StorageClass) field.ErrorList {
allErrs = append(allErrs, validateParameters(storageClass.Parameters, field.NewPath("parameters"))...)
allErrs = append(allErrs, validateReclaimPolicy(storageClass.ReclaimPolicy, field.NewPath("reclaimPolicy"))...)
allErrs = append(allErrs, validateAllowVolumeExpansion(storageClass.AllowVolumeExpansion, field.NewPath("allowVolumeExpansion"))...)
+ allErrs = append(allErrs, validateVolumeBindingMode(storageClass.VolumeBindingMode, field.NewPath("volumeBindingMode"))...)
return allErrs
}
@@ -64,6 +65,8 @@ func ValidateStorageClassUpdate(storageClass, oldStorageClass *storage.StorageCl
if *storageClass.ReclaimPolicy != *oldStorageClass.ReclaimPolicy {
allErrs = append(allErrs, field.Forbidden(field.NewPath("reclaimPolicy"), "updates to reclaimPolicy are forbidden."))
}
+
+ allErrs = append(allErrs, apivalidation.ValidateImmutableField(storageClass.VolumeBindingMode, oldStorageClass.VolumeBindingMode, field.NewPath("volumeBindingMode"))...)
return allErrs
}
@@ -218,3 +221,21 @@ func ValidateVolumeAttachmentUpdate(new, old *storage.VolumeAttachment) field.Er
}
return allErrs
}
+
+var supportedVolumeBindingModes = sets.NewString(string(storage.VolumeBindingImmediate), string(storage.VolumeBindingWaitForFirstConsumer))
+
+// validateVolumeBindingMode tests that VolumeBindingMode specifies valid values.
+func validateVolumeBindingMode(mode *storage.VolumeBindingMode, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if utilfeature.DefaultFeatureGate.Enabled(features.VolumeScheduling) {
+ if mode == nil {
+ allErrs = append(allErrs, field.Required(fldPath, ""))
+ } else if !supportedVolumeBindingModes.Has(string(*mode)) {
+ allErrs = append(allErrs, field.NotSupported(fldPath, mode, supportedVolumeBindingModes.List()))
+ }
+ } else if mode != nil {
+ allErrs = append(allErrs, field.Forbidden(fldPath, "field is disabled by feature-gate VolumeScheduling"))
+ }
+
+ return allErrs
+}
diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go
index 1c0542a787e..2cb0a61a414 100644
--- a/pkg/apis/storage/validation/validation_test.go
+++ b/pkg/apis/storage/validation/validation_test.go
@@ -27,6 +27,14 @@ import (
"k8s.io/kubernetes/pkg/apis/storage"
)
+var (
+ deleteReclaimPolicy = api.PersistentVolumeReclaimDelete
+ immediateMode1 = storage.VolumeBindingImmediate
+ immediateMode2 = storage.VolumeBindingImmediate
+ waitingMode = storage.VolumeBindingWaitForFirstConsumer
+ invalidMode = storage.VolumeBindingMode("foo")
+)
+
func TestValidateStorageClass(t *testing.T) {
deleteReclaimPolicy := api.PersistentVolumeReclaimPolicy("Delete")
retainReclaimPolicy := api.PersistentVolumeReclaimPolicy("Retain")
@@ -436,3 +444,141 @@ func TestVolumeAttachmentUpdateValidation(t *testing.T) {
}
}
}
+
+func makeClassWithBinding(mode *storage.VolumeBindingMode) *storage.StorageClass {
+ return &storage.StorageClass{
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", ResourceVersion: "foo"},
+ Provisioner: "kubernetes.io/foo-provisioner",
+ ReclaimPolicy: &deleteReclaimPolicy,
+ VolumeBindingMode: mode,
+ }
+}
+
+// TODO: Remove these tests once feature gate is not required
+func TestValidateVolumeBindingModeAlphaDisabled(t *testing.T) {
+ errorCases := map[string]*storage.StorageClass{
+ "immediate mode": makeClassWithBinding(&immediateMode1),
+ "waiting mode": makeClassWithBinding(&waitingMode),
+ "invalid mode": makeClassWithBinding(&invalidMode),
+ }
+
+ for testName, storageClass := range errorCases {
+ if errs := ValidateStorageClass(storageClass); len(errs) == 0 {
+ t.Errorf("Expected failure for test: %v", testName)
+ }
+ }
+}
+
+type bindingTest struct {
+ class *storage.StorageClass
+ shouldSucceed bool
+}
+
+func TestValidateVolumeBindingMode(t *testing.T) {
+ cases := map[string]bindingTest{
+ "no mode": {
+ class: makeClassWithBinding(nil),
+ shouldSucceed: false,
+ },
+ "immediate mode": {
+ class: makeClassWithBinding(&immediateMode1),
+ shouldSucceed: true,
+ },
+ "waiting mode": {
+ class: makeClassWithBinding(&waitingMode),
+ shouldSucceed: true,
+ },
+ "invalid mode": {
+ class: makeClassWithBinding(&invalidMode),
+ shouldSucceed: false,
+ },
+ }
+
+ // TODO: remove when feature gate not required
+ err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=true")
+ if err != nil {
+ t.Fatalf("Failed to enable feature gate for VolumeScheduling: %v", err)
+ }
+
+ for testName, testCase := range cases {
+ errs := ValidateStorageClass(testCase.class)
+ if testCase.shouldSucceed && len(errs) != 0 {
+ t.Errorf("Expected success for test %q, got %v", testName, errs)
+ }
+ if !testCase.shouldSucceed && len(errs) == 0 {
+ t.Errorf("Expected failure for test %q, got success", testName)
+ }
+ }
+
+ err = utilfeature.DefaultFeatureGate.Set("VolumeScheduling=false")
+ if err != nil {
+ t.Fatalf("Failed to disable feature gate for VolumeScheduling: %v", err)
+ }
+}
+
+type updateTest struct {
+ oldClass *storage.StorageClass
+ newClass *storage.StorageClass
+ shouldSucceed bool
+}
+
+func TestValidateUpdateVolumeBindingMode(t *testing.T) {
+ noBinding := makeClassWithBinding(nil)
+ immediateBinding1 := makeClassWithBinding(&immediateMode1)
+ immediateBinding2 := makeClassWithBinding(&immediateMode2)
+ waitBinding := makeClassWithBinding(&waitingMode)
+
+ cases := map[string]updateTest{
+ "old and new no mode": {
+ oldClass: noBinding,
+ newClass: noBinding,
+ shouldSucceed: true,
+ },
+ "old and new same mode ptr": {
+ oldClass: immediateBinding1,
+ newClass: immediateBinding1,
+ shouldSucceed: true,
+ },
+ "old and new same mode value": {
+ oldClass: immediateBinding1,
+ newClass: immediateBinding2,
+ shouldSucceed: true,
+ },
+ "old no mode, new mode": {
+ oldClass: noBinding,
+ newClass: waitBinding,
+ shouldSucceed: false,
+ },
+ "old mode, new no mode": {
+ oldClass: waitBinding,
+ newClass: noBinding,
+ shouldSucceed: false,
+ },
+ "old and new different modes": {
+ oldClass: waitBinding,
+ newClass: immediateBinding1,
+ shouldSucceed: false,
+ },
+ }
+
+ // TODO: remove when feature gate not required
+ err := utilfeature.DefaultFeatureGate.Set("VolumeScheduling=true")
+ if err != nil {
+ t.Fatalf("Failed to enable feature gate for VolumeScheduling: %v", err)
+ }
+
+ for testName, testCase := range cases {
+ errs := ValidateStorageClassUpdate(testCase.newClass, testCase.oldClass)
+ if testCase.shouldSucceed && len(errs) != 0 {
+ t.Errorf("Expected success for %v, got %v", testName, errs)
+ }
+ if !testCase.shouldSucceed && len(errs) == 0 {
+ t.Errorf("Expected failure for %v, got success", testName)
+ }
+ }
+
+ err = utilfeature.DefaultFeatureGate.Set("VolumeScheduling=false")
+ if err != nil {
+ t.Fatalf("Failed to disable feature gate for VolumeScheduling: %v", err)
+ }
+}
diff --git a/pkg/apis/storage/zz_generated.deepcopy.go b/pkg/apis/storage/zz_generated.deepcopy.go
index 61191fa283d..287623fd426 100644
--- a/pkg/apis/storage/zz_generated.deepcopy.go
+++ b/pkg/apis/storage/zz_generated.deepcopy.go
@@ -60,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
**out = **in
}
}
+ if in.VolumeBindingMode != nil {
+ in, out := &in.VolumeBindingMode, &out.VolumeBindingMode
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(VolumeBindingMode)
+ **out = **in
+ }
+ }
return
}
diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go
index 9e6a61274a0..910c7cfdbed 100644
--- a/pkg/features/kube_features.go
+++ b/pkg/features/kube_features.go
@@ -98,7 +98,7 @@ const (
// the API server as the certificate approaches expiration.
RotateKubeletClientCertificate utilfeature.Feature = "RotateKubeletClientCertificate"
- // owner: @msau
+ // owner: @msau42
// alpha: v1.7
//
// A new volume type that supports local disks on a node.
@@ -175,6 +175,12 @@ const (
//
// Enable running mount utilities in containers.
MountContainers utilfeature.Feature = "MountContainers"
+
+ // owner: @msau42
+ // alpha: v1.9
+ //
+ // Extend the default scheduler to be aware of PV topology and handle PV binding
+ VolumeScheduling utilfeature.Feature = "VolumeScheduling"
)
func init() {
@@ -208,6 +214,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
CPUManager: {Default: false, PreRelease: utilfeature.Alpha},
ServiceNodeExclusion: {Default: false, PreRelease: utilfeature.Alpha},
MountContainers: {Default: false, PreRelease: utilfeature.Alpha},
+ VolumeScheduling: {Default: false, PreRelease: utilfeature.Alpha},
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
// unintentionally on either side:
diff --git a/pkg/printers/internalversion/describe.go b/pkg/printers/internalversion/describe.go
index 79295cf21fc..4392e8e7dbb 100644
--- a/pkg/printers/internalversion/describe.go
+++ b/pkg/printers/internalversion/describe.go
@@ -3214,6 +3214,9 @@ func describeStorageClass(sc *storage.StorageClass, events *api.EventList) (stri
if sc.ReclaimPolicy != nil {
w.Write(LEVEL_0, "ReclaimPolicy:\t%s\n", *sc.ReclaimPolicy)
}
+ if sc.VolumeBindingMode != nil {
+ w.Write(LEVEL_0, "VolumeBindingMode:\t%s\n", *sc.VolumeBindingMode)
+ }
if events != nil {
DescribeEvents(events, w)
}
diff --git a/pkg/printers/internalversion/describe_test.go b/pkg/printers/internalversion/describe_test.go
index 962ff3936f6..75030fea5df 100644
--- a/pkg/printers/internalversion/describe_test.go
+++ b/pkg/printers/internalversion/describe_test.go
@@ -943,6 +943,7 @@ func TestDescribeDeployment(t *testing.T) {
func TestDescribeStorageClass(t *testing.T) {
reclaimPolicy := api.PersistentVolumeReclaimRetain
+ bindingMode := storage.VolumeBindingMode("bindingmode")
f := fake.NewSimpleClientset(&storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
@@ -956,14 +957,22 @@ func TestDescribeStorageClass(t *testing.T) {
"param1": "value1",
"param2": "value2",
},
- ReclaimPolicy: &reclaimPolicy,
+ ReclaimPolicy: &reclaimPolicy,
+ VolumeBindingMode: &bindingMode,
})
s := StorageClassDescriber{f}
out, err := s.Describe("", "foo", printers.DescriberSettings{ShowEvents: true})
if err != nil {
t.Errorf("unexpected error: %v", err)
}
- if !strings.Contains(out, "foo") {
+ if !strings.Contains(out, "foo") ||
+ !strings.Contains(out, "my-provisioner") ||
+ !strings.Contains(out, "param1") ||
+ !strings.Contains(out, "param2") ||
+ !strings.Contains(out, "value1") ||
+ !strings.Contains(out, "value2") ||
+ !strings.Contains(out, "Retain") ||
+ !strings.Contains(out, "bindingmode") {
t.Errorf("unexpected out: %s", out)
}
}
diff --git a/pkg/registry/storage/storageclass/BUILD b/pkg/registry/storage/storageclass/BUILD
index 44e2166842b..d8d1d0a375c 100644
--- a/pkg/registry/storage/storageclass/BUILD
+++ b/pkg/registry/storage/storageclass/BUILD
@@ -16,6 +16,7 @@ go_library(
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/storage:go_default_library",
+ "//pkg/apis/storage/util:go_default_library",
"//pkg/apis/storage/validation:go_default_library",
"//pkg/features:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
diff --git a/pkg/registry/storage/storageclass/strategy.go b/pkg/registry/storage/storageclass/strategy.go
index 6ea4fb1250f..b1cbf49ebcf 100644
--- a/pkg/registry/storage/storageclass/strategy.go
+++ b/pkg/registry/storage/storageclass/strategy.go
@@ -24,6 +24,7 @@ import (
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/storage"
+ storageutil "k8s.io/kubernetes/pkg/apis/storage/util"
"k8s.io/kubernetes/pkg/apis/storage/validation"
"k8s.io/kubernetes/pkg/features"
)
@@ -49,6 +50,8 @@ func (storageClassStrategy) PrepareForCreate(ctx genericapirequest.Context, obj
if !utilfeature.DefaultFeatureGate.Enabled(features.ExpandPersistentVolumes) {
class.AllowVolumeExpansion = nil
}
+
+ storageutil.DropDisabledAlphaFields(class)
}
func (storageClassStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
@@ -73,6 +76,8 @@ func (storageClassStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj,
newClass.AllowVolumeExpansion = nil
oldClass.AllowVolumeExpansion = nil
}
+ storageutil.DropDisabledAlphaFields(oldClass)
+ storageutil.DropDisabledAlphaFields(newClass)
}
func (storageClassStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
diff --git a/pkg/registry/storage/storageclass/strategy_test.go b/pkg/registry/storage/storageclass/strategy_test.go
index 1f455e7528c..33842efa775 100644
--- a/pkg/registry/storage/storageclass/strategy_test.go
+++ b/pkg/registry/storage/storageclass/strategy_test.go
@@ -35,6 +35,7 @@ func TestStorageClassStrategy(t *testing.T) {
}
deleteReclaimPolicy := api.PersistentVolumeReclaimDelete
+ bindingMode := storage.VolumeBindingWaitForFirstConsumer
storageClass := &storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "valid-class",
@@ -43,7 +44,8 @@ func TestStorageClassStrategy(t *testing.T) {
Parameters: map[string]string{
"foo": "bar",
},
- ReclaimPolicy: &deleteReclaimPolicy,
+ ReclaimPolicy: &deleteReclaimPolicy,
+ VolumeBindingMode: &bindingMode,
}
Strategy.PrepareForCreate(ctx, storageClass)
@@ -62,7 +64,8 @@ func TestStorageClassStrategy(t *testing.T) {
Parameters: map[string]string{
"foo": "bar",
},
- ReclaimPolicy: &deleteReclaimPolicy,
+ ReclaimPolicy: &deleteReclaimPolicy,
+ VolumeBindingMode: &bindingMode,
}
Strategy.PrepareForUpdate(ctx, newStorageClass, storageClass)
diff --git a/staging/src/k8s.io/api/storage/v1/generated.pb.go b/staging/src/k8s.io/api/storage/v1/generated.pb.go
index 4befedff1ef..7157b72ff28 100644
--- a/staging/src/k8s.io/api/storage/v1/generated.pb.go
+++ b/staging/src/k8s.io/api/storage/v1/generated.pb.go
@@ -146,6 +146,12 @@ func (m *StorageClass) MarshalTo(dAtA []byte) (int, error) {
}
i++
}
+ if m.VolumeBindingMode != nil {
+ dAtA[i] = 0x3a
+ i++
+ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.VolumeBindingMode)))
+ i += copy(dAtA[i:], *m.VolumeBindingMode)
+ }
return i, nil
}
@@ -242,6 +248,10 @@ func (m *StorageClass) Size() (n int) {
if m.AllowVolumeExpansion != nil {
n += 2
}
+ if m.VolumeBindingMode != nil {
+ l = len(*m.VolumeBindingMode)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
return n
}
@@ -293,6 +303,7 @@ func (this *StorageClass) String() string {
`ReclaimPolicy:` + valueToStringGenerated(this.ReclaimPolicy) + `,`,
`MountOptions:` + fmt.Sprintf("%v", this.MountOptions) + `,`,
`AllowVolumeExpansion:` + valueToStringGenerated(this.AllowVolumeExpansion) + `,`,
+ `VolumeBindingMode:` + valueToStringGenerated(this.VolumeBindingMode) + `,`,
`}`,
}, "")
return s
@@ -600,6 +611,36 @@ func (m *StorageClass) Unmarshal(dAtA []byte) error {
}
b := bool(v != 0)
m.AllowVolumeExpansion = &b
+ case 7:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field VolumeBindingMode", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ s := VolumeBindingMode(dAtA[iNdEx:postIndex])
+ m.VolumeBindingMode = &s
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@@ -842,43 +883,44 @@ func init() {
}
var fileDescriptorGenerated = []byte{
- // 593 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x6f, 0xd3, 0x3e,
- 0x18, 0xc6, 0x9b, 0x76, 0xfd, 0x6b, 0x73, 0x37, 0xfd, 0xab, 0x30, 0xa4, 0xa8, 0x87, 0xb4, 0x1a,
- 0x97, 0x0a, 0x09, 0x7b, 0xdd, 0x06, 0x9a, 0x90, 0x40, 0xa2, 0x68, 0x12, 0x48, 0x9b, 0x56, 0x05,
- 0x89, 0x03, 0xe2, 0x80, 0x9b, 0xbd, 0x64, 0x26, 0x89, 0x1d, 0xd9, 0x4e, 0xa0, 0x37, 0x3e, 0x02,
- 0x9f, 0x87, 0x13, 0xc7, 0x1d, 0x77, 0xdc, 0x29, 0x62, 0xe1, 0x5b, 0x70, 0x42, 0x49, 0xca, 0x92,
- 0xad, 0x9d, 0xd8, 0xcd, 0x7e, 0xdf, 0xe7, 0xf7, 0xd8, 0x7e, 0xfd, 0xa0, 0xe7, 0xfe, 0xbe, 0xc2,
- 0x4c, 0x10, 0x3f, 0x9e, 0x82, 0xe4, 0xa0, 0x41, 0x91, 0x04, 0xf8, 0x89, 0x90, 0x64, 0xde, 0xa0,
- 0x11, 0x23, 0x4a, 0x0b, 0x49, 0x3d, 0x20, 0xc9, 0x88, 0x78, 0xc0, 0x41, 0x52, 0x0d, 0x27, 0x38,
- 0x92, 0x42, 0x0b, 0xf3, 0x7e, 0x29, 0xc3, 0x34, 0x62, 0x78, 0x2e, 0xc3, 0xc9, 0xa8, 0xf7, 0xc8,
- 0x63, 0xfa, 0x34, 0x9e, 0x62, 0x57, 0x84, 0xc4, 0x13, 0x9e, 0x20, 0x85, 0x7a, 0x1a, 0x7f, 0x2c,
- 0x76, 0xc5, 0xa6, 0x58, 0x95, 0x2e, 0x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 0xe6, 0x1f, 0xf2, 0x11, 0x18, 0xf7, 0x8a, 0xa1, 0x37, 0xb3, 0xd4, 0x5a, 0x3b,
+ 0xbe, 0x49, 0x5e, 0x2e, 0x02, 0xdd, 0xf9, 0x90, 0xce, 0x73, 0x74, 0xff, 0xc6, 0xf6, 0xf5, 0x36,
+ 0x6a, 0x8c, 0x61, 0x52, 0x54, 0x6b, 0xd9, 0xcd, 0x3f, 0xf5, 0x75, 0xd4, 0x4c, 0x48, 0x10, 0x43,
+ 0xd9, 0x04, 0xb7, 0x3c, 0x3c, 0xab, 0xef, 0x69, 0x1b, 0x3f, 0x35, 0xd4, 0xae, 0xfe, 0xca, 0x03,
+ 0x2a, 0x95, 0xfe, 0x61, 0xae, 0xa0, 0xf8, 0x6e, 0x05, 0xcd, 0xdd, 0x45, 0x3d, 0xdb, 0xd3, 0x02,
+ 0x2c, 0xfd, 0x45, 0x2a, 0xe5, 0x7c, 0x8d, 0x9a, 0x54, 0x41, 0x28, 0x8d, 0x7a, 0x51, 0xb0, 0x47,
+ 0x77, 0x28, 0x98, 0xb3, 0x3a, 0xcd, 0x6b, 0xbe, 0xc9, 0x9d, 0x6e, 0x19, 0xe0, 0xf4, 0x4e, 0x2f,
+ 0xcc, 0xda, 0xd9, 0x85, 0x59, 0x3b, 0xbf, 0x30, 0x6b, 0xdf, 0x32, 0x53, 0x3b, 0xcd, 0x4c, 0xed,
+ 0x2c, 0x33, 0xb5, 0xf3, 0xcc, 0xd4, 0x7e, 0x65, 0xa6, 0xf6, 0xfd, 0xb7, 0x59, 0x7b, 0x5f, 0x4f,
+ 0xfa, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xee, 0x56, 0xcc, 0xfd, 0x0a, 0x05, 0x00, 0x00,
}
diff --git a/staging/src/k8s.io/api/storage/v1/generated.proto b/staging/src/k8s.io/api/storage/v1/generated.proto
index 6a335e5268a..939ebde685f 100644
--- a/staging/src/k8s.io/api/storage/v1/generated.proto
+++ b/staging/src/k8s.io/api/storage/v1/generated.proto
@@ -63,6 +63,13 @@ message StorageClass {
// AllowVolumeExpansion shows whether the storage class allow volume expand
// +optional
optional bool allowVolumeExpansion = 6;
+
+ // VolumeBindingMode indicates how PersistentVolumeClaims should be
+ // provisioned and bound. When unset, VolumeBindingImmediate is used.
+ // This field is alpha-level and is only honored by servers that enable
+ // the VolumeScheduling feature.
+ // +optional
+ optional string volumeBindingMode = 7;
}
// StorageClassList is a collection of storage classes.
diff --git a/staging/src/k8s.io/api/storage/v1/types.go b/staging/src/k8s.io/api/storage/v1/types.go
index 9afdafb62ac..288d40abb8f 100644
--- a/staging/src/k8s.io/api/storage/v1/types.go
+++ b/staging/src/k8s.io/api/storage/v1/types.go
@@ -59,6 +59,13 @@ type StorageClass struct {
// AllowVolumeExpansion shows whether the storage class allow volume expand
// +optional
AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
+
+ // VolumeBindingMode indicates how PersistentVolumeClaims should be
+ // provisioned and bound. When unset, VolumeBindingImmediate is used.
+ // This field is alpha-level and is only honored by servers that enable
+ // the VolumeScheduling feature.
+ // +optional
+ VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -74,3 +81,18 @@ type StorageClassList struct {
// Items is the list of StorageClasses
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}
+
+// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
+type VolumeBindingMode string
+
+const (
+ // VolumeBindingImmediate indicates that PersistentVolumeClaims should be
+ // immediately provisioned and bound. This is the default mode.
+ VolumeBindingImmediate VolumeBindingMode = "Immediate"
+
+ // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
+ // should not be provisioned and bound until the first Pod is created that
+ // references the PeristentVolumeClaim. The volume provisioning and
+ // binding will occur during Pod scheduing.
+ VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
+)
diff --git a/staging/src/k8s.io/api/storage/v1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/storage/v1/types_swagger_doc_generated.go
index b4be857dd1a..3eb9bdab769 100644
--- a/staging/src/k8s.io/api/storage/v1/types_swagger_doc_generated.go
+++ b/staging/src/k8s.io/api/storage/v1/types_swagger_doc_generated.go
@@ -35,6 +35,7 @@ var map_StorageClass = map[string]string{
"reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
"mountOptions": "Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, e.g. [\"ro\", \"soft\"]. Not validated - mount of the PVs will simply fail if one is invalid.",
"allowVolumeExpansion": "AllowVolumeExpansion shows whether the storage class allow volume expand",
+ "volumeBindingMode": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature.",
}
func (StorageClass) SwaggerDoc() map[string]string {
diff --git a/staging/src/k8s.io/api/storage/v1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/storage/v1/zz_generated.deepcopy.go
index 2fef3d9d486..a2b2f8e7152 100644
--- a/staging/src/k8s.io/api/storage/v1/zz_generated.deepcopy.go
+++ b/staging/src/k8s.io/api/storage/v1/zz_generated.deepcopy.go
@@ -60,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
**out = **in
}
}
+ if in.VolumeBindingMode != nil {
+ in, out := &in.VolumeBindingMode, &out.VolumeBindingMode
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(VolumeBindingMode)
+ **out = **in
+ }
+ }
return
}
diff --git a/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go b/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go
index b31d6f12296..f2c8ea96005 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go
@@ -146,6 +146,12 @@ func (m *StorageClass) MarshalTo(dAtA []byte) (int, error) {
}
i++
}
+ if m.VolumeBindingMode != nil {
+ dAtA[i] = 0x3a
+ i++
+ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.VolumeBindingMode)))
+ i += copy(dAtA[i:], *m.VolumeBindingMode)
+ }
return i, nil
}
@@ -242,6 +248,10 @@ func (m *StorageClass) Size() (n int) {
if m.AllowVolumeExpansion != nil {
n += 2
}
+ if m.VolumeBindingMode != nil {
+ l = len(*m.VolumeBindingMode)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
return n
}
@@ -293,6 +303,7 @@ func (this *StorageClass) String() string {
`ReclaimPolicy:` + valueToStringGenerated(this.ReclaimPolicy) + `,`,
`MountOptions:` + fmt.Sprintf("%v", this.MountOptions) + `,`,
`AllowVolumeExpansion:` + valueToStringGenerated(this.AllowVolumeExpansion) + `,`,
+ `VolumeBindingMode:` + valueToStringGenerated(this.VolumeBindingMode) + `,`,
`}`,
}, "")
return s
@@ -600,6 +611,36 @@ func (m *StorageClass) Unmarshal(dAtA []byte) error {
}
b := bool(v != 0)
m.AllowVolumeExpansion = &b
+ case 7:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field VolumeBindingMode", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= (uint64(b) & 0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ s := VolumeBindingMode(dAtA[iNdEx:postIndex])
+ m.VolumeBindingMode = &s
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@@ -842,42 +883,44 @@ func init() {
}
var fileDescriptorGenerated = []byte{
- // 589 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4f, 0xd4, 0x40,
- 0x18, 0xc6, 0xb7, 0x2c, 0xab, 0x30, 0x0b, 0x71, 0x53, 0x39, 0x34, 0x7b, 0xe8, 0x6e, 0x38, 0xf5,
- 0xc2, 0x0c, 0x20, 0x1a, 0x62, 0xe2, 0xc1, 0x12, 0x0e, 0x26, 0x10, 0x36, 0x35, 0xf1, 0x60, 0x3c,
- 0x38, 0x5b, 0x5e, 0xcb, 0xd8, 0x76, 0xa6, 0x99, 0x99, 0xae, 0xee, 0xcd, 0x8f, 0xe0, 0x37, 0xf2,
- 0x64, 0xc2, 0x91, 0x23, 0xa7, 0x46, 0xea, 0xb7, 0xf0, 0x64, 0xfa, 0x47, 0x5a, 0x58, 0x88, 0xdc,
- 0x3a, 0xef, 0xfb, 0xfc, 0x9e, 0xb7, 0xf3, 0xce, 0x83, 0x0e, 0xc2, 0x7d, 0x85, 0x99, 0x20, 0x61,
- 0x3a, 0x05, 0xc9, 0x41, 0x83, 0x22, 0x33, 0xe0, 0xa7, 0x42, 0x92, 0xba, 0x41, 0x13, 0x46, 0x94,
- 0x16, 0x92, 0x06, 0x40, 0x66, 0x3b, 0x53, 0xd0, 0x74, 0x87, 0x04, 0xc0, 0x41, 0x52, 0x0d, 0xa7,
- 0x38, 0x91, 0x42, 0x0b, 0x73, 0x58, 0x69, 0x31, 0x4d, 0x18, 0xae, 0xb5, 0xb8, 0xd6, 0x0e, 0xb7,
- 0x02, 0xa6, 0xcf, 0xd2, 0x29, 0xf6, 0x45, 0x4c, 0x02, 0x11, 0x08, 0x52, 0x22, 0xd3, 0xf4, 0x53,
- 0x79, 0x2a, 0x0f, 0x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0x29, 0xf3, 0x7b, 0x7c, 0x08, 0xc6, 0x6a, 0xfe, 0xe8, 0x67, 0x69, 0x62, 0x6d, 0x9d, 0xcf,
+ 0x36, 0x6f, 0x17, 0x15, 0xdd, 0x79, 0x93, 0xf6, 0x6b, 0xf4, 0x64, 0x66, 0xfb, 0x7a, 0x0b, 0xd5,
+ 0x47, 0x30, 0xc9, 0xf3, 0xb5, 0xee, 0x66, 0x9f, 0xfa, 0x36, 0x6a, 0x8c, 0x49, 0x10, 0x43, 0x11,
+ 0x07, 0xb7, 0x38, 0xbc, 0x5a, 0x39, 0xd2, 0x76, 0x7e, 0x69, 0xa8, 0x55, 0xfd, 0x95, 0xa7, 0x54,
+ 0x2a, 0xfd, 0xe3, 0x5c, 0x4a, 0xf1, 0xc3, 0x52, 0x9a, 0xd1, 0x79, 0x46, 0x5b, 0x65, 0x00, 0xd6,
+ 0xfe, 0x55, 0x2a, 0x09, 0xed, 0xa1, 0x06, 0x55, 0x10, 0x4a, 0x63, 0x25, 0x4f, 0x59, 0xf7, 0xa1,
+ 0x29, 0x73, 0x36, 0x4b, 0xd3, 0xc6, 0xdb, 0x0c, 0x77, 0x0b, 0x17, 0x67, 0xf7, 0xf2, 0xc6, 0xac,
+ 0x5d, 0xdd, 0x98, 0xb5, 0xeb, 0x1b, 0xb3, 0xf6, 0x3d, 0x35, 0xb5, 0xcb, 0xd4, 0xd4, 0xae, 0x52,
+ 0x53, 0xbb, 0x4e, 0x4d, 0xed, 0x77, 0x6a, 0x6a, 0x3f, 0xfe, 0x98, 0xb5, 0x0f, 0xab, 0xa5, 0xe3,
+ 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0xe2, 0x8e, 0x84, 0x1b, 0x05, 0x00, 0x00,
}
diff --git a/staging/src/k8s.io/api/storage/v1beta1/generated.proto b/staging/src/k8s.io/api/storage/v1beta1/generated.proto
index f8070b67cf4..b0e030c01b4 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/generated.proto
+++ b/staging/src/k8s.io/api/storage/v1beta1/generated.proto
@@ -63,6 +63,13 @@ message StorageClass {
// AllowVolumeExpansion shows whether the storage class allow volume expand
// +optional
optional bool allowVolumeExpansion = 6;
+
+ // VolumeBindingMode indicates how PersistentVolumeClaims should be
+ // provisioned and bound. When unset, VolumeBindingImmediate is used.
+ // This field is alpha-level and is only honored by servers that enable
+ // the VolumeScheduling feature.
+ // +optional
+ optional string volumeBindingMode = 7;
}
// StorageClassList is a collection of storage classes.
diff --git a/staging/src/k8s.io/api/storage/v1beta1/types.go b/staging/src/k8s.io/api/storage/v1beta1/types.go
index e5036b55b33..7fb9ad98077 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/types.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/types.go
@@ -59,6 +59,13 @@ type StorageClass struct {
// AllowVolumeExpansion shows whether the storage class allow volume expand
// +optional
AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
+
+ // VolumeBindingMode indicates how PersistentVolumeClaims should be
+ // provisioned and bound. When unset, VolumeBindingImmediate is used.
+ // This field is alpha-level and is only honored by servers that enable
+ // the VolumeScheduling feature.
+ // +optional
+ VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -74,3 +81,18 @@ type StorageClassList struct {
// Items is the list of StorageClasses
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}
+
+// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
+type VolumeBindingMode string
+
+const (
+ // VolumeBindingImmediate indicates that PersistentVolumeClaims should be
+ // immediately provisioned and bound. This is the default mode.
+ VolumeBindingImmediate VolumeBindingMode = "Immediate"
+
+ // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
+ // should not be provisioned and bound until the first Pod is created that
+ // references the PeristentVolumeClaim. The volume provisioning and
+ // binding will occur during Pod scheduing.
+ VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
+)
diff --git a/staging/src/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go
index e2148c231f4..85886f7dfb3 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go
@@ -35,6 +35,7 @@ var map_StorageClass = map[string]string{
"reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
"mountOptions": "Dynamically provisioned PersistentVolumes of this storage class are created with these mountOptions, e.g. [\"ro\", \"soft\"]. Not validated - mount of the PVs will simply fail if one is invalid.",
"allowVolumeExpansion": "AllowVolumeExpansion shows whether the storage class allow volume expand",
+ "volumeBindingMode": "VolumeBindingMode indicates how PersistentVolumeClaims should be provisioned and bound. When unset, VolumeBindingImmediate is used. This field is alpha-level and is only honored by servers that enable the VolumeScheduling feature.",
}
func (StorageClass) SwaggerDoc() map[string]string {
diff --git a/staging/src/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go
index 73418126000..9d1e79823b0 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go
@@ -60,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
**out = **in
}
}
+ if in.VolumeBindingMode != nil {
+ in, out := &in.VolumeBindingMode, &out.VolumeBindingMode
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(VolumeBindingMode)
+ **out = **in
+ }
+ }
return
}