mirror of
https://github.com/rancher/rke.git
synced 2025-09-18 16:36:41 +00:00
Final fixes and cleanup for state management
Fix dind and local and etcd snapshots add ExternalFlags and dialer options
This commit is contained in:
committed by
Alena Prokharchyk
parent
6da35256a8
commit
696b61679c
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rancher/rke/cloudprovider"
|
||||
"github.com/rancher/rke/docker"
|
||||
"github.com/rancher/rke/k8s"
|
||||
"github.com/rancher/rke/log"
|
||||
@@ -43,6 +44,16 @@ const (
|
||||
DefaultEtcdElectionTimeoutValue = "5000"
|
||||
)
|
||||
|
||||
type ExternalFlags struct {
|
||||
ConfigDir string
|
||||
ClusterFilePath string
|
||||
DisablePortCheck bool
|
||||
Local bool
|
||||
RotateCACerts bool
|
||||
RotateComponents []string
|
||||
UpdateOnly bool
|
||||
}
|
||||
|
||||
func setDefaultIfEmptyMapValue(configMap map[string]string, key string, value string) {
|
||||
if _, ok := configMap[key]; !ok {
|
||||
configMap[key] = value
|
||||
@@ -260,3 +271,33 @@ func d(image, defaultRegistryURL string) string {
|
||||
}
|
||||
return fmt.Sprintf("%s/%s", defaultRegistryURL, image)
|
||||
}
|
||||
|
||||
func (c *Cluster) setCloudProvider() error {
|
||||
p, err := cloudprovider.InitCloudProvider(c.CloudProvider)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to initialize cloud provider: %v", err)
|
||||
}
|
||||
if p != nil {
|
||||
c.CloudConfigFile, err = p.GenerateCloudConfigFile()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse cloud config file: %v", err)
|
||||
}
|
||||
c.CloudProvider.Name = p.GetName()
|
||||
if c.CloudProvider.Name == "" {
|
||||
return fmt.Errorf("Name of the cloud provider is not defined for custom provider")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetExternalFlags(local, rotateca, updateOnly, disablePortCheck bool, RotateComponents []string, configDir, clusterFilePath string) ExternalFlags {
|
||||
return ExternalFlags{
|
||||
Local: local,
|
||||
UpdateOnly: updateOnly,
|
||||
DisablePortCheck: disablePortCheck,
|
||||
ConfigDir: configDir,
|
||||
ClusterFilePath: clusterFilePath,
|
||||
RotateCACerts: rotateca,
|
||||
RotateComponents: RotateComponents,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user