diff --git a/api/swagger-spec/apps_v1alpha1.json b/api/swagger-spec/apps_v1alpha1.json index d2e19731c45..84bbf0da3f7 100644 --- a/api/swagger-spec/apps_v1alpha1.json +++ b/api/swagger-spec/apps_v1alpha1.json @@ -1647,11 +1647,7 @@ "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", "required": [ "monitors", - "image", - "pool", - "user", - "keyring", - "secretRef" + "image" ], "properties": { "monitors": { @@ -1683,7 +1679,7 @@ }, "secretRef": { "$ref": "v1.LocalObjectReference", - "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" + "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" }, "readOnly": { "type": "boolean", diff --git a/api/swagger-spec/batch_v1.json b/api/swagger-spec/batch_v1.json index 73ab04d67c2..56cf0581703 100644 --- a/api/swagger-spec/batch_v1.json +++ b/api/swagger-spec/batch_v1.json @@ -1652,11 +1652,7 @@ "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", "required": [ "monitors", - "image", - "pool", - "user", - "keyring", - "secretRef" + "image" ], "properties": { "monitors": { @@ -1688,7 +1684,7 @@ }, "secretRef": { "$ref": "v1.LocalObjectReference", - "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" + "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" }, "readOnly": { "type": "boolean", diff --git a/api/swagger-spec/extensions_v1beta1.json b/api/swagger-spec/extensions_v1beta1.json index e12d6e96310..d926bcdc1cb 100644 --- a/api/swagger-spec/extensions_v1beta1.json +++ b/api/swagger-spec/extensions_v1beta1.json @@ -7479,11 +7479,7 @@ "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", "required": [ "monitors", - "image", - "pool", - "user", - "keyring", - "secretRef" + "image" ], "properties": { "monitors": { @@ -7515,7 +7511,7 @@ }, "secretRef": { "$ref": "v1.LocalObjectReference", - "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" + "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" }, "readOnly": { "type": "boolean", diff --git a/api/swagger-spec/v1.json b/api/swagger-spec/v1.json index 2db61fd8713..a09b10ff663 100644 --- a/api/swagger-spec/v1.json +++ b/api/swagger-spec/v1.json @@ -17339,11 +17339,7 @@ "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.", "required": [ "monitors", - "image", - "pool", - "user", - "keyring", - "secretRef" + "image" ], "properties": { "monitors": { @@ -17375,7 +17371,7 @@ }, "secretRef": { "$ref": "v1.LocalObjectReference", - "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" + "description": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it" }, "readOnly": { "type": "boolean", diff --git a/docs/api-reference/batch/v1/definitions.html b/docs/api-reference/batch/v1/definitions.html index 18754573de4..8e39b462990 100755 --- a/docs/api-reference/batch/v1/definitions.html +++ b/docs/api-reference/batch/v1/definitions.html @@ -4056,28 +4056,28 @@ Populated by the system when a graceful deletion is requested. Read-only. More i

pool

The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it.

-

true

+

false

string

user

The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

keyring

Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

secretRef

-

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

+

false

v1.LocalObjectReference

@@ -4103,7 +4103,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i diff --git a/docs/api-reference/extensions/v1beta1/definitions.html b/docs/api-reference/extensions/v1beta1/definitions.html index a38cf74d7ea..f0295aec273 100755 --- a/docs/api-reference/extensions/v1beta1/definitions.html +++ b/docs/api-reference/extensions/v1beta1/definitions.html @@ -3908,28 +3908,28 @@ Populated by the system when a graceful deletion is requested. Read-only. More i

pool

The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it.

-

true

+

false

string

user

The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

keyring

Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

secretRef

-

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

+

false

v1.LocalObjectReference

@@ -6093,7 +6093,7 @@ Both these may change in the future. Incoming requests are matched against the h diff --git a/docs/api-reference/v1/definitions.html b/docs/api-reference/v1/definitions.html index 660eecdebd1..e365f9c2ac8 100755 --- a/docs/api-reference/v1/definitions.html +++ b/docs/api-reference/v1/definitions.html @@ -4971,28 +4971,28 @@ The resulting set of endpoints can be viewed as:

pool

The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it.

-

true

+

false

string

user

The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

keyring

Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

false

string

secretRef

-

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

-

true

+

SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

+

false

v1.LocalObjectReference

@@ -8105,7 +8105,7 @@ The resulting set of endpoints can be viewed as:
diff --git a/pkg/api/testing/fuzzer.go b/pkg/api/testing/fuzzer.go index 5c52bbb77e2..8e3094ad825 100644 --- a/pkg/api/testing/fuzzer.go +++ b/pkg/api/testing/fuzzer.go @@ -333,6 +333,20 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source) c.FuzzNoCustom(s) // fuzz self without calling this function again s.Type = api.SecretTypeOpaque }, + func(r *api.RBDVolumeSource, c fuzz.Continue) { + r.RBDPool = c.RandString() + if r.RBDPool == "" { + r.RBDPool = "rbd" + } + r.RadosUser = c.RandString() + if r.RadosUser == "" { + r.RadosUser = "admin" + } + r.Keyring = c.RandString() + if r.Keyring == "" { + r.Keyring = "/etc/ceph/keyring" + } + }, func(pv *api.PersistentVolume, c fuzz.Continue) { c.FuzzNoCustom(pv) // fuzz self without calling this function again types := []api.PersistentVolumePhase{api.VolumeAvailable, api.VolumePending, api.VolumeBound, api.VolumeReleased, api.VolumeFailed} diff --git a/pkg/api/types.generated.go b/pkg/api/types.generated.go index b7c6d05a4d8..6abe187dbf2 100644 --- a/pkg/api/types.generated.go +++ b/pkg/api/types.generated.go @@ -11999,12 +11999,16 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[2] = x.FSType != "" + yyq2[3] = x.RBDPool != "" + yyq2[4] = x.RadosUser != "" + yyq2[5] = x.Keyring != "" + yyq2[6] = x.SecretRef != nil yyq2[7] = x.ReadOnly != false var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - yynn2 = 6 + yynn2 = 2 for _, b := range yyq2 { if b { yynn2++ @@ -12086,76 +12090,100 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym13 := z.EncBinary() - _ = yym13 - if false { + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("pool")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("pool")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym16 := z.EncBinary() - _ = yym16 - if false { + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("user")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("user")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym19 := z.EncBinary() - _ = yym19 - if false { + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("keyring")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("keyring")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if x.SecretRef == nil { + if yyq2[6] { + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } else { r.EncodeNil() - } else { - x.SecretRef.CodecEncodeSelf(e) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("secretRef")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.SecretRef == nil { - r.EncodeNil() - } else { - x.SecretRef.CodecEncodeSelf(e) + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } } } if yyr2 || yy2arr2 { diff --git a/pkg/api/types.go b/pkg/api/types.go index 6a3aa5c4052..6392ec21fa1 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -645,13 +645,13 @@ type RBDVolumeSource struct { // TODO: how do we prevent errors in the filesystem from compromising the machine FSType string `json:"fsType,omitempty"` // Optional: RadosPool is the rados pool name,default is rbd - RBDPool string `json:"pool"` + RBDPool string `json:"pool,omitempty"` // Optional: RBDUser is the rados user name, default is admin - RadosUser string `json:"user"` + RadosUser string `json:"user,omitempty"` // Optional: Keyring is the path to key ring for RBDUser, default is /etc/ceph/keyring - Keyring string `json:"keyring"` - // Optional: SecretRef is name of the authentication secret for RBDUser, default is empty. - SecretRef *LocalObjectReference `json:"secretRef"` + Keyring string `json:"keyring,omitempty"` + // Optional: SecretRef is name of the authentication secret for RBDUser, default is nil. + SecretRef *LocalObjectReference `json:"secretRef,omitempty"` // Optional: Defaults to false (read/write). ReadOnly here will force // the ReadOnly setting in VolumeMounts. ReadOnly bool `json:"readOnly,omitempty"` diff --git a/pkg/api/v1/conversion_generated.go b/pkg/api/v1/conversion_generated.go index 59fe6edc04f..d2f9548a5a7 100644 --- a/pkg/api/v1/conversion_generated.go +++ b/pkg/api/v1/conversion_generated.go @@ -5106,6 +5106,7 @@ func Convert_api_Probe_To_v1_Probe(in *api.Probe, out *Probe, s conversion.Scope } func autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error { + SetDefaults_RBDVolumeSource(in) out.CephMonitors = in.CephMonitors out.RBDImage = in.RBDImage out.FSType = in.FSType diff --git a/pkg/api/v1/defaults.go b/pkg/api/v1/defaults.go index 938df8ec8f5..c6f11b4ee16 100644 --- a/pkg/api/v1/defaults.go +++ b/pkg/api/v1/defaults.go @@ -47,6 +47,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) { SetDefaults_ObjectFieldSelector, SetDefaults_LimitRangeItem, SetDefaults_ConfigMap, + SetDefaults_RBDVolumeSource, ) } @@ -286,3 +287,15 @@ func defaultHostNetworkPorts(containers *[]Container) { } } } + +func SetDefaults_RBDVolumeSource(obj *RBDVolumeSource) { + if obj.RBDPool == "" { + obj.RBDPool = "rbd" + } + if obj.RadosUser == "" { + obj.RadosUser = "admin" + } + if obj.Keyring == "" { + obj.Keyring = "/etc/ceph/keyring" + } +} diff --git a/pkg/api/v1/generated.proto b/pkg/api/v1/generated.proto index f049831837e..f8b1fe247e6 100644 --- a/pkg/api/v1/generated.proto +++ b/pkg/api/v1/generated.proto @@ -2276,7 +2276,7 @@ message RBDVolumeSource { // SecretRef is name of the authentication secret for RBDUser. If provided // overrides keyring. - // Default is empty. + // Default is nil. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it optional LocalObjectReference secretRef = 7; diff --git a/pkg/api/v1/types.generated.go b/pkg/api/v1/types.generated.go index 5ccb6999081..b381d52b44e 100644 --- a/pkg/api/v1/types.generated.go +++ b/pkg/api/v1/types.generated.go @@ -9452,12 +9452,16 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { _, _, _ = yysep2, yyq2, yy2arr2 const yyr2 bool = false yyq2[2] = x.FSType != "" + yyq2[3] = x.RBDPool != "" + yyq2[4] = x.RadosUser != "" + yyq2[5] = x.Keyring != "" + yyq2[6] = x.SecretRef != nil yyq2[7] = x.ReadOnly != false var yynn2 int if yyr2 || yy2arr2 { r.EncodeArrayStart(8) } else { - yynn2 = 6 + yynn2 = 2 for _, b := range yyq2 { if b { yynn2++ @@ -9539,76 +9543,100 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) { } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym13 := z.EncBinary() - _ = yym13 - if false { + if yyq2[3] { + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("pool")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym14 := z.EncBinary() - _ = yym14 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + if yyq2[3] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("pool")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym16 := z.EncBinary() - _ = yym16 - if false { + if yyq2[4] { + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("user")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym17 := z.EncBinary() - _ = yym17 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + if yyq2[4] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("user")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - yym19 := z.EncBinary() - _ = yym19 - if false { + if yyq2[5] { + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + } } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + r.EncodeString(codecSelferC_UTF81234, "") } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("keyring")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - yym20 := z.EncBinary() - _ = yym20 - if false { - } else { - r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + if yyq2[5] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("keyring")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) + } } } if yyr2 || yy2arr2 { z.EncSendContainerState(codecSelfer_containerArrayElem1234) - if x.SecretRef == nil { + if yyq2[6] { + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } + } else { r.EncodeNil() - } else { - x.SecretRef.CodecEncodeSelf(e) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1234) - r.EncodeString(codecSelferC_UTF81234, string("secretRef")) - z.EncSendContainerState(codecSelfer_containerMapValue1234) - if x.SecretRef == nil { - r.EncodeNil() - } else { - x.SecretRef.CodecEncodeSelf(e) + if yyq2[6] { + z.EncSendContainerState(codecSelfer_containerMapKey1234) + r.EncodeString(codecSelferC_UTF81234, string("secretRef")) + z.EncSendContainerState(codecSelfer_containerMapValue1234) + if x.SecretRef == nil { + r.EncodeNil() + } else { + x.SecretRef.CodecEncodeSelf(e) + } } } if yyr2 || yy2arr2 { diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index 9aecfd56d6b..3942099e83c 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -573,20 +573,20 @@ type RBDVolumeSource struct { // The rados pool name. // Default is rbd. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it. - RBDPool string `json:"pool" protobuf:"bytes,4,opt,name=pool"` + RBDPool string `json:"pool,omitempty" protobuf:"bytes,4,opt,name=pool"` // The rados user name. // Default is admin. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it - RadosUser string `json:"user" protobuf:"bytes,5,opt,name=user"` + RadosUser string `json:"user,omitempty" protobuf:"bytes,5,opt,name=user"` // Keyring is the path to key ring for RBDUser. // Default is /etc/ceph/keyring. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it - Keyring string `json:"keyring" protobuf:"bytes,6,opt,name=keyring"` + Keyring string `json:"keyring,omitempty" protobuf:"bytes,6,opt,name=keyring"` // SecretRef is name of the authentication secret for RBDUser. If provided // overrides keyring. - // Default is empty. + // Default is nil. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it - SecretRef *LocalObjectReference `json:"secretRef" protobuf:"bytes,7,opt,name=secretRef"` + SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,7,opt,name=secretRef"` // ReadOnly here will force the ReadOnly setting in VolumeMounts. // Defaults to false. // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it diff --git a/pkg/api/v1/types_swagger_doc_generated.go b/pkg/api/v1/types_swagger_doc_generated.go index cf40307487d..cb85f338d7c 100644 --- a/pkg/api/v1/types_swagger_doc_generated.go +++ b/pkg/api/v1/types_swagger_doc_generated.go @@ -1337,7 +1337,7 @@ var map_RBDVolumeSource = map[string]string{ "pool": "The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it.", "user": "The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", "keyring": "Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", - "secretRef": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", + "secretRef": "SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", "readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it", } diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 361b6199723..337a19904bc 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -107,17 +107,8 @@ func (plugin *rbdPlugin) getRBDVolumeSource(spec *volume.Spec) (*api.RBDVolumeSo func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager diskManager, mounter mount.Interface, secret string) (volume.Mounter, error) { source, readOnly := plugin.getRBDVolumeSource(spec) pool := source.RBDPool - if pool == "" { - pool = "rbd" - } id := source.RadosUser - if id == "" { - id = "admin" - } keyring := source.Keyring - if keyring == "" { - keyring = "/etc/ceph/keyring" - } return &rbdMounter{ rbd: &rbd{