Skip to content

Commit

Permalink
Merge pull request #51 from solarwinds/feature/NH-15440
Browse files Browse the repository at this point in the history
NH-15440: Production readyness
  • Loading branch information
gantrior authored Jul 19, 2022
2 parents ea9f26f + b6a871e commit 1433c6d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/buildAndDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 12 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <CHOSEN NAMESPACE> --from-literal=SOLARWINDS_API_TOKEN=<REPLACE WITH 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=<insert-namespace-name-here>
```

5. Deploy the manifest

```shell
kubectl apply -f deploy/k8s/manifest.yaml
```
Walk through Add Kubernetes wizard in SolarWinds Observability

## Development

Expand Down
6 changes: 3 additions & 3 deletions build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

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
Expand All @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/processor/prometheustypeconverterprocessor/go.mod
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/processor/swmetricstransformprocessor/go.mod
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/deploy/base/patch-apply-env-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/deploy/base/patch-logs-apply-env-variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1433c6d

Please sign in to comment.