-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add experimental otelcol log collector
This is an alpha feature without a stable API. It only supports container logs from docker-shim. chore: update changelog
- Loading branch information
Mikolaj Swiatek
committed
Jan 3, 2022
1 parent
066fe63
commit e99294c
Showing
20 changed files
with
622 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ tpl (toYaml .Values.otellogs.config | replace ": '{{" ": {{" | replace "}}'" "}}") . | nindent 2 }} |
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
11 changes: 11 additions & 0 deletions
11
deploy/helm/sumologic/templates/logs/collector/otelcol/configmap.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,11 @@ | ||
{{- if .Values.otellogs.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "sumologic.logs.collector.name.configmap" . }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.logs.collector.configmap" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
data: | ||
{{- (tpl (.Files.Glob "conf/logs/collector/otelcol/config.yaml").AsConfig .) | nindent 2 }} | ||
{{- end }} |
109 changes: 109 additions & 0 deletions
109
deploy/helm/sumologic/templates/logs/collector/otelcol/daemonset.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,109 @@ | ||
{{- if .Values.otellogs.enabled }} | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ template "sumologic.logs.collector.name.daemonset" . }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.logs.collector.daemonset" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ template "sumologic.labels.app.logs.collector.pod" . }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/logs/collector/otelcol/configmap.yaml") . | sha256sum }} | ||
{{- if .Values.sumologic.podAnnotations }} | ||
{{ toYaml .Values.sumologic.podAnnotations | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.otellogs.daemonset.podAnnotations }} | ||
{{ toYaml .Values.otellogs.daemonset.podAnnotations | indent 8 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ template "sumologic.labels.app.logs.collector.pod" . }} | ||
{{- include "sumologic.labels.common" . | nindent 8 }} | ||
{{- if .Values.sumologic.podLabels }} | ||
{{ toYaml .Values.sumologic.podLabels | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.otellogs.daemonset.podLabels }} | ||
{{ toYaml .Values.otellogs.daemonset.podLabels | indent 8 }} | ||
{{- end }} | ||
spec: | ||
securityContext: | ||
{{- toYaml .Values.otellogs.daemonset.securityContext | nindent 8 }} | ||
{{- if .Values.otellogs.daemonset.priorityClassName }} | ||
priorityClassName: {{ .Values.metadata.logs.daemonset.priorityClassName | quote }} | ||
{{- end }} | ||
containers: | ||
- args: | ||
- --config=/etc/otelcol/config.yaml | ||
image: {{ .Values.otellogs.image.repository }}:{{ .Values.otellogs.image.tag }} | ||
imagePullPolicy: {{ .Values.otellogs.image.pullPolicy }} | ||
name: otelcol | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 13133 # Health Check extension default port. | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 13133 # Health Check extension default port. | ||
volumeMounts: | ||
- mountPath: /etc/otelcol | ||
name: otelcol-config | ||
- mountPath: /var/log/pods | ||
name: varlogpods | ||
readOnly: true | ||
- mountPath: /var/lib/docker/containers | ||
name: varlibdockercontainers | ||
readOnly: true | ||
- mountPath: {{ .Values.otellogs.config.extensions.file_storage.directory }} | ||
name: file-storage | ||
env: | ||
- name: LOGS_METADATA_SVC | ||
valueFrom: | ||
configMapKeyRef: | ||
name: sumologic-configmap | ||
key: fluentdLogs | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
securityContext: | ||
{{- toYaml .Values.otellogs.daemonset.containers.otelcol.securityContext | nindent 10 }} | ||
initContainers: # ensure the host path is owned by the otel user group | ||
- name: changeowner | ||
image: busybox | ||
command: | ||
- "sh" | ||
- "-c" | ||
- | | ||
chown -R \ | ||
{{ .Values.otellogs.daemonset.securityContext.fsGroup }}:{{ .Values.otellogs.daemonset.securityContext.fsGroup }} \ | ||
{{ .Values.otellogs.config.extensions.file_storage.directory }} | ||
volumeMounts: | ||
- mountPath: {{ .Values.otellogs.config.extensions.file_storage.directory }} | ||
name: file-storage | ||
volumes: | ||
- configMap: | ||
defaultMode: 420 | ||
items: | ||
- key: config.yaml | ||
path: config.yaml | ||
name: {{ template "sumologic.logs.collector.name.configmap" . }} | ||
name: otelcol-config | ||
- hostPath: | ||
path: /var/log/pods | ||
type: "" | ||
name: varlogpods | ||
- hostPath: | ||
path: /var/lib/docker/containers | ||
type: "" | ||
name: varlibdockercontainers | ||
- hostPath: | ||
path: /var/lib/otc | ||
type: DirectoryOrCreate | ||
name: file-storage | ||
serviceAccountName: {{ template "sumologic.logs.collector.name.serviceaccount" . }} | ||
{{- end }} |
9 changes: 9 additions & 0 deletions
9
deploy/helm/sumologic/templates/logs/collector/otelcol/serviceaccount.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,9 @@ | ||
{{- if .Values.otellogs.enabled }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ template "sumologic.logs.collector.name.serviceaccount" . }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.logs.collector.serviceaccount" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
{{- 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
Oops, something went wrong.