diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 03320e0e..bb7996f5 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -97,14 +97,26 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' + cache-dependency-path: | + .otelcol-builder.yaml + .goreleaser.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + - name: Install opentelemetry-collector-builder + working-directory: ./sidecar/otelcol + run: make install-builder - uses: imranismail/setup-kustomize@v2 - name: Install kuttl run: | curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_x86_64 chmod +x /usr/local/bin/kubectl-kuttl - - name: Run Helm e2e tests - run: make e2e-helm + - name: Run Helm e2e tests for Fluent Bit in tailing sidecar + run: make e2e-helm TAILING_SIDECAR=fluentbit + - name: Run Helm e2e tests for otelcol in tailing sidecar + run: make e2e-helm TAILING_SIDECAR=otelcol test-helm-chart-with-cert-manager: name: Test Helm chart with cert-manager @@ -115,14 +127,26 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' + cache-dependency-path: | + sidecar/otelcol/.otelcol-builder.yaml + sidecar/otelcol/.goreleaser.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + - name: Install opentelemetry-collector-builder + working-directory: ./sidecar/otelcol + run: make install-builder - uses: imranismail/setup-kustomize@v2 - name: Install kuttl run: | curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_x86_64 chmod +x /usr/local/bin/kubectl-kuttl - - name: Run e2e tests - run: make e2e-helm-certmanager + - name: Run Helm e2e tests for Fluent Bit in tailing sidecar + run: make e2e-helm-certmanager TAILING_SIDECAR=fluentbit + - name: Run Helm e2e tests for otelcol in tailing sidecar + run: make e2e-helm-certmanager TAILING_SIDECAR=otelcol test-helm-chart-with-custom-configuration: name: Test Helm chart with custom configuration @@ -133,11 +157,23 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21' + cache-dependency-path: | + sidecar/otelcol/.otelcol-builder.yaml + sidecar/otelcol/.goreleaser.yaml + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + - name: Install opentelemetry-collector-builder + working-directory: ./sidecar/otelcol + run: make install-builder - uses: imranismail/setup-kustomize@v2 - name: Install kuttl run: | curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v${{ env.KUTTL_VERSION }}/kubectl-kuttl_${{ env.KUTTL_VERSION }}_linux_x86_64 chmod +x /usr/local/bin/kubectl-kuttl - - name: Run e2e tests - run: make e2e-helm-custom-configuration + - name: Run Helm e2e tests for Fluent Bit in tailing sidecar + run: make e2e-helm-custom-configuration TAILING_SIDECAR=fluentbit + - name: Run Helm e2e tests for otelcol in tailing sidecar + run: make e2e-helm-custom-configuration TAILING_SIDECAR=otelcol diff --git a/Makefile b/Makefile index 25c18612..8abb50ea 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ e2e-helm-certmanager: KUTTL_CONFIG = kuttl-test-helm-certmanager.yaml e2e-helm-certmanager: e2e .PHONY: e2e-helm-custom-configuration -e2e-helm-custom-configuration: KUTTL_CONFIG = kuttl-test-helm-custom-configuration.yaml +e2e-helm-custom-configuration: KUTTL_CONFIG = kuttl-test-helm-$(TAILING_SIDECAR)-custom-configuration.yaml e2e-helm-custom-configuration: e2e # We sleep for 10 seconds here because webhooks can mysteriously be unavailable even though the readiness check passes diff --git a/helm/tests/values.withCustomConfiguration.yaml b/helm/tests/values.withFluentBitCustomConfiguration.yaml similarity index 100% rename from helm/tests/values.withCustomConfiguration.yaml rename to helm/tests/values.withFluentBitCustomConfiguration.yaml diff --git a/helm/tests/values.withOtelcolCustomConfiguration.yaml b/helm/tests/values.withOtelcolCustomConfiguration.yaml new file mode 100644 index 00000000..8158f3e7 --- /dev/null +++ b/helm/tests/values.withOtelcolCustomConfiguration.yaml @@ -0,0 +1,53 @@ +operator: + image: + repository: registry.localhost:5000/sumologic/tailing-sidecar-operator + tag: test + +sidecar: + image: + repository: registry.localhost:5000/sumologic/tailing-sidecar + tag: test + + resources: + limits: + cpu: "0" + memory: "0" + requests: + cpu: "0" + memory: "0" + + config: + content: + mountPath: /etc/otel/ + config.yaml: | + receivers: + filelog: + include: + - ${PATH_TO_TAIL} + start_at: beginning + storage: file_storage + + exporters: + file: + path: /dev/stdout + encoding: text_encoding + + extensions: + text_encoding: + file_storage: + directory: /var/lib/otc + + service: + extensions: + - text_encoding + - file_storage + telemetry: + metrics: + level: none + logs: + output_paths: + - /var/log/otelcol.log + pipelines: + logs: + exporters: [file] + receivers: [filelog] diff --git a/kuttl-test-helm-custom-configuration.yaml b/kuttl-test-helm-fluentbit-custom-configuration.yaml similarity index 79% rename from kuttl-test-helm-custom-configuration.yaml rename to kuttl-test-helm-fluentbit-custom-configuration.yaml index b50a76c7..d004f743 100644 --- a/kuttl-test-helm-custom-configuration.yaml +++ b/kuttl-test-helm-fluentbit-custom-configuration.yaml @@ -12,5 +12,5 @@ kindContainers: - registry.localhost:5000/sumologic/tailing-sidecar-operator:test - registry.localhost:5000/sumologic/tailing-sidecar:test commands: - - command: helm upgrade --install test-release ./helm/tailing-sidecar-operator -f ./helm/tests/values.withCustomConfiguration.yaml -n tailing-sidecar-system --create-namespace + - command: helm upgrade --install test-release ./helm/tailing-sidecar-operator -f ./helm/tests/values.withFluentBitCustomConfiguration.yaml -n tailing-sidecar-system --create-namespace - command: make e2e-wait-until-operator-ready diff --git a/kuttl-test-helm-otelcol-custom-configuration.yaml b/kuttl-test-helm-otelcol-custom-configuration.yaml new file mode 100644 index 00000000..e970c65c --- /dev/null +++ b/kuttl-test-helm-otelcol-custom-configuration.yaml @@ -0,0 +1,16 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestSuite +artifactsDir: ./tests/_build/artifacts/ +testDirs: + - ./tests/sidecar/ + - ./tests/operator/ +timeout: 150 +parallel: 4 +startKIND: true +kindNodeCache: true +kindContainers: + - registry.localhost:5000/sumologic/tailing-sidecar-operator:test + - registry.localhost:5000/sumologic/tailing-sidecar:test +commands: + - command: helm upgrade --install test-release ./helm/tailing-sidecar-operator -f ./helm/tests/values.withOtelcolCustomConfiguration.yaml -n tailing-sidecar-system --create-namespace + - command: make e2e-wait-until-operator-ready diff --git a/sidecar/otelcol/Makefile b/sidecar/otelcol/Makefile index 4df156cf..accbdf4b 100644 --- a/sidecar/otelcol/Makefile +++ b/sidecar/otelcol/Makefile @@ -15,8 +15,6 @@ BUILDER=$(BUILDER_BIN_PATH)/$(BUILDER_BIN_NAME) INSTALLED_VERSION := $(shell $(BUILDER) version 2>&1) -CONTAINER_REGISTRY := ghcr.io/sumologic/tailing-sidecar-otel - # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) define go-get-tool @@ -74,8 +72,9 @@ release: ensure-correct-builder-version install-goreleaser @$(GORELEASER) release --clean .PHONY: build-test-image +build-test-image: GHCR_IMAGE = ghcr.io/sumologic/tailing-sidecar-otel build-test-image: build - docker tag $(CONTAINER_REGISTRY):latest-$(ARCH) $(TAG) + docker tag $(GHCR_IMAGE):main-$(ARCH) $(TAG) .PHONY: generate-sources generate-sources: