Skip to content

Commit

Permalink
fix(installer): installer restconfig always nil (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoryu authored Nov 25, 2021
1 parent 1888e23 commit d639abb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/platform/provider/baremetal/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,10 @@ func (p *Provider) EnsureStoreCredential(ctx context.Context, c *v1.Cluster) err
c.IsCredentialChanged = true
}

if c.IsCredentialChanged {
c.RegisterRestConfig(c.ClusterCredential.RESTConfig(c.Cluster))
}

return nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/platform/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type Cluster struct {
}

func (c *Cluster) setRESTConfigDefaults() error {
if c.restConfig == nil {
c.restConfig = &rest.Config{}
}
if c.restConfig.Host == "" {
host, err := c.Host()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/platform/types/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func (c *Cluster) RESTConfigForBootstrap() (*rest.Config, error) {
}

func (c *Cluster) setRESTConfigDefaults() error {
if c.restConfig == nil {
c.restConfig = &rest.Config{}
}
if c.restConfig.Host == "" {
host, err := c.Host()
if err != nil {
Expand Down

0 comments on commit d639abb

Please sign in to comment.