Skip to content

Commit

Permalink
Fix elastic-agent-service Docker container entrypoint (#5892)
Browse files Browse the repository at this point in the history
* 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'
  • Loading branch information
cmacknz authored Oct 30, 2024
1 parent 89dca1d commit 0cdfef5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 && \
Expand Down Expand Up @@ -172,7 +172,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 && \
Expand Down Expand Up @@ -294,7 +294,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
Expand Down
5 changes: 0 additions & 5 deletions testing/integration/kubernetes_agent_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0cdfef5

Please sign in to comment.