diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json
index fecc51b26cb..7cd27b43cfd 100644
--- a/api/openapi-spec/swagger.json
+++ b/api/openapi-spec/swagger.json
@@ -64235,6 +64235,10 @@
"provisioner": {
"description": "Provisioner indicates the type of the provisioner.",
"type": "string"
+ },
+ "reclaimPolicy": {
+ "description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
+ "type": "string"
}
},
"x-kubernetes-group-version-kind": [
@@ -64307,6 +64311,10 @@
"provisioner": {
"description": "Provisioner indicates the type of the provisioner.",
"type": "string"
+ },
+ "reclaimPolicy": {
+ "description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
+ "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 f86ae454e38..e914d98d2f1 100644
--- a/api/swagger-spec/storage.k8s.io_v1.json
+++ b/api/swagger-spec/storage.k8s.io_v1.json
@@ -716,6 +716,10 @@
"parameters": {
"type": "object",
"description": "Parameters holds the parameters for the provisioner that should create volumes of this storage class."
+ },
+ "reclaimPolicy": {
+ "$ref": "v1.PersistentVolumeReclaimPolicy",
+ "description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete."
}
}
},
@@ -957,6 +961,10 @@
}
}
},
+ "v1.PersistentVolumeReclaimPolicy": {
+ "id": "v1.PersistentVolumeReclaimPolicy",
+ "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 31c31419f2c..cd0e2b8c170 100644
--- a/api/swagger-spec/storage.k8s.io_v1beta1.json
+++ b/api/swagger-spec/storage.k8s.io_v1beta1.json
@@ -716,6 +716,10 @@
"parameters": {
"type": "object",
"description": "Parameters holds the parameters for the provisioner that should create volumes of this storage class."
+ },
+ "reclaimPolicy": {
+ "$ref": "v1.PersistentVolumeReclaimPolicy",
+ "description": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete."
}
}
},
@@ -957,6 +961,10 @@
}
}
},
+ "v1.PersistentVolumeReclaimPolicy": {
+ "id": "v1.PersistentVolumeReclaimPolicy",
+ "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 19a38db5df4..63386fb87c7 100755
--- a/docs/api-reference/storage.k8s.io/v1/definitions.html
+++ b/docs/api-reference/storage.k8s.io/v1/definitions.html
@@ -968,6 +968,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
object |
|
+
+reclaimPolicy |
+Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete. |
+false |
+v1.PersistentVolumeReclaimPolicy |
+ |
+
@@ -1195,6 +1202,10 @@ When an object is created, the system will populate this list with the current s
+
+
+
v1.PersistentVolumeReclaimPolicy
+
v1.APIResource
diff --git a/docs/api-reference/storage.k8s.io/v1beta1/definitions.html b/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
index c55d3b0c6d2..a8091346e9e 100755
--- a/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
+++ b/docs/api-reference/storage.k8s.io/v1beta1/definitions.html
@@ -436,6 +436,12 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
+
+
+
v1.Patch
+
+
Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
+
v1beta1.StorageClassList
@@ -491,12 +497,6 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
-
-
-
v1.Patch
-
-
Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
-
v1.DeleteOptions
@@ -930,6 +930,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
object |
|
+
+reclaimPolicy |
+Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete. |
+false |
+v1.PersistentVolumeReclaimPolicy |
+ |
+
@@ -1195,6 +1202,10 @@ When an object is created, the system will populate this list with the current s
+
+
+
v1.PersistentVolumeReclaimPolicy
+
v1.APIResource
diff --git a/pkg/api/defaulting_test.go b/pkg/api/defaulting_test.go
index 75d9080b6ef..f5ba8780e74 100644
--- a/pkg/api/defaulting_test.go
+++ b/pkg/api/defaulting_test.go
@@ -129,6 +129,10 @@ func TestDefaulting(t *testing.T) {
{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Kind: "ExternalAdmissionHookConfigurationList"}: {},
{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicy"}: {},
{Group: "networking.k8s.io", Version: "v1", Kind: "NetworkPolicyList"}: {},
+ {Group: "storage.k8s.io", Version: "v1beta1", Kind: "StorageClass"}: {},
+ {Group: "storage.k8s.io", Version: "v1beta1", Kind: "StorageClassList"}: {},
+ {Group: "storage.k8s.io", Version: "v1", Kind: "StorageClass"}: {},
+ {Group: "storage.k8s.io", Version: "v1", Kind: "StorageClassList"}: {},
}
f := fuzz.New().NilChance(.5).NumElements(1, 1).RandSource(rand.NewSource(1))
diff --git a/pkg/api/testing/BUILD b/pkg/api/testing/BUILD
index 636e289d2ac..c914bec2270 100644
--- a/pkg/api/testing/BUILD
+++ b/pkg/api/testing/BUILD
@@ -26,6 +26,7 @@ go_library(
"//pkg/apis/extensions/v1beta1:go_default_library",
"//pkg/apis/policy/fuzzer:go_default_library",
"//pkg/apis/rbac/fuzzer:go_default_library",
+ "//pkg/apis/storage/fuzzer:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/testing:go_default_library",
diff --git a/pkg/api/testing/fuzzer.go b/pkg/api/testing/fuzzer.go
index cb1d85ecb8a..844b9f79d2b 100644
--- a/pkg/api/testing/fuzzer.go
+++ b/pkg/api/testing/fuzzer.go
@@ -40,6 +40,7 @@ import (
extensionsv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
policyfuzzer "k8s.io/kubernetes/pkg/apis/policy/fuzzer"
rbacfuzzer "k8s.io/kubernetes/pkg/apis/rbac/fuzzer"
+ storagefuzzer "k8s.io/kubernetes/pkg/apis/storage/fuzzer"
)
// overrideGenericFuncs override some generic fuzzer funcs from k8s.io/apiserver in order to have more realistic
@@ -100,4 +101,5 @@ var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
policyfuzzer.Funcs,
certificatesfuzzer.Funcs,
admissionregistrationfuzzer.Funcs,
+ storagefuzzer.Funcs,
)
diff --git a/pkg/apis/storage/BUILD b/pkg/apis/storage/BUILD
index f47699e1f7d..cf4b841ba87 100644
--- a/pkg/apis/storage/BUILD
+++ b/pkg/apis/storage/BUILD
@@ -14,6 +14,7 @@ go_library(
"zz_generated.deepcopy.go",
],
deps = [
+ "//pkg/api:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
diff --git a/pkg/apis/storage/fuzzer/BUILD b/pkg/apis/storage/fuzzer/BUILD
index dd0561eec8f..e88684ac21e 100644
--- a/pkg/apis/storage/fuzzer/BUILD
+++ b/pkg/apis/storage/fuzzer/BUILD
@@ -8,7 +8,12 @@ load(
go_library(
name = "go_default_library",
srcs = ["fuzzer.go"],
- deps = ["//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library"],
+ deps = [
+ "//pkg/api:go_default_library",
+ "//pkg/apis/storage:go_default_library",
+ "//vendor/github.com/google/gofuzz:go_default_library",
+ "//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
+ ],
)
filegroup(
diff --git a/pkg/apis/storage/fuzzer/fuzzer.go b/pkg/apis/storage/fuzzer/fuzzer.go
index a0a68bdf9ff..e8a36514947 100644
--- a/pkg/apis/storage/fuzzer/fuzzer.go
+++ b/pkg/apis/storage/fuzzer/fuzzer.go
@@ -17,10 +17,20 @@ limitations under the License.
package fuzzer
import (
+ fuzz "github.com/google/gofuzz"
+
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
+ "k8s.io/kubernetes/pkg/api"
+ "k8s.io/kubernetes/pkg/apis/storage"
)
// Funcs returns the fuzzer functions for the storage api group.
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
- return []interface{}{}
+ return []interface{}{
+ func(obj *storage.StorageClass, c fuzz.Continue) {
+ c.FuzzNoCustom(obj) // fuzz self without calling this function again
+ reclamationPolicies := []api.PersistentVolumeReclaimPolicy{api.PersistentVolumeReclaimDelete, api.PersistentVolumeReclaimRetain}
+ obj.ReclaimPolicy = &reclamationPolicies[c.Rand.Intn(len(reclamationPolicies))]
+ },
+ }
}
diff --git a/pkg/apis/storage/types.go b/pkg/apis/storage/types.go
index ded08718782..26955afde3b 100644
--- a/pkg/apis/storage/types.go
+++ b/pkg/apis/storage/types.go
@@ -16,7 +16,10 @@ limitations under the License.
package storage
-import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/kubernetes/pkg/api"
+)
// +genclient
// +genclient:nonNamespaced
@@ -46,6 +49,11 @@ type StorageClass struct {
// 512, with a cumulative max size of 256K
// +optional
Parameters map[string]string
+
+ // reclaimPolicy is the reclaim policy that dynamically provisioned
+ // PersistentVolumes of this storage class are created with
+ // +optional
+ ReclaimPolicy *api.PersistentVolumeReclaimPolicy
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/storage/v1/BUILD b/pkg/apis/storage/v1/BUILD
index 1cf3cf86ab3..fc6190e1a6e 100644
--- a/pkg/apis/storage/v1/BUILD
+++ b/pkg/apis/storage/v1/BUILD
@@ -8,13 +8,16 @@ load(
go_library(
name = "go_default_library",
srcs = [
+ "defaults.go",
"doc.go",
"register.go",
"zz_generated.conversion.go",
"zz_generated.defaults.go",
],
deps = [
+ "//pkg/api:go_default_library",
"//pkg/apis/storage: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",
diff --git a/pkg/apis/storage/v1/defaults.go b/pkg/apis/storage/v1/defaults.go
new file mode 100644
index 00000000000..2e7c51c632e
--- /dev/null
+++ b/pkg/apis/storage/v1/defaults.go
@@ -0,0 +1,34 @@
+/*
+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
+
+import (
+ "k8s.io/api/core/v1"
+ storagev1 "k8s.io/api/storage/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+func addDefaultingFuncs(scheme *runtime.Scheme) error {
+ return RegisterDefaults(scheme)
+}
+
+func SetDefaults_StorageClass(obj *storagev1.StorageClass) {
+ if obj.ReclaimPolicy == nil {
+ obj.ReclaimPolicy = new(v1.PersistentVolumeReclaimPolicy)
+ *obj.ReclaimPolicy = v1.PersistentVolumeReclaimDelete
+ }
+}
diff --git a/pkg/apis/storage/v1/register.go b/pkg/apis/storage/v1/register.go
index bda48325c97..f56f75d58b4 100644
--- a/pkg/apis/storage/v1/register.go
+++ b/pkg/apis/storage/v1/register.go
@@ -41,5 +41,5 @@ func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
- localSchemeBuilder.Register(RegisterDefaults)
+ localSchemeBuilder.Register(addDefaultingFuncs)
}
diff --git a/pkg/apis/storage/v1/zz_generated.conversion.go b/pkg/apis/storage/v1/zz_generated.conversion.go
index f21171b7af5..6041cff96fa 100644
--- a/pkg/apis/storage/v1/zz_generated.conversion.go
+++ b/pkg/apis/storage/v1/zz_generated.conversion.go
@@ -21,9 +21,11 @@ limitations under the License.
package v1
import (
+ core_v1 "k8s.io/api/core/v1"
v1 "k8s.io/api/storage/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
+ api "k8s.io/kubernetes/pkg/api"
storage "k8s.io/kubernetes/pkg/apis/storage"
unsafe "unsafe"
)
@@ -47,6 +49,7 @@ func autoConvert_v1_StorageClass_To_storage_StorageClass(in *v1.StorageClass, ou
out.ObjectMeta = in.ObjectMeta
out.Provisioner = in.Provisioner
out.Parameters = *(*map[string]string)(unsafe.Pointer(&in.Parameters))
+ out.ReclaimPolicy = (*api.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
return nil
}
@@ -59,6 +62,7 @@ func autoConvert_storage_StorageClass_To_v1_StorageClass(in *storage.StorageClas
out.ObjectMeta = in.ObjectMeta
out.Provisioner = in.Provisioner
out.Parameters = *(*map[string]string)(unsafe.Pointer(&in.Parameters))
+ out.ReclaimPolicy = (*core_v1.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
return nil
}
diff --git a/pkg/apis/storage/v1/zz_generated.defaults.go b/pkg/apis/storage/v1/zz_generated.defaults.go
index 6df448eb9fd..4db23e8cfba 100644
--- a/pkg/apis/storage/v1/zz_generated.defaults.go
+++ b/pkg/apis/storage/v1/zz_generated.defaults.go
@@ -21,6 +21,7 @@ limitations under the License.
package v1
import (
+ v1 "k8s.io/api/storage/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -28,5 +29,18 @@ import (
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
+ scheme.AddTypeDefaultingFunc(&v1.StorageClass{}, func(obj interface{}) { SetObjectDefaults_StorageClass(obj.(*v1.StorageClass)) })
+ scheme.AddTypeDefaultingFunc(&v1.StorageClassList{}, func(obj interface{}) { SetObjectDefaults_StorageClassList(obj.(*v1.StorageClassList)) })
return nil
}
+
+func SetObjectDefaults_StorageClass(in *v1.StorageClass) {
+ SetDefaults_StorageClass(in)
+}
+
+func SetObjectDefaults_StorageClassList(in *v1.StorageClassList) {
+ for i := range in.Items {
+ a := &in.Items[i]
+ SetObjectDefaults_StorageClass(a)
+ }
+}
diff --git a/pkg/apis/storage/v1beta1/BUILD b/pkg/apis/storage/v1beta1/BUILD
index 6e9c1695fa7..f0ad28c7ada 100644
--- a/pkg/apis/storage/v1beta1/BUILD
+++ b/pkg/apis/storage/v1beta1/BUILD
@@ -8,13 +8,16 @@ load(
go_library(
name = "go_default_library",
srcs = [
+ "defaults.go",
"doc.go",
"register.go",
"zz_generated.conversion.go",
"zz_generated.defaults.go",
],
deps = [
+ "//pkg/api:go_default_library",
"//pkg/apis/storage: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",
diff --git a/pkg/apis/storage/v1beta1/defaults.go b/pkg/apis/storage/v1beta1/defaults.go
new file mode 100644
index 00000000000..e50599bf273
--- /dev/null
+++ b/pkg/apis/storage/v1beta1/defaults.go
@@ -0,0 +1,34 @@
+/*
+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
+
+import (
+ "k8s.io/api/core/v1"
+ storagev1beta1 "k8s.io/api/storage/v1beta1"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+func addDefaultingFuncs(scheme *runtime.Scheme) error {
+ return RegisterDefaults(scheme)
+}
+
+func SetDefaults_StorageClass(obj *storagev1beta1.StorageClass) {
+ if obj.ReclaimPolicy == nil {
+ obj.ReclaimPolicy = new(v1.PersistentVolumeReclaimPolicy)
+ *obj.ReclaimPolicy = v1.PersistentVolumeReclaimDelete
+ }
+}
diff --git a/pkg/apis/storage/v1beta1/register.go b/pkg/apis/storage/v1beta1/register.go
index 9dbb95ec2b9..961f75c0037 100644
--- a/pkg/apis/storage/v1beta1/register.go
+++ b/pkg/apis/storage/v1beta1/register.go
@@ -41,5 +41,5 @@ func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
- localSchemeBuilder.Register(RegisterDefaults)
+ localSchemeBuilder.Register(addDefaultingFuncs)
}
diff --git a/pkg/apis/storage/v1beta1/zz_generated.conversion.go b/pkg/apis/storage/v1beta1/zz_generated.conversion.go
index b10ff0bc2a0..80bab19cd89 100644
--- a/pkg/apis/storage/v1beta1/zz_generated.conversion.go
+++ b/pkg/apis/storage/v1beta1/zz_generated.conversion.go
@@ -21,9 +21,11 @@ limitations under the License.
package v1beta1
import (
+ v1 "k8s.io/api/core/v1"
v1beta1 "k8s.io/api/storage/v1beta1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
+ api "k8s.io/kubernetes/pkg/api"
storage "k8s.io/kubernetes/pkg/apis/storage"
unsafe "unsafe"
)
@@ -47,6 +49,7 @@ func autoConvert_v1beta1_StorageClass_To_storage_StorageClass(in *v1beta1.Storag
out.ObjectMeta = in.ObjectMeta
out.Provisioner = in.Provisioner
out.Parameters = *(*map[string]string)(unsafe.Pointer(&in.Parameters))
+ out.ReclaimPolicy = (*api.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
return nil
}
@@ -59,6 +62,7 @@ func autoConvert_storage_StorageClass_To_v1beta1_StorageClass(in *storage.Storag
out.ObjectMeta = in.ObjectMeta
out.Provisioner = in.Provisioner
out.Parameters = *(*map[string]string)(unsafe.Pointer(&in.Parameters))
+ out.ReclaimPolicy = (*v1.PersistentVolumeReclaimPolicy)(unsafe.Pointer(in.ReclaimPolicy))
return nil
}
diff --git a/pkg/apis/storage/v1beta1/zz_generated.defaults.go b/pkg/apis/storage/v1beta1/zz_generated.defaults.go
index e24e70be38b..1200af6b071 100644
--- a/pkg/apis/storage/v1beta1/zz_generated.defaults.go
+++ b/pkg/apis/storage/v1beta1/zz_generated.defaults.go
@@ -21,6 +21,7 @@ limitations under the License.
package v1beta1
import (
+ v1beta1 "k8s.io/api/storage/v1beta1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -28,5 +29,18 @@ import (
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
+ scheme.AddTypeDefaultingFunc(&v1beta1.StorageClass{}, func(obj interface{}) { SetObjectDefaults_StorageClass(obj.(*v1beta1.StorageClass)) })
+ scheme.AddTypeDefaultingFunc(&v1beta1.StorageClassList{}, func(obj interface{}) { SetObjectDefaults_StorageClassList(obj.(*v1beta1.StorageClassList)) })
return nil
}
+
+func SetObjectDefaults_StorageClass(in *v1beta1.StorageClass) {
+ SetDefaults_StorageClass(in)
+}
+
+func SetObjectDefaults_StorageClassList(in *v1beta1.StorageClassList) {
+ for i := range in.Items {
+ a := &in.Items[i]
+ SetObjectDefaults_StorageClass(a)
+ }
+}
diff --git a/pkg/apis/storage/validation/BUILD b/pkg/apis/storage/validation/BUILD
index 2c6b951cf6a..2ce7952d201 100644
--- a/pkg/apis/storage/validation/BUILD
+++ b/pkg/apis/storage/validation/BUILD
@@ -10,8 +10,10 @@ go_library(
name = "go_default_library",
srcs = ["validation.go"],
deps = [
+ "//pkg/api:go_default_library",
"//pkg/api/validation:go_default_library",
"//pkg/apis/storage:go_default_library",
+ "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
],
@@ -22,6 +24,7 @@ go_test(
srcs = ["validation_test.go"],
library = ":go_default_library",
deps = [
+ "//pkg/api:go_default_library",
"//pkg/apis/storage:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
],
diff --git a/pkg/apis/storage/validation/validation.go b/pkg/apis/storage/validation/validation.go
index 029694f0523..84dc042faec 100644
--- a/pkg/apis/storage/validation/validation.go
+++ b/pkg/apis/storage/validation/validation.go
@@ -20,8 +20,10 @@ import (
"reflect"
"strings"
+ "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
+ "k8s.io/kubernetes/pkg/api"
apivalidation "k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/apis/storage"
)
@@ -31,6 +33,7 @@ func ValidateStorageClass(storageClass *storage.StorageClass) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&storageClass.ObjectMeta, false, apivalidation.ValidateClassName, field.NewPath("metadata"))
allErrs = append(allErrs, validateProvisioner(storageClass.Provisioner, field.NewPath("provisioner"))...)
allErrs = append(allErrs, validateParameters(storageClass.Parameters, field.NewPath("parameters"))...)
+ allErrs = append(allErrs, validateReclaimPolicy(storageClass.ReclaimPolicy, field.NewPath("reclaimPolicy"))...)
return allErrs
}
@@ -45,6 +48,10 @@ func ValidateStorageClassUpdate(storageClass, oldStorageClass *storage.StorageCl
if storageClass.Provisioner != oldStorageClass.Provisioner {
allErrs = append(allErrs, field.Forbidden(field.NewPath("provisioner"), "updates to provisioner are forbidden."))
}
+
+ if *storageClass.ReclaimPolicy != *oldStorageClass.ReclaimPolicy {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("reclaimPolicy"), "updates to reclaimPolicy are forbidden."))
+ }
return allErrs
}
@@ -87,3 +94,17 @@ func validateParameters(params map[string]string, fldPath *field.Path) field.Err
}
return allErrs
}
+
+var supportedReclaimPolicy = sets.NewString(string(api.PersistentVolumeReclaimDelete), string(api.PersistentVolumeReclaimRetain))
+
+// validateReclaimPolicy tests that the reclaim policy is one of the supported. It is up to the volume plugin to reject
+// provisioning for storage classes with impossible reclaim policies, e.g. EBS is not Recyclable
+func validateReclaimPolicy(reclaimPolicy *api.PersistentVolumeReclaimPolicy, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+ if len(string(*reclaimPolicy)) > 0 {
+ if !supportedReclaimPolicy.Has(string(*reclaimPolicy)) {
+ allErrs = append(allErrs, field.NotSupported(fldPath, reclaimPolicy, supportedReclaimPolicy.List()))
+ }
+ }
+ return allErrs
+}
diff --git a/pkg/apis/storage/validation/validation_test.go b/pkg/apis/storage/validation/validation_test.go
index d113ea3922b..07b020b52eb 100644
--- a/pkg/apis/storage/validation/validation_test.go
+++ b/pkg/apis/storage/validation/validation_test.go
@@ -21,21 +21,27 @@ import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/storage"
)
func TestValidateStorageClass(t *testing.T) {
+ deleteReclaimPolicy := api.PersistentVolumeReclaimPolicy("Delete")
+ retainReclaimPolicy := api.PersistentVolumeReclaimPolicy("Retain")
+ recycleReclaimPolicy := api.PersistentVolumeReclaimPolicy("Recycle")
successCases := []storage.StorageClass{
{
// empty parameters
- ObjectMeta: metav1.ObjectMeta{Name: "foo"},
- Provisioner: "kubernetes.io/foo-provisioner",
- Parameters: map[string]string{},
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/foo-provisioner",
+ Parameters: map[string]string{},
+ ReclaimPolicy: &deleteReclaimPolicy,
},
{
// nil parameters
- ObjectMeta: metav1.ObjectMeta{Name: "foo"},
- Provisioner: "kubernetes.io/foo-provisioner",
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/foo-provisioner",
+ ReclaimPolicy: &deleteReclaimPolicy,
},
{
// some parameters
@@ -46,6 +52,13 @@ func TestValidateStorageClass(t *testing.T) {
"foo-parameter": "free-form-string",
"foo-parameter2": "{\"embedded\": \"json\", \"with\": {\"structures\":\"inside\"}}",
},
+ ReclaimPolicy: &deleteReclaimPolicy,
+ },
+ {
+ // retain reclaimPolicy
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/foo-provisioner",
+ ReclaimPolicy: &retainReclaimPolicy,
},
}
@@ -68,12 +81,14 @@ func TestValidateStorageClass(t *testing.T) {
errorCases := map[string]storage.StorageClass{
"namespace is present": {
- ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
- Provisioner: "kubernetes.io/foo-provisioner",
+ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
+ Provisioner: "kubernetes.io/foo-provisioner",
+ ReclaimPolicy: &deleteReclaimPolicy,
},
"invalid provisioner": {
- ObjectMeta: metav1.ObjectMeta{Name: "foo"},
- Provisioner: "kubernetes.io/invalid/provisioner",
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/invalid/provisioner",
+ ReclaimPolicy: &deleteReclaimPolicy,
},
"invalid empty parameter name": {
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
@@ -81,15 +96,23 @@ func TestValidateStorageClass(t *testing.T) {
Parameters: map[string]string{
"": "value",
},
+ ReclaimPolicy: &deleteReclaimPolicy,
},
"provisioner: Required value": {
- ObjectMeta: metav1.ObjectMeta{Name: "foo"},
- Provisioner: "",
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "",
+ ReclaimPolicy: &deleteReclaimPolicy,
},
"too long parameters": {
- ObjectMeta: metav1.ObjectMeta{Name: "foo"},
- Provisioner: "kubernetes.io/foo",
- Parameters: longParameters,
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/foo",
+ Parameters: longParameters,
+ ReclaimPolicy: &deleteReclaimPolicy,
+ },
+ "invalid reclaimpolicy": {
+ ObjectMeta: metav1.ObjectMeta{Name: "foo"},
+ Provisioner: "kubernetes.io/foo",
+ ReclaimPolicy: &recycleReclaimPolicy,
},
}
diff --git a/pkg/apis/storage/zz_generated.deepcopy.go b/pkg/apis/storage/zz_generated.deepcopy.go
index d3dfe0a4d8c..e5fd6432cc8 100644
--- a/pkg/apis/storage/zz_generated.deepcopy.go
+++ b/pkg/apis/storage/zz_generated.deepcopy.go
@@ -23,6 +23,7 @@ package storage
import (
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
+ api "k8s.io/kubernetes/pkg/api"
reflect "reflect"
)
@@ -59,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
(*out)[key] = val
}
}
+ if in.ReclaimPolicy != nil {
+ in, out := &in.ReclaimPolicy, &out.ReclaimPolicy
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(api.PersistentVolumeReclaimPolicy)
+ **out = **in
+ }
+ }
return
}
diff --git a/pkg/controller/volume/persistentvolume/provision_test.go b/pkg/controller/volume/persistentvolume/provision_test.go
index f881a920c90..8465136074c 100644
--- a/pkg/controller/volume/persistentvolume/provision_test.go
+++ b/pkg/controller/volume/persistentvolume/provision_test.go
@@ -31,6 +31,7 @@ var class1Parameters = map[string]string{
var class2Parameters = map[string]string{
"param2": "value2",
}
+var deleteReclaimPolicy = v1.PersistentVolumeReclaimDelete
var storageClasses = []*storage.StorageClass{
{
TypeMeta: metav1.TypeMeta{
@@ -41,8 +42,9 @@ var storageClasses = []*storage.StorageClass{
Name: "gold",
},
- Provisioner: mockPluginName,
- Parameters: class1Parameters,
+ Provisioner: mockPluginName,
+ Parameters: class1Parameters,
+ ReclaimPolicy: &deleteReclaimPolicy,
},
{
TypeMeta: metav1.TypeMeta{
@@ -51,8 +53,9 @@ var storageClasses = []*storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "silver",
},
- Provisioner: mockPluginName,
- Parameters: class2Parameters,
+ Provisioner: mockPluginName,
+ Parameters: class2Parameters,
+ ReclaimPolicy: &deleteReclaimPolicy,
},
{
TypeMeta: metav1.TypeMeta{
@@ -61,8 +64,9 @@ var storageClasses = []*storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "external",
},
- Provisioner: "vendor.com/my-volume",
- Parameters: class1Parameters,
+ Provisioner: "vendor.com/my-volume",
+ Parameters: class1Parameters,
+ ReclaimPolicy: &deleteReclaimPolicy,
},
{
TypeMeta: metav1.TypeMeta{
@@ -71,8 +75,9 @@ var storageClasses = []*storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "unknown-internal",
},
- Provisioner: "kubernetes.io/unknown",
- Parameters: class1Parameters,
+ Provisioner: "kubernetes.io/unknown",
+ Parameters: class1Parameters,
+ ReclaimPolicy: &deleteReclaimPolicy,
},
}
diff --git a/pkg/controller/volume/persistentvolume/pv_controller.go b/pkg/controller/volume/persistentvolume/pv_controller.go
index e516c9f9df9..16ad055d83a 100644
--- a/pkg/controller/volume/persistentvolume/pv_controller.go
+++ b/pkg/controller/volume/persistentvolume/pv_controller.go
@@ -1309,7 +1309,7 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interfa
tags[CloudVolumeCreatedForVolumeNameTag] = pvName
options := vol.VolumeOptions{
- PersistentVolumeReclaimPolicy: v1.PersistentVolumeReclaimDelete,
+ PersistentVolumeReclaimPolicy: *storageClass.ReclaimPolicy,
CloudTags: &tags,
ClusterName: ctrl.clusterName,
PVName: pvName,
diff --git a/pkg/registry/storage/storageclass/BUILD b/pkg/registry/storage/storageclass/BUILD
index e3216aa9075..1e906231a19 100644
--- a/pkg/registry/storage/storageclass/BUILD
+++ b/pkg/registry/storage/storageclass/BUILD
@@ -28,6 +28,7 @@ go_test(
srcs = ["strategy_test.go"],
library = ":go_default_library",
deps = [
+ "//pkg/api:go_default_library",
"//pkg/apis/storage:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
diff --git a/pkg/registry/storage/storageclass/storage/BUILD b/pkg/registry/storage/storageclass/storage/BUILD
index 481ceb7d59a..578387b6fa1 100644
--- a/pkg/registry/storage/storageclass/storage/BUILD
+++ b/pkg/registry/storage/storageclass/storage/BUILD
@@ -11,6 +11,7 @@ go_test(
srcs = ["storage_test.go"],
library = ":go_default_library",
deps = [
+ "//pkg/api:go_default_library",
"//pkg/apis/storage:go_default_library",
"//pkg/registry/registrytest:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
diff --git a/pkg/registry/storage/storageclass/storage/storage_test.go b/pkg/registry/storage/storageclass/storage/storage_test.go
index e6f8f37f35d..f9858b9a2bd 100644
--- a/pkg/registry/storage/storageclass/storage/storage_test.go
+++ b/pkg/registry/storage/storageclass/storage/storage_test.go
@@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/registry/generic"
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
+ "k8s.io/kubernetes/pkg/api"
storageapi "k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/registry/registrytest"
)
@@ -42,6 +43,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
}
func validNewStorageClass(name string) *storageapi.StorageClass {
+ deleteReclaimPolicy := api.PersistentVolumeReclaimDelete
return &storageapi.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: name,
@@ -50,6 +52,7 @@ func validNewStorageClass(name string) *storageapi.StorageClass {
Parameters: map[string]string{
"foo": "bar",
},
+ ReclaimPolicy: &deleteReclaimPolicy,
}
}
@@ -64,12 +67,14 @@ func TestCreate(t *testing.T) {
test := registrytest.New(t, storage.Store).ClusterScope()
storageClass := validNewStorageClass("foo")
storageClass.ObjectMeta = metav1.ObjectMeta{GenerateName: "foo"}
+ deleteReclaimPolicy := api.PersistentVolumeReclaimDelete
test.TestCreate(
// valid
storageClass,
// invalid
&storageapi.StorageClass{
- ObjectMeta: metav1.ObjectMeta{Name: "*BadName!"},
+ ObjectMeta: metav1.ObjectMeta{Name: "*BadName!"},
+ ReclaimPolicy: &deleteReclaimPolicy,
},
)
}
diff --git a/pkg/registry/storage/storageclass/strategy_test.go b/pkg/registry/storage/storageclass/strategy_test.go
index 2bcbc21b944..da57f0460c9 100644
--- a/pkg/registry/storage/storageclass/strategy_test.go
+++ b/pkg/registry/storage/storageclass/strategy_test.go
@@ -21,6 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
+ "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/storage"
)
@@ -33,6 +34,7 @@ func TestStorageClassStrategy(t *testing.T) {
t.Errorf("StorageClass should not allow create on update")
}
+ deleteReclaimPolicy := api.PersistentVolumeReclaimDelete
storageClass := &storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{
Name: "valid-class",
@@ -41,6 +43,7 @@ func TestStorageClassStrategy(t *testing.T) {
Parameters: map[string]string{
"foo": "bar",
},
+ ReclaimPolicy: &deleteReclaimPolicy,
}
Strategy.PrepareForCreate(ctx, storageClass)
@@ -59,6 +62,7 @@ func TestStorageClassStrategy(t *testing.T) {
Parameters: map[string]string{
"foo": "bar",
},
+ ReclaimPolicy: &deleteReclaimPolicy,
}
Strategy.PrepareForUpdate(ctx, newStorageClass, storageClass)
diff --git a/staging/src/k8s.io/api/storage/v1/BUILD b/staging/src/k8s.io/api/storage/v1/BUILD
index 2c4953766bb..08bdaa7ba37 100644
--- a/staging/src/k8s.io/api/storage/v1/BUILD
+++ b/staging/src/k8s.io/api/storage/v1/BUILD
@@ -20,6 +20,7 @@ go_library(
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/github.com/ugorji/go/codec:go_default_library",
+ "//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
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 c83ddad7578..31e18f7f72f 100644
--- a/staging/src/k8s.io/api/storage/v1/generated.pb.go
+++ b/staging/src/k8s.io/api/storage/v1/generated.pb.go
@@ -34,6 +34,8 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
+import k8s_io_api_core_v1 "k8s.io/api/core/v1"
+
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
import strings "strings"
@@ -113,6 +115,12 @@ func (m *StorageClass) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], v)
}
}
+ if m.ReclaimPolicy != nil {
+ dAtA[i] = 0x22
+ i++
+ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ReclaimPolicy)))
+ i += copy(dAtA[i:], *m.ReclaimPolicy)
+ }
return i, nil
}
@@ -196,6 +204,10 @@ func (m *StorageClass) Size() (n int) {
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
}
}
+ if m.ReclaimPolicy != nil {
+ l = len(*m.ReclaimPolicy)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
return n
}
@@ -244,6 +256,7 @@ func (this *StorageClass) String() string {
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Provisioner:` + fmt.Sprintf("%v", this.Provisioner) + `,`,
`Parameters:` + mapStringForParameters + `,`,
+ `ReclaimPolicy:` + valueToStringGenerated(this.ReclaimPolicy) + `,`,
`}`,
}, "")
return s
@@ -471,6 +484,36 @@ func (m *StorageClass) Unmarshal(dAtA []byte) error {
m.Parameters[mapkey] = mapvalue
}
iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ReclaimPolicy", 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 := k8s_io_api_core_v1.PersistentVolumeReclaimPolicy(dAtA[iNdEx:postIndex])
+ m.ReclaimPolicy = &s
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@@ -713,35 +756,39 @@ func init() {
}
var fileDescriptorGenerated = []byte{
- // 465 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xcf, 0x6e, 0xd3, 0x40,
- 0x10, 0xc6, 0xb3, 0x8e, 0x22, 0xb5, 0x1b, 0x10, 0x91, 0x01, 0x29, 0xca, 0x61, 0x1b, 0x95, 0x4b,
- 0x2e, 0xec, 0x92, 0x16, 0x50, 0x85, 0x04, 0x87, 0x20, 0x24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0x3c, 0xba, 0x45, 0x2a, 0x93, 0xbb, 0x95, 0x5f, 0xe7, 0x5d, 0x4e, 0x7a, 0xa5,
- 0xc1, 0x64, 0xb4, 0xde, 0xb0, 0xd6, 0xd9, 0x86, 0xb5, 0xce, 0x37, 0xac, 0xf5, 0x23, 0x63, 0x64,
- 0x9d, 0x31, 0x72, 0x96, 0x31, 0x72, 0x9e, 0x31, 0xf2, 0x27, 0x63, 0xe4, 0xe7, 0x5f, 0xd6, 0xfa,
- 0xec, 0xa4, 0xe3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xba, 0xfb, 0xcc, 0xa9, 0x93, 0x03, 0x00,
+ // 529 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x8a, 0x13, 0x41,
+ 0x10, 0xce, 0x24, 0x2e, 0xec, 0x76, 0x0c, 0x86, 0x51, 0x21, 0xe4, 0x30, 0x09, 0xeb, 0x25, 0x08,
+ 0x76, 0x6f, 0x76, 0x55, 0x16, 0x41, 0x0f, 0x91, 0x05, 0x05, 0xc5, 0x30, 0x82, 0x07, 0xf1, 0x60,
+ 0x67, 0x52, 0x4e, 0xda, 0xf9, 0xe9, 0xa1, 0xbb, 0x66, 0x20, 0x37, 0x1f, 0xc1, 0xe7, 0x11, 0x1f,
+ 0x20, 0xc7, 0x3d, 0xee, 0x29, 0x98, 0xf1, 0x2d, 0x3c, 0xc9, 0xcc, 0xc4, 0xcc, 0xec, 0x26, 0x8b,
+ 0x7b, 0xeb, 0xaa, 0xfa, 0xbe, 0xaf, 0xab, 0xea, 0x2b, 0xf2, 0xc2, 0x3b, 0xd5, 0x54, 0x48, 0xe6,
+ 0xc5, 0x13, 0x50, 0x21, 0x20, 0x68, 0x96, 0x40, 0x38, 0x95, 0x8a, 0xad, 0x0b, 0x3c, 0x12, 0x4c,
+ 0xa3, 0x54, 0xdc, 0x05, 0x96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ce, 0x98, 0x76, 0x21, 0x30,
+ 0x1a, 0x2c, 0x56, 0x56, 0xed, 0x7c, 0x65, 0xd5, 0x2e, 0x56, 0x56, 0xed, 0x5b, 0x6a, 0x19, 0x8b,
+ 0xd4, 0x32, 0xce, 0x53, 0xcb, 0xb8, 0x48, 0x2d, 0xe3, 0x57, 0x6a, 0x19, 0xdf, 0x7f, 0x5b, 0xb5,
+ 0x8f, 0xf5, 0x64, 0xf8, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x64, 0xc7, 0x7e, 0x2c, 0x04, 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 cd66f0b1008..7df04a0b2fa 100644
--- a/staging/src/k8s.io/api/storage/v1/generated.proto
+++ b/staging/src/k8s.io/api/storage/v1/generated.proto
@@ -21,6 +21,7 @@ syntax = 'proto2';
package k8s.io.api.storage.v1;
+import "k8s.io/api/storage/v1beta1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
@@ -47,6 +48,11 @@ message StorageClass {
// create volumes of this storage class.
// +optional
map parameters = 3;
+
+ // Dynamically provisioned PersistentVolumes of this storage class are
+ // created with this reclaimPolicy. Defaults to Delete.
+ // +optional
+ optional string reclaimPolicy = 4;
}
// StorageClassList is a collection of storage classes.
diff --git a/staging/src/k8s.io/api/storage/v1/types.generated.go b/staging/src/k8s.io/api/storage/v1/types.generated.go
index aa667e38e52..c6c8022474c 100644
--- a/staging/src/k8s.io/api/storage/v1/types.generated.go
+++ b/staging/src/k8s.io/api/storage/v1/types.generated.go
@@ -25,6 +25,7 @@ import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
+ pkg3_v1 "k8s.io/api/core/v1"
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkg2_types "k8s.io/apimachinery/pkg/types"
"reflect"
@@ -62,10 +63,11 @@ func init() {
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
- var v0 pkg1_v1.TypeMeta
- var v1 pkg2_types.UID
- var v2 time.Time
- _, _, _ = v0, v1, v2
+ var v0 pkg3_v1.PersistentVolumeReclaimPolicy
+ var v1 pkg1_v1.TypeMeta
+ var v2 pkg2_types.UID
+ var v3 time.Time
+ _, _, _, _ = v0, v1, v2, v3
}
}
@@ -83,16 +85,17 @@ func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
- var yyq2 [5]bool
+ var yyq2 [6]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Kind != ""
yyq2[1] = x.APIVersion != ""
yyq2[2] = true
yyq2[4] = len(x.Parameters) != 0
+ yyq2[5] = x.ReclaimPolicy != nil
var yynn2 int
if yyr2 || yy2arr2 {
- r.EncodeArrayStart(5)
+ r.EncodeArrayStart(6)
} else {
yynn2 = 1
for _, b := range yyq2 {
@@ -234,6 +237,33 @@ func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
}
+ if yyr2 || yy2arr2 {
+ z.EncSendContainerState(codecSelfer_containerArrayElem1234)
+ if yyq2[5] {
+ if x.ReclaimPolicy == nil {
+ r.EncodeNil()
+ } else {
+ yy21 := *x.ReclaimPolicy
+ yysf22 := &yy21
+ yysf22.CodecEncodeSelf(e)
+ }
+ } else {
+ r.EncodeNil()
+ }
+ } else {
+ if yyq2[5] {
+ z.EncSendContainerState(codecSelfer_containerMapKey1234)
+ r.EncodeString(codecSelferC_UTF81234, string("reclaimPolicy"))
+ z.EncSendContainerState(codecSelfer_containerMapValue1234)
+ if x.ReclaimPolicy == nil {
+ r.EncodeNil()
+ } else {
+ yy23 := *x.ReclaimPolicy
+ yysf24 := &yy23
+ yysf24.CodecEncodeSelf(e)
+ }
+ }
+ }
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@@ -356,6 +386,17 @@ func (x *StorageClass) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.F.DecMapStringStringX(yyv12, false, d)
}
}
+ case "reclaimPolicy":
+ if r.TryDecodeAsNil() {
+ if x.ReclaimPolicy != nil {
+ x.ReclaimPolicy = nil
+ }
+ } else {
+ if x.ReclaimPolicy == nil {
+ x.ReclaimPolicy = new(pkg3_v1.PersistentVolumeReclaimPolicy)
+ }
+ x.ReclaimPolicy.CodecDecodeSelf(d)
+ }
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@@ -367,16 +408,16 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
- var yyj14 int
- var yyb14 bool
- var yyhl14 bool = l >= 0
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ var yyj15 int
+ var yyb15 bool
+ var yyhl15 bool = l >= 0
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -384,21 +425,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
- yyv15 := &x.Kind
- yym16 := z.DecBinary()
- _ = yym16
+ yyv16 := &x.Kind
+ yym17 := z.DecBinary()
+ _ = yym17
if false {
} else {
- *((*string)(yyv15)) = r.DecodeString()
+ *((*string)(yyv16)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -406,21 +447,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
- yyv17 := &x.APIVersion
- yym18 := z.DecBinary()
- _ = yym18
+ yyv18 := &x.APIVersion
+ yym19 := z.DecBinary()
+ _ = yym19
if false {
} else {
- *((*string)(yyv17)) = r.DecodeString()
+ *((*string)(yyv18)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -428,22 +469,22 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else {
- yyv19 := &x.ObjectMeta
- yym20 := z.DecBinary()
- _ = yym20
+ yyv20 := &x.ObjectMeta
+ yym21 := z.DecBinary()
+ _ = yym21
if false {
- } else if z.HasExtensions() && z.DecExt(yyv19) {
+ } else if z.HasExtensions() && z.DecExt(yyv20) {
} else {
- z.DecFallback(yyv19, false)
+ z.DecFallback(yyv20, false)
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -451,21 +492,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
- yyv21 := &x.Provisioner
- yym22 := z.DecBinary()
- _ = yym22
+ yyv22 := &x.Provisioner
+ yym23 := z.DecBinary()
+ _ = yym23
if false {
} else {
- *((*string)(yyv21)) = r.DecodeString()
+ *((*string)(yyv22)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -473,26 +514,47 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
- yyv23 := &x.Parameters
- yym24 := z.DecBinary()
- _ = yym24
+ yyv24 := &x.Parameters
+ yym25 := z.DecBinary()
+ _ = yym25
if false {
} else {
- z.F.DecMapStringStringX(yyv23, false, d)
+ z.F.DecMapStringStringX(yyv24, false, d)
}
}
- for {
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
+ } else {
+ yyb15 = r.CheckBreak()
+ }
+ if yyb15 {
+ z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
+ return
+ }
+ z.DecSendContainerState(codecSelfer_containerArrayElem1234)
+ if r.TryDecodeAsNil() {
+ if x.ReclaimPolicy != nil {
+ x.ReclaimPolicy = nil
}
- if yyb14 {
+ } else {
+ if x.ReclaimPolicy == nil {
+ x.ReclaimPolicy = new(pkg3_v1.PersistentVolumeReclaimPolicy)
+ }
+ x.ReclaimPolicy.CodecDecodeSelf(d)
+ }
+ for {
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
+ } else {
+ yyb15 = r.CheckBreak()
+ }
+ if yyb15 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
- z.DecStructFieldNotFound(yyj14-1, "")
+ z.DecStructFieldNotFound(yyj15-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@@ -904,7 +966,7 @@ func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.De
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
- yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 288)
+ yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 296)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
diff --git a/staging/src/k8s.io/api/storage/v1/types.go b/staging/src/k8s.io/api/storage/v1/types.go
index caa71907108..02b17795bb0 100644
--- a/staging/src/k8s.io/api/storage/v1/types.go
+++ b/staging/src/k8s.io/api/storage/v1/types.go
@@ -17,6 +17,7 @@ limitations under the License.
package v1
import (
+ "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -43,6 +44,11 @@ type StorageClass struct {
// create volumes of this storage class.
// +optional
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
+
+ // Dynamically provisioned PersistentVolumes of this storage class are
+ // created with this reclaimPolicy. Defaults to Delete.
+ // +optional
+ ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
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 a13106fa3c6..82a5eb61646 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
@@ -28,10 +28,11 @@ package v1
// AUTO-GENERATED FUNCTIONS START HERE
var map_StorageClass = map[string]string{
- "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
- "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
- "provisioner": "Provisioner indicates the type of the provisioner.",
- "parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
+ "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
+ "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
+ "provisioner": "Provisioner indicates the type of the provisioner.",
+ "parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
+ "reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
}
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 cd5c5d16239..3f8d5771e41 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
@@ -21,6 +21,7 @@ limitations under the License.
package v1
import (
+ core_v1 "k8s.io/api/core/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
@@ -59,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
(*out)[key] = val
}
}
+ if in.ReclaimPolicy != nil {
+ in, out := &in.ReclaimPolicy, &out.ReclaimPolicy
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(core_v1.PersistentVolumeReclaimPolicy)
+ **out = **in
+ }
+ }
return
}
diff --git a/staging/src/k8s.io/api/storage/v1beta1/BUILD b/staging/src/k8s.io/api/storage/v1beta1/BUILD
index 2c4953766bb..08bdaa7ba37 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/BUILD
+++ b/staging/src/k8s.io/api/storage/v1beta1/BUILD
@@ -20,6 +20,7 @@ go_library(
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/github.com/ugorji/go/codec:go_default_library",
+ "//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
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 b858a8c5c67..20ef9a29e17 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/generated.pb.go
@@ -34,6 +34,8 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
+import k8s_io_api_core_v1 "k8s.io/api/core/v1"
+
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
import strings "strings"
@@ -113,6 +115,12 @@ func (m *StorageClass) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], v)
}
}
+ if m.ReclaimPolicy != nil {
+ dAtA[i] = 0x22
+ i++
+ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ReclaimPolicy)))
+ i += copy(dAtA[i:], *m.ReclaimPolicy)
+ }
return i, nil
}
@@ -196,6 +204,10 @@ func (m *StorageClass) Size() (n int) {
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
}
}
+ if m.ReclaimPolicy != nil {
+ l = len(*m.ReclaimPolicy)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
return n
}
@@ -244,6 +256,7 @@ func (this *StorageClass) String() string {
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Provisioner:` + fmt.Sprintf("%v", this.Provisioner) + `,`,
`Parameters:` + mapStringForParameters + `,`,
+ `ReclaimPolicy:` + valueToStringGenerated(this.ReclaimPolicy) + `,`,
`}`,
}, "")
return s
@@ -471,6 +484,36 @@ func (m *StorageClass) Unmarshal(dAtA []byte) error {
m.Parameters[mapkey] = mapvalue
}
iNdEx = postIndex
+ case 4:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field ReclaimPolicy", 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 := k8s_io_api_core_v1.PersistentVolumeReclaimPolicy(dAtA[iNdEx:postIndex])
+ m.ReclaimPolicy = &s
+ iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
@@ -713,35 +756,38 @@ func init() {
}
var fileDescriptorGenerated = []byte{
- // 468 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x8e, 0xd3, 0x40,
- 0x10, 0xc6, 0xbd, 0x89, 0x22, 0xee, 0x36, 0x20, 0x22, 0x43, 0x11, 0xb9, 0xf0, 0x45, 0x57, 0xa5,
- 0xb9, 0x5d, 0x72, 0xfc, 0x51, 0x84, 0x44, 0x93, 0x13, 0x05, 0x12, 0x27, 0x4e, 0xa6, 0x43, 0x14,
- 0xac, 0x93, 0xc1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0x2b, 0x77, 0x99, 0x9e, 0xad,
+ 0xb7, 0x66, 0xed, 0x66, 0x6b, 0xd6, 0x6e, 0xb7, 0x66, 0xed, 0x4b, 0x62, 0xa2, 0x75, 0x62, 0xa2,
+ 0x9b, 0xc4, 0x44, 0xb7, 0x89, 0x89, 0x7e, 0x24, 0x26, 0xfa, 0xfa, 0xd3, 0xac, 0xbd, 0xff, 0xbf,
+ 0x70, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x94, 0xc8, 0xc6, 0xb6, 0x3d, 0x04, 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 689ad4de26b..a5978d2438a 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/generated.proto
+++ b/staging/src/k8s.io/api/storage/v1beta1/generated.proto
@@ -21,6 +21,7 @@ syntax = 'proto2';
package k8s.io.api.storage.v1beta1;
+import "k8s.io/api/core/v1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
@@ -47,6 +48,11 @@ message StorageClass {
// create volumes of this storage class.
// +optional
map parameters = 3;
+
+ // Dynamically provisioned PersistentVolumes of this storage class are
+ // created with this reclaimPolicy. Defaults to Delete.
+ // +optional
+ optional string reclaimPolicy = 4;
}
// StorageClassList is a collection of storage classes.
diff --git a/staging/src/k8s.io/api/storage/v1beta1/types.generated.go b/staging/src/k8s.io/api/storage/v1beta1/types.generated.go
index d9f5d5f77dc..3caaac55851 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/types.generated.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/types.generated.go
@@ -25,6 +25,7 @@ import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
+ pkg3_v1 "k8s.io/api/core/v1"
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkg2_types "k8s.io/apimachinery/pkg/types"
"reflect"
@@ -62,10 +63,11 @@ func init() {
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
- var v0 pkg1_v1.TypeMeta
- var v1 pkg2_types.UID
- var v2 time.Time
- _, _, _ = v0, v1, v2
+ var v0 pkg3_v1.PersistentVolumeReclaimPolicy
+ var v1 pkg1_v1.TypeMeta
+ var v2 pkg2_types.UID
+ var v3 time.Time
+ _, _, _, _ = v0, v1, v2, v3
}
}
@@ -83,16 +85,17 @@ func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
- var yyq2 [5]bool
+ var yyq2 [6]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Kind != ""
yyq2[1] = x.APIVersion != ""
yyq2[2] = true
yyq2[4] = len(x.Parameters) != 0
+ yyq2[5] = x.ReclaimPolicy != nil
var yynn2 int
if yyr2 || yy2arr2 {
- r.EncodeArrayStart(5)
+ r.EncodeArrayStart(6)
} else {
yynn2 = 1
for _, b := range yyq2 {
@@ -234,6 +237,33 @@ func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
}
+ if yyr2 || yy2arr2 {
+ z.EncSendContainerState(codecSelfer_containerArrayElem1234)
+ if yyq2[5] {
+ if x.ReclaimPolicy == nil {
+ r.EncodeNil()
+ } else {
+ yy21 := *x.ReclaimPolicy
+ yysf22 := &yy21
+ yysf22.CodecEncodeSelf(e)
+ }
+ } else {
+ r.EncodeNil()
+ }
+ } else {
+ if yyq2[5] {
+ z.EncSendContainerState(codecSelfer_containerMapKey1234)
+ r.EncodeString(codecSelferC_UTF81234, string("reclaimPolicy"))
+ z.EncSendContainerState(codecSelfer_containerMapValue1234)
+ if x.ReclaimPolicy == nil {
+ r.EncodeNil()
+ } else {
+ yy23 := *x.ReclaimPolicy
+ yysf24 := &yy23
+ yysf24.CodecEncodeSelf(e)
+ }
+ }
+ }
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@@ -356,6 +386,17 @@ func (x *StorageClass) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.F.DecMapStringStringX(yyv12, false, d)
}
}
+ case "reclaimPolicy":
+ if r.TryDecodeAsNil() {
+ if x.ReclaimPolicy != nil {
+ x.ReclaimPolicy = nil
+ }
+ } else {
+ if x.ReclaimPolicy == nil {
+ x.ReclaimPolicy = new(pkg3_v1.PersistentVolumeReclaimPolicy)
+ }
+ x.ReclaimPolicy.CodecDecodeSelf(d)
+ }
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@@ -367,16 +408,16 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
- var yyj14 int
- var yyb14 bool
- var yyhl14 bool = l >= 0
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ var yyj15 int
+ var yyb15 bool
+ var yyhl15 bool = l >= 0
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -384,21 +425,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
- yyv15 := &x.Kind
- yym16 := z.DecBinary()
- _ = yym16
+ yyv16 := &x.Kind
+ yym17 := z.DecBinary()
+ _ = yym17
if false {
} else {
- *((*string)(yyv15)) = r.DecodeString()
+ *((*string)(yyv16)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -406,21 +447,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
- yyv17 := &x.APIVersion
- yym18 := z.DecBinary()
- _ = yym18
+ yyv18 := &x.APIVersion
+ yym19 := z.DecBinary()
+ _ = yym19
if false {
} else {
- *((*string)(yyv17)) = r.DecodeString()
+ *((*string)(yyv18)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -428,22 +469,22 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else {
- yyv19 := &x.ObjectMeta
- yym20 := z.DecBinary()
- _ = yym20
+ yyv20 := &x.ObjectMeta
+ yym21 := z.DecBinary()
+ _ = yym21
if false {
- } else if z.HasExtensions() && z.DecExt(yyv19) {
+ } else if z.HasExtensions() && z.DecExt(yyv20) {
} else {
- z.DecFallback(yyv19, false)
+ z.DecFallback(yyv20, false)
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -451,21 +492,21 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
- yyv21 := &x.Provisioner
- yym22 := z.DecBinary()
- _ = yym22
+ yyv22 := &x.Provisioner
+ yym23 := z.DecBinary()
+ _ = yym23
if false {
} else {
- *((*string)(yyv21)) = r.DecodeString()
+ *((*string)(yyv22)) = r.DecodeString()
}
}
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
} else {
- yyb14 = r.CheckBreak()
+ yyb15 = r.CheckBreak()
}
- if yyb14 {
+ if yyb15 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -473,26 +514,47 @@ func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
- yyv23 := &x.Parameters
- yym24 := z.DecBinary()
- _ = yym24
+ yyv24 := &x.Parameters
+ yym25 := z.DecBinary()
+ _ = yym25
if false {
} else {
- z.F.DecMapStringStringX(yyv23, false, d)
+ z.F.DecMapStringStringX(yyv24, false, d)
}
}
- for {
- yyj14++
- if yyhl14 {
- yyb14 = yyj14 > l
- } else {
- yyb14 = r.CheckBreak()
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
+ } else {
+ yyb15 = r.CheckBreak()
+ }
+ if yyb15 {
+ z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
+ return
+ }
+ z.DecSendContainerState(codecSelfer_containerArrayElem1234)
+ if r.TryDecodeAsNil() {
+ if x.ReclaimPolicy != nil {
+ x.ReclaimPolicy = nil
}
- if yyb14 {
+ } else {
+ if x.ReclaimPolicy == nil {
+ x.ReclaimPolicy = new(pkg3_v1.PersistentVolumeReclaimPolicy)
+ }
+ x.ReclaimPolicy.CodecDecodeSelf(d)
+ }
+ for {
+ yyj15++
+ if yyhl15 {
+ yyb15 = yyj15 > l
+ } else {
+ yyb15 = r.CheckBreak()
+ }
+ if yyb15 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
- z.DecStructFieldNotFound(yyj14-1, "")
+ z.DecStructFieldNotFound(yyj15-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@@ -904,7 +966,7 @@ func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.De
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
- yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 288)
+ yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 296)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
diff --git a/staging/src/k8s.io/api/storage/v1beta1/types.go b/staging/src/k8s.io/api/storage/v1beta1/types.go
index 7a15aa0f2ea..aa828172a44 100644
--- a/staging/src/k8s.io/api/storage/v1beta1/types.go
+++ b/staging/src/k8s.io/api/storage/v1beta1/types.go
@@ -17,6 +17,7 @@ limitations under the License.
package v1beta1
import (
+ "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -43,6 +44,11 @@ type StorageClass struct {
// create volumes of this storage class.
// +optional
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
+
+ // Dynamically provisioned PersistentVolumes of this storage class are
+ // created with this reclaimPolicy. Defaults to Delete.
+ // +optional
+ ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
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 0d43bb03c3d..7a4942e437b 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
@@ -28,10 +28,11 @@ package v1beta1
// AUTO-GENERATED FUNCTIONS START HERE
var map_StorageClass = map[string]string{
- "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
- "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
- "provisioner": "Provisioner indicates the type of the provisioner.",
- "parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
+ "": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
+ "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
+ "provisioner": "Provisioner indicates the type of the provisioner.",
+ "parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
+ "reclaimPolicy": "Dynamically provisioned PersistentVolumes of this storage class are created with this reclaimPolicy. Defaults to Delete.",
}
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 2a1afe1cd62..e89661c18f5 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
@@ -21,6 +21,7 @@ limitations under the License.
package v1beta1
import (
+ v1 "k8s.io/api/core/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
@@ -59,6 +60,15 @@ func (in *StorageClass) DeepCopyInto(out *StorageClass) {
(*out)[key] = val
}
}
+ if in.ReclaimPolicy != nil {
+ in, out := &in.ReclaimPolicy, &out.ReclaimPolicy
+ if *in == nil {
+ *out = nil
+ } else {
+ *out = new(v1.PersistentVolumeReclaimPolicy)
+ **out = **in
+ }
+ }
return
}