mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #20069 from BugRoger/cephfs_subtree_mount_master
Auto commit by PR queue bot
This commit is contained in:
commit
71727385e8
@ -15173,6 +15173,10 @@
|
|||||||
},
|
},
|
||||||
"description": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
"description": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
||||||
},
|
},
|
||||||
|
"path": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /"
|
||||||
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
"description": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
||||||
|
@ -3816,6 +3816,10 @@
|
|||||||
},
|
},
|
||||||
"description": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
"description": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
||||||
},
|
},
|
||||||
|
"path": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /"
|
||||||
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
"description": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it"
|
||||||
|
@ -805,6 +805,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||||||
<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">path</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: Used as the mounted root, rather than the full Ceph tree, default is /</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"></td>
|
||||||
|
</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">Optional: User is the rados user name, default is admin More info: <a href="http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it</a></p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: User is the rados user name, default is admin More info: <a href="http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it</a></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">false</p></td>
|
||||||
@ -4457,7 +4464,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-01-28 22:16:41 UTC
|
Last updated 2016-02-01 21:08:12 UTC
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -852,6 +852,13 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||||||
<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">path</p></td>
|
||||||
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: Used as the mounted root, rather than the full Ceph tree, default is /</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"></td>
|
||||||
|
</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">Optional: User is the rados user name, default is admin More info: <a href="http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it</a></p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Optional: User is the rados user name, default is admin More info: <a href="http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it">http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it</a></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">false</p></td>
|
||||||
@ -7261,7 +7268,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-01-28 23:29:05 UTC
|
Last updated 2016-02-01 21:08:06 UTC
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -45,6 +45,7 @@ Then get the keyring from the Ceph cluster and copy it to */etc/ceph/keyring*.
|
|||||||
Once you have installed Ceph and a Kubernetes cluster, you can create a pod based on my examples [cephfs.yaml](cephfs.yaml) and [cephfs-with-secret.yaml](cephfs-with-secret.yaml). In the pod yaml, you need to provide the following information.
|
Once you have installed Ceph and a Kubernetes cluster, you can create a pod based on my examples [cephfs.yaml](cephfs.yaml) and [cephfs-with-secret.yaml](cephfs-with-secret.yaml). In the pod yaml, you need to provide the following information.
|
||||||
|
|
||||||
- *monitors*: Array of Ceph monitors.
|
- *monitors*: Array of Ceph monitors.
|
||||||
|
- *path*: Used as the mounted root, rather than the full Ceph tree. If not provided, default */* is used.
|
||||||
- *user*: The RADOS user name. If not provided, default *admin* is used.
|
- *user*: The RADOS user name. If not provided, default *admin* is used.
|
||||||
- *secretFile*: The path to the keyring file. If not provided, default */etc/ceph/user.secret* is used.
|
- *secretFile*: The path to the keyring file. If not provided, default */etc/ceph/user.secret* is used.
|
||||||
- *secretRef*: Reference to Ceph authentication secrets. If provided, *secret* overrides *secretFile*.
|
- *secretRef*: Reference to Ceph authentication secrets. If provided, *secret* overrides *secretFile*.
|
||||||
|
@ -227,6 +227,7 @@ func deepCopy_api_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSou
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
if in.SecretRef != nil {
|
if in.SecretRef != nil {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -637,6 +637,8 @@ type CinderVolumeSource struct {
|
|||||||
type CephFSVolumeSource struct {
|
type CephFSVolumeSource struct {
|
||||||
// Required: Monitors is a collection of Ceph monitors
|
// Required: Monitors is a collection of Ceph monitors
|
||||||
Monitors []string `json:"monitors"`
|
Monitors []string `json:"monitors"`
|
||||||
|
// Optional: Used as the mounted root, rather than the full Ceph tree, default is /
|
||||||
|
Path string `json:"path,omitempty"`
|
||||||
// Optional: User is the rados user name, default is admin
|
// Optional: User is the rados user name, default is admin
|
||||||
User string `json:"user,omitempty"`
|
User string `json:"user,omitempty"`
|
||||||
// Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret
|
// Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret
|
||||||
|
@ -99,6 +99,7 @@ func autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
// unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference
|
// unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference
|
||||||
@ -3263,6 +3264,7 @@ func autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *CephFSVolum
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
// unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference
|
// unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference
|
||||||
|
@ -115,6 +115,7 @@ func deepCopy_v1_CephFSVolumeSource(in CephFSVolumeSource, out *CephFSVolumeSour
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
if in.SecretRef != nil {
|
if in.SecretRef != nil {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -590,6 +590,8 @@ type CephFSVolumeSource struct {
|
|||||||
// Required: Monitors is a collection of Ceph monitors
|
// Required: Monitors is a collection of Ceph monitors
|
||||||
// More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it
|
// More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it
|
||||||
Monitors []string `json:"monitors"`
|
Monitors []string `json:"monitors"`
|
||||||
|
// Optional: Used as the mounted root, rather than the full Ceph tree, default is /
|
||||||
|
Path string `json:"path,omitempty"`
|
||||||
// Optional: User is the rados user name, default is admin
|
// Optional: User is the rados user name, default is admin
|
||||||
// More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it
|
// More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it
|
||||||
User string `json:"user,omitempty"`
|
User string `json:"user,omitempty"`
|
||||||
|
@ -62,6 +62,7 @@ func (Capabilities) SwaggerDoc() map[string]string {
|
|||||||
var map_CephFSVolumeSource = map[string]string{
|
var map_CephFSVolumeSource = map[string]string{
|
||||||
"": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.",
|
"": "Represents a Ceph Filesystem mount that lasts the lifetime of a pod Cephfs volumes do not support ownership management or SELinux relabeling.",
|
||||||
"monitors": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
"monitors": "Required: Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
||||||
|
"path": "Optional: Used as the mounted root, rather than the full Ceph tree, default is /",
|
||||||
"user": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
"user": "Optional: User is the rados user name, default is admin More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
||||||
"secretFile": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
"secretFile": "Optional: SecretFile is the path to key ring for User, default is /etc/ceph/user.secret More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
||||||
"secretRef": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
"secretRef": "Optional: SecretRef is reference to the authentication secret for User, default is empty. More info: http://releases.k8s.io/HEAD/examples/cephfs/README.md#how-to-use-it",
|
||||||
|
@ -83,6 +83,7 @@ func autoConvert_api_CephFSVolumeSource_To_v1_CephFSVolumeSource(in *api.CephFSV
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
// unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference
|
// unable to generate simple pointer conversion for api.LocalObjectReference -> v1.LocalObjectReference
|
||||||
@ -1294,6 +1295,7 @@ func autoConvert_v1_CephFSVolumeSource_To_api_CephFSVolumeSource(in *v1.CephFSVo
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
// unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference
|
// unable to generate simple pointer conversion for v1.LocalObjectReference -> api.LocalObjectReference
|
||||||
|
@ -102,6 +102,7 @@ func deepCopy_v1_CephFSVolumeSource(in v1.CephFSVolumeSource, out *v1.CephFSVolu
|
|||||||
} else {
|
} else {
|
||||||
out.Monitors = nil
|
out.Monitors = nil
|
||||||
}
|
}
|
||||||
|
out.Path = in.Path
|
||||||
out.User = in.User
|
out.User = in.User
|
||||||
out.SecretFile = in.SecretFile
|
out.SecretFile = in.SecretFile
|
||||||
if in.SecretRef != nil {
|
if in.SecretRef != nil {
|
||||||
|
@ -19,12 +19,13 @@ package cephfs
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
"k8s.io/kubernetes/pkg/util/strings"
|
utilstrings "k8s.io/kubernetes/pkg/util/strings"
|
||||||
"k8s.io/kubernetes/pkg/volume"
|
"k8s.io/kubernetes/pkg/volume"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -92,6 +93,13 @@ func (plugin *cephfsPlugin) newBuilderInternal(spec *volume.Spec, podUID types.U
|
|||||||
if id == "" {
|
if id == "" {
|
||||||
id = "admin"
|
id = "admin"
|
||||||
}
|
}
|
||||||
|
path := cephvs.Path
|
||||||
|
if path == "" {
|
||||||
|
path = "/"
|
||||||
|
}
|
||||||
|
if !strings.HasPrefix(path, "/") {
|
||||||
|
path = "/" + path
|
||||||
|
}
|
||||||
secret_file := cephvs.SecretFile
|
secret_file := cephvs.SecretFile
|
||||||
if secret_file == "" {
|
if secret_file == "" {
|
||||||
secret_file = "/etc/ceph/" + id + ".secret"
|
secret_file = "/etc/ceph/" + id + ".secret"
|
||||||
@ -102,6 +110,7 @@ func (plugin *cephfsPlugin) newBuilderInternal(spec *volume.Spec, podUID types.U
|
|||||||
podUID: podUID,
|
podUID: podUID,
|
||||||
volName: spec.Name(),
|
volName: spec.Name(),
|
||||||
mon: cephvs.Monitors,
|
mon: cephvs.Monitors,
|
||||||
|
path: path,
|
||||||
secret: secret,
|
secret: secret,
|
||||||
id: id,
|
id: id,
|
||||||
secret_file: secret_file,
|
secret_file: secret_file,
|
||||||
@ -138,6 +147,7 @@ type cephfs struct {
|
|||||||
volName string
|
volName string
|
||||||
podUID types.UID
|
podUID types.UID
|
||||||
mon []string
|
mon []string
|
||||||
|
path string
|
||||||
id string
|
id string
|
||||||
secret string
|
secret string
|
||||||
secret_file string
|
secret_file string
|
||||||
@ -208,7 +218,7 @@ func (cephfsVolume *cephfsCleaner) TearDownAt(dir string) error {
|
|||||||
// GatePath creates global mount path
|
// GatePath creates global mount path
|
||||||
func (cephfsVolume *cephfs) GetPath() string {
|
func (cephfsVolume *cephfs) GetPath() string {
|
||||||
name := cephfsPluginName
|
name := cephfsPluginName
|
||||||
return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, strings.EscapeQualifiedNameForDisk(name), cephfsVolume.volName)
|
return cephfsVolume.plugin.host.GetPodVolumeDir(cephfsVolume.podUID, utilstrings.EscapeQualifiedNameForDisk(name), cephfsVolume.volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cephfsVolume *cephfs) cleanup(dir string) error {
|
func (cephfsVolume *cephfs) cleanup(dir string) error {
|
||||||
@ -261,7 +271,7 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
|||||||
for i = 0; i < l-1; i++ {
|
for i = 0; i < l-1; i++ {
|
||||||
src += hosts[i] + ","
|
src += hosts[i] + ","
|
||||||
}
|
}
|
||||||
src += hosts[i] + ":/"
|
src += hosts[i] + ":" + cephfsVolume.path
|
||||||
|
|
||||||
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", opt); err != nil {
|
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", opt); err != nil {
|
||||||
return fmt.Errorf("CephFS: mount failed: %v", err)
|
return fmt.Errorf("CephFS: mount failed: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user