Skip to content

Commit

Permalink
Add helper to setup standard clientset
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Feb 18, 2019
1 parent e8db88c commit df03425
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
12 changes: 1 addition & 11 deletions pkg/ctl/delete/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,7 @@ func doDeleteNodeGroup(p *api.ProviderConfig, cfg *api.ClusterConfig, ng *api.No

// post-deletion action
if updateAuthConfigMap {
clientConfigBase, err := ctl.NewClientConfig(cfg)
if err != nil {
return err
}

clientConfig, err := clientConfigBase.WithEmbeddedToken()
if err != nil {
return err
}

clientSet, err := clientConfig.NewClientSetWithEmbeddedToken()
clientSet, err := ctl.NewStandardClientSet(cfg)
if err != nil {
return err
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/eks/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ func (c *ClusterProvider) NewClientConfig(spec *api.ClusterConfig) (*ClientConfi
return clientConfig, nil
}

// NewStandardClientSet returns a new clientset using emebedded token
func (c *ClusterProvider) NewStandardClientSet(spec *api.ClusterConfig) (*clientset.Clientset, error) {
clientConfigBase, err := c.NewClientConfig(spec)
if err != nil {
return nil, err
}

clientConfig, err := clientConfigBase.WithEmbeddedToken()
if err != nil {
return nil, err
}

return clientConfig.NewClientSetWithEmbeddedToken()
}

// WithExecAuthenticator creates a copy of ClientConfig with authenticator exec plugin
// it ensures that AWS_PROFILE environment variable gets added to config also
func (c *ClientConfig) WithExecAuthenticator() *ClientConfig {
Expand Down

0 comments on commit df03425

Please sign in to comment.