From c0753f95a9106355bb0dc7dbd06d39cac40bd1bc Mon Sep 17 00:00:00 2001 From: aymericdd Date: Wed, 25 Feb 2026 13:39:31 +0100 Subject: [PATCH] fix(makefile): improve Lima local dev setup and fix open-dd dashboard URL - Fix open-dd target to use updated Datadog infrastructure hosts URL format - Check Helm release status instead of namespace in lima-install-datadog-agent - Use envsubst to substitute LIMA_INSTANCE in datadog-agent.yaml - Add kubectl wait for Datadog agent deployment readiness - Use dynamic clusterName and set DD_HOSTNAME in datadog-agent.yaml - Add .envrc to .gitignore --- .gitignore | 2 ++ Makefile | 13 +++++++------ examples/datadog-agent.yaml | 7 ++++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 46d304079..5f518ad29 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,5 @@ ebpf/builds/ # DS_Store .DS_Store + +.envrc diff --git a/Makefile b/Makefile index 4b3b5db53..dea7ee14c 100644 --- a/Makefile +++ b/Makefile @@ -509,23 +509,24 @@ endif install-go: BUILDGOVERSION=$(BUILDGOVERSION) ./scripts/install-go -EXISTING_NAMESPACE = $(shell $(KUBECTL) get ns datadog-agent -oname || echo "") +EXISTING_HELM_RELEASE = $(shell helm status -n datadog-agent my-datadog-operator --output json 2>/dev/null | grep -q '"status":"deployed"' && echo "true" || echo "") lima-install-datadog-agent: ifeq (true,$(INSTALL_DATADOG_AGENT)) -ifeq (,$(EXISTING_NAMESPACE)) - $(KUBECTL) create ns datadog-agent +ifeq (,$(EXISTING_HELM_RELEASE)) + $(KUBECTL) create ns datadog-agent 2>/dev/null || true helm repo add --force-update datadoghq https://helm.datadoghq.com helm install -n datadog-agent my-datadog-operator datadoghq/datadog-operator - $(KUBECTL) create secret -n datadog-agent generic datadog-secret --from-literal api-key=${STAGING_DATADOG_API_KEY} --from-literal app-key=${STAGING_DATADOG_APP_KEY} + $(KUBECTL) create secret -n datadog-agent generic datadog-secret --from-literal api-key=${STAGING_DATADOG_API_KEY} --from-literal app-key=${STAGING_DATADOG_APP_KEY} 2>/dev/null || true + $(KUBECTL) wait --for=condition=Available -n datadog-agent deployment --all --timeout=120s endif - $(KUBECTL) apply -f - < examples/datadog-agent.yaml + LIMA_INSTANCE=$(LIMA_INSTANCE) envsubst < examples/datadog-agent.yaml | $(KUBECTL) apply -f - endif open-dd: ifeq (true,$(INSTALL_DATADOG_AGENT)) ifdef STAGING_DD_SITE - open "${STAGING_DD_SITE}/infrastructure?host=lima-$(LIMA_INSTANCE)&tab=details" + open "https://${STAGING_DD_SITE}/infrastructure/hosts?hostType=all-hosts&scope=host%3Alima-$(LIMA_INSTANCE)" else @echo "You need to define STAGING_DD_SITE in your .zshrc or similar to use this feature" endif diff --git a/examples/datadog-agent.yaml b/examples/datadog-agent.yaml index 019b0659e..88ba46231 100644 --- a/examples/datadog-agent.yaml +++ b/examples/datadog-agent.yaml @@ -10,7 +10,7 @@ metadata: namespace: datadog-agent spec: global: - clusterName: operator-lima-cluster + clusterName: ${LIMA_INSTANCE} logLevel: debug site: datadoghq.com credentials: @@ -50,3 +50,8 @@ spec: nodeAgent: image: name: gcr.io/datadoghq/agent:latest + env: + - name: DD_HOSTNAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName