flags

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBothBoolFlags

func AddBothBoolFlags(f *pflag.FlagSet, p *bool, name, short string, value bool, usage string)

AddBothBoolFlags adds the given flag in both `--foo` and `--no-foo` variants. If you do this, make sure you call ReconcileBoolFlags later to catch errors and set the relationship between the flag values. Only the flag that does the non-default behavior is visible; the other is hidden.

func AddBothBoolFlagsUnhidden

func AddBothBoolFlagsUnhidden(f *pflag.FlagSet, p *bool, name, short string, value bool, usage string)

AddBothBoolFlagsUnhidden is just like AddBothBoolFlags but shows both flags.

func DefaultStrictSecCon added in v0.38.0

func DefaultStrictSecCon() *corev1.SecurityContext

DefaultStrictSecCon helper function to get default strict Security Context

func FirstCharToLower added in v0.13.2

func FirstCharToLower(s string) string

FirstCharToLower converts first char in given string to lowercase

func InvertUsage added in v0.13.2

func InvertUsage(usage string) string

InvertUsage inverts the usage string with prefix "Do not"

func ReconcileBoolFlags

func ReconcileBoolFlags(f *pflag.FlagSet) error

ReconcileBoolFlags sets the value of the all the "--foo" flags based on "--no-foo" if provided, and returns an error if both were provided or an explicit value of false was provided to either (as that's confusing).

func UpdateContainerArg added in v0.19.0

func UpdateContainerArg(spec *corev1.PodSpec, arg []string) error

UpdateContainerArg updates container with a given argument

func UpdateContainerCommand added in v0.19.0

func UpdateContainerCommand(spec *corev1.PodSpec, command []string) error

UpdateContainerCommand updates container with a given argument

func UpdateContainerPort added in v0.19.0

func UpdateContainerPort(spec *corev1.PodSpec, port string) error

UpdateContainerPort updates container with a given name:port

func UpdateContainers added in v0.25.0

func UpdateContainers(spec *corev1.PodSpec, containers []corev1.Container)

UpdateContainers updates the containers array with additional ones provided from file or os.Stdin

func UpdateEnvFrom added in v0.19.0

func UpdateEnvFrom(spec *corev1.PodSpec, toUpdate []string, toRemove []string) error

UpdateEnvFrom updates envFrom

func UpdateEnvVars added in v0.19.0

func UpdateEnvVars(spec *corev1.PodSpec, allArgs []string,
	envToUpdate *util.OrderedMap, envToRemove []string,
	envValueFromToUpdate *util.OrderedMap, envValueFromToRemove []string,
	envFileName string, envValueFileToUpdate *util.OrderedMap, envValueFileToRemove []string,
) error

UpdateEnvVars gives the configuration all the env var values listed in the given map of vars. Does not touch any environment variables not mentioned, but it can add new env vars and change the values of existing ones.

func UpdateImage added in v0.19.0

func UpdateImage(spec *corev1.PodSpec, image string) error

UpdateImage a given image

func UpdateImagePullPolicy added in v0.31.0

func UpdateImagePullPolicy(spec *corev1.PodSpec, imagePullPolicy string) error

UpdateImagePullPolicy updates the pull policy for the given revision template

func UpdateImagePullSecrets added in v0.19.0

func UpdateImagePullSecrets(spec *corev1.PodSpec, pullsecrets string)

UpdateImagePullSecrets updates the image pull secrets used for the corresponding knative service

func UpdateLivenessProbe added in v0.33.0

func UpdateLivenessProbe(spec *corev1.PodSpec, probeString string) error

UpdateLivenessProbe updates container liveness probe based on provided string

func UpdateLivenessProbeOpts added in v0.33.0

func UpdateLivenessProbeOpts(spec *corev1.PodSpec, probeString string) error

UpdateLivenessProbeOpts updates container liveness probe commons options based on provided string

func UpdateReadinessProbe added in v0.33.0

func UpdateReadinessProbe(spec *corev1.PodSpec, probeString string) error

UpdateReadinessProbe updates container readiness probe based on provided string

func UpdateReadinessProbeOpts added in v0.33.0

func UpdateReadinessProbeOpts(spec *corev1.PodSpec, probeString string) error

UpdateReadinessProbeOpts updates container readiness probe commons options based on provided string

func UpdateResources added in v0.19.0

func UpdateResources(spec *corev1.PodSpec, resources corev1.ResourceRequirements, requestsToRemove, limitsToRemove []string) error

UpdateResources updates container resources for given revision spec

func UpdateSecurityContext added in v0.38.0

func UpdateSecurityContext(spec *corev1.PodSpec, securityContext string) error

UpdateSecurityContext update the Security Context

func UpdateServiceAccountName added in v0.19.0

func UpdateServiceAccountName(spec *corev1.PodSpec, serviceAccountName string)

UpdateServiceAccountName updates the service account name used for the corresponding knative service

func UpdateUser added in v0.19.0

func UpdateUser(spec *corev1.PodSpec, user int64) error

UpdateUser updates container with a given user id

func UpdateVolumeMountsAndVolumes added in v0.19.0

func UpdateVolumeMountsAndVolumes(spec *corev1.PodSpec,
	mountsToUpdate *util.OrderedMap, mountsToRemove []string, volumesToUpdate *util.OrderedMap, volumesToRemove []string) error

UpdateVolumeMountsAndVolumes updates the configuration for volume mounts and volumes.

Types

type ChannelRef added in v0.17.1

type ChannelRef struct {
	Cref string
}

func (*ChannelRef) Add added in v0.17.1

func (i *ChannelRef) Add(f *pflag.FlagSet)

Add sets channel reference flag definition to given flagset

func (*ChannelRef) Parse added in v0.17.1

func (i *ChannelRef) Parse() (*duckv1.KReference, error)

Parse parses the CLI value for channel ref flag and populates object reference or return error

type ChannelTypeFlags added in v0.17.0

type ChannelTypeFlags struct {
	// contains filtered or unexported fields
}

func (*ChannelTypeFlags) Add added in v0.17.0

func (i *ChannelTypeFlags) Add(f *pflag.FlagSet)

Add sets channel type flag definition to given flagset

func (*ChannelTypeFlags) Parse added in v0.17.0

Parse parses the CLI value for channel type flag and populates GVK or returns error

type MountInfo added in v0.31.0

type MountInfo struct {
	VolumeName   string
	SubPath      string
	MountOptions string
}

type PodSpecFlags added in v0.17.0

type PodSpecFlags struct {
	// Direct field manipulation
	Image           uniqueStringArg
	ImagePullPolicy string
	Env             []string
	EnvFrom         []string
	EnvValueFrom    []string
	EnvFile         string
	Mount           []string
	Volume          []string

	Command []string
	Arg     []string

	LivenessProbe      string
	LivenessProbeOpts  string
	ReadinessProbe     string
	ReadinessProbeOpts string

	ExtraContainers string

	Resources          ResourceOptions
	Port               string
	ServiceAccountName string
	ImagePullSecrets   string
	User               int64

	SecurityContext string
}

PodSpecFlags to hold the container resource requirements values

func (*PodSpecFlags) AddCreateFlags added in v0.28.0

func (p *PodSpecFlags) AddCreateFlags(flagset *pflag.FlagSet) []string

AddCreateFlags will add PodSpec flags related to environment variable to FlagSet of create command

func (*PodSpecFlags) AddFlags added in v0.17.0

func (p *PodSpecFlags) AddFlags(flagset *pflag.FlagSet) []string

AddFlags will add PodSpec related flags to FlagSet

func (*PodSpecFlags) AddUpdateFlags added in v0.28.0

func (p *PodSpecFlags) AddUpdateFlags(flagset *pflag.FlagSet) []string

AddUpdateFlags will add PodSpec flags related to environment variable to FlagSet of update command

func (*PodSpecFlags) ResolvePodSpec added in v0.19.0

func (p *PodSpecFlags) ResolvePodSpec(podSpec *corev1.PodSpec, flags *pflag.FlagSet, allArgs []string) error

ResolvePodSpec will create corev1.PodSpec based on the flag inputs and all input arguments

type ResourceFlags added in v0.17.0

type ResourceFlags struct {
	CPU    string
	Memory string
}

type ResourceOptions added in v0.15.0

type ResourceOptions struct {
	Requests             []string
	Limits               []string
	ResourceRequirements corev1.ResourceRequirements
}

ResourceOptions to hold the container resource requirements values

func (*ResourceOptions) Validate added in v0.15.0

func (o *ResourceOptions) Validate() ([]string, []string, error)

Validate parses the limits and requests parameters if specified and sets ResourceRequirements for ResourceOptions or returns error if any

type VolumeSourceType added in v0.19.0

type VolumeSourceType int

VolumeSourceType is a type standing for enumeration of ConfigMap and Secret

const (
	ConfigMapVolumeSourceType VolumeSourceType = iota
	SecretVolumeSourceType
	EmptyDirVolumeSourceType
	PVCVolumeSourceType
	PortFormatErr = "" /* 154-byte string literal not displayed */
)

Enumeration of volume source types: ConfigMap or Secret

func (VolumeSourceType) String added in v0.19.0

func (vt VolumeSourceType) String() string

Jump to

Keyboard shortcuts

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