Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
porridge authored Aug 22, 2024
1 parent add5d67 commit 832d572
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Flags are:

Directory to output kind logs to (if not specified, the current working directory).

* **`--as`**
* **`--as (string)`**

The kubernetes user to impersonate for the operation. User could be a regular user or a service account in a namespace.

Expand Down
3 changes: 1 addition & 2 deletions pkg/k8s/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ var ImpersonateAs = ""

func GetConfig() (*rest.Config, error) {
cfg, err := config.GetConfig()

if err != nil {
return &rest.Config{}, err
return nil, err
}

if ImpersonateAs != "" {
Expand Down
4 changes: 0 additions & 4 deletions pkg/test/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ func Errors(namespace string, timeout int, errorFiles ...string) error {

func Client(_ bool) (client.Client, error) {
cfg, err := k8s.GetConfig()

if err != nil {
return nil, err
}

client, err := testutils.NewRetryClient(cfg, client.Options{
Scheme: testutils.Scheme(),
})

if err != nil {
return nil, fmt.Errorf("fatal error getting client: %v", err)
}
Expand All @@ -124,13 +122,11 @@ func Client(_ bool) (client.Client, error) {

func DiscoveryClient() (discovery.DiscoveryInterface, error) {
cfg, err := k8s.GetConfig()

if err != nil {
return nil, err
}

dclient, err := discovery.NewDiscoveryClientForConfig(cfg)

if err != nil {
return nil, fmt.Errorf("fatal error getting discovery client: %v", err)
}
Expand Down

0 comments on commit 832d572

Please sign in to comment.