Documentation ¶
Index ¶
- Constants
- Variables
- func AgentConditionToMetaV1(condition v1alpha1.DatadogAgentCondition) metav1.Condition
- 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 IsV2Available(cl *kubernetes.Clientset) (bool, error)
- 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) IsDatadogAgentV2Available() bool
- 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) 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 AgentConditionToMetaV1 ¶ added in v1.3.0
func AgentConditionToMetaV1(condition v1alpha1.DatadogAgentCondition) metav1.Condition
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 IsV2Available ¶ added in v1.0.0
func IsV2Available(cl *kubernetes.Clientset) (bool, error)
IsV2Available returns true if the v2alpha1.DatadogAgent resource kind is available
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 UserNamespace string // contains filtered or unexported fields }
Options encapsulates the common fields of command options
func (*Options) GetClientConfig ¶
func (o *Options) GetClientConfig() clientcmd.ClientConfig
GetClientConfig returns the client config
func (*Options) IsDatadogAgentV2Available ¶ added in v1.0.0
IsDatadogAgentV2Available returns true if the v2Alpha1.DatadogAgent resource is available
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) SetNamespace ¶
SetNamespace configures the namespace
type StatusWrapper ¶ added in v1.1.0
type StatusWrapper interface { GetObjectMeta() metav1.Object GetAgentStatus() *commonv1.DaemonSetStatus GetClusterAgentStatus() *commonv1.DeploymentStatus GetClusterChecksRunnerStatus() *commonv1.DeploymentStatus GetStatusCondition() []metav1.Condition }
func NewV1StatusWrapper ¶ added in v1.1.0
func NewV1StatusWrapper(dda *v1alpha1.DatadogAgent) StatusWrapper
func NewV2StatusWrapper ¶ added in v1.1.0
func NewV2StatusWrapper(dda *v2alpha1.DatadogAgent) StatusWrapper