Version: v0.7.0 Latest Latest

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 20 Imported by: 0




View Source
const (
	// ADPrefix prefix used for AD annotations
	ADPrefix = ""
	// AgentLabelValue label value to define the Agent
	AgentLabelValue = "agent"
	// ComponentLabelKey label key used to define the datadog agent component
	ComponentLabelKey = ""
	// ClcRunnerLabelValue label value to define the Cluster Checks Runner
	ClcRunnerLabelValue = "cluster-checks-runner"


View Source
var (
	// AgentLabel can be used as a LabelSelector for the Agent
	AgentLabel = fmt.Sprintf("%s=%s", ComponentLabelKey, AgentLabelValue)
	// ClcRunnerLabel can be used as a LabelSelector for the Cluster Checks Runner
	ClcRunnerLabel = fmt.Sprintf("%s=%s", ComponentLabelKey, ClcRunnerLabelValue)


func AskForConfirmation

func AskForConfirmation(input string) bool

AskForConfirmation asks for the user's confirmation before taking an action

func AskForInput

func AskForInput(question string) (string, error)

AskForInput asks the user for a given information

func GetDurationAsString

func GetDurationAsString(obj *metav1.ObjectMeta) string

GetDurationAsString gets object's age

func HasImagePattern

func HasImagePattern(image string) bool

HasImagePattern returns true if the image string respects the format <string>/<string>:<string>

func IntToString

func IntToString(i int32) string

IntToString converts int32 to string

func IsAnnotated

func IsAnnotated(annotations map[string]string, prefix string) bool

IsAnnotated returns true if annotations contain a key with a given prefix

func NewClient

func NewClient(clientConfig clientcmd.ClientConfig) (client.Client, error)

NewClient returns a new controller-runtime client instance

func NewClientset

func NewClientset(clientConfig clientcmd.ClientConfig) (*kubernetes.Clientset, error)

NewClientset returns a new client-go instance

func StreamToBytes

func StreamToBytes(stream io.Reader) ([]byte, error)

StreamToBytes converts a stream to bytes

func ValidateAnnotationsContent

func ValidateAnnotationsContent(annotations map[string]string, identifier string) ([]string, bool)

ValidateAnnotationsContent reports errors in AD annotations content the identifier string is expected to include the AD prefix

func ValidateAnnotationsMatching

func ValidateAnnotationsMatching(annotations map[string]string, validIDs map[string]bool) []string

ValidateAnnotationsMatching detects if AD annotations don't match a valid container identifier

func ValidateUpgrade

func ValidateUpgrade(image string, latest bool) error

ValidateUpgrade valides the input of the upgrade commands


type Options

type Options struct {
	ConfigFlags   *genericclioptions.ConfigFlags
	Client        client.Client
	Clientset     *kubernetes.Clientset
	UserNamespace string

Options encapsulates the common fields of command options

func (*Options) GetClientConfig

func (o *Options) GetClientConfig() clientcmd.ClientConfig

GetClientConfig returns the client config

func (*Options) Init

func (o *Options) Init(cmd *cobra.Command) error

Init initialize the common config of command options

func (*Options) SetClient

func (o *Options) SetClient(client client.Client)

SetClient configures the client

func (*Options) SetClientset

func (o *Options) SetClientset(clientset *kubernetes.Clientset)

SetClientset configures the clientset

func (*Options) SetConfigFlags

func (o *Options) SetConfigFlags()

SetConfigFlags configures the config flags

func (*Options) SetNamespace

func (o *Options) SetNamespace(ns string)

SetNamespace configures the namespace

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL