diff --git a/.github/workflows/buildAndDeploy.yml b/.github/workflows/buildAndDeploy.yml index 64a20a99..8d0cc8d8 100644 --- a/.github/workflows/buildAndDeploy.yml +++ b/.github/workflows/buildAndDeploy.yml @@ -105,8 +105,8 @@ jobs: - name: Tag images if: github.ref == 'refs/heads/master' || (github.event_name == 'release' && github.event.action == 'published') run: | - docker tag nighthawk-swi-opentelemetry-collector:${{ steps.generate-tag.outputs.value }} ${{ env.ECR_REPO }}/${{ env.ECR_IMAGE }}:${{ steps.generate-tag.outputs.value }} - docker tag nighthawk-swi-opentelemetry-collector:${{ steps.generate-tag.outputs.value }} ${{ env.ECR_REPO }}/${{ env.ECR_IMAGE }}:latest + docker tag swi-k8s-opentelemetry-collector:${{ steps.generate-tag.outputs.value }} ${{ env.ECR_REPO }}/${{ env.ECR_IMAGE }}:${{ steps.generate-tag.outputs.value }} + docker tag swi-k8s-opentelemetry-collector:${{ steps.generate-tag.outputs.value }} ${{ env.ECR_REPO }}/${{ env.ECR_IMAGE }}:latest - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 diff --git a/README.md b/README.md index 0e00cbf2..ccbcedb9 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,31 @@ -# nighthawk-im-k8s-monitor +# swi-k8s-opentelemetry-collector -Assets to monitor kubernetes infrastructure +Assets to monitor kubernetes infrastructure in SolarWinds Observability ## Table of contents - [About](#about) - [Installation](#installation) +- [Development](#development) ## About -This repository contains Kubernetes manifest files to collect metrics provided by existing Prometheus server, and export those metrics to SolarWinds OaaS infrastructure. +This repository contains: +* Kubernetes manifest files to collect metrics provided by existing Prometheus server, events and logs and export it to SolarWinds OaaS infrastructure. +* Dockerfile for images published to Docker hub that is deployed as part of Kubernetes monitoring +* All related sources that are built into that: + * Custom OpenTelemetry collector processors + * OpenTelemetry collector configuration + Components that are being deployed: - Service account - identity of deployed pods - Deployment - customized OpenTelemetry Collector deployment, configured to poll Prometheus instance(s) - ConfigMap - configuration of OpenTelemetry Collector +- DaemonSet - customized OpenTelemetry Collector deployment, configured to poll container logs ## Installation - -1. First decide to which namespace you want to deploy the manifest. It is recommended to deploy them to the same namespace where you Prometheus instance is deployed. -2. Store API Token to kubernetes secret called `solarwinds-api-token` (Get the token from `Settings` -> `API Tokens` -> `Create API Token` and select `Ingestion` Type) - -```shell -kubectl create secret generic solarwinds-api-token -n --from-literal=SOLARWINDS_API_TOKEN= -``` - -3. Adjust Prometheus instance(s) in the manifest (look for `PROMETHEUS_URL` in the manifest or in case of multiple instances adjust OtelCollector configuration in `receivers` -> `prometheus` -> `config` -> `scrape_configs` -> `job_name: prometheus` -> `static_configs` -> `targets`) -4. Set current active namespace to namespace from step 1 - -```shell -kubectl config set-context --current --namespace= -``` - -5. Deploy the manifest - -```shell -kubectl apply -f deploy/k8s/manifest.yaml -``` +Walk through Add Kubernetes wizard in SolarWinds Observability ## Development diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index cbffca56..833383eb 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -2,13 +2,13 @@ ARG GOLANG_IMAGE=docker.io/library/golang:1.17.1-alpine@sha256:13919fb9091f6667c FROM ${GOLANG_IMAGE} as builder -COPY /build/nighthawk-swi-opentelemetry-collector.yaml /src/nighthawk-swi-opentelemetry-collector.yaml +COPY /build/swi-k8s-opentelemetry-collector.yaml /src/swi-k8s-opentelemetry-collector.yaml RUN GO111MODULE=on go install go.opentelemetry.io/collector/cmd/builder@v0.51.0 WORKDIR /src COPY ["./src/", "./src/"] -RUN CGO_ENABLED=0 /go/bin/builder --config ./nighthawk-swi-opentelemetry-collector.yaml --output-path ./ +RUN CGO_ENABLED=0 /go/bin/builder --config ./swi-k8s-opentelemetry-collector.yaml --output-path ./ FROM alpine:latest as prep RUN apk --update add ca-certificates @@ -19,7 +19,7 @@ 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/nighthawk-swi-opentelemetry-collector /swi-otelcol +COPY --from=builder /src/swi-k8s-opentelemetry-collector /swi-otelcol ENTRYPOINT ["/swi-otelcol"] CMD ["--config=/opt/default-config.yaml"] diff --git a/build/nighthawk-swi-opentelemetry-collector.yaml b/build/swi-k8s-opentelemetry-collector.yaml similarity index 87% rename from build/nighthawk-swi-opentelemetry-collector.yaml rename to build/swi-k8s-opentelemetry-collector.yaml index e3c0722e..69b7e614 100644 --- a/build/nighthawk-swi-opentelemetry-collector.yaml +++ b/build/swi-k8s-opentelemetry-collector.yaml @@ -1,5 +1,5 @@ dist: - name: nighthawk-swi-opentelemetry-collector + name: swi-k8s-opentelemetry-collector description: "SolarWinds distribution for OpenTelemetry" otelcol_version: "0.51.0" version: "0.1.0" @@ -24,9 +24,9 @@ processors: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.51.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor v0.51.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.51.0 - - gomod: github.com/solarwinds/nighthawk-im-k8s-monitor/processor/prometheustypeconverterprocessor v0.0.1 + - gomod: github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/prometheustypeconverterprocessor v0.0.1 path: "./src/processor/prometheustypeconverterprocessor" - - gomod: github.com/solarwinds/nighthawk-im-k8s-monitor/processor/swmetricstransformprocessor v0.0.1 + - gomod: github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/swmetricstransformprocessor v0.0.1 path: "./src/processor/swmetricstransformprocessor" extensions: diff --git a/skaffold.yaml b/skaffold.yaml index d283b00e..1a1828da 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -1,12 +1,12 @@ apiVersion: skaffold/v2beta22 kind: Config metadata: - name: nighthawk-im-k8s-monitor + name: swi-k8s-opentelemetry-collector build: local: push: false artifacts: - - image: nighthawk-swi-opentelemetry-collector + - image: swi-k8s-opentelemetry-collector docker: dockerfile: build/docker/Dockerfile deploy: diff --git a/src/processor/prometheustypeconverterprocessor/go.mod b/src/processor/prometheustypeconverterprocessor/go.mod index 4467eb76..92d0c14c 100644 --- a/src/processor/prometheustypeconverterprocessor/go.mod +++ b/src/processor/prometheustypeconverterprocessor/go.mod @@ -1,4 +1,4 @@ -module github.com/solarwinds/nighthawk-im-k8s-monitor/processor/prometheustypeconverterprocessor +module github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/prometheustypeconverterprocessor go 1.17 diff --git a/src/processor/swmetricstransformprocessor/go.mod b/src/processor/swmetricstransformprocessor/go.mod index c919919c..141d7213 100644 --- a/src/processor/swmetricstransformprocessor/go.mod +++ b/src/processor/swmetricstransformprocessor/go.mod @@ -1,4 +1,4 @@ -module github.com/solarwinds/nighthawk-im-k8s-monitor/processor/swmetricstransformprocessor +module github.com/solarwinds/swi-k8s-opentelemetry-collector/processor/swmetricstransformprocessor go 1.17 diff --git a/tests/deploy/base/patch-apply-env-variables.yaml b/tests/deploy/base/patch-apply-env-variables.yaml index f39210d7..66bea237 100644 --- a/tests/deploy/base/patch-apply-env-variables.yaml +++ b/tests/deploy/base/patch-apply-env-variables.yaml @@ -7,7 +7,7 @@ spec: spec: containers: - name: opentelemetry-collector - image: nighthawk-swi-opentelemetry-collector + image: swi-k8s-opentelemetry-collector imagePullPolicy: Never env: - name: SOLARWINDS_API_TOKEN diff --git a/tests/deploy/base/patch-logs-apply-env-variables.yaml b/tests/deploy/base/patch-logs-apply-env-variables.yaml index 1d69b27d..5708b8d9 100644 --- a/tests/deploy/base/patch-logs-apply-env-variables.yaml +++ b/tests/deploy/base/patch-logs-apply-env-variables.yaml @@ -7,7 +7,7 @@ spec: spec: containers: - name: swi-opentelemetry-collector - image: nighthawk-swi-opentelemetry-collector + image: swi-k8s-opentelemetry-collector imagePullPolicy: Never env: - name: SOLARWINDS_API_TOKEN