Documentation ¶
Index ¶
- Constants
- Variables
- func AskForConfirmation(input string) bool
- func AskForInput(question string) (string, error)
- func GetDurationAsString(obj metav1.Object) 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 OverrideComponentImage(spec *v2alpha1.DatadogAgentSpec, cmpName v2alpha1.ComponentName, ...) error
- func SplitImageString(in string) (name string, tag string)
- 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
- func (o *Options) GetClientConfig() clientcmd.ClientConfig
- func (o *Options) Init(cmd *cobra.Command) error
- func (o *Options) SetApiExtensionClient(client *apiextensionclient.Clientset)
- func (o *Options) SetClient(client client.Client)
- func (o *Options) SetClientset(clientset *kubernetes.Clientset)
- func (o *Options) SetConfigFlags()
- func (o *Options) SetDiscoveryClient(client discovery.DiscoveryInterface)
- func (o *Options) SetNamespace(ns string)
- type StatusWrapper
Constants ¶
const ( // ADPrefix prefix used for AD annotations ADPrefix = "ad.datadoghq.com/" // ADPrefixRegex used for matching AD annotations ADPrefixRegex = "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 ¶
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 OverrideComponentImage ¶ added in v1.0.0
func OverrideComponentImage(spec *v2alpha1.DatadogAgentSpec, cmpName v2alpha1.ComponentName, imageName, imageTag string) error
func SplitImageString ¶ added in v1.0.0
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 APIExtClient *apiextensionclient.Clientset DiscoveryClient discovery.DiscoveryInterface 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) SetApiExtensionClient ¶ added in v1.2.0
func (o *Options) SetApiExtensionClient(client *apiextensionclient.Clientset)
SetApiExtensionClient configures the APIExtClient
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) SetDiscoveryClient ¶ added in v1.9.0
func (o *Options) SetDiscoveryClient(client discovery.DiscoveryInterface)
SetDiscoveryClient configures the DiscoveryClient
func (*Options) SetNamespace ¶
SetNamespace configures the namespace
type StatusWrapper ¶ added in v1.1.0
type StatusWrapper interface { GetObjectMeta() metav1.Object GetAgentStatus() *v2alpha1.DaemonSetStatus GetClusterAgentStatus() *v2alpha1.DeploymentStatus GetClusterChecksRunnerStatus() *v2alpha1.DeploymentStatus GetStatusCondition() []metav1.Condition }
func NewV2StatusWrapper ¶ added in v1.1.0
func NewV2StatusWrapper(dda *v2alpha1.DatadogAgent) StatusWrapper