Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/docker/build/docker/alpine-eece025
Browse files Browse the repository at this point in the history
  • Loading branch information
gantrior authored Oct 9, 2023
2 parents 46de3d8 + 3616f74 commit 249fc61
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 873 deletions.
17 changes: 10 additions & 7 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ FROM debian:11.7@sha256:432f545c6ba13b79e2681f4cc4858788b0ab099fc1cca799cc0fae46
RUN apt update
RUN apt install -y systemd

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=prep /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /src/swi-k8s-opentelemetry-collector /swi-otelcol
FROM scratch as journalbinaries

# dynamically linked libraries that are required for journalctl and the journalctl binary itself
# use `ldd /bin/journalctl` to get dynamically linked libraries from the binary
Expand Down Expand Up @@ -60,6 +54,15 @@ COPY --from=journal /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 /usr/lib/x86_64-li
COPY --from=journal /lib/x86_64-linux-gnu/libcap-ng.so.0 /lib/x86_64-linux-gnu/libcap-ng.so.0
COPY --from=journal /bin/journalctl /bin/journalctl

FROM scratch

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=prep /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /src/swi-k8s-opentelemetry-collector /swi-otelcol
COPY --from=journalbinaries / /

ENTRYPOINT ["/swi-otelcol"]
CMD ["--config=/opt/default-config.yaml"]

