mirror of https://github.com/k3s-io/k3s
Disable storing bootstrap information by default
parent
a005219c5b
commit
2cb6f52339
|
@ -22,6 +22,7 @@ type Server struct {
|
|||
ExtraSchedulerArgs cli.StringSlice
|
||||
ExtraControllerArgs cli.StringSlice
|
||||
Rootless bool
|
||||
StoreBootstrap bool
|
||||
StorageEndpoint string
|
||||
StorageCAFile string
|
||||
StorageCertFile string
|
||||
|
@ -142,6 +143,12 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
|||
Usage: "(experimental) Run rootless",
|
||||
Destination: &ServerConfig.Rootless,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "bootstrap-save",
|
||||
Usage: "(experimental) Save bootstrap information in the storage endpoint",
|
||||
Hidden: true,
|
||||
Destination: &ServerConfig.StoreBootstrap,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "storage-endpoint",
|
||||
Usage: "Specify etcd, Mysql, Postgres, or Sqlite (default) data source name",
|
||||
|
|
|
@ -87,6 +87,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
|||
serverConfig.ControlConfig.Storage.KeyFile = cfg.StorageKeyFile
|
||||
serverConfig.ControlConfig.AdvertiseIP = cfg.AdvertiseIP
|
||||
serverConfig.ControlConfig.AdvertisePort = cfg.AdvertisePort
|
||||
serverConfig.ControlConfig.BootstrapReadOnly = !cfg.StoreBootstrap
|
||||
|
||||
if cmds.AgentConfig.FlannelIface != "" && cmds.AgentConfig.NodeIP == "" {
|
||||
cmds.AgentConfig.NodeIP = netutil.GetIPFromInterface(cmds.AgentConfig.FlannelIface)
|
||||
|
|
|
@ -68,28 +68,27 @@ type Agent struct {
|
|||
}
|
||||
|
||||
type Control struct {
|
||||
AdvertisePort int
|
||||
AdvertiseIP string
|
||||
ListenPort int
|
||||
HTTPSPort int
|
||||
ClusterSecret string
|
||||
ClusterIPRange *net.IPNet
|
||||
ServiceIPRange *net.IPNet
|
||||
ClusterDNS net.IP
|
||||
ClusterDomain string
|
||||
NoCoreDNS bool
|
||||
KubeConfigOutput string
|
||||
KubeConfigMode string
|
||||
DataDir string
|
||||
Skips []string
|
||||
BootstrapReadOnly bool
|
||||
BootstrapOverwriteLocal bool
|
||||
Storage endpoint.Config
|
||||
NoScheduler bool
|
||||
ExtraAPIArgs []string
|
||||
ExtraControllerArgs []string
|
||||
ExtraSchedulerAPIArgs []string
|
||||
NoLeaderElect bool
|
||||
AdvertisePort int
|
||||
AdvertiseIP string
|
||||
ListenPort int
|
||||
HTTPSPort int
|
||||
ClusterSecret string
|
||||
ClusterIPRange *net.IPNet
|
||||
ServiceIPRange *net.IPNet
|
||||
ClusterDNS net.IP
|
||||
ClusterDomain string
|
||||
NoCoreDNS bool
|
||||
KubeConfigOutput string
|
||||
KubeConfigMode string
|
||||
DataDir string
|
||||
Skips []string
|
||||
BootstrapReadOnly bool
|
||||
Storage endpoint.Config
|
||||
NoScheduler bool
|
||||
ExtraAPIArgs []string
|
||||
ExtraControllerArgs []string
|
||||
ExtraSchedulerAPIArgs []string
|
||||
NoLeaderElect bool
|
||||
|
||||
Runtime *ControlRuntime `json:"-"`
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ const (
|
|||
)
|
||||
|
||||
// fetchBootstrapData copies the bootstrap data (certs, keys, passwords)
|
||||
// from etcd to inidividual files specified by cfg.Runtime.
|
||||
// from etcd to individual files specified by cfg.Runtime.
|
||||
func fetchBootstrapData(ctx context.Context, cfg *config.Control, c client.Client) error {
|
||||
logrus.Info("Fetching bootstrap data from etcd")
|
||||
gr, err := c.Get(ctx, k3sRuntimeEtcdPath)
|
||||
|
@ -45,12 +45,6 @@ func fetchBootstrapData(ctx context.Context, cfg *config.Control, c client.Clien
|
|||
continue
|
||||
}
|
||||
|
||||
if !cfg.BootstrapOverwriteLocal {
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil {
|
||||
return errors.Wrapf(err, "failed to mkdir %s", filepath.Dir(path))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue