cmd

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd holds what every kubectl-nv command needs before it can talk to a cluster: the kubectl configuration flags, the resolved kubeconfig path, and the factory the commands get their clients from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConfigFlags

func AddConfigFlags(flags *pflag.FlagSet, configFlags *genericclioptions.ConfigFlags)

AddConfigFlags registers the kubectl configuration flags on flags, giving --kubeconfig the -k shorthand that kubectl-nv accepted before it moved to cobra.

Types

type Factory

type Factory interface {
	KubernetesClient() (kubernetes.Interface, error)
	DynamicClient() (dynamic.Interface, error)
	RESTConfig() (*rest.Config, error)
}

Factory hands a command the clients it needs. There is one implementation against a real cluster, built from the kubectl configuration flags; tests supply their own so that no test reaches a cluster.

func NewFactory

func NewFactory(configFlags *genericclioptions.ConfigFlags) Factory

NewFactory returns the Factory that talks to the cluster the configuration flags point at. The REST configuration and the clients are built once and reused, so a command that needs two of them does not read the kubeconfig twice.

type Options

type Options struct {
	ConfigFlags *genericclioptions.ConfigFlags
	Streams     genericiooptions.IOStreams
	Factory     Factory

	// Debug reports whether debug-level logging was asked for, by --debug, -d or
	// the DEBUG environment variable.
	Debug bool

	// Logger is where commands report progress. It writes to the error stream
	// only, so stdout stays the command's own output.
	Logger *output.Logger
}

Options is the state the root command resolves once and every subcommand reads.

func (*Options) KubeconfigDisplay

func (o *Options) KubeconfigDisplay() string

KubeconfigDisplay names the kubeconfig the clients will be built from, for reporting it to the user. It asks the client configuration rather than resolving a path of its own: a second resolver can disagree with the one that actually loads the file, and then the gather names a cluster it never looked at.

func (*Options) Log

func (o *Options) Log() *output.Logger

Log returns where this command reports progress, making a plain one over the error stream when the root has not set one, so that a command built by hand in a test still has somewhere to write.

Directories

Path Synopsis
Package adm carries the admin-level operations on the NVIDIA resources of a cluster.
Package adm carries the admin-level operations on the NVIDIA resources of a cluster.
Package root builds the kubectl-nv command tree.
Package root builds the kubectl-nv command tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL