Documentation ¶
Index ¶
- Constants
- Variables
- func AskForConfirmation(input string) bool
- func AskForInput(question string) (string, error)
- func GetDurationAsString(obj *metav1.ObjectMeta) string
- func HasImagePattern(image string) bool
- func IntToString(i int32) string
- func IsAnnotated(annotations map[string]string, prefix string) bool
- func NewClient(clientConfig clientcmd.ClientConfig) (client.Client, error)
- func NewClientset(clientConfig clientcmd.ClientConfig) (*kubernetes.Clientset, error)
- func StreamToBytes(stream io.Reader) ([]byte, error)
- func ValidateAnnotationsContent(annotations map[string]string, identifier string) ([]string, bool)
- func ValidateAnnotationsMatching(annotations map[string]string, validIDs map[string]bool) []string
- func ValidateUpgrade(image string, latest bool) error
- type Options
Constants ¶
const ( // ADPrefix prefix used for AD annotations ADPrefix = "ad.datadoghq.com/" // AgentLabelValue label value to define the Agent AgentLabelValue = "agent" // ComponentLabelKey label key used to define the datadog agent component ComponentLabelKey = "agent.datadoghq.com/component" // ClcRunnerLabelValue label value to define the Cluster Checks Runner ClcRunnerLabelValue = "cluster-checks-runner" )
Variables ¶
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) )
Functions ¶
func AskForConfirmation ¶
AskForConfirmation asks for the user's confirmation before taking an action
func AskForInput ¶
AskForInput asks the user for a given information
func GetDurationAsString ¶
func GetDurationAsString(obj *metav1.ObjectMeta) string
GetDurationAsString gets object's age
func HasImagePattern ¶
HasImagePattern returns true if the image string respects the format <string>/<string>:<string>
func IsAnnotated ¶
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 ¶
StreamToBytes converts a stream to bytes
func ValidateAnnotationsContent ¶
ValidateAnnotationsContent reports errors in AD annotations content the identifier string is expected to include the AD prefix
func ValidateAnnotationsMatching ¶
ValidateAnnotationsMatching detects if AD annotations don't match a valid container identifier
func ValidateUpgrade ¶
ValidateUpgrade valides the input of the upgrade commands
Types ¶
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) 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 ¶
SetNamespace configures the namespace