Skip to content

Commit

Permalink
Merge pull request crossplane#5542 from padlar/issue-5537
Browse files Browse the repository at this point in the history
Add --context option to crossplane cli beta trace command
  • Loading branch information
phisco authored Apr 4, 2024
2 parents d35ecef + c9088a5 commit 9568f16
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/crank/beta/trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/restmapper"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"

"github.com/crossplane/crossplane-runtime/pkg/errors"
"github.com/crossplane/crossplane-runtime/pkg/logging"
Expand Down Expand Up @@ -62,6 +62,7 @@ type Cmd struct {

// TODO(phisco): add support for all the usual kubectl flags; configFlags := genericclioptions.NewConfigFlags(true).AddFlags(...)
// TODO(phisco): move to namespace defaulting to "" and use the current context's namespace
Context string `default:"" help:"Kubernetes context." name:"context" short:"c"`
Namespace string `default:"default" help:"Namespace of the resource." name:"namespace" short:"n"`
Output string `default:"default" enum:"default,wide,json,dot" help:"Output format. One of: default, wide, json, dot." name:"output" short:"o"`
ShowConnectionSecrets bool `help:"Show connection secrets in the output." name:"show-connection-secrets" short:"s"`
Expand Down Expand Up @@ -113,7 +114,7 @@ func (c *Cmd) Run(k *kong.Context, logger logging.Logger) error {
}
logger.Debug("Built printer", "output", c.Output)

kubeconfig, err := ctrl.GetConfig()
kubeconfig, err := config.GetConfigWithContext(c.Context)
if err != nil {
return errors.Wrap(err, errKubeConfig)
}
Expand Down

0 comments on commit 9568f16

Please sign in to comment.