mirror of https://github.com/kubernetes/kops.git
GCE: move file assets to writeable location
On container OS, the /srv/kubernetes location is not writeable, so we use /etc/srv/kubernetes instead.
This commit is contained in:
parent
0224883aba
commit
2f6dc34704
|
@ -18,6 +18,7 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"k8s.io/kops/nodeup/pkg/distros"
|
"k8s.io/kops/nodeup/pkg/distros"
|
||||||
"k8s.io/kops/pkg/apis/kops"
|
"k8s.io/kops/pkg/apis/kops"
|
||||||
|
@ -71,6 +72,11 @@ func (c *NodeupModelContext) PathSrvKubernetes() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FileAssetsDefaultPath is the default location for assets which have no path
|
||||||
|
func (c *NodeupModelContext) FileAssetsDefaultPath() string {
|
||||||
|
return filepath.Join(c.PathSrvKubernetes(), "assets")
|
||||||
|
}
|
||||||
|
|
||||||
// PathSrvSshproxy returns the path for the SSL proxy
|
// PathSrvSshproxy returns the path for the SSL proxy
|
||||||
func (c *NodeupModelContext) PathSrvSshproxy() string {
|
func (c *NodeupModelContext) PathSrvSshproxy() string {
|
||||||
switch c.Distribution {
|
switch c.Distribution {
|
||||||
|
|
|
@ -28,11 +28,6 @@ import (
|
||||||
"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
|
"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// FileAssetsDefaultPath is the default location for assets which have no path
|
|
||||||
FileAssetsDefaultPath string = "/srv/kubernetes/assets"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FileAssetsBuilder configures the hooks
|
// FileAssetsBuilder configures the hooks
|
||||||
type FileAssetsBuilder struct {
|
type FileAssetsBuilder struct {
|
||||||
*NodeupModelContext
|
*NodeupModelContext
|
||||||
|
@ -46,7 +41,7 @@ func (f *FileAssetsBuilder) Build(c *fi.ModelBuilderContext) error {
|
||||||
tracker := make(map[string]bool, 0)
|
tracker := make(map[string]bool, 0)
|
||||||
// ensure the default path exists
|
// ensure the default path exists
|
||||||
c.AddTask(&nodetasks.File{
|
c.AddTask(&nodetasks.File{
|
||||||
Path: FileAssetsDefaultPath,
|
Path: f.FileAssetsDefaultPath(),
|
||||||
Type: nodetasks.FileType_Directory,
|
Type: nodetasks.FileType_Directory,
|
||||||
Mode: s("0755"),
|
Mode: s("0755"),
|
||||||
})
|
})
|
||||||
|
@ -75,7 +70,7 @@ func (f *FileAssetsBuilder) buildFileAssets(c *fi.ModelBuilderContext, assets []
|
||||||
// @check if e have a path and if not use the default path
|
// @check if e have a path and if not use the default path
|
||||||
assetPath := asset.Path
|
assetPath := asset.Path
|
||||||
if assetPath == "" {
|
if assetPath == "" {
|
||||||
assetPath = fmt.Sprintf("%s/%s", FileAssetsDefaultPath, asset.Name)
|
assetPath = filepath.Join(f.FileAssetsDefaultPath(), asset.Name)
|
||||||
}
|
}
|
||||||
// @check if the file has already been done and skip
|
// @check if the file has already been done and skip
|
||||||
if _, found := tracker[assetPath]; found {
|
if _, found := tracker[assetPath]; found {
|
||||||
|
|
Loading…
Reference in New Issue