mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Expose InitializeCloudFromSecret()
This commit is contained in:
parent
d127ef5a44
commit
be3eeb296f
@ -248,7 +248,7 @@ func NewCloud(configReader io.Reader) (cloudprovider.Interface, error) {
|
|||||||
unmanagedNodes: sets.NewString(),
|
unmanagedNodes: sets.NewString(),
|
||||||
routeCIDRs: map[string]string{},
|
routeCIDRs: map[string]string{},
|
||||||
}
|
}
|
||||||
err = az.initializeCloudFromConfig(config, false)
|
err = az.InitializeCloudFromConfig(config, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -256,8 +256,8 @@ func NewCloud(configReader io.Reader) (cloudprovider.Interface, error) {
|
|||||||
return az, nil
|
return az, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializeCloudFromConfig initializes the Cloud from config.
|
// InitializeCloudFromConfig initializes the Cloud from config.
|
||||||
func (az *Cloud) initializeCloudFromConfig(config *Config, fromSecret bool) error {
|
func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret bool) error {
|
||||||
// cloud-config not set, return nil so that it would be initialized from secret.
|
// cloud-config not set, return nil so that it would be initialized from secret.
|
||||||
if config == nil {
|
if config == nil {
|
||||||
klog.Warning("cloud-config is not provided, Azure cloud provider would be initialized from secret")
|
klog.Warning("cloud-config is not provided, Azure cloud provider would be initialized from secret")
|
||||||
@ -545,7 +545,7 @@ func (az *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder,
|
|||||||
az.eventBroadcaster = record.NewBroadcaster()
|
az.eventBroadcaster = record.NewBroadcaster()
|
||||||
az.eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: az.kubeClient.CoreV1().Events("")})
|
az.eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: az.kubeClient.CoreV1().Events("")})
|
||||||
az.eventRecorder = az.eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "azure-cloud-provider"})
|
az.eventRecorder = az.eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "azure-cloud-provider"})
|
||||||
az.initializeCloudFromSecret()
|
az.InitializeCloudFromSecret()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
|
// LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise.
|
||||||
|
@ -58,7 +58,8 @@ const (
|
|||||||
secretOverrideTypeCan secretOverrideType = "can"
|
secretOverrideTypeCan secretOverrideType = "can"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (az *Cloud) initializeCloudFromSecret() {
|
// InitializeCloudFromSecret initializes Azure cloud provider from Kubernetes secret.
|
||||||
|
func (az *Cloud) InitializeCloudFromSecret() {
|
||||||
config, err := az.getConfigFromSecret()
|
config, err := az.getConfigFromSecret()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Warningf("Failed to get cloud-config from secret: %v, skip initializing from secret", err)
|
klog.Warningf("Failed to get cloud-config from secret: %v, skip initializing from secret", err)
|
||||||
@ -70,7 +71,7 @@ func (az *Cloud) initializeCloudFromSecret() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := az.initializeCloudFromConfig(config, true); err != nil {
|
if err := az.InitializeCloudFromConfig(config, true); err != nil {
|
||||||
klog.Errorf("Failed to initialize Azure cloud provider: %v", err)
|
klog.Errorf("Failed to initialize Azure cloud provider: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user