Skip to content

Commit

Permalink
Annotate APM Server Pods with co.elastic.logs/module
Browse files Browse the repository at this point in the history
Annotate APM Server pods with `co.elastic.logs/module: apmserver`
annotation to give a hint to filebeat so that it uses the
appropriate module to analyze the logs of the container.

Signed-off-by: prateekpandey14 <[email protected]>
  • Loading branch information
prateekpandey14 committed Oct 14, 2020
1 parent 2af071e commit 8bb87b3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/apmserver/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"

apmv1 "github.com/elastic/cloud-on-k8s/pkg/apis/apm/v1"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/annotation"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/container"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/defaults"
"github.com/elastic/cloud-on-k8s/pkg/controller/common/keystore"
Expand All @@ -39,6 +40,11 @@ var (
corev1.ResourceMemory: DefaultMemoryLimits,
},
}

// DefaultAnnotations are the default annotations for the apmserver pods
DefaultAnnotations = map[string]string{
annotation.FilebeatModuleAnnotation: "apmserver",
}
)

// readinessProbe is the readiness probe for the APM Server container
Expand Down Expand Up @@ -122,6 +128,7 @@ func newPodSpec(as *apmv1.ApmServer, p PodSpecParams) corev1.PodTemplateSpec {

builder := defaults.NewPodTemplateBuilder(p.PodTemplate, apmv1.ApmServerContainerName).
WithLabels(labels).
WithAnnotations(DefaultAnnotations).
WithResources(DefaultResources).
WithDockerImage(p.CustomImageName, container.ImageRepository(container.APMServerImage, p.Version)).
WithReadinessProbe(readinessProbe(as.Spec.HTTP.TLS.Enabled())).
Expand Down

0 comments on commit 8bb87b3

Please sign in to comment.