Skip to content

Commit

Permalink
fix: refresh talos token
Browse files Browse the repository at this point in the history
Due to the failover process, we also need to refresh the Talos token.

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed May 6, 2024
1 parent 85e2022 commit 0faf0ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/talos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func newClient(ctx context.Context, config *cloudConfig) (*client, error) {
}, 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 {
talos, err := newClient(ctx, c.config)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/talos/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c *cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder,
c.ctx = ctx
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)

return
Expand Down
2 changes: 1 addition & 1 deletion pkg/talos/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (i *instances) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloud
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)
}

Expand Down

0 comments on commit 0faf0ae

Please sign in to comment.