mirror of
https://github.com/outbackdingo/talos-cloud-controller-manager.git
synced 2026-01-27 18:20:23 +00:00
fix: refresh talos token
Due to the failover process, we also need to refresh the Talos token. Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
This commit is contained in:
@@ -47,7 +47,7 @@ func newClient(ctx context.Context, config *cloudConfig) (*client, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) refreshClient(ctx context.Context) error {
|
func (c *client) refreshTalosClient(ctx context.Context) error {
|
||||||
if _, err := c.talos.Version(ctx); err != nil {
|
if _, err := c.talos.Version(ctx); err != nil {
|
||||||
talos, err := newClient(ctx, c.config)
|
talos, err := newClient(ctx, c.config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func (c *cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder,
|
|||||||
c.ctx = ctx
|
c.ctx = ctx
|
||||||
c.stop = cancel
|
c.stop = cancel
|
||||||
|
|
||||||
if _, err := c.client.talos.Version(c.ctx); err != nil {
|
if err := c.client.refreshTalosClient(c.ctx); err != nil {
|
||||||
klog.Errorf("failed to initialized talos client: %v", err)
|
klog.Errorf("failed to initialized talos client: %v", err)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud
|
|||||||
nodeIP string
|
nodeIP string
|
||||||
)
|
)
|
||||||
|
|
||||||
if err = i.c.refreshClient(ctx); err != nil {
|
if err = i.c.refreshTalosClient(ctx); err != nil {
|
||||||
return nil, fmt.Errorf("error refreshing client connection: %w", err)
|
return nil, fmt.Errorf("error refreshing client connection: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user