-
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 OT event collection
- Loading branch information
Mikołaj Świątek
committed
Jun 15, 2022
1 parent
62827c3
commit 8e056c0
Showing
22 changed files
with
964 additions
and
10 deletions.
There are no files selected for viewing
File renamed without changes.
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,59 @@ | ||
receivers: | ||
raw_k8s_events: {} | ||
extensions: | ||
health_check: {} | ||
file_storage: | ||
directory: /var/lib/storage/otc | ||
timeout: 10s | ||
pprof: {} | ||
exporters: | ||
sumologic: | ||
log_format: json | ||
json_logs: | ||
add_timestamp: true | ||
timestamp_key: timestamp | ||
endpoint: ${SUMO_ENDPOINT_DEFAULT_EVENTS_SOURCE} | ||
source_name: "%{_sourceName}" | ||
source_category: "%{_sourceCategory}" | ||
sending_queue: | ||
enabled: true | ||
persistent_storage_enabled: {{ .Values.otelevents.persistence.enabled }} | ||
processors: | ||
memory_limiter: | ||
check_interval: 1s | ||
limit_percentage: 70 | ||
spike_limit_percentage: 20 | ||
batch: | ||
send_batch_size: 1024 | ||
send_batch_max_size: 2_048 | ||
timeout: 1s | ||
resource/add_cluster: | ||
attributes: | ||
- key: cluster | ||
value: {{ .Values.sumologic.clusterName | quote }} | ||
action: upsert | ||
source: | ||
collector: {{ .Values.sumologic.collectorName | default .Values.sumologic.clusterName | quote }} | ||
source_name: {{ .Values.fluentd.events.sourceName | quote}} | ||
source_category: {{ .Values.fluentd.events.sourceCategory | default (printf "%s/%s" (include "sumologic.clusterNameReplaceSpaceWithDash" .) (.Values.fluentd.events.sourceName )) | quote}} | ||
source_category_prefix: "" | ||
|
||
service: | ||
telemetry: | ||
logs: | ||
level: {{ .Values.otelevents.logLevel }} | ||
extensions: | ||
- health_check | ||
- file_storage | ||
- pprof | ||
pipelines: | ||
logs/events: | ||
receivers: | ||
- raw_k8s_events | ||
processors: | ||
- memory_limiter | ||
- resource/add_cluster | ||
- source | ||
- batch | ||
exporters: | ||
- sumologic |
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
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
15 changes: 15 additions & 0 deletions
15
deploy/helm/sumologic/templates/events/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,15 @@ | ||
{{- if eq (include "events.otelcol.enabled" .) "true" }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "sumologic.metadata.name.events.configmap" . }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.events.configmap" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
data: | ||
{{- $baseConfig := (tpl (.Files.Get "conf/events/otelcol/config.yaml") .) | fromYaml -}} | ||
{{- $overrideConfig := .Values.otelevents.config.override -}} | ||
{{- $finalConfig := mergeOverwrite $baseConfig $overrideConfig }} | ||
config.yaml: | | ||
{{- $finalConfig | toYaml | nindent 4 }} | ||
{{- end }} |
166 changes: 166 additions & 0 deletions
166
deploy/helm/sumologic/templates/events/otelcol/statefulset.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,166 @@ | ||
{{- if eq (include "events.otelcol.enabled" .) "true" }} | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ template "sumologic.metadata.name.events.statefulset" . }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.events.statefulset" . }} | ||
{{- include "sumologic.labels.common" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ template "sumologic.labels.app.events.pod" . }} | ||
serviceName: {{ template "sumologic.metadata.name.events.service-headless" . }} | ||
podManagementPolicy: "Parallel" | ||
replicas: 1 | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/events/otelcol/configmap.yaml") . | sha256sum }} | ||
{{- if .Values.sumologic.podAnnotations }} | ||
{{ toYaml .Values.sumologic.podAnnotations | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.otelevents.statefulset.podAnnotations }} | ||
{{ toYaml .Values.otelevents.statefulset.podAnnotations | indent 8 }} | ||
{{- end }} | ||
labels: | ||
app: {{ template "sumologic.labels.app.events.pod" . }} | ||
{{- include "sumologic.labels.common" . | nindent 8 }} | ||
{{- if .Values.sumologic.podLabels }} | ||
{{ toYaml .Values.sumologic.podLabels | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.otelevents.statefulset.podLabels }} | ||
{{ toYaml .Values.otelevents.statefulset.podLabels | indent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ template "sumologic.metadata.name.roles.serviceaccount" . }} | ||
{{- if .Values.otelevents.statefulset.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.otelevents.statefulset.nodeSelector | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.otelevents.statefulset.tolerations }} | ||
tolerations: | ||
{{ toYaml .Values.otelevents.statefulset.tolerations | indent 8 }} | ||
{{- end }} | ||
{{- if or .Values.otelevents.statefulset.affinity .Values.otelevents.statefulset.podAntiAffinity }} | ||
affinity: | ||
{{- if .Values.otelevents.statefulset.affinity }} | ||
{{ toYaml .Values.otelevents.statefulset.affinity | indent 8 }} | ||
{{- end }} | ||
{{- if eq .Values.otelevents.statefulset.podAntiAffinity "hard"}} | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- {{ template "sumologic.labels.app.logs" . }} | ||
- {{ template "sumologic.labels.app.metrics" . }} | ||
- key: app | ||
operator: In | ||
values: | ||
- prometheus-operator-prometheus | ||
topologyKey: "kubernetes.io/hostname" | ||
{{else if eq .Values.otelevents.statefulset.podAntiAffinity "soft"}} | ||
podAntiAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 100 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app | ||
operator: In | ||
values: | ||
- {{ template "sumologic.labels.app.logs.pod" . }} | ||
- {{ template "sumologic.labels.app.events.pod" . }} | ||
- key: app | ||
operator: In | ||
values: | ||
- prometheus-operator-prometheus | ||
topologyKey: "kubernetes.io/hostname" | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.otelevents.statefulset.topologySpreadConstraints }} | ||
topologySpreadConstraints: | ||
{{ toYaml .Values.otelevents.statefulset.topologySpreadConstraints | indent 6 }} | ||
{{- end }} | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: {{ template "sumologic.metadata.name.events.configmap" . }} | ||
{{- if .Values.otelevents.statefulset.extraVolumes }} | ||
{{ toYaml .Values.otelevents.statefulset.extraVolumes | indent 6 }} | ||
{{- end }} | ||
securityContext: | ||
{{- toYaml .Values.otelevents.statefulset.securityContext | nindent 8 }} | ||
{{- if .Values.otelevents.statefulset.priorityClassName }} | ||
priorityClassName: {{ .Values.otelevents.statefulset.priorityClassName | quote }} | ||
{{- end }} | ||
containers: | ||
- name: otelcol | ||
image: {{ .Values.otelevents.image.repository }}:{{ .Values.otelevents.image.tag }} | ||
imagePullPolicy: {{ .Values.otelevents.image.pullPolicy }} | ||
args: | ||
- --config=/etc/otel/config.yaml | ||
resources: | ||
{{- toYaml .Values.otelevents.statefulset.resources | nindent 10 }} | ||
{{- if .Values.otelevents.statefulset.containers.otelcol.securityContext }} | ||
securityContext: | ||
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.securityContext | nindent 10 }} | ||
{{- end }} | ||
ports: | ||
- name: metrics | ||
containerPort: 8888 | ||
protocol: TCP | ||
- name: pprof | ||
containerPort: 1777 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: 13133 # Health Check extension default port. | ||
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.livenessProbe | nindent 10 }} | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: 13133 # Health Check extension default port. | ||
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.readinessProbe | nindent 10 }} | ||
startupProbe: | ||
httpGet: | ||
path: / | ||
port: 13133 # Health Check extension default port. | ||
{{- toYaml .Values.otelevents.statefulset.containers.otelcol.startupProbe | nindent 10 }} | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/otel/config.yaml | ||
subPath: config.yaml | ||
{{- if .Values.otelevents.persistence.enabled }} | ||
- name: file-storage | ||
mountPath: /var/lib/storage/otc | ||
{{- end}} | ||
{{- if .Values.otelevents.statefulset.extraVolumeMounts }} | ||
{{ toYaml .Values.otelevents.statefulset.extraVolumeMounts | indent 8 }} | ||
{{- end }} | ||
env: | ||
{{- $ctx := .Values -}} | ||
{{- include "kubernetes.sources.envs" (dict "Context" $ctx "Type" "events") -}} | ||
{{- if .Values.otelevents.statefulset.extraEnvVars }} | ||
{{ toYaml .Values.otelevents.statefulset.extraEnvVars | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.otelevents.persistence.enabled }} | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: file-storage | ||
{{- if .Values.otelevents.persistence.pvcLabels }} | ||
labels: | ||
{{ toYaml .Values.otelevents.persistence.pvcLabels | indent 8 }} | ||
{{- end }} | ||
spec: | ||
accessModes: [{{ .Values.otelevents.persistence.accessMode }}] | ||
storageClassName: {{ .Values.otelevents.persistence.storageClass }} | ||
resources: | ||
requests: | ||
storage: {{ .Values.otelevents.persistence.size }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.