mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Enforce explicit read or write for bootstrap
This commit is contained in:
parent
403e73ab1c
commit
e79fda96d2
@ -77,7 +77,10 @@ func fetchBootstrapData(cfg *config.Control) error {
|
||||
return err
|
||||
}
|
||||
if len(gr.Kvs) == 0 {
|
||||
return nil
|
||||
if cfg.BootstrapType != bootstrapTypeRead {
|
||||
return nil
|
||||
}
|
||||
return errors.New("Unable to read bootstrap data from server")
|
||||
}
|
||||
|
||||
runtimeJSON, err := base64.URLEncoding.DecodeString(string(gr.Kvs[0].Value))
|
||||
@ -118,13 +121,16 @@ func storeBootstrapData(cfg *config.Control) error {
|
||||
}
|
||||
defer cli.Close()
|
||||
|
||||
gr, err := cli.Get(context.TODO(), k3sRuntimeEtcdPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(gr.Kvs) > 0 && string(gr.Kvs[0].Value) != "" {
|
||||
return nil
|
||||
if cfg.BootstrapType != bootstrapTypeWrite {
|
||||
gr, err := cli.Get(context.TODO(), k3sRuntimeEtcdPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(gr.Kvs) > 0 && string(gr.Kvs[0].Value) != "" {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
certData, err := readRuntimeBootstrapData(cfg.Runtime)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user