Merge pull request #25490 from rootfs/rbd-defaults

Automatic merge from submit-queue

correction on rbd volume object and defaults

- add `omitempty` to `RBDPool RadosUser Keyring SecretRef ReadOnly`
- move defaults from `pkg/volume/rbd/rbd.go` to `pkg/api/v1/defaults.go`

addressing #18885
This commit is contained in:
k8s-merge-robot 2016-06-06 13:02:22 -07:00
commit 1de4b05442
17 changed files with 216 additions and 157 deletions

View File

@ -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.", "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.",
"required": [ "required": [
"monitors", "monitors",
"image", "image"
"pool",
"user",
"keyring",
"secretRef"
], ],
"properties": { "properties": {
"monitors": { "monitors": {
@ -1683,7 +1679,7 @@
}, },
"secretRef": { "secretRef": {
"$ref": "v1.LocalObjectReference", "$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": { "readOnly": {
"type": "boolean", "type": "boolean",

View File

@ -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.", "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.",
"required": [ "required": [
"monitors", "monitors",
"image", "image"
"pool",
"user",
"keyring",
"secretRef"
], ],
"properties": { "properties": {
"monitors": { "monitors": {
@ -1688,7 +1684,7 @@
}, },
"secretRef": { "secretRef": {
"$ref": "v1.LocalObjectReference", "$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": { "readOnly": {
"type": "boolean", "type": "boolean",

View File

@ -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.", "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.",
"required": [ "required": [
"monitors", "monitors",
"image", "image"
"pool",
"user",
"keyring",
"secretRef"
], ],
"properties": { "properties": {
"monitors": { "monitors": {
@ -7515,7 +7511,7 @@
}, },
"secretRef": { "secretRef": {
"$ref": "v1.LocalObjectReference", "$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": { "readOnly": {
"type": "boolean", "type": "boolean",

View File

@ -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.", "description": "Represents a Rados Block Device mount that lasts the lifetime of a pod. RBD volumes support ownership management and SELinux relabeling.",
"required": [ "required": [
"monitors", "monitors",
"image", "image"
"pool",
"user",
"keyring",
"secretRef"
], ],
"properties": { "properties": {
"monitors": { "monitors": {
@ -17375,7 +17371,7 @@
}, },
"secretRef": { "secretRef": {
"$ref": "v1.LocalObjectReference", "$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": { "readOnly": {
"type": "boolean", "type": "boolean",

View File

@ -4056,28 +4056,28 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
@ -4103,7 +4103,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2016-05-24 11:53:33 UTC Last updated 2016-06-06 17:05:30 UTC
</div> </div>
</div> </div>
</body> </body>

View File

@ -3908,28 +3908,28 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
@ -6093,7 +6093,7 @@ Both these may change in the future. Incoming requests are matched against the h
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2016-05-24 11:53:27 UTC Last updated 2016-06-06 17:05:19 UTC
</div> </div>
</div> </div>
</body> </body>

View File

@ -4971,28 +4971,28 @@ The resulting set of endpoints can be viewed as:<br>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">pool</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados pool name. Default is rbd. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a>.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">user</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">The rados user name. Default is admin. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">keyring</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
<tr> <tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">secretRef</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is empty. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">SecretRef is name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: <a href="http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_localobjectreference">v1.LocalObjectReference</a></p></td>
<td class="tableblock halign-left valign-top"></td> <td class="tableblock halign-left valign-top"></td>
</tr> </tr>
@ -8105,7 +8105,7 @@ The resulting set of endpoints can be viewed as:<br>
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2016-05-30 16:33:41 UTC Last updated 2016-06-06 17:05:06 UTC
</div> </div>
</div> </div>
</body> </body>

View File

@ -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 c.FuzzNoCustom(s) // fuzz self without calling this function again
s.Type = api.SecretTypeOpaque 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) { func(pv *api.PersistentVolume, c fuzz.Continue) {
c.FuzzNoCustom(pv) // fuzz self without calling this function again c.FuzzNoCustom(pv) // fuzz self without calling this function again
types := []api.PersistentVolumePhase{api.VolumeAvailable, api.VolumePending, api.VolumeBound, api.VolumeReleased, api.VolumeFailed} types := []api.PersistentVolumePhase{api.VolumeAvailable, api.VolumePending, api.VolumeBound, api.VolumeReleased, api.VolumeFailed}

View File

@ -11999,12 +11999,16 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[2] = x.FSType != "" 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 yyq2[7] = x.ReadOnly != false
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(8) r.EncodeArrayStart(8)
} else { } else {
yynn2 = 6 yynn2 = 2
for _, b := range yyq2 { for _, b := range yyq2 {
if b { if b {
yynn2++ yynn2++
@ -12086,6 +12090,7 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym13 := z.EncBinary() yym13 := z.EncBinary()
_ = yym13 _ = yym13
if false { if false {
@ -12093,6 +12098,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("pool")) r.EncodeString(codecSelferC_UTF81234, string("pool"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -12103,8 +12112,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary() yym16 := z.EncBinary()
_ = yym16 _ = yym16
if false { if false {
@ -12112,6 +12123,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("user")) r.EncodeString(codecSelferC_UTF81234, string("user"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -12122,8 +12137,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[5] {
yym19 := z.EncBinary() yym19 := z.EncBinary()
_ = yym19 _ = yym19
if false { if false {
@ -12131,6 +12148,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) r.EncodeString(codecSelferC_UTF81234, string(x.Keyring))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("keyring")) r.EncodeString(codecSelferC_UTF81234, string("keyring"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -12141,14 +12162,20 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) r.EncodeString(codecSelferC_UTF81234, string(x.Keyring))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[6] {
if x.SecretRef == nil { if x.SecretRef == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
x.SecretRef.CodecEncodeSelf(e) x.SecretRef.CodecEncodeSelf(e)
} }
} else { } else {
r.EncodeNil()
}
} else {
if yyq2[6] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("secretRef")) r.EncodeString(codecSelferC_UTF81234, string("secretRef"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -12158,6 +12185,7 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
x.SecretRef.CodecEncodeSelf(e) x.SecretRef.CodecEncodeSelf(e)
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[7] { if yyq2[7] {

View File

@ -645,13 +645,13 @@ type RBDVolumeSource struct {
// TODO: how do we prevent errors in the filesystem from compromising the machine // TODO: how do we prevent errors in the filesystem from compromising the machine
FSType string `json:"fsType,omitempty"` FSType string `json:"fsType,omitempty"`
// Optional: RadosPool is the rados pool name,default is rbd // 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 // 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 // Optional: Keyring is the path to key ring for RBDUser, default is /etc/ceph/keyring
Keyring string `json:"keyring"` Keyring string `json:"keyring,omitempty"`
// Optional: SecretRef is name of the authentication secret for RBDUser, default is empty. // Optional: SecretRef is name of the authentication secret for RBDUser, default is nil.
SecretRef *LocalObjectReference `json:"secretRef"` SecretRef *LocalObjectReference `json:"secretRef,omitempty"`
// Optional: Defaults to false (read/write). ReadOnly here will force // Optional: Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts. // the ReadOnly setting in VolumeMounts.
ReadOnly bool `json:"readOnly,omitempty"` ReadOnly bool `json:"readOnly,omitempty"`

View File

@ -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 { func autoConvert_v1_RBDVolumeSource_To_api_RBDVolumeSource(in *RBDVolumeSource, out *api.RBDVolumeSource, s conversion.Scope) error {
SetDefaults_RBDVolumeSource(in)
out.CephMonitors = in.CephMonitors out.CephMonitors = in.CephMonitors
out.RBDImage = in.RBDImage out.RBDImage = in.RBDImage
out.FSType = in.FSType out.FSType = in.FSType

View File

@ -47,6 +47,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) {
SetDefaults_ObjectFieldSelector, SetDefaults_ObjectFieldSelector,
SetDefaults_LimitRangeItem, SetDefaults_LimitRangeItem,
SetDefaults_ConfigMap, 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"
}
}

View File

@ -2276,7 +2276,7 @@ message RBDVolumeSource {
// SecretRef is name of the authentication secret for RBDUser. If provided // SecretRef is name of the authentication secret for RBDUser. If provided
// overrides keyring. // overrides keyring.
// Default is empty. // Default is nil.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it
optional LocalObjectReference secretRef = 7; optional LocalObjectReference secretRef = 7;

View File

@ -9452,12 +9452,16 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[2] = x.FSType != "" 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 yyq2[7] = x.ReadOnly != false
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(8) r.EncodeArrayStart(8)
} else { } else {
yynn2 = 6 yynn2 = 2
for _, b := range yyq2 { for _, b := range yyq2 {
if b { if b {
yynn2++ yynn2++
@ -9539,6 +9543,7 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym13 := z.EncBinary() yym13 := z.EncBinary()
_ = yym13 _ = yym13
if false { if false {
@ -9546,6 +9551,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("pool")) r.EncodeString(codecSelferC_UTF81234, string("pool"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -9556,8 +9565,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool)) r.EncodeString(codecSelferC_UTF81234, string(x.RBDPool))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
yym16 := z.EncBinary() yym16 := z.EncBinary()
_ = yym16 _ = yym16
if false { if false {
@ -9565,6 +9576,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("user")) r.EncodeString(codecSelferC_UTF81234, string("user"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -9575,8 +9590,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser)) r.EncodeString(codecSelferC_UTF81234, string(x.RadosUser))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[5] {
yym19 := z.EncBinary() yym19 := z.EncBinary()
_ = yym19 _ = yym19
if false { if false {
@ -9584,6 +9601,10 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) r.EncodeString(codecSelferC_UTF81234, string(x.Keyring))
} }
} else { } else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[5] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("keyring")) r.EncodeString(codecSelferC_UTF81234, string("keyring"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -9594,14 +9615,20 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string(x.Keyring)) r.EncodeString(codecSelferC_UTF81234, string(x.Keyring))
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[6] {
if x.SecretRef == nil { if x.SecretRef == nil {
r.EncodeNil() r.EncodeNil()
} else { } else {
x.SecretRef.CodecEncodeSelf(e) x.SecretRef.CodecEncodeSelf(e)
} }
} else { } else {
r.EncodeNil()
}
} else {
if yyq2[6] {
z.EncSendContainerState(codecSelfer_containerMapKey1234) z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("secretRef")) r.EncodeString(codecSelferC_UTF81234, string("secretRef"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
@ -9611,6 +9638,7 @@ func (x *RBDVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
x.SecretRef.CodecEncodeSelf(e) x.SecretRef.CodecEncodeSelf(e)
} }
} }
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[7] { if yyq2[7] {

View File

@ -573,20 +573,20 @@ type RBDVolumeSource struct {
// The rados pool name. // The rados pool name.
// Default is rbd. // Default is rbd.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it. // 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. // The rados user name.
// Default is admin. // Default is admin.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it // 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. // Keyring is the path to key ring for RBDUser.
// Default is /etc/ceph/keyring. // Default is /etc/ceph/keyring.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it // 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 // SecretRef is name of the authentication secret for RBDUser. If provided
// overrides keyring. // overrides keyring.
// Default is empty. // Default is nil.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it // 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. // ReadOnly here will force the ReadOnly setting in VolumeMounts.
// Defaults to false. // Defaults to false.
// More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it // More info: http://releases.k8s.io/HEAD/examples/rbd/README.md#how-to-use-it

View File

@ -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.", "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", "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", "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", "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",
} }

View File

@ -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) { 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) source, readOnly := plugin.getRBDVolumeSource(spec)
pool := source.RBDPool pool := source.RBDPool
if pool == "" {
pool = "rbd"
}
id := source.RadosUser id := source.RadosUser
if id == "" {
id = "admin"
}
keyring := source.Keyring keyring := source.Keyring
if keyring == "" {
keyring = "/etc/ceph/keyring"
}
return &rbdMounter{ return &rbdMounter{
rbd: &rbd{ rbd: &rbd{