From 00f9baf12fe0991d115f8bb42ada9cff9f4132da Mon Sep 17 00:00:00 2001 From: Povilas Versockas Date: Mon, 17 Jul 2023 16:32:49 +0300 Subject: [PATCH] [otel-infrastructure-collector] add helm install ci test (#254) * [otel-infrastructure-collector] add helm install ci test * Update .github/workflows/otel-infra-helm-test.yml Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com> * fixes after review --------- Co-authored-by: Matej Gera <38492574+matej-g@users.noreply.github.com> --- ...helm-test.yml => otel-agent-helm-test.yml} | 2 + .github/workflows/otel-infra-helm-test.yml | 24 +++ .../k8s-helm/ci/ci-values.yaml | 156 ++++++++++++++++++ 3 files changed, 182 insertions(+) rename .github/workflows/{helm-test.yml => otel-agent-helm-test.yml} (90%) create mode 100644 .github/workflows/otel-infra-helm-test.yml create mode 100644 otel-infrastructure-collector/k8s-helm/ci/ci-values.yaml diff --git a/.github/workflows/helm-test.yml b/.github/workflows/otel-agent-helm-test.yml similarity index 90% rename from .github/workflows/helm-test.yml rename to .github/workflows/otel-agent-helm-test.yml index 4310003a..02fe6bc6 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/otel-agent-helm-test.yml @@ -2,6 +2,8 @@ name: Otel Agent Helm Install Test on: pull_request: + paths: + - 'otel-agent/k8s-helm/**' jobs: collector-test: diff --git a/.github/workflows/otel-infra-helm-test.yml b/.github/workflows/otel-infra-helm-test.yml new file mode 100644 index 00000000..790c10fb --- /dev/null +++ b/.github/workflows/otel-infra-helm-test.yml @@ -0,0 +1,24 @@ +name: Otel Infrastructure Collector Helm Install Test + +on: + pull_request: + paths: + - 'otel-infrastructure-collector/k8s-helm/**' + +jobs: + collector-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup + uses: ./.github/actions/setup + with: + create-kind-cluster: "true" + - name: Setup Secret + run: kubectl create secret generic coralogix-keys --from-literal=PRIVATE_KEY=123 + - name: Run chart-testing (install) + run: ct install --namespace default --charts otel-infrastructure-collector/k8s-helm + diff --git a/otel-infrastructure-collector/k8s-helm/ci/ci-values.yaml b/otel-infrastructure-collector/k8s-helm/ci/ci-values.yaml new file mode 100644 index 00000000..5e8aa278 --- /dev/null +++ b/otel-infrastructure-collector/k8s-helm/ci/ci-values.yaml @@ -0,0 +1,156 @@ +global: + domain: "coralogix.com" + traces: + endpoint: "" + metrics: + endpoint: "" + logs: + endpoint: "" + defaultApplicationName: "default" + defaultSubsystemName: "nodes" + +opentelemetry-collector: + mode: deployment + fullnameOverride: otel-infrastructure-collector + clusterRole: + name: "otel-infrastructure-collector" + create: true + rules: + - apiGroups: ["", "events.k8s.io"] + resources: ["events"] + verbs: ["watch", "list"] + clusterRoleBinding: + name: "otel-infrastructure-collector" + replicaCount: 1 + presets: + clusterMetrics: + enabled: true + ports: + otlp: + enabled: true + otlp-http: + enabled: false + jaeger-compact: + enabled: false + jaeger-thrift: + enabled: false + jaeger-grpc: + enabled: false + zipkin: + enabled: false + + extraEnvs: + - name: CORALOGIX_PRIVATE_KEY + valueFrom: + secretKeyRef: + name: coralogix-keys + key: PRIVATE_KEY + config: + extensions: + zpages: + endpoint: localhost:55679 + receivers: + k8sobjects: + objects: + - name: events + mode: pull + interval: 15s + group: events.k8s.io + prometheus: + config: + scrape_configs: + - job_name: opentelemetry-infrastructure-collector + scrape_interval: 30s + static_configs: + - targets: + - ${MY_POD_IP}:8888 + exporters: + coralogix: + timeout: "1m" + private_key: "${CORALOGIX_PRIVATE_KEY}" + domain: "{{.Values.global.domain}}" + traces: + endpoint: "{{ .Values.global.traces.endpoint }}" + metrics: + endpoint: "{{ .Values.global.metrics.endpoint }}" + logs: + endpoint: "{{ .Values.global.logs.endpoint }}" + application_name_attributes: + - "k8s.namespace.name" + - "service.namespace" + subsystem_name_attributes: + - "k8s.deployment.name" + - "k8s.statefulset.name" + - "k8s.daemonset.name" + - "k8s.cronjob.name" + - "k8s.job.name" + - "k8s.container.name" + - "k8s.node.name" + - "service.name" + application_name: "{{.Values.global.defaultApplicationName }}" + subsystem_name: "{{.Values.global.defaultSubsystemName }}" + processors: + memory_limiter: null # Will get the k8s resource limits + transform/kube-events: + log_statements: + - context: log + statements: + - keep_keys(body, ["type", "action", "eventTime", "reason", "regarding", "reportingController", "note", "series", "metadata", "deprecatedFirstTimestamp", "deprecatedLastTimestamp"]) + resource/kube-events: + attributes: + - key: service.name + value: "kube-events" + action: upsert + service: + extensions: + - zpages + - health_check + - memory_ballast + telemetry: + logs: + encoding: json + metrics: + address: ${MY_POD_IP}:8888 + pipelines: + logs/kube-events: + exporters: + - coralogix + processors: + - memory_limiter + - batch + - transform/kube-events + - resource/kube-events + receivers: + - k8sobjects + metrics: + exporters: + - coralogix + processors: + - memory_limiter + - batch + receivers: + - prometheus + - otlp + tolerations: + - operator: Exists + + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 1 + memory: 2G + + # In order to enable serviceMonitor, following part must be enabled in order to expose the required port: + # ports: + # metrics: + # enabled: true + + # serviceMonitor: + # enabled: true + + # prometheusRule: + # enabled: true + # defaultRules: + # enabled: true