Allow relative and ~ path for container mount
This patch allow to specify relative and home (~/) path for container mounts.src field. In case if specified path is not absolute, it will be created by following pattern: 'targetPath+mounts.src'; in case if path contains ~/ - it will be properly expanded (it will allow us to mount ~/.airship working directory). Change-Id: I878094371a2bc4e48216b1d076e466e3d29a86f6 Signed-off-by: Ruslan Aliev <raliev@mirantis.com> Relates-To: #484 Closes: #484
This commit is contained in:
@@ -187,7 +187,7 @@ func (b *Builder) trySource(clusterID, dstContext string, source v1alpha1.Kubeco
|
||||
getter = b.fromClusterAPI(clusterID, source.ClusterAPI)
|
||||
default:
|
||||
// TODO add validation for fast fails to clustermap interface instead of this
|
||||
return nil, &ErrUknownKubeconfigSourceType{Type: string(source.Type)}
|
||||
return nil, &ErrUnknownKubeconfigSourceType{Type: string(source.Type)}
|
||||
}
|
||||
kubeBytes, err := getter()
|
||||
if err != nil {
|
||||
|
||||
@@ -40,11 +40,11 @@ func IsErrAllSourcesFailedErr(err error) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// ErrUknownKubeconfigSourceType returned type of kubeconfig source is unknown
|
||||
type ErrUknownKubeconfigSourceType struct {
|
||||
// ErrUnknownKubeconfigSourceType returned type of kubeconfig source is unknown
|
||||
type ErrUnknownKubeconfigSourceType struct {
|
||||
Type string
|
||||
}
|
||||
|
||||
func (e *ErrUknownKubeconfigSourceType) Error() string {
|
||||
func (e *ErrUnknownKubeconfigSourceType) Error() string {
|
||||
return fmt.Sprintf("unknown source type %s", e.Type)
|
||||
}
|
||||
|
||||
@@ -113,10 +113,7 @@ func FromSecret(c client.Interface, o *client.GetKubeconfigOptions) KubeSourceFu
|
||||
// FromFile returns KubeSource type, uses path to kubeconfig on FS as source to construct kubeconfig object
|
||||
func FromFile(path string, fSys fs.FileSystem) KubeSourceFunc {
|
||||
return func() ([]byte, error) {
|
||||
expandedPath, err := util.ExpandTilde(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
expandedPath := util.ExpandTilde(path)
|
||||
if fSys == nil {
|
||||
fSys = fs.NewDocumentFs()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user