{"modulePath":"github.com/DataDog/datadog-operator","version":"v1.32.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package common\n\n## Constants\n\n```go\nconst (\n\t// ADPrefix prefix used for AD annotations\n\tADPrefix = \"ad.datadoghq.com/\"\n\t// ADPrefixRegex used for matching AD annotations\n\tADPrefixRegex = \"ad\\\\.datadoghq\\\\.com/\"\n\t// AgentLabelValue label value to define the Agent\n\tAgentLabelValue = \"agent\"\n\t// ComponentLabelKey label key used to define the datadog agent component\n\tComponentLabelKey = \"agent.datadoghq.com/component\"\n\t// ClcRunnerLabelValue label value to define the Cluster Checks Runner\n\tClcRunnerLabelValue = \"cluster-checks-runner\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// AgentLabel can be used as a LabelSelector for the Agent\n\tAgentLabel = fmt.Sprintf(\"%s=%s\", ComponentLabelKey, AgentLabelValue)\n\t// ClcRunnerLabel can be used as a LabelSelector for the Cluster Checks Runner\n\tClcRunnerLabel = fmt.Sprintf(\"%s=%s\", ComponentLabelKey, ClcRunnerLabelValue)\n)\n```\n\n## Functions\n\n```go\nfunc AskForConfirmation(input string) bool\n```\nAskForConfirmation asks for the user's confirmation before taking an action\n\n```go\nfunc AskForInput(question string) (string, error)\n```\nAskForInput asks the user for a given information\n\n```go\nfunc GetDurationAsString(obj metav1.Object) string\n```\nGetDurationAsString gets object's age\n\n```go\nfunc HasImagePattern(image string) bool\n```\nHasImagePattern returns true if the image string respects the format \\\u003cstring\u003e/\\\u003cstring\u003e:\\\u003cstring\u003e\n\n```go\nfunc IsAnnotated(annotations map[string]string, prefix string) bool\n```\nIsAnnotated returns true if annotations contain a key with a given prefix\n\n```go\nfunc NewClient(clientConfig clientcmd.ClientConfig) (client.Client, error)\n```\nNewClient returns a new controller-runtime client instance\n\n```go\nfunc NewClientset(clientConfig clientcmd.ClientConfig) (*kubernetes.Clientset, error)\n```\nNewClientset returns a new client-go instance\n\n```go\nfunc OverrideComponentImage(spec *v2alpha1.DatadogAgentSpec, cmpName v2alpha1.ComponentName, imageName, imageTag string) error\n```\n\n```go\nfunc SplitImageString(in string) (name string, tag string)\n```\n\n```go\nfunc StreamToBytes(stream io.Reader) ([]byte, error)\n```\nStreamToBytes converts a stream to bytes\n\n```go\nfunc ValidateAnnotationsContent(annotations map[string]string, identifier string) ([]string, bool)\n```\nValidateAnnotationsContent reports errors in AD annotations content the identifier string is expected to include the AD prefix\n\n```go\nfunc ValidateAnnotationsMatching(annotations map[string]string, validIDs map[string]bool) []string\n```\nValidateAnnotationsMatching detects if AD annotations don't match a valid container identifier\n\n```go\nfunc ValidateUpgrade(image string, latest bool) error\n```\nValidateUpgrade valides the input of the upgrade commands\n\n## Types\n\n```go\ntype Options struct {\n\tConfigFlags     *genericclioptions.ConfigFlags\n\tClient          client.Client\n\tClientset       *kubernetes.Clientset\n\tAPIExtClient    *apiextensionclient.Clientset\n\tDiscoveryClient discovery.DiscoveryInterface\n\n\tUserNamespace string\n}\n```\nOptions encapsulates the common fields of command options\n\n```go\nfunc (o *Options) GetClientConfig() clientcmd.ClientConfig\n```\nGetClientConfig returns the client config\n\n```go\nfunc (o *Options) Init(cmd *cobra.Command) error\n```\nInit initialize the common config of command options\n\n```go\nfunc (o *Options) SetAPIExtensionClient(client *apiextensionclient.Clientset)\n```\nSetAPIExtensionClient configures the API extension client.\n\n```go\nfunc (o *Options) SetApiExtensionClient(client *apiextensionclient.Clientset)\n```\nSetApiExtensionClient configures the API extension client. Deprecated: use SetAPIExtensionClient.\n\n```go\nfunc (o *Options) SetClient(client client.Client)\n```\nSetClient configures the client\n\n```go\nfunc (o *Options) SetClientset(clientset *kubernetes.Clientset)\n```\nSetClientset configures the clientset\n\n```go\nfunc (o *Options) SetConfigFlags()\n```\nSetConfigFlags configures the config flags\n\n```go\nfunc (o *Options) SetDiscoveryClient(client discovery.DiscoveryInterface)\n```\nSetDiscoveryClient configures the DiscoveryClient\n\n```go\nfunc (o *Options) SetNamespace(ns string)\n```\nSetNamespace configures the namespace\n\n```go\ntype StatusWrapper interface {\n\tGetObjectMeta() metav1.Object\n\tGetAgentStatus() *v2alpha1.DaemonSetStatus\n\tGetClusterAgentStatus() *v2alpha1.DeploymentStatus\n\tGetClusterChecksRunnerStatus() *v2alpha1.DeploymentStatus\n\tGetStatusCondition() []metav1.Condition\n}\n```\n\n```go\nfunc NewV2StatusWrapper(dda *v2alpha1.DatadogAgent) StatusWrapper\n```\n\n","path":"github.com/DataDog/datadog-operator/pkg/plugin/common","name":"common","synopsis":"","isRedistributable":true}
