Documentation
¶
Overview ¶
package kubectlplugin contains helpers for building kubectl plugins.
Copyright © 2025 Gino Latorilla ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Variables
- func As[T any](object runtime.Object) T
- type CobraOpts
- type Column
- type ConfigFlags
- type Handler
- type HandlerArgs
- type Runner
- type RunnerOpts
- func WithAllNamespaces() RunnerOpts
- func WithDefaultDiscoveryApi() RunnerOpts
- func WithDefaultKubeApi() RunnerOpts
- func WithDiscoveryApiV2(discoveryApi discovery.DiscoveryInterface, dynamicApi dynamic.Interface) RunnerOpts
- func WithKubeApi(kubeApi kubernetes.Interface) RunnerOpts
- func WithResourcePrinters() RunnerOpts
- func WithTablePrinter() RunnerOpts
- type TableBuilder
Constants ¶
This section is empty.
Variables ¶
var ResourceKindColumn = Column{
Name: "Kind",
Description: "Kubernetes resource kind",
}
Functions ¶
Types ¶
type CobraOpts ¶
func WithVersion ¶
type ConfigFlags ¶
type ConfigFlags struct {
genericclioptions.ConfigFlags
genericclioptions.PrintFlags
genericclioptions.ResourceBuilderFlags
NoHeaders bool
}
func NewConfigFlags ¶
func NewConfigFlags() *ConfigFlags
func (*ConfigFlags) AddFlags ¶
func (f *ConfigFlags) AddFlags(cmd *cobra.Command)
func (*ConfigFlags) ToPrinter ¶
func (f *ConfigFlags) ToPrinter() (printers.ResourcePrinter, error)
type HandlerArgs ¶
func (HandlerArgs) ToResourceFinder ¶
func (a HandlerArgs) ToResourceFinder(resources ...string) genericclioptions.ResourceFinder
type Runner ¶
type Runner struct {
ConfigFlags *ConfigFlags
KubeApi kubernetes.Interface
DiscoveryApi discovery.DiscoveryInterface
DynamicApi dynamic.Interface
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(handler Handler, opts ...RunnerOpts) *Runner
func (*Runner) GetAllServerResources ¶
func (r *Runner) GetAllServerResources() ([]schema.GroupVersionResource, error)
type RunnerOpts ¶
type RunnerOpts func(*Runner)
func WithAllNamespaces ¶
func WithAllNamespaces() RunnerOpts
func WithDefaultDiscoveryApi ¶
func WithDefaultDiscoveryApi() RunnerOpts
func WithDefaultKubeApi ¶
func WithDefaultKubeApi() RunnerOpts
func WithDiscoveryApiV2 ¶
func WithDiscoveryApiV2(discoveryApi discovery.DiscoveryInterface, dynamicApi dynamic.Interface) RunnerOpts
func WithKubeApi ¶
func WithKubeApi(kubeApi kubernetes.Interface) RunnerOpts
func WithResourcePrinters ¶
func WithResourcePrinters() RunnerOpts
func WithTablePrinter ¶
func WithTablePrinter() RunnerOpts
type TableBuilder ¶
func NewTableBuilder ¶
func NewTableBuilder() *TableBuilder
func (*TableBuilder) AddRow ¶
func (tb *TableBuilder) AddRow(object runtime.Object, cells map[string]any)
func (*TableBuilder) AdditionalColumns ¶
func (tb *TableBuilder) AdditionalColumns(columns ...Column) *TableBuilder