From 789bc154a433a867a74ece4d48f8b658da01164b Mon Sep 17 00:00:00 2001 From: Craig MacKenzie Date: Wed, 30 Oct 2024 18:01:59 -0400 Subject: [PATCH] Fix elastic-agent-service Docker container entrypoint (#5892) * Stop treating the service image like cloud. The image will be deployed in cloud, but the runtime requirements are that of the standard Docker image. * Remove elastic-agent-service command customization. * Remove unnecessary 'or' (cherry picked from commit 0cdfef580e28e0488ae2bfa9e1372e083e3712c0) --- .../templates/docker/Dockerfile.elastic-agent.tmpl | 6 +++--- testing/integration/kubernetes_agent_service_test.go | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl b/dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl index 027a4241267..54e9b911df9 100644 --- a/dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl +++ b/dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl @@ -43,7 +43,7 @@ RUN true && \ chmod 0775 {{ $beatHome}}/{{ $modulesd }} && \ {{- end }} -{{- if or (eq .Variant "cloud") (eq .Variant "service") }} +{{- if eq .Variant "cloud" }} mkdir -p /opt/agentbeat /opt/filebeat /opt/metricbeat && \ cp -f {{ $beatHome }}/data/cloud_downloads/filebeat.sh /opt/filebeat/filebeat && \ chmod +x /opt/filebeat/filebeat && \ @@ -173,7 +173,7 @@ RUN mkdir /licenses COPY --from=home {{ $beatHome }}/LICENSE.txt /licenses COPY --from=home {{ $beatHome }}/NOTICE.txt /licenses -{{- if or (eq .Variant "cloud") (eq .Variant "service") }} +{{- if eq .Variant "cloud" }} COPY --from=home /opt /opt # Generate folder for a stub command that will be overwritten at runtime RUN mkdir /app && \ @@ -295,7 +295,7 @@ ENV LIBBEAT_MONITORING_CGROUPS_HIERARCHY_OVERRIDE=/ WORKDIR {{ $beatHome }} -{{- if or (eq .Variant "cloud") (eq .Variant "service") }} +{{- if eq .Variant "cloud" }} ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["/app/apm.sh"] # Generate a stub command that will be overwritten at runtime diff --git a/testing/integration/kubernetes_agent_service_test.go b/testing/integration/kubernetes_agent_service_test.go index de015a06d15..f3cdcad87eb 100644 --- a/testing/integration/kubernetes_agent_service_test.go +++ b/testing/integration/kubernetes_agent_service_test.go @@ -88,11 +88,6 @@ func TestKubernetesAgentService(t *testing.T) { container.Env[idx].ValueFrom = nil } } - - // has a unique entrypoint and command because its ran in the cloud - // adjust the spec to run it correctly - container.Command = []string{"elastic-agent"} - container.Args = []string{"-c", "/etc/elastic-agent/agent.yml", "-e"} }, func(pod *corev1.PodSpec) { for volumeIdx, volume := range pod.Volumes {