-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agent sidecar injection support via Admission Controller (#1348)
* Add basic baseline tests for agent chart * baselines for AC sidecar injection * Agent sidecar injection support via Admission Controller * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/README.md Co-authored-by: Celene <celene@datadoghq.com> * PR review updates * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * PR review updates 2 * Update charts/datadog/values.yaml Co-authored-by: Celene <celene@datadoghq.com> * doc generate * Set chart version to 3.59.1 --------- Co-authored-by: Celene <celene@datadoghq.com>
- Loading branch information
1 parent
b11447b
commit 433211e
Showing
19 changed files
with
3,604 additions
and
5 deletions.
There are no files selected for viewing
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,50 @@ | ||
{{- define "ac-agent-sidecar-env" -}} | ||
{{- if and .Values.clusterAgent.admissionController.enabled .Values.clusterAgent.admissionController.agentSidecarInjection.enabled }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_ENABLED | ||
value: "true" | ||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.clusterAgentCommunicationEnabled }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_CLUSTER_AGENT_ENABLED | ||
value: "true" | ||
{{- else }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_CLUSTER_AGENT_ENABLED | ||
value: "false" | ||
{{- end }} | ||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.provider }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_PROVIDER | ||
value: {{ .Values.clusterAgent.admissionController.agentSidecarInjection.provider }} | ||
{{- end }} | ||
|
||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.containerRegistry }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_CONTAINER_REGISTRY | ||
value: {{ .Values.clusterAgent.admissionController.agentSidecarInjection.containerRegistry }} | ||
{{- else if .Values.registry }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_CONTAINER_REGISTRY | ||
value: {{ .Values.registry }} | ||
{{- end }} | ||
|
||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.imageName }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_IMAGE_NAME | ||
value: {{ .Values.clusterAgent.admissionController.agentSidecarInjection.imageName }} | ||
{{- else if .Values.agents.image.name}} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_IMAGE_NAME | ||
value: {{ .Values.agents.image.name }} | ||
{{- end }} | ||
|
||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.imageTag }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_IMAGE_TAG | ||
value: {{ .Values.clusterAgent.admissionController.agentSidecarInjection.imageTag }} | ||
{{- else if .Values.agents.image.tag}} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_IMAGE_TAG | ||
value: {{ .Values.agents.image.tag }} | ||
{{- end }} | ||
|
||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.selectors }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_SELECTORS | ||
value: '{{ toJson .Values.clusterAgent.admissionController.agentSidecarInjection.selectors }}' | ||
{{- end }} | ||
{{- if .Values.clusterAgent.admissionController.agentSidecarInjection.profiles }} | ||
- name: DD_ADMISSION_CONTROLLER_AGENT_SIDECAR_PROFILES | ||
value: '{{ toJson .Values.clusterAgent.admissionController.agentSidecarInjection.profiles }}' | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
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
181 changes: 181 additions & 0 deletions
181
test/datadog/baseline/agent-clusterchecks-deployment_default.yaml
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,181 @@ | ||
--- | ||
# Source: datadog/templates/agent-clusterchecks-deployment.yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: datadog-clusterchecks | ||
namespace: datadog-agent | ||
labels: | ||
helm.sh/chart: 'datadog-3.58.2' | ||
app.kubernetes.io/name: "datadog" | ||
app.kubernetes.io/instance: "datadog" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/version: "7" | ||
app.kubernetes.io/component: clusterchecks-agent | ||
|
||
spec: | ||
replicas: 2 | ||
revisionHistoryLimit: 10 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 0 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: datadog-clusterchecks | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: "datadog" | ||
app.kubernetes.io/instance: "datadog" | ||
app.kubernetes.io/managed-by: Helm | ||
app.kubernetes.io/component: clusterchecks-agent | ||
admission.datadoghq.com/enabled: "false" | ||
app: datadog-clusterchecks | ||
|
||
name: datadog-clusterchecks | ||
annotations: | ||
checksum/clusteragent_token: 999b326e98e9596150bcbfd45becfdc4695634b0d8198c59d43ce7043ac9a611 | ||
checksum/install_info: 3c5d7a2732f453d72b241f37b74f59319bcbf51e387a8fc35dc47bc4a1a7a390 | ||
spec: | ||
serviceAccountName: datadog-cluster-checks | ||
automountServiceAccountToken: true | ||
imagePullSecrets: | ||
[] | ||
initContainers: | ||
- name: init-volume | ||
image: "gcr.io/datadoghq/agent:7.51.0" | ||
imagePullPolicy: IfNotPresent | ||
command: ["bash", "-c"] | ||
args: | ||
- cp -r /etc/datadog-agent /opt | ||
volumeMounts: | ||
- name: config | ||
mountPath: /opt/datadog-agent | ||
readOnly: false # Need RW for writing agent config files | ||
resources: | ||
{} | ||
- name: init-config | ||
image: "gcr.io/datadoghq/agent:7.51.0" | ||
imagePullPolicy: IfNotPresent | ||
command: ["bash", "-c"] | ||
args: | ||
- for script in $(find /etc/cont-init.d/ -type f -name '*.sh' | sort) ; do bash $script ; done | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/datadog-agent | ||
readOnly: false # Need RW for writing datadog.yaml config file | ||
resources: | ||
{} | ||
containers: | ||
- name: agent | ||
image: "gcr.io/datadoghq/agent:7.51.0" | ||
command: ["bash", "-c"] | ||
args: | ||
- rm -rf /etc/datadog-agent/conf.d && touch /etc/datadog-agent/datadog.yaml && exec agent run | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: DD_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: "datadog-secret" | ||
key: api-key | ||
- name: KUBERNETES | ||
value: "yes" | ||
- name: DD_LOG_LEVEL | ||
value: "INFO" | ||
- name: DD_EXTRA_CONFIG_PROVIDERS | ||
value: "clusterchecks" | ||
- name: DD_HEALTH_PORT | ||
value: "5557" | ||
# Cluster checks (cluster-agent communication) | ||
- name: DD_CLUSTER_AGENT_ENABLED | ||
value: "true" | ||
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME | ||
value: datadog-cluster-agent | ||
- name: DD_CLUSTER_AGENT_AUTH_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: datadog-cluster-agent | ||
key: token | ||
# Safely run alongside the daemonset | ||
- name: DD_ENABLE_METADATA_COLLECTION | ||
value: "false" | ||
# Expose CLC stats | ||
- name: DD_CLC_RUNNER_ENABLED | ||
value: "true" | ||
- name: DD_CLC_RUNNER_HOST | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP | ||
- name: DD_CLC_RUNNER_ID | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
# Remove unused features | ||
- name: DD_USE_DOGSTATSD | ||
value: "false" | ||
- name: DD_PROCESS_AGENT_ENABLED | ||
value: "false" | ||
- name: DD_LOGS_ENABLED | ||
value: "false" | ||
- name: DD_APM_ENABLED | ||
value: "false" | ||
- name: DD_REMOTE_CONFIGURATION_ENABLED | ||
value: "false" | ||
- name: DD_HOSTNAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
|
||
|
||
resources: | ||
{} | ||
volumeMounts: | ||
- name: installinfo | ||
subPath: install_info | ||
mountPath: /etc/datadog-agent/install_info | ||
readOnly: true | ||
- name: config | ||
mountPath: /etc/datadog-agent | ||
readOnly: false # Need RW for config path | ||
livenessProbe: | ||
failureThreshold: 6 | ||
httpGet: | ||
path: /live | ||
port: 5557 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
periodSeconds: 15 | ||
successThreshold: 1 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
failureThreshold: 6 | ||
httpGet: | ||
path: /ready | ||
port: 5557 | ||
scheme: HTTP | ||
initialDelaySeconds: 15 | ||
periodSeconds: 15 | ||
successThreshold: 1 | ||
timeoutSeconds: 5 | ||
volumes: | ||
- name: installinfo | ||
configMap: | ||
name: datadog-installinfo | ||
- name: config | ||
emptyDir: {} | ||
affinity: | ||
# Prefer scheduling the runners on different nodes if possible | ||
# for better checks stability in case of node failure. | ||
podAntiAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 50 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchLabels: | ||
app: datadog-clusterchecks | ||
topologyKey: kubernetes.io/hostname | ||
nodeSelector: | ||
kubernetes.io/os: linux |
Oops, something went wrong.