Skip to content

Commit

Permalink
Fix other uses of NewForConfigOrDie in contexts where we could return…
Browse files Browse the repository at this point in the history
… err

Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Oct 29, 2021
1 parent 5acd0b9 commit 3da1bb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/daemons/control/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,10 @@ func checkForCloudControllerPrivileges(ctx context.Context, runtime *config.Cont
if err != nil {
return err
}
authClient := authorizationv1client.NewForConfigOrDie(restConfig)
authClient, err := authorizationv1client.NewForConfig(restConfig)
if err != nil {
return err
}
sar := &authorizationv1.SubjectAccessReview{
Spec: authorizationv1.SubjectAccessReviewSpec{
User: version.Program + "-cloud-controller-manager",
Expand Down
5 changes: 4 additions & 1 deletion pkg/server/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ func NewContext(ctx context.Context, cfg string) (*Context, error) {
return nil, errors.Wrap(err, "failed to register CRDs")
}

k8s := kubernetes.NewForConfigOrDie(restConfig)
k8s, err := kubernetes.NewForConfig(restConfig)
if err != nil {
return nil, err
}
return &Context{
K3s: k3s.NewFactoryFromConfigOrDie(restConfig),
Helm: helm.NewFactoryFromConfigOrDie(restConfig),
Expand Down

0 comments on commit 3da1bb3

Please sign in to comment.