Skip to content

Conversation

@t0mmylam
Copy link
Collaborator

Initial kubectl plugin implementation

Features:

  • Root command with global flags (kubeconfig, namespace, output, verbose)
  • Version command with operator discovery
  • Constructor pattern for testability

const defaultNamespace = "skyhook"

// GlobalOptions holds persistent CLI options (kubeconfig, namespace, output, etc.).
type GlobalOptions struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making this a GlobalFlags struct which has all the global flags that every command uses. Then make another struct which you can call CLIContext which will then hold the have the GlobalFlags struct in it. This CLIContext is then what will be passed around as a parameter for every command.

I do this in URMA as it makes it so that you can easily add stuff to all commands in the future.

@riceriley59
Copy link
Collaborator

riceriley59 commented Nov 18, 2025

Three things here. (Discussed between me and Brian)

  1. Lets put the plugin code inside of the operator/cli directory.
  2. Move the entry point for the operator (currently cmd/main.go) to cmd/manager/main.go and the plugin/CLI entry point to cmd/cli/main.go.
  3. I don't think we need a pkg directory in the plugin the only public thing that people should import from this project is in the api folder.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just call this version.go all of our other go projects use this pattern including the operator, so let's keep it consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants