kubectlk8s.io/kubectl/pkg/generate Index | Files | Directories

package generate

import "k8s.io/kubectl/pkg/generate"

Index

Functions

func AnnotateFlags

func AnnotateFlags(cmd *cobra.Command, generators map[string]Generator)

AnnotateFlags annotates all flags that are used by generators.

func EnsureFlagsValid

func EnsureFlagsValid(cmd *cobra.Command, generators map[string]Generator, generatorInUse string) error

EnsureFlagsValid ensures that no invalid flags are being used against a

func GetBool

func GetBool(params map[string]string, key string, defValue bool) (bool, error)

func IsZero

func IsZero(i interface{}) bool

func MakeParams

func MakeParams(cmd *cobra.Command, params []GeneratorParam) map[string]interface{}

MakeParams is a utility that creates generator parameters from a command line

func MakeProtocols

func MakeProtocols(protocols map[string]string) string

func ParseLabels

func ParseLabels(labelSpec interface{}) (map[string]string, error)

ParseLabels turns a string representation of a label set into a map[string]string

func ParseProtocols

func ParseProtocols(protocols interface{}) (map[string]string, error)

func ValidateParams

func ValidateParams(paramSpec []GeneratorParam, params map[string]interface{}) error

ValidateParams ensures that all required params are present in the params map

Types

type Generator

type Generator interface {
	// Generate creates an API object given a set of parameters
	Generate(params map[string]interface{}) (runtime.Object, error)
	// ParamNames returns the list of parameters that this generator uses
	ParamNames() []GeneratorParam
}

Generator is an interface for things that can generate API objects from input parameters. One example is the "expose" generator that is capable of exposing new replication controllers and services, among other things.

type GeneratorFunc

type GeneratorFunc func(cmdName string) map[string]Generator

GeneratorFunc returns the generators for the provided command

type GeneratorParam

type GeneratorParam struct {
	Name     string
	Required bool
}

GeneratorParam is a parameter for a generator TODO: facilitate structured json generator input schemes

type StructuredGenerator

type StructuredGenerator interface {
	// StructuredGenerator creates an API object using pre-configured parameters
	StructuredGenerate() (runtime.Object, error)
}

StructuredGenerator is an interface for things that can generate API objects not using parameter injection

Source Files

generate.go

Directories

PathSynopsis
pkg/generate/versioned
Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
33 minutes ago

Tools for package owners.