utilities

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvPrefix = "KUBECTL_COST"
)

Variables

This section is empty.

Functions

func AddKubeOptionsFlags

func AddKubeOptionsFlags(cmd *cobra.Command, ko *KubeOptions)

AddKubeOptionsFlags sets up the cobra command with the flags from KubeOptions' configFlags so that a kube client can be built to a user's specification. Its one modification is to change the name of the namespace flag to kubecost-namespace because we want to "behave as expected", i.e. --namespace affects the request to the kubecost API, not the request to the k8s API.

func BindAFlagToViperEnv

func BindAFlagToViperEnv(cmd *cobra.Command, v *viper.Viper, flag string)

Binds the flag with viper environment variable and ensures the order of precendence command line > environment variable > default value

Types

type KubeOptions

type KubeOptions struct {
	RestConfig *rest.Config

	// Namespace should be the currently-configured defaultNamespace of the client.
	// This allows e.g. predict to fill in the defaultNamespace if one is not provided
	// in the workload spec.
	DefaultNamespace string

	genericclioptions.IOStreams
	// contains filtered or unexported fields
}

KubeOptions provides information required to communicate with the Kubernetes API

func NewKubeOptions

func NewKubeOptions(streams genericclioptions.IOStreams) *KubeOptions

NewCommonCostOptions creates the default set of cost options

func (*KubeOptions) Complete

func (o *KubeOptions) Complete(cmd *cobra.Command, args []string) error

Complete sets all information required for getting cost information

func (*KubeOptions) Validate

func (o *KubeOptions) Validate() error

Validate ensures that all required arguments and flag values are provided

Jump to

Keyboard shortcuts

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