-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
173 changed files
with
50,090 additions
and
17,084 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
package common | ||
|
||
// Datadog const value | ||
const ( | ||
// AgentDeploymentNameLabelKey label key use to link a Resource to a DatadogAgent | ||
AgentDeploymentNameLabelKey = "agent.datadoghq.com/name" | ||
// AgentDeploymentComponentLabelKey label key use to know with component is it | ||
AgentDeploymentComponentLabelKey = "agent.datadoghq.com/component" | ||
// MD5AgentDeploymentAnnotationKey annotation key used on a Resource in order to identify which AgentDeployment have been used to generate it. | ||
MD5AgentDeploymentAnnotationKey = "agent.datadoghq.com/agentspechash" | ||
|
||
// DefaultAgentResourceSuffix use as suffix for agent resource naming | ||
DefaultAgentResourceSuffix = "agent" | ||
// DefaultClusterAgentResourceSuffix use as suffix for cluster-agent resource naming | ||
DefaultClusterAgentResourceSuffix = "cluster-agent" | ||
// DefaultClusterChecksRunnerResourceSuffix use as suffix for cluster-checks-runner resource naming | ||
DefaultClusterChecksRunnerResourceSuffix = "cluster-checks-runner" | ||
// DefaultMetricsServerResourceSuffix use as suffix for cluster-agent metrics-server resource naming | ||
DefaultMetricsServerResourceSuffix = "cluster-agent-metrics-server" | ||
// DefaultAPPKeyKey default app-key key (use in secret for instance). | ||
DefaultAPPKeyKey = "app_key" | ||
// DefaultAPIKeyKey default api-key key (use in secret for instance). | ||
DefaultAPIKeyKey = "api_key" | ||
// DefaultTokenKey default token key (use in secret for instance). | ||
DefaultTokenKey = "token" | ||
// DefaultClusterAgentServicePort default cluster-agent service port | ||
DefaultClusterAgentServicePort = 5005 | ||
// DefaultMetricsServerServicePort default metrics-server port | ||
DefaultMetricsServerServicePort = 443 | ||
// DefaultMetricsServerTargetPort default metrics-server pod port | ||
DefaultMetricsServerTargetPort = int(DefaultMetricsProviderPort) | ||
// DefaultAdmissionControllerServicePort default admission controller service port | ||
DefaultAdmissionControllerServicePort = 443 | ||
// DefaultAdmissionControllerTargetPort default admission controller pod port | ||
DefaultAdmissionControllerTargetPort = 8000 | ||
// DefaultDogstatsdPort default dogstatsd port | ||
DefaultDogstatsdPort = 8125 | ||
// DefaultDogstatsdPortName default dogstatsd port name | ||
DefaultDogstatsdPortName = "dogstatsd" | ||
// DefaultApmPortName default apm port name | ||
DefaultApmPortName = "apm" | ||
// DefaultMetricsProviderPort default metrics provider port | ||
DefaultMetricsProviderPort int32 = 8443 | ||
// DefaultKubeStateMetricsCoreConf default ksm core ConfigMap name | ||
DefaultKubeStateMetricsCoreConf string = "kube-state-metrics-core-config" | ||
// DefaultSystemProbeSocketPath default System Probe socket path | ||
DefaultSystemProbeSocketPath string = "/var/run/sysprobe/sysprobe.sock" | ||
|
||
// Liveness probe default config | ||
DefaultLivenessProbeInitialDelaySeconds int32 = 15 | ||
DefaultLivenessProbePeriodSeconds int32 = 15 | ||
DefaultLivenessProbeTimeoutSeconds int32 = 5 | ||
DefaultLivenessProbeSuccessThreshold int32 = 1 | ||
DefaultLivenessProbeFailureThreshold int32 = 6 | ||
DefaultAgentHealthPort int32 = 5555 | ||
DefaultLivenessProbeHTTPPath = "/live" | ||
|
||
// Readiness probe default config | ||
DefaultReadinessProbeInitialDelaySeconds int32 = 15 | ||
DefaultReadinessProbePeriodSeconds int32 = 15 | ||
DefaultReadinessProbeTimeoutSeconds int32 = 5 | ||
DefaultReadinessProbeSuccessThreshold int32 = 1 | ||
DefaultReadinessProbeFailureThreshold int32 = 6 | ||
DefaultReadinessProbeHTTPPath = "/ready" | ||
) | ||
|
||
// Annotations | ||
const ( | ||
SystemProbeAppArmorAnnotationKey = "container.apparmor.security.beta.kubernetes.io/system-probe" | ||
SystemProbeAppArmorAnnotationValue = "unconfined" | ||
) | ||
|
||
// Datadog volume names and mount paths | ||
const ( | ||
ConfdVolumeName = "confd" | ||
ConfdVolumePath = "/conf.d" | ||
ConfigVolumeName = "config" | ||
ConfigVolumePath = "/etc/datadog-agent" | ||
KubeStateMetricCoreVolumeName = "ksm-core-config" | ||
|
||
HostRootVolumeName = "hostroot" | ||
HostRootHostPath = "/" | ||
HostRootMountPath = "/host/root" | ||
|
||
ProcdirVolumeName = "procdir" | ||
ProcdirHostPath = "/proc" | ||
ProcdirMountPath = "/host/proc" | ||
|
||
CgroupsVolumeName = "cgroups" | ||
CgroupsHostPath = "/sys/fs/cgroup" | ||
CgroupsMountPath = "/host/sys/fs/cgroup" | ||
|
||
SystemProbeSocketVolumeName = "sysprobe-socket-dir" | ||
SystemProbeSocketVolumePath = "/var/run/sysprobe" | ||
|
||
DebugfsVolumeName = "debugfs" | ||
// same path on host and container | ||
DebugfsPath = "/sys/kernel/debug" | ||
|
||
ModulesVolumeName = "modules" | ||
// same path on host and container | ||
ModulesVolumePath = "/lib/modules" | ||
SrcVolumeName = "src" | ||
// same path on host and container | ||
SrcVolumePath = "/usr/src" | ||
LogDatadogVolumeName = "logdatadog" | ||
LogDatadogVolumePath = "/var/log/datadog" | ||
TmpVolumeName = "tmp" | ||
TmpVolumePath = "/tmp" | ||
CertificatesVolumeName = "certificates" | ||
CertificatesVolumePath = "/etc/datadog-agent/certificates" | ||
AuthVolumeName = "datadog-agent-auth" | ||
AuthVolumePath = "/etc/datadog-agent/auth" | ||
InstallInfoVolumeName = "installinfo" | ||
InstallInfoVolumeSubPath = "install_info" | ||
InstallInfoVolumePath = "/etc/datadog-agent/install_info" | ||
InstallInfoVolumeReadOnly = true | ||
PointerVolumeName = "pointerdir" | ||
PointerVolumePath = "/opt/datadog-agent/run" | ||
LogTempStoragePath = "/var/lib/datadog-agent/logs" | ||
PodLogVolumeName = "logpodpath" | ||
PodLogVolumePath = "/var/log/pods" | ||
ContainerLogVolumeName = "logcontainerpath" | ||
ContainerLogVolumePath = "/var/lib/docker/containers" | ||
SymlinkContainerVolumeName = "symlinkcontainerpath" | ||
SymlinkContainerVolumePath = "/var/log/containers" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
package common | ||
|
||
// Datadog env var names | ||
const ( | ||
DDIgnoreAutoConf = "DD_IGNORE_AUTOCONF" | ||
DDKubeStateMetricsCoreEnabled = "DD_KUBE_STATE_METRICS_CORE_ENABLED" | ||
DDKubeStateMetricsCoreConfigMap = "DD_KUBE_STATE_METRICS_CORE_CONFIGMAP_NAME" | ||
DDHostRootEnvVar = "HOST_ROOT" | ||
DDSystemProbeNPMEnabledEnvVar = "DD_SYSTEM_PROBE_NETWORK_ENABLED" | ||
DDSystemProbeEnabledEnvVar = "DD_SYSTEM_PROBE_ENABLED" | ||
DDProcessAgentEnabledEnvVar = "DD_PROCESS_AGENT_ENABLED" | ||
DDSystemProbeExternal = "DD_SYSTEM_PROBE_EXTERNAL" | ||
DDSystemProbeServiceMonitoringEnabled = "DD_SYSTEM_PROBE_SERVICE_MONITORING_ENABLED" | ||
DDSystemProbeSocket = "DD_SYSPROBE_SOCKET" | ||
DDEnableOOMKillEnvVar = "DD_SYSTEM_PROBE_CONFIG_ENABLE_OOM_KILL" | ||
DDEnableTCPQueueLengthEnvVar = "DD_SYSTEM_PROBE_CONFIG_ENABLE_TCP_QUEUE_LENGTH" | ||
DDLeaderElection = "DD_LEADER_ELECTION" | ||
DDClusterAgentKubeServiceName = "DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME" | ||
DDHealthPort = "DD_HEALTH_PORT" | ||
DDLogsEnabled = "DD_LOGS_ENABLED" | ||
DDLogsConfigContainerCollectAll = "DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL" | ||
DDLogsContainerCollectUsingFiles = "DD_LOGS_CONFIG_K8S_CONTAINER_USE_FILE" | ||
DDLogsConfigOpenFilesLimit = "DD_LOGS_CONFIG_OPEN_FILES_LIMIT" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
package common | ||
|
||
import corev1 "k8s.io/api/core/v1" | ||
|
||
// AgentImageConfig defines the agent container image config. | ||
// +kubebuilder:object:generate=true | ||
type AgentImageConfig struct { | ||
// Define the image to use: | ||
// Use "gcr.io/datadoghq/agent:latest" for Datadog Agent 7. | ||
// Use "datadog/dogstatsd:latest" for standalone Datadog Agent DogStatsD 7. | ||
// Use "gcr.io/datadoghq/cluster-agent:latest" for Datadog Cluster Agent. | ||
// Use "agent" with the registry and tag configurations for <registry>/agent:<tag>. | ||
// Use "cluster-agent" with the registry and tag configurations for <registry>/cluster-agent:<tag>. | ||
Name string `json:"name,omitempty"` | ||
|
||
// Define the image tag to use. | ||
// To be used if the Name field does not correspond to a full image string. | ||
// +optional | ||
Tag string `json:"tag,omitempty"` | ||
|
||
// Define whether the Agent image should support JMX. | ||
// +optional | ||
JMXEnabled bool `json:"jmxEnabled,omitempty"` | ||
|
||
// The Kubernetes pull policy: | ||
// Use Always, Never or IfNotPresent. | ||
PullPolicy *corev1.PullPolicy `json:"pullPolicy,omitempty"` | ||
|
||
// It is possible to specify Docker registry credentials. | ||
// See https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod | ||
// +optional | ||
PullSecrets *[]corev1.LocalObjectReference `json:"pullSecrets,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
package common | ||
|
||
import ( | ||
"fmt" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GetConfName get the name of the Configmap for a CustomConfigSpec | ||
func GetConfName(owner metav1.Object, conf *CustomConfig, defaultName string) string { | ||
// `configData` and `configMap` can't be set together. | ||
// Return the default if the conf is not overridden or if it is just overridden with the ConfigData. | ||
if conf != nil && conf.ConfigMap != nil { | ||
return conf.ConfigMap.Name | ||
} | ||
return fmt.Sprintf("%s-%s", owner.GetName(), defaultName) | ||
} |
Oops, something went wrong.