13 changes: 0 additions & 13 deletions build/docker/wiremockFiles/redirectKubeStateMetricsResponse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ kube_pod_container_resource_limits{container="test-container",endpoint="http",in
kube_pod_container_resource_limits{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021
kube_pod_container_resource_limits{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021
kube_pod_container_resource_limits{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="cpu",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="core",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021
# TYPE kube_pod_container_resource_limits_cpu_cores untyped
kube_pod_container_resource_limits_cpu_cores{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="71057e83-7723-4db5-a7ca-52ad7904e34d",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
# TYPE kube_pod_container_resource_limits_memory_bytes untyped
kube_pod_container_resource_limits_memory_bytes{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="03d2b55c-b225-476b-9178-c74f8e5eaba2",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 2.68435456e+08 1675856675021
kube_pod_container_resource_limits_memory_bytes{container="test-container",endpoint="tcp-model",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021
# TYPE kube_pod_container_resource_requests untyped
kube_pod_container_resource_requests{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="cpu",service="test-service",uid="f15ca7ca-af33-4f43-a793-ec3176b31842",unit="core",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021
kube_pod_container_resource_requests{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",node="test-node",pod="test-pod",resource="memory",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",unit="byte",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 3.221225472e+09 1675856675021
Expand Down Expand Up @@ -242,14 +237,6 @@ kube_pod_info{container="test-container",created_by_kind="ReplicaSet",created_by
kube_pod_init_container_info{container="test-container",container_id="docker://f1c98663d614379552d6c9aae831b4eb3e149c469d4d589b62ea077cf3dad807",endpoint="http",image="busybox:1.29.2",image_id="docker-pullable://busybox@sha256:cb63aa0641a885f54de20f61d152187419e8f6b159ed11a251a09d115fdff9bd",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="9cab81cb-9da1-4029-ac51-c7c3024c6fbf",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
kube_pod_init_container_info{container="test-container",container_id="docker://f55a97f615b1a90f15f114def871a7d4f0ed8a32d9a329cc7e2f94a24d4780c1",endpoint="http",image="fullstorydev/grpcurl:latest",image_id="docker-pullable://fullstorydev/grpcurl@sha256:d42ef512419560776bee5bb51e338a1734a0edb99f450b6d98fd98bcc93796f3",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
kube_pod_init_container_info{container="test-container",container_id="docker://6fb07210b86971939dbfb16ae47f98afdb8214a52a21dd5fc26f21ae35c09d9e",endpoint="http",image="busybox:latest",image_id="docker-pullable://busybox@sha256:b5d6fe0712636ceb7430189de28819e195e8966372edfc2d9409d79402a0dc16",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
# TYPE kube_pod_init_container_resource_limits_cpu_cores untyped
kube_pod_init_container_resource_limits_cpu_cores{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="2a82ed12-a31a-427a-adb9-d14cf6a4a063",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.1 1675856675021
# TYPE kube_pod_init_container_resource_limits_memory_bytes untyped
kube_pod_init_container_resource_limits_memory_bytes{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="a920ed2f-477d-4ad7-93d6-3222aabfece2",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1.073741824e+09 1675856675021
# TYPE kube_pod_init_container_resource_requests_cpu_cores untyped
kube_pod_init_container_resource_requests_cpu_cores{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="c7f7a05a-a1b5-4fd0-a611-8e2a0e7acbf6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 0.25 1675856675021
# TYPE kube_pod_init_container_resource_requests_memory_bytes untyped
kube_pod_init_container_resource_requests_memory_bytes{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="c7f7a05a-a1b5-4fd0-a611-8e2a0e7acbf6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 6.7108864e+07 1675856675021
# TYPE kube_pod_init_container_status_ready untyped
kube_pod_init_container_status_ready{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="64b6d309-44e3-4a41-8883-c15c7cc9bc4a",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
kube_pod_init_container_status_ready{container="test-container",endpoint="http",instance="test-node",job="test-job",namespace="test-namespace",pod="test-pod",service="test-service",uid="bafeef2c-1292-4a5e-a92c-d709480b04b6",prometheus="prometheus-system/kube-prometheus-kube-prome-prometheus",prometheus_replica="prometheus-kube-prometheus-kube-prome-prometheus-0"} 1 1675856675021
Expand Down
16 changes: 13 additions & 3 deletions deploy/helm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.8.0-alpha.2] - 2023-09-14
### Fixed

### Added
- Detection of Node name for Fargate Nodes's metrics

- Add monitoring windows node logs
## [2.8.0-alpha.3] - 2023-10-06

### Changed

- Changing log message attributes to respect OTEL log format

### Fixed
- Fixing nodeselector for kube-state-metrics so that it is deployed on linux nodes only

## [2.8.0-alpha.2] - 2023-09-14

### Added

- Add monitoring windows node logs
## [2.8.0-alpha.1] - 2023-09-11

### Added
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: swo-k8s-collector
version: 2.8.0-alpha.2
version: 2.8.0-alpha.3
appVersion: "0.8.3"
description: SolarWinds Kubernetes Integration
keywords:
Expand Down
13 changes: 4 additions & 9 deletions deploy/helm/logs-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ processors:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- host.hostname
- host.name
- service.name


Expand Down Expand Up @@ -98,12 +98,8 @@ processors:
log_statements:
- context: log
statements:
- set( attributes["syslog.facility"], 1 )
- set( attributes["syslog.version"], 1 )
- set( attributes["host.hostname"], attributes["k8s.pod.name"])
- set( attributes["host.name"], attributes["k8s.pod.name"])
- set( attributes["service.name"], attributes["k8s.container.name"])
- set( attributes["syslog.procid"], attributes["run_id"])
- set( attributes["syslog.msgid"], attributes["stream"])

batch:
{{ toYaml .Values.otel.logs.batch | indent 4 }}
Expand Down Expand Up @@ -232,9 +228,8 @@ receivers:
- type: move
from: attributes.pod_name
to: attributes["k8s.pod.name"]
- type: move
from: attributes.run_id
to: attributes["run_id"]
- type: remove
field: attributes.run_id
- type: move
from: attributes.uid
to: attributes["k8s.pod.uid"]
Expand Down
12 changes: 8 additions & 4 deletions deploy/helm/metrics-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ processors:
datapoint:
- 'attributes["container"] == "POD" and IsMatch(metric.name, "container_network_.*|k8s.container.*") == true'


# unify attributes
attributes/unify_node_attribute:
include:
Expand All @@ -72,9 +71,13 @@ processors:
from_attribute: kubernetes_io_hostname
action: insert
{{- end }}
- key: k8s.node.name
from_attribute: service.instance.id
action: insert

transform/unify_node_attribute:
metric_statements:
- context: datapoint
statements:
# use "service.instance.id" for Node name when the attributes/unify_node_attribute processor failed to provide it
- set(attributes["k8s.node.name"], resource.attributes["service.instance.id"]) where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$") == true and attributes["k8s.node.name"] == nil

attributes/unify_volume_attribute:
include:
Expand Down Expand Up @@ -1484,6 +1487,7 @@ service:
- transform
- filter/remove_internal
- attributes/unify_node_attribute
- transform/unify_node_attribute
- attributes/unify_volume_attribute
- attributes/identify_init_container
- attributes/identify_standard_container
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/templates/swo-agent-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ spec:
solarwinds/swo-agent: "true"
spec:
securityContext: {}
nodeSelector:
kubernetes.io/os: linux
containers:
- name: swo-agent
image: "{{ .Values.swoagent.image.repository }}:{{ .Values.swoagent.image.tag | default "v2.3.16@sha256:c42c9ca134db54341dc88c3e0c35b1a04db4629b1d97bfde524dfc5d2b8722e5" }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Logs config for windows nodes should match snapshot when using default values:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- host.hostname
- host.name
- service.name
memory_limiter:
check_interval: 1s
Expand Down Expand Up @@ -65,12 +65,8 @@ Logs config for windows nodes should match snapshot when using default values:
log_statements:
- context: log
statements:
- set( attributes["syslog.facility"], 1 )
- set( attributes["syslog.version"], 1 )
- set( attributes["host.hostname"], attributes["k8s.pod.name"])
- set( attributes["host.name"], attributes["k8s.pod.name"])
- set( attributes["service.name"], attributes["k8s.container.name"])
- set( attributes["syslog.procid"], attributes["run_id"])
- set( attributes["syslog.msgid"], attributes["stream"])
receivers:
filelog:
encoding: utf-8
Expand Down Expand Up @@ -156,9 +152,8 @@ Logs config for windows nodes should match snapshot when using default values:
- from: attributes.pod_name
to: attributes["k8s.pod.name"]
type: move
- from: attributes.run_id
to: attributes["run_id"]
type: move
- field: attributes.run_id
type: remove
- from: attributes.uid
to: attributes["k8s.pod.uid"]
type: move
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Logs config should match snapshot when using default values:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- host.hostname
- host.name
- service.name
memory_limiter:
check_interval: 1s
Expand Down Expand Up @@ -85,12 +85,8 @@ Logs config should match snapshot when using default values:
log_statements:
- context: log
statements:
- set( attributes["syslog.facility"], 1 )
- set( attributes["syslog.version"], 1 )
- set( attributes["host.hostname"], attributes["k8s.pod.name"])
- set( attributes["host.name"], attributes["k8s.pod.name"])
- set( attributes["service.name"], attributes["k8s.container.name"])
- set( attributes["syslog.procid"], attributes["run_id"])
- set( attributes["syslog.msgid"], attributes["stream"])
receivers:
filelog:
encoding: utf-8
Expand Down Expand Up @@ -176,9 +172,8 @@ Logs config should match snapshot when using default values:
- from: attributes.pod_name
to: attributes["k8s.pod.name"]
type: move
- from: attributes.run_id
to: attributes["run_id"]
type: move
- field: attributes.run_id
type: remove
- from: attributes.uid
to: attributes["k8s.pod.uid"]
type: move
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Fargate logging ConfigMap spec should include additional filters when they are c
Match *
Add sw.k8s.cluster.uid <CLUSTER_UID>
Add sw.k8s.log.type container
Add sw.k8s.agent.manifest.version "2.8.0-alpha.2"
Add sw.k8s.agent.manifest.version "2.8.0-alpha.3"
flb_log_cw: "false"
output.conf: |
[OUTPUT]
Expand Down Expand Up @@ -64,7 +64,7 @@ Fargate logging ConfigMap spec should match snapshot when Fargate logging is ena
Match *
Add sw.k8s.cluster.uid <CLUSTER_UID>
Add sw.k8s.log.type container
Add sw.k8s.agent.manifest.version "2.8.0-alpha.2"
Add sw.k8s.agent.manifest.version "2.8.0-alpha.3"
flb_log_cw: "false"
output.conf: |
[OUTPUT]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ Metrics config should match snapshot when using default values:
- action: insert
from_attribute: node
key: k8s.node.name
- action: insert
from_attribute: service.instance.id
key: k8s.node.name
include:
match_type: regexp
metric_names:
Expand Down Expand Up @@ -1926,6 +1923,13 @@ Metrics config should match snapshot when using default values:
- delete_key(resource.attributes, "sw.k8s.job.found")
- delete_key(resource.attributes, "sw.k8s.cronjob.found")
- delete_key(resource.attributes, "sw.k8s.node.found")
transform/unify_node_attribute:
metric_statements:
- context: datapoint
statements:
- set(attributes["k8s.node.name"], resource.attributes["service.instance.id"])
where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$")
== true and attributes["k8s.node.name"] == nil
receivers:
k8s_events: null
prometheus/kube-state-metrics:
Expand Down Expand Up @@ -1989,6 +1993,7 @@ Metrics config should match snapshot when using default values:
- transform
- filter/remove_internal
- attributes/unify_node_attribute
- transform/unify_node_attribute
- attributes/unify_volume_attribute
- attributes/identify_init_container
- attributes/identify_standard_container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,6 @@ Metrics config should match snapshot when using default values:
- action: insert
from_attribute: kubernetes_io_hostname
key: k8s.node.name
- action: insert
from_attribute: service.instance.id
key: k8s.node.name
include:
match_type: regexp
metric_names:
Expand Down Expand Up @@ -1929,6 +1926,13 @@ Metrics config should match snapshot when using default values:
- delete_key(resource.attributes, "sw.k8s.job.found")
- delete_key(resource.attributes, "sw.k8s.cronjob.found")
- delete_key(resource.attributes, "sw.k8s.node.found")
transform/unify_node_attribute:
metric_statements:
- context: datapoint
statements:
- set(attributes["k8s.node.name"], resource.attributes["service.instance.id"])
where IsMatch(metric.name, "^(container_.*)|(kube_node_.*)|(kube_pod_info)|(kube_pod_container_resource_requests)|(kube_pod_container_resource_limits)|(kube_pod_init_container_resource_requests)|(kube_pod_init_container_resource_limits)$")
== true and attributes["k8s.node.name"] == nil
receivers:
k8s_events: null
prometheus/kube-state-metrics:
Expand Down Expand Up @@ -1992,6 +1996,7 @@ Metrics config should match snapshot when using default values:
- transform
- filter/remove_internal
- attributes/unify_node_attribute
- transform/unify_node_attribute
- attributes/unify_volume_attribute
- attributes/identify_init_container
- attributes/identify_standard_container
Expand Down
Loading

0 comments on commit 249fc61

Please sign in to comment.