From 841125725dbc7ba2a26ac30d1620752a836362ae Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 15 Aug 2024 16:00:25 +0200 Subject: [PATCH 01/35] Add eks-fargate tests --- tests/fargate_logs_e2e_test.go | 96 ++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/fargate_logs_e2e_test.go diff --git a/tests/fargate_logs_e2e_test.go b/tests/fargate_logs_e2e_test.go new file mode 100644 index 00000000..51cfd3a0 --- /dev/null +++ b/tests/fargate_logs_e2e_test.go @@ -0,0 +1,96 @@ +package tests + +import ( + "bytes" + "encoding/json" + "fmt" + "go.uber.org/zap" + "io" + "net/http" + "os" + "testing" +) + +type FargateLogResponse struct { + Hits struct { + Total int `json:"total"` + Hits []struct { + Source struct { + LogLevel string `json:"log_level"` + Kubernetes struct { + ContainerName string `json:"container_name"` + ContainerHash string `json:"container_hash"` + Host string `json:"host"` + PodID string `json:"pod_id"` + ContainerImageTag string `json:"container_image"` + PodName string `json:"pod_name"` + NamespaceName string `json:"namespace_name"` + } `json:"kubernetes"` + } `json:"_source"` + } `json:"hits"` + } `json:"hits"` +} + +func TestLogzioMonitoringFargateLogs(t *testing.T) { + logsApiKey := os.Getenv("LOGZIO_LOGS_API_KEY") + if logsApiKey == "" { + t.Fatalf("LOGZIO_LOGS_API_KEY environment variable not set") + } + + logResponse, err := fetchFargateLogs(logsApiKey) + if err != nil { + t.Fatalf("Failed to fetch logs: %v", err) + } + + if logResponse.Hits.Total == 0 { + t.Errorf("No logs found") + } + + for _, hit := range logResponse.Hits.Hits { + kubernetes := hit.Source.Kubernetes + if kubernetes.ContainerImageTag == "" || kubernetes.ContainerName == "" || kubernetes.NamespaceName == "" || kubernetes.PodName == "" || kubernetes.PodID == "" || kubernetes.Host == "" { + logger.Error("Missing log fields", zap.Any("log", hit)) + t.Errorf("Missing log fields") + break + } + } +} + +func fetchFargateLogs(logsApiKey string) (*FargateLogResponse, error) { + url := fmt.Sprintf("%s/search", BaseLogzioApiUrl) + client := &http.Client{} + envID := os.Getenv("ENV_ID") + query := fmt.Sprintf("type:%s AND kubernetes.container_name:random-logger", envID) + formattedQuery := formatQuery(query) + logger.Info("sending api request", zap.String("url", url), zap.String("query", query)) + req, err := http.NewRequest("POST", url, bytes.NewBufferString(formattedQuery)) + if err != nil { + return nil, err + } + req.Header.Set("Accept", "application/json") + req.Header.Set("Content-Type", "application/json") + req.Header.Set("X-API-TOKEN", logsApiKey) + + resp, err := client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode) + } + + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + var logResponse FargateLogResponse + err = json.Unmarshal(body, &logResponse) + if err != nil { + return nil, err + } + + return &logResponse, nil +} From 6b7cd3ad254b1b44b8a2a2c42229a20d9be8eef9 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 15 Aug 2024 16:01:06 +0200 Subject: [PATCH 02/35] add eks fargate tests + kubernetes version matrix --- .github/workflows/logzio-monitoring-test.yaml | 148 +++++++++++------- 1 file changed, 95 insertions(+), 53 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index a3b5c065..5a10b9a0 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -7,20 +7,25 @@ on: paths: - 'charts/logzio-monitoring/**' jobs: - test-helm-chart: - name: Test Helm Chart + setup-cluster: + name: Set up EKS Cluster runs-on: ubuntu-latest strategy: matrix: - environment: [eks-linux] - + kubernetes_version: [1.24, 1.25, 1.27, 1.30] + environment: [eks-linux, eks-fargate] + outputs: + env_id: ${{ steps.set_env_id.outputs.env_id }} steps: - name: Generate random id id: random_id run: echo "::set-output name=rand::$(echo $RANDOM)" - name: Set ENV_ID - run: echo "ENV_ID=monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" >> $GITHUB_ENV + id: set_env_id + run: | + echo "ENV_ID=monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" >> $GITHUB_ENV + echo "::set-output name=env_id::monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" - name: Checkout repository uses: actions/checkout@v4 @@ -31,30 +36,11 @@ jobs: echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV echo "AWS_REGION=us-west-1" >> $GITHUB_ENV - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.20' - - - name: Set up Helm - uses: azure/setup-helm@v4.2.0 - - - name: Set up kubectl - uses: azure/setup-kubectl@v4 - - - name: Install AWS CLI - run: | - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - unzip awscliv2.zip - sudo ./aws/install --update - - name: Set up eksctl run: | ARCH=amd64 PLATFORM=$(uname -s)_$ARCH curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz" - # (Optional) Verify checksum - curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz sudo mv /tmp/eksctl /usr/local/bin @@ -62,41 +48,55 @@ jobs: env: NUMBER_OF_NODES: 3 run: | - eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} --nodes ${{ env.NUMBER_OF_NODES }} --with-oidc - - aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.ENV_ID }}-${{ matrix.environment }} + if [ "${{ matrix.environment }}" == "eks-linux" ]; then + eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ + --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} --with-oidc + elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then + eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ + --version ${{ matrix.kubernetes_version }} --fargate + fi - name: Update kubeconfig run: | aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.ENV_ID }}-${{ matrix.environment }} - name: Label Nodes + if: matrix.environment == 'eks-linux' run: | kubectl get nodes -o name | xargs -I {} kubectl label {} node-role.kubernetes.io/worker=worker --overwrite + - name: Deploy Helm Chart run: | cd charts/logzio-monitoring helm dependency build - helm upgrade --install \ + HELM_CMD="helm upgrade --install \ --set logs.enabled=true \ --set logzio-logs-collector.enabled=true \ - --set logzio-logs-collector.secrets.logzioLogsToken="${{ secrets.LOGZIO_LOGS_TOKEN }}" \ - --set logzio-logs-collector.secrets.logzioRegion="us" \ - --set logzio-logs-collector.secrets.env_id="${{ env.ENV_ID }}" \ - --set secrets.logType="test" \ + --set logzio-logs-collector.secrets.logzioLogsToken='${{ secrets.LOGZIO_LOGS_TOKEN }}' \ + --set logzio-logs-collector.secrets.logzioRegion='us' \ + --set logzio-logs-collector.secrets.env_id='${{ env.ENV_ID }}' \ + --set secrets.logType='test' \ --set metricsOrTraces.enabled=true \ --set logzio-k8s-telemetry.metrics.enabled=true \ - --set logzio-k8s-telemetry.secrets.MetricsToken="${{ secrets.LOGZIO_METRICS_TOKEN }}" \ - --set logzio-k8s-telemetry.secrets.ListenerHost="https://listener.logz.io:8053" \ - --set logzio-k8s-telemetry.secrets.p8s_logzio_name="${{ env.ENV_ID }}" \ + --set logzio-k8s-telemetry.secrets.MetricsToken='${{ secrets.LOGZIO_METRICS_TOKEN }}' \ + --set logzio-k8s-telemetry.secrets.ListenerHost='https://listener.logz.io:8053' \ + --set logzio-k8s-telemetry.secrets.p8s_logzio_name='${{ env.ENV_ID }}' \ --set logzio-k8s-telemetry.traces.enabled=true \ - --set logzio-k8s-telemetry.secrets.TracesToken="${{ secrets.LOGZIO_TRACES_TOKEN }}" \ - --set logzio-k8s-telemetry.secrets.LogzioRegion="us" \ + --set logzio-k8s-telemetry.secrets.TracesToken='${{ secrets.LOGZIO_TRACES_TOKEN }}' \ + --set logzio-k8s-telemetry.secrets.LogzioRegion='us' \ --set logzio-k8s-telemetry.spm.enabled=true \ - --set logzio-k8s-telemetry.secrets.env_id="${{ env.ENV_ID }}" \ - --set logzio-k8s-telemetry.secrets.SpmToken="${{ secrets.LOGZIO_METRICS_TOKEN }}" \ - --set logzio-k8s-telemetry.serviceGraph.enabled=true \ - logzio-monitoring . + --set logzio-k8s-telemetry.secrets.env_id='${{ env.ENV_ID }}' \ + --set logzio-k8s-telemetry.secrets.SpmToken='${{ secrets.LOGZIO_METRICS_TOKEN }}' \ + --set logzio-k8s-telemetry.serviceGraph.enabled=true" + + if [ "${{ matrix.environment }}" == "eks-fargate" ]; then + HELM_CMD="$HELM_CMD --set logzio-logs-collector.fargateLogRouter.enabled='true'" + fi + + HELM_CMD="$HELM_CMD logzio-monitoring ." + + eval $HELM_CMD + kubectl rollout status deployment/logzio-monitoring-otel-collector-standalone --timeout=300s kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s @@ -111,25 +111,67 @@ jobs: kubectl rollout status deployment/trace-gen --timeout=300s - name: sleep - run: sleep 120 + run: sleep 180 + + - name: Uninstall Helm Chart + run: | + helm uninstall logzio-monitoring + + - name: Delete Cluster + if: always() + run: | + eksctl delete cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} - - name: Run Go Tests + run-logs-tests: + name: Run Logs Tests + runs-on: ubuntu-latest + needs: setup-cluster + env: + ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Go Logs Tests env: KUBERNETES_ENV: ${{ matrix.environment }} - LOGZIO_METRICS_API_KEY: ${{ secrets.LOGZIO_METRICS_API_KEY }} - LOGZIO_TRACES_API_KEY: ${{ secrets.LOGZIO_TRACES_API_KEY }} LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }} run: | go get go.uber.org/zap - go test -v ./tests/traces_e2e_test.go ./tests/common.go - go test -v ./tests/metrics_e2e_test.go ./tests/common.go go test -v ./tests/logs_e2e_test.go ./tests/common.go - - name: Cleanup Environment - run: | - helm uninstall logzio-monitoring - - name: Delete Cluster - if: always() + run-metrics-tests: + name: Run Metrics Tests + runs-on: ubuntu-latest + needs: setup-cluster + env: + ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Go Metrics Tests + env: + KUBERNETES_ENV: ${{ matrix.environment }} + LOGZIO_METRICS_API_KEY: ${{ secrets.LOGZIO_METRICS_API_KEY }} run: | - eksctl delete cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} + go get go.uber.org/zap + go test -v ./tests/metrics_e2e_test.go ./tests/common.go + + run-traces-tests: + name: Run Traces Tests + runs-on: ubuntu-latest + needs: setup-cluster + env: + ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run Go Traces Tests + env: + KUBERNETES_ENV: ${{ matrix.environment }} + LOGZIO_TRACES_API_KEY: ${{ secrets.LOGZIO_TRACES_API_KEY }} + run: | + go get go.uber.org/zap + go test -v ./tests/traces_e2e_test.go ./tests/common.go From 56824e8acbac75e59a337e70025eb47a6338eb1e Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 15 Aug 2024 16:04:54 +0200 Subject: [PATCH 03/35] trigger workflow --- charts/logzio-monitoring/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/logzio-monitoring/Chart.yaml b/charts/logzio-monitoring/Chart.yaml index 48bf4d5c..30253747 100644 --- a/charts/logzio-monitoring/Chart.yaml +++ b/charts/logzio-monitoring/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: logzio-monitoring description: logzio-monitoring allows you to ship logs, metrics, traces and security reports from your Kubernetes cluster using the OpenTelemetry collector for metrics and traces, Fluentd for logs, and Trivy for security reports. type: application -version: 6.0.7 +version: 6.0.7-trigger From 38141aa29232322af5403b5f5115acbec1f4c108 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 15 Aug 2024 16:07:33 +0200 Subject: [PATCH 04/35] update kubernetes versions --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 5a10b9a0..19fdd89c 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - kubernetes_version: [1.24, 1.25, 1.27, 1.30] + kubernetes_version: [1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] outputs: env_id: ${{ steps.set_env_id.outputs.env_id }} From fee2751948e0111a6e3e6c52a6d92ccf9b8464ea Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 16:13:21 +0200 Subject: [PATCH 05/35] `us-west-1` -> us-east-1 --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 19fdd89c..0658dc9d 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -34,7 +34,7 @@ jobs: run: | echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV - echo "AWS_REGION=us-west-1" >> $GITHUB_ENV + echo "AWS_REGION=us-east-1" >> $GITHUB_ENV - name: Set up eksctl run: | From ce4bf24a812944d10c42184253168166ff4273a4 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:34:14 +0200 Subject: [PATCH 06/35] merge jobs --- .github/workflows/logzio-monitoring-test.yaml | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 0658dc9d..947a788d 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -7,15 +7,13 @@ on: paths: - 'charts/logzio-monitoring/**' jobs: - setup-cluster: - name: Set up EKS Cluster + eks-e2e-test: + name: EKS e2e Test runs-on: ubuntu-latest strategy: matrix: kubernetes_version: [1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] - outputs: - env_id: ${{ steps.set_env_id.outputs.env_id }} steps: - name: Generate random id id: random_id @@ -25,7 +23,6 @@ jobs: id: set_env_id run: | echo "ENV_ID=monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" >> $GITHUB_ENV - echo "::set-output name=env_id::monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" - name: Checkout repository uses: actions/checkout@v4 @@ -110,29 +107,13 @@ jobs: kubectl apply -f tests/resources/tracegen-monitoring.yaml kubectl rollout status deployment/trace-gen --timeout=300s - - name: sleep + - name: Sleep run: sleep 180 - - name: Uninstall Helm Chart - run: | - helm uninstall logzio-monitoring - - - name: Delete Cluster - if: always() - run: | - eksctl delete cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} - - run-logs-tests: - name: Run Logs Tests - runs-on: ubuntu-latest - needs: setup-cluster - env: - ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Go Logs Tests + - name: Run linux logs tests + id: linux_logs_tests + continue-on-error: true + if: matrix.environment == 'eks-linux' env: KUBERNETES_ENV: ${{ matrix.environment }} LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }} @@ -140,17 +121,20 @@ jobs: go get go.uber.org/zap go test -v ./tests/logs_e2e_test.go ./tests/common.go - run-metrics-tests: - name: Run Metrics Tests - runs-on: ubuntu-latest - needs: setup-cluster - env: - ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Run fargate logs tests + id: fargate_logs_tests + continue-on-error: true + if: matrix.environment == 'eks-fargate' + env: + KUBERNETES_ENV: ${{ matrix.environment }} + LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }} + run: | + go get go.uber.org/zap + go test -v ./tests/fargate_logs_e2e_test.go ./tests/common.go - - name: Run Go Metrics Tests + - name: Run metrics tests + id: metrics_tests + continue-on-error: true env: KUBERNETES_ENV: ${{ matrix.environment }} LOGZIO_METRICS_API_KEY: ${{ secrets.LOGZIO_METRICS_API_KEY }} @@ -158,20 +142,35 @@ jobs: go get go.uber.org/zap go test -v ./tests/metrics_e2e_test.go ./tests/common.go - run-traces-tests: - name: Run Traces Tests - runs-on: ubuntu-latest - needs: setup-cluster - env: - ENV_ID: ${{ needs.setup-cluster.outputs.env_id }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Run Go Traces Tests + - name: Run traces tests + id: traces_tests + continue-on-error: true env: KUBERNETES_ENV: ${{ matrix.environment }} LOGZIO_TRACES_API_KEY: ${{ secrets.LOGZIO_TRACES_API_KEY }} run: | go get go.uber.org/zap go test -v ./tests/traces_e2e_test.go ./tests/common.go + + - name: Check test results + run: | + if [ "${{ steps.linux_logs_tests.outcome }}" == "failure" ] || \ + [ "${{ steps.fargate_logs_tests.outcome }}" == "failure" ] || \ + [ "${{ steps.metrics_tests.outcome }}" == "failure" ] || \ + [ "${{ steps.traces_tests.outcome }}" == "failure" ]; then + echo "One or more tests failed" + exit 1 + fi + + - name: Uninstall Helm Chart + if: always() + run: | + helm uninstall logzio-monitoring + + - name: Delete Cluster + if: always() + run: | + eksctl delete cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} + + + From f2a0ba103fff2fed7895c72a0448d88f932150c4 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:35:22 +0200 Subject: [PATCH 07/35] remove `set-output` command --- .github/workflows/logzio-monitoring-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 947a788d..0069a921 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -17,12 +17,12 @@ jobs: steps: - name: Generate random id id: random_id - run: echo "::set-output name=rand::$(echo $RANDOM)" + run: echo "rand=$(echo $RANDOM)" >> $GITHUB_ENV - name: Set ENV_ID id: set_env_id run: | - echo "ENV_ID=monitoring-test-run-${{ steps.random_id.outputs.rand }}-${{ matrix.environment }}" >> $GITHUB_ENV + echo "ENV_ID=monitoring-test-run-${{ env.rand }}-${{ matrix.environment }}" >> $GITHUB_ENV - name: Checkout repository uses: actions/checkout@v4 From fc62eb9e2aa20bf4c4beaf1a1ac9a315b1913069 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:41:11 +0200 Subject: [PATCH 08/35] Load all environment variables in single step --- .github/workflows/logzio-monitoring-test.yaml | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 0069a921..1ead5122 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -27,11 +27,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up AWS credentials + - name: Set up credentials run: | echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV echo "AWS_REGION=us-east-1" >> $GITHUB_ENV + echo "NUMBER_OF_NODES=3" >> $GITHUB_ENV + echo "KUBERNETES_ENV=${{ matrix.environment }}" >> $GITHUB_ENV + echo "LOGZIO_LOGS_API_KEY=${{ secrets.LOGZIO_LOGS_API_KEY }}" >> $GITHUB_ENV + echo "LOGZIO_METRICS_API_KEY=${{ secrets.LOGZIO_METRICS_API_KEY }}" >> $GITHUB_ENV + echo "LOGZIO_TRACES_API_KEY=${{ secrets.LOGZIO_TRACES_API_KEY }}" >> $GITHUB_ENV - name: Set up eksctl run: | @@ -42,8 +47,6 @@ jobs: sudo mv /tmp/eksctl /usr/local/bin - name: Provision Cluster - env: - NUMBER_OF_NODES: 3 run: | if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ @@ -114,9 +117,6 @@ jobs: id: linux_logs_tests continue-on-error: true if: matrix.environment == 'eks-linux' - env: - KUBERNETES_ENV: ${{ matrix.environment }} - LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }} run: | go get go.uber.org/zap go test -v ./tests/logs_e2e_test.go ./tests/common.go @@ -125,9 +125,6 @@ jobs: id: fargate_logs_tests continue-on-error: true if: matrix.environment == 'eks-fargate' - env: - KUBERNETES_ENV: ${{ matrix.environment }} - LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }} run: | go get go.uber.org/zap go test -v ./tests/fargate_logs_e2e_test.go ./tests/common.go @@ -135,9 +132,6 @@ jobs: - name: Run metrics tests id: metrics_tests continue-on-error: true - env: - KUBERNETES_ENV: ${{ matrix.environment }} - LOGZIO_METRICS_API_KEY: ${{ secrets.LOGZIO_METRICS_API_KEY }} run: | go get go.uber.org/zap go test -v ./tests/metrics_e2e_test.go ./tests/common.go @@ -145,9 +139,6 @@ jobs: - name: Run traces tests id: traces_tests continue-on-error: true - env: - KUBERNETES_ENV: ${{ matrix.environment }} - LOGZIO_TRACES_API_KEY: ${{ secrets.LOGZIO_TRACES_API_KEY }} run: | go get go.uber.org/zap go test -v ./tests/traces_e2e_test.go ./tests/common.go From 74f7aa994ef43f2a28d395a9736de5e9ef8e9b5d Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:44:20 +0200 Subject: [PATCH 09/35] Add 1.30 --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 1ead5122..acb95283 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - kubernetes_version: [1.24, 1.25, 1.27] + kubernetes_version: [1.30, 1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] steps: - name: Generate random id From da14f0635f367047ee3ab7398bba658ce46b27c5 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:49:04 +0200 Subject: [PATCH 10/35] revert Add 1.30 --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index acb95283..1ead5122 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - kubernetes_version: [1.30, 1.24, 1.25, 1.27] + kubernetes_version: [1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] steps: - name: Generate random id From a5c721ec3fe66980fa8ce03dbb33fd1f464ab291 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 17:59:14 +0200 Subject: [PATCH 11/35] Add `NODE_TYPE` --- .github/workflows/logzio-monitoring-test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 1ead5122..2172dfa7 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -33,10 +33,12 @@ jobs: echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV echo "AWS_REGION=us-east-1" >> $GITHUB_ENV echo "NUMBER_OF_NODES=3" >> $GITHUB_ENV + echo "NODE_TYPE=t3.medium" >> $GITHUB_ENV echo "KUBERNETES_ENV=${{ matrix.environment }}" >> $GITHUB_ENV echo "LOGZIO_LOGS_API_KEY=${{ secrets.LOGZIO_LOGS_API_KEY }}" >> $GITHUB_ENV echo "LOGZIO_METRICS_API_KEY=${{ secrets.LOGZIO_METRICS_API_KEY }}" >> $GITHUB_ENV echo "LOGZIO_TRACES_API_KEY=${{ secrets.LOGZIO_TRACES_API_KEY }}" >> $GITHUB_ENV + - name: Set up eksctl run: | @@ -50,7 +52,8 @@ jobs: run: | if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} --with-oidc + --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} \ + --node-type ${{ env.NODE_TYPE }} --with-oidc elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ --version ${{ matrix.kubernetes_version }} --fargate From 4076f68ee9fb6ad8f961fae2cfb134adabc64434 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 18 Aug 2024 18:46:46 +0200 Subject: [PATCH 12/35] Ad `fail-fast: false` --- .github/workflows/logzio-monitoring-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 2172dfa7..25a05c0b 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -11,6 +11,7 @@ jobs: name: EKS e2e Test runs-on: ubuntu-latest strategy: + fail-fast: false matrix: kubernetes_version: [1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] From b26cd88337761a2f6e93334b7e567324af46e973 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Mon, 19 Aug 2024 11:15:57 +0200 Subject: [PATCH 13/35] Add test log type --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 25a05c0b..70cfab92 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -79,7 +79,7 @@ jobs: --set logzio-logs-collector.secrets.logzioLogsToken='${{ secrets.LOGZIO_LOGS_TOKEN }}' \ --set logzio-logs-collector.secrets.logzioRegion='us' \ --set logzio-logs-collector.secrets.env_id='${{ env.ENV_ID }}' \ - --set secrets.logType='test' \ + --set logzio-logs-collector.secrets.logType='${{ env.ENV_ID }}' \ --set metricsOrTraces.enabled=true \ --set logzio-k8s-telemetry.metrics.enabled=true \ --set logzio-k8s-telemetry.secrets.MetricsToken='${{ secrets.LOGZIO_METRICS_TOKEN }}' \ From 371c367adc6840910b600dfecef475a92fc54260 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Mon, 19 Aug 2024 12:53:33 +0200 Subject: [PATCH 14/35] change default log type --- tests/logs_e2e_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/logs_e2e_test.go b/tests/logs_e2e_test.go index b8e0636f..a805fea5 100644 --- a/tests/logs_e2e_test.go +++ b/tests/logs_e2e_test.go @@ -58,7 +58,7 @@ func fetchLogs(logsApiKey string) (*LogResponse, error) { url := fmt.Sprintf("%s/search", BaseLogzioApiUrl) client := &http.Client{} envID := os.Getenv("ENV_ID") - query := fmt.Sprintf("env_id:%s AND type:agent-k8s AND k8s_deployment_name:log-generator", envID) + query := fmt.Sprintf("env_id:%s AND type:%s AND k8s_deployment_name:log-generator", envID, envID) formattedQuery := formatQuery(query) logger.Info("sending api request", zap.String("url", url), zap.String("query", query)) req, err := http.NewRequest("POST", url, bytes.NewBufferString(formattedQuery)) From 4fee16e0a6c16b609a5cef96da32b6d49a99c0c5 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 12:12:33 +0200 Subject: [PATCH 15/35] Update logs test --- .github/workflows/logzio-monitoring-test.yaml | 2 +- tests/fargate_logs_e2e_test.go | 2 +- tests/resources/logsgen.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 70cfab92..baa1e1f2 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -115,7 +115,7 @@ jobs: kubectl rollout status deployment/trace-gen --timeout=300s - name: Sleep - run: sleep 180 + run: sleep 240 - name: Run linux logs tests id: linux_logs_tests diff --git a/tests/fargate_logs_e2e_test.go b/tests/fargate_logs_e2e_test.go index 51cfd3a0..5477572c 100644 --- a/tests/fargate_logs_e2e_test.go +++ b/tests/fargate_logs_e2e_test.go @@ -60,7 +60,7 @@ func fetchFargateLogs(logsApiKey string) (*FargateLogResponse, error) { url := fmt.Sprintf("%s/search", BaseLogzioApiUrl) client := &http.Client{} envID := os.Getenv("ENV_ID") - query := fmt.Sprintf("type:%s AND kubernetes.container_name:random-logger", envID) + query := fmt.Sprintf("type:%s AND kubernetes.container_name:log-generator", envID) formattedQuery := formatQuery(query) logger.Info("sending api request", zap.String("url", url), zap.String("query", query)) req, err := http.NewRequest("POST", url, bytes.NewBufferString(formattedQuery)) diff --git a/tests/resources/logsgen.yaml b/tests/resources/logsgen.yaml index b81554f2..cd6afc52 100644 --- a/tests/resources/logsgen.yaml +++ b/tests/resources/logsgen.yaml @@ -15,7 +15,7 @@ spec: app: log-generator spec: containers: - - name: random-logger + - name: log-generator image: chentex/random-logger:latest args: - "100" From 9297b3bb96e9b66800c2e182695b84127a243b47 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 12:15:27 +0200 Subject: [PATCH 16/35] shorten test names --- .github/workflows/logzio-logs-collector-test.yaml | 2 +- .github/workflows/logzio-monitoring-test.yaml | 2 +- .github/workflows/logzio-telemetry-test.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/logzio-logs-collector-test.yaml b/.github/workflows/logzio-logs-collector-test.yaml index 7796f087..c37ef284 100644 --- a/.github/workflows/logzio-logs-collector-test.yaml +++ b/.github/workflows/logzio-logs-collector-test.yaml @@ -1,4 +1,4 @@ -name: Test Logzio Logs Collector Helm Chart on Kind Kubernetes Environment +name: Test `logzio-logs-collector` chart on: pull_request: diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index baa1e1f2..36008413 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -1,4 +1,4 @@ -name: Test Logzio Monitoring Helm Chart on EKS Kubernetes Environments +name: Test `logzio-monitoring` chart on: pull_request: diff --git a/.github/workflows/logzio-telemetry-test.yaml b/.github/workflows/logzio-telemetry-test.yaml index 5027eeb9..320f1547 100644 --- a/.github/workflows/logzio-telemetry-test.yaml +++ b/.github/workflows/logzio-telemetry-test.yaml @@ -1,4 +1,4 @@ -name: Test Logzio Telemetry Helm Chart on Kind Kubernetes Environment +name: Test `logzio-telemetry` chart on: pull_request: From c7b988e39c77b80860b6105ab33bfc0e6c2be02b Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 13:06:26 +0200 Subject: [PATCH 17/35] Add `aws-observability` namespace and configmap validation --- .github/workflows/logzio-monitoring-test.yaml | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 36008413..d6147077 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -92,17 +92,39 @@ jobs: --set logzio-k8s-telemetry.secrets.env_id='${{ env.ENV_ID }}' \ --set logzio-k8s-telemetry.secrets.SpmToken='${{ secrets.LOGZIO_METRICS_TOKEN }}' \ --set logzio-k8s-telemetry.serviceGraph.enabled=true" - + if [ "${{ matrix.environment }}" == "eks-fargate" ]; then - HELM_CMD="$HELM_CMD --set logzio-logs-collector.fargateLogRouter.enabled='true'" + HELM_CMD="$HELM_CMD --set logzio-logs-collector.fargateLogRouter.enabled='true' --set logzio-k8s-telemetry.collector.mode=standalone" fi - + HELM_CMD="$HELM_CMD logzio-monitoring ." eval $HELM_CMD - + kubectl rollout status deployment/logzio-monitoring-otel-collector-standalone --timeout=300s - kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s + kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s + + - name: Confirm `aws-observability` namespace and configmap are created (fargate) + if: matrix.environment == 'eks-fargate' + run: | + NAMESPACE="aws-observability" + CONFIGMAP="aws-logging" + + if kubectl get namespace $NAMESPACE; then + echo "Namespace $NAMESPACE exists." + else + echo "Namespace $NAMESPACE does not exist." + exit 1 + fi + + # Check if the configmap exists in the namespace + if kubectl get configmap $CONFIGMAP -n $NAMESPACE; then + echo "ConfigMap $CONFIGMAP exists in namespace $NAMESPACE." + else + echo "ConfigMap $CONFIGMAP does not exist in namespace $NAMESPACE." + exit 1 + fi + - name: run log generator run: | From 3bb93a9a6f16b20bec74ebf6de3316e3dfa64ca1 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 14:00:32 +0200 Subject: [PATCH 18/35] change node type --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index d6147077..10a9bbfb 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -34,7 +34,7 @@ jobs: echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV echo "AWS_REGION=us-east-1" >> $GITHUB_ENV echo "NUMBER_OF_NODES=3" >> $GITHUB_ENV - echo "NODE_TYPE=t3.medium" >> $GITHUB_ENV + echo "NODE_TYPE=t3a.large" >> $GITHUB_ENV echo "KUBERNETES_ENV=${{ matrix.environment }}" >> $GITHUB_ENV echo "LOGZIO_LOGS_API_KEY=${{ secrets.LOGZIO_LOGS_API_KEY }}" >> $GITHUB_ENV echo "LOGZIO_METRICS_API_KEY=${{ secrets.LOGZIO_METRICS_API_KEY }}" >> $GITHUB_ENV From c42a10ed35d2045b5f322555117392e11487ebc7 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 15:18:59 +0200 Subject: [PATCH 19/35] Add logging for debugging --- .github/workflows/logzio-monitoring-test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 10a9bbfb..2d6f4236 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -99,8 +99,10 @@ jobs: HELM_CMD="$HELM_CMD logzio-monitoring ." + echo "Running Helm command: $HELM_CMD" eval $HELM_CMD + kubectl rollout status deployment/logzio-monitoring-otel-collector-standalone --timeout=300s kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s From f9d214e05c1525689333478773abe03258d4ccc5 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 15:20:20 +0200 Subject: [PATCH 20/35] Update chart dependencies --- charts/logzio-monitoring/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/logzio-monitoring/Chart.yaml b/charts/logzio-monitoring/Chart.yaml index 642f1eeb..84c772ef 100644 --- a/charts/logzio-monitoring/Chart.yaml +++ b/charts/logzio-monitoring/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: logzio-monitoring description: logzio-monitoring allows you to ship logs, metrics, traces and security reports from your Kubernetes cluster using the OpenTelemetry collector for metrics and traces, Fluentd for logs, and Trivy for security reports. type: application -version: 6.0.8 +version: 6.0.9-trigger sources: @@ -29,7 +29,7 @@ dependencies: repository: "https://logzio.github.io/logzio-helm/" condition: deployEvents.enabled - name: logzio-logs-collector - version: "1.0.7" + version: "1.0.8" repository: "https://logzio.github.io/logzio-helm/" condition: logs.enabled maintainers: From b6c372953647a6db71316e0cd218da5e1226f9a9 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 17:14:59 +0200 Subject: [PATCH 21/35] wait for all pods + logs for monitoring --- .github/workflows/logzio-monitoring-test.yaml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 2d6f4236..18c80971 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -34,7 +34,7 @@ jobs: echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV echo "AWS_REGION=us-east-1" >> $GITHUB_ENV echo "NUMBER_OF_NODES=3" >> $GITHUB_ENV - echo "NODE_TYPE=t3a.large" >> $GITHUB_ENV + echo "NODE_TYPE=m5.large" >> $GITHUB_ENV echo "KUBERNETES_ENV=${{ matrix.environment }}" >> $GITHUB_ENV echo "LOGZIO_LOGS_API_KEY=${{ secrets.LOGZIO_LOGS_API_KEY }}" >> $GITHUB_ENV echo "LOGZIO_METRICS_API_KEY=${{ secrets.LOGZIO_METRICS_API_KEY }}" >> $GITHUB_ENV @@ -102,9 +102,17 @@ jobs: echo "Running Helm command: $HELM_CMD" eval $HELM_CMD - + + + - name: Wait for pods to be ready + run: | kubectl rollout status deployment/logzio-monitoring-otel-collector-standalone --timeout=300s - kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s + kubectl rollout status deployment/logzio-monitoring-otel-collector-spm --timeout=300s + kubectl rollout status deployment/logzio-monitoring-kube-state-metrics --timeout=300s + if [ "${{ matrix.environment }}" == "eks-linux" ]; then + kubectl rollout status ds/logzio-monitoring-prometheus-node-exporter --timeout=300s + kubectl rollout status ds/logzio-monitoring-otel-collector-ds --timeout=300s + fi - name: Confirm `aws-observability` namespace and configmap are created (fargate) if: matrix.environment == 'eks-fargate' @@ -139,7 +147,15 @@ jobs: kubectl rollout status deployment/trace-gen --timeout=300s - name: Sleep - run: sleep 240 + run: sleep 180 + + - name: Get Logs + run: | + kubectl logs deployment/deployment/logzio-monitoring-otel-collector-standalone + kubectl logs deployment/deployment/logzio-monitoring-otel-collector-spm + if [ "${{ matrix.environment }}" == "eks-linux" ]; then + kubectl logs ds/logzio-monitoring-otel-collector-ds + fi - name: Run linux logs tests id: linux_logs_tests From 218c3474684f8aa621150cf41f267fda9cc5f398 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 17:36:45 +0200 Subject: [PATCH 22/35] fix `deployment/deployment` --- .github/workflows/logzio-monitoring-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 18c80971..86c16588 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -151,8 +151,8 @@ jobs: - name: Get Logs run: | - kubectl logs deployment/deployment/logzio-monitoring-otel-collector-standalone - kubectl logs deployment/deployment/logzio-monitoring-otel-collector-spm + kubectl logs deployment/logzio-monitoring-otel-collector-standalone + kubectl logs deployment/logzio-monitoring-otel-collector-spm if [ "${{ matrix.environment }}" == "eks-linux" ]; then kubectl logs ds/logzio-monitoring-otel-collector-ds fi From 0d43645363fb01223d0d79e5ee04094ee3b37139 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Wed, 21 Aug 2024 22:01:44 +0200 Subject: [PATCH 23/35] test default version --- .github/workflows/logzio-monitoring-test.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 86c16588..05c89541 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - kubernetes_version: [1.24, 1.25, 1.27] + kubernetes_version: [1.24] environment: [eks-linux, eks-fargate] steps: - name: Generate random id @@ -53,11 +53,11 @@ jobs: run: | if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} \ + --nodes ${{ env.NUMBER_OF_NODES }} \ --node-type ${{ env.NODE_TYPE }} --with-oidc elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version ${{ matrix.kubernetes_version }} --fargate + --fargate fi - name: Update kubeconfig @@ -151,9 +151,12 @@ jobs: - name: Get Logs run: | + echo "logzio-monitoring-otel-collector-standalone: " kubectl logs deployment/logzio-monitoring-otel-collector-standalone + echo "logzio-monitoring-otel-collector-spm: " kubectl logs deployment/logzio-monitoring-otel-collector-spm if [ "${{ matrix.environment }}" == "eks-linux" ]; then + echo "logzio-monitoring-otel-collector-ds: " kubectl logs ds/logzio-monitoring-otel-collector-ds fi From 60257723a6f0f72bb2db18c83bde95010611f6c5 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 10:41:05 +0200 Subject: [PATCH 24/35] test default version --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 05c89541..ebc76d68 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - kubernetes_version: [1.24] + kubernetes_version: [1.24, 1.25, 1.27] environment: [eks-linux, eks-fargate] steps: - name: Generate random id From e4de361922294980baf5ed150c989ea6b1854496 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 11:19:53 +0200 Subject: [PATCH 25/35] Add `--version` flag --- .github/workflows/logzio-monitoring-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index ebc76d68..824090ad 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -53,11 +53,11 @@ jobs: run: | if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --nodes ${{ env.NUMBER_OF_NODES }} \ + --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} \ --node-type ${{ env.NODE_TYPE }} --with-oidc elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --fargate + --version ${{ matrix.kubernetes_version }} --fargate fi - name: Update kubeconfig From 21c941a8303e3c2d42066d42b36b4e1802198e75 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 12:09:04 +0200 Subject: [PATCH 26/35] Add separate metrics test for fargate --- tests/metrics_e2e_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/metrics_e2e_test.go b/tests/metrics_e2e_test.go index 5cfb60d5..ac38b9a3 100644 --- a/tests/metrics_e2e_test.go +++ b/tests/metrics_e2e_test.go @@ -39,6 +39,9 @@ func TestContainerMetrics(t *testing.T) { } func TestInfrastructureMetrics(t *testing.T) { + if os.Getenv("KUBERNETES_ENV") == "eks-fargate" { + t.Skip("Skipping infrastructure metrics test") + } requiredMetrics := map[string][]string{ "kube_pod_status_phase": {"p8s_logzio_name", "namespace", "pod", "phase", "uid"}, "kube_pod_info": {"p8s_logzio_name", "namespace", "host_ip", "node", "pod"}, @@ -66,6 +69,28 @@ func TestInfrastructureMetrics(t *testing.T) { testMetrics(t, requiredMetrics, query) } +func TestFargateMetrics(t *testing.T) { + if os.Getenv("KUBERNETES_ENV") != "eks-fargate" { + t.Skip("Skipping Fargate metrics test") + } + requiredMetrics := map[string][]string{ + "kube_pod_status_phase": {"p8s_logzio_name", "namespace", "pod", "phase", "uid"}, + "kube_pod_info": {"p8s_logzio_name", "namespace", "host_ip", "pod"}, + "kube_pod_container_resource_limits": {"p8s_logzio_name", "namespace", "pod", "resource"}, + "kube_pod_container_info": {"p8s_logzio_name", "namespace", "pod"}, + "kube_pod_created": {"p8s_logzio_name", "namespace", "pod"}, + "kube_pod_owner": {"p8s_logzio_name", "namespace", "pod", "owner_kind", "owner_name"}, + "kube_pod_container_status_restarts_total": {"p8s_logzio_name", "namespace", "pod"}, + "kube_pod_status_reason": {"p8s_logzio_name", "namespace", "pod", "reason"}, + "kube_replicaset_owner": {"p8s_logzio_name", "namespace", "owner_kind", "owner_name", "replicaset"}, + "kube_deployment_created": {"p8s_logzio_name", "namespace", "deployment"}, + "kube_deployment_status_condition": {"p8s_logzio_name", "namespace", "deployment", "status"}, + } + envId := os.Getenv("ENV_ID") + query := fmt.Sprintf(`{env_id='%s'}`, envId) + testMetrics(t, requiredMetrics, query) +} + func TestSpmMetrics(t *testing.T) { requiredMetrics := map[string][]string{ "calls_total": {"k8s_node_name", "k8s_namespace_name", "k8s_pod_name", "span_kind", "operation"}, From 4a087717ce9ede7a6242ce99a40dfdb5a6c2f21c Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 13:46:33 +0200 Subject: [PATCH 27/35] Capital step names + one log tests step --- .../workflows/logzio-logs-collector-test.yaml | 2 +- .github/workflows/logzio-monitoring-test.yaml | 28 ++++++++----------- .github/workflows/logzio-telemetry-test.yaml | 2 +- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/logzio-logs-collector-test.yaml b/.github/workflows/logzio-logs-collector-test.yaml index c37ef284..5158a9f7 100644 --- a/.github/workflows/logzio-logs-collector-test.yaml +++ b/.github/workflows/logzio-logs-collector-test.yaml @@ -52,7 +52,7 @@ jobs: --set secrets.logzioRegion=us \ logzio-logs-collector . - - name: run log generator + - name: Run log generator run: | kubectl apply -f tests/resources/logsgen.yaml kubectl rollout status deployment/log-generator --timeout=300s diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 824090ad..37d238b8 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -114,7 +114,7 @@ jobs: kubectl rollout status ds/logzio-monitoring-otel-collector-ds --timeout=300s fi - - name: Confirm `aws-observability` namespace and configmap are created (fargate) + - name: Check `aws-observability` namespace and configmap (fargate) if: matrix.environment == 'eks-fargate' run: | NAMESPACE="aws-observability" @@ -136,12 +136,12 @@ jobs: fi - - name: run log generator + - name: Run log generator run: | kubectl apply -f tests/resources/logsgen.yaml kubectl rollout status deployment/log-generator --timeout=300s - - name: run trace generator + - name: Run trace generator run: | kubectl apply -f tests/resources/tracegen-monitoring.yaml kubectl rollout status deployment/trace-gen --timeout=300s @@ -160,21 +160,16 @@ jobs: kubectl logs ds/logzio-monitoring-otel-collector-ds fi - - name: Run linux logs tests - id: linux_logs_tests + - name: Run logs tests + id: logs_tests continue-on-error: true - if: matrix.environment == 'eks-linux' run: | go get go.uber.org/zap - go test -v ./tests/logs_e2e_test.go ./tests/common.go - - - name: Run fargate logs tests - id: fargate_logs_tests - continue-on-error: true - if: matrix.environment == 'eks-fargate' - run: | - go get go.uber.org/zap - go test -v ./tests/fargate_logs_e2e_test.go ./tests/common.go + if [ "${{ matrix.environment }}" == "eks-linux" ]; then + go test -v ./tests/logs_e2e_test.go ./tests/common.go + elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then + go test -v ./tests/fargate_logs_e2e_test.go ./tests/common.go + fi - name: Run metrics tests id: metrics_tests @@ -192,8 +187,7 @@ jobs: - name: Check test results run: | - if [ "${{ steps.linux_logs_tests.outcome }}" == "failure" ] || \ - [ "${{ steps.fargate_logs_tests.outcome }}" == "failure" ] || \ + if [ "${{ steps.logs_tests.outcome }}" == "failure" ] || \ [ "${{ steps.metrics_tests.outcome }}" == "failure" ] || \ [ "${{ steps.traces_tests.outcome }}" == "failure" ]; then echo "One or more tests failed" diff --git a/.github/workflows/logzio-telemetry-test.yaml b/.github/workflows/logzio-telemetry-test.yaml index 320f1547..4287f802 100644 --- a/.github/workflows/logzio-telemetry-test.yaml +++ b/.github/workflows/logzio-telemetry-test.yaml @@ -64,7 +64,7 @@ jobs: kubectl rollout status deployment/logzio-k8s-telemetry-otel-collector-standalone --timeout=300s kubectl rollout status deployment/logzio-k8s-telemetry-otel-collector-spm --timeout=300s - - name: run trace generator + - name: Run trace generator run: | kubectl apply -f tests/resources/tracegen.yaml kubectl rollout status deployment/trace-gen --timeout=300s From 5f338a3c240cfb34539ca2c8b6df7f09110728f8 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 13:47:13 +0200 Subject: [PATCH 28/35] Add version `1.30` --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index 37d238b8..b05c1368 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - kubernetes_version: [1.24, 1.25, 1.27] + kubernetes_version: [1.24, 1.25, 1.27, 1.30] environment: [eks-linux, eks-fargate] steps: - name: Generate random id From 55dd2f144294bf50a45b79206e13274326c5e35f Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 14:01:57 +0200 Subject: [PATCH 29/35] revise `Provision Cluster` --- .github/workflows/logzio-monitoring-test.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index b05c1368..a30ce168 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -51,13 +51,14 @@ jobs: - name: Provision Cluster run: | + K8S_VERSION=${{ matrix.kubernetes_version }} if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} \ + --version $K8S_VERSION --nodes ${{ env.NUMBER_OF_NODES }} \ --node-type ${{ env.NODE_TYPE }} --with-oidc elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version ${{ matrix.kubernetes_version }} --fargate + --version $K8S_VERSION --fargate fi - name: Update kubeconfig From 394d00d1335436d8b0c4ef22c6e311beb7cdb65e Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 15:37:17 +0200 Subject: [PATCH 30/35] change `FargateLogResponse` struct --- tests/fargate_logs_e2e_test.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/fargate_logs_e2e_test.go b/tests/fargate_logs_e2e_test.go index 5477572c..6e55a377 100644 --- a/tests/fargate_logs_e2e_test.go +++ b/tests/fargate_logs_e2e_test.go @@ -16,16 +16,14 @@ type FargateLogResponse struct { Total int `json:"total"` Hits []struct { Source struct { - LogLevel string `json:"log_level"` - Kubernetes struct { - ContainerName string `json:"container_name"` - ContainerHash string `json:"container_hash"` - Host string `json:"host"` - PodID string `json:"pod_id"` - ContainerImageTag string `json:"container_image"` - PodName string `json:"pod_name"` - NamespaceName string `json:"namespace_name"` - } `json:"kubernetes"` + LogLevel string `json:"log_level"` + ContainerName string `json:"kubernetes_container_name"` + ContainerHash string `json:"kubernetes_container_hash"` + Host string `json:"kubernetes_host"` + PodID string `json:"kubernetes_pod_id"` + ContainerImageTag string `json:"kubernetes_container_image"` + PodName string `json:"kubernetes_pod_name"` + NamespaceName string `json:"kubernetes_namespace_name"` } `json:"_source"` } `json:"hits"` } `json:"hits"` @@ -47,8 +45,8 @@ func TestLogzioMonitoringFargateLogs(t *testing.T) { } for _, hit := range logResponse.Hits.Hits { - kubernetes := hit.Source.Kubernetes - if kubernetes.ContainerImageTag == "" || kubernetes.ContainerName == "" || kubernetes.NamespaceName == "" || kubernetes.PodName == "" || kubernetes.PodID == "" || kubernetes.Host == "" { + log := hit.Source + if log.ContainerImageTag == "" || log.ContainerName == "" || log.NamespaceName == "" || log.PodName == "" || log.PodID == "" || log.Host == "" { logger.Error("Missing log fields", zap.Any("log", hit)) t.Errorf("Missing log fields") break From 458ec299b3af79df1f64dd46ba41ac45f49f093f Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 15:37:41 +0200 Subject: [PATCH 31/35] `kubernetes_version` matrix as string --- .github/workflows/logzio-monitoring-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index a30ce168..ab3d2476 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - kubernetes_version: [1.24, 1.25, 1.27, 1.30] + kubernetes_version: ['1.24', '1.25', '1.27', '1.30'] environment: [eks-linux, eks-fargate] steps: - name: Generate random id From 5a06e3297a9a5302502b2522753f3dfc5adccaf1 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 15:38:43 +0200 Subject: [PATCH 32/35] change query `.` -> `_` --- tests/fargate_logs_e2e_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fargate_logs_e2e_test.go b/tests/fargate_logs_e2e_test.go index 6e55a377..68659cf8 100644 --- a/tests/fargate_logs_e2e_test.go +++ b/tests/fargate_logs_e2e_test.go @@ -58,7 +58,7 @@ func fetchFargateLogs(logsApiKey string) (*FargateLogResponse, error) { url := fmt.Sprintf("%s/search", BaseLogzioApiUrl) client := &http.Client{} envID := os.Getenv("ENV_ID") - query := fmt.Sprintf("type:%s AND kubernetes.container_name:log-generator", envID) + query := fmt.Sprintf("type:%s AND kubernetes_container_name:log-generator", envID) formattedQuery := formatQuery(query) logger.Info("sending api request", zap.String("url", url), zap.String("query", query)) req, err := http.NewRequest("POST", url, bytes.NewBufferString(formattedQuery)) From 01e030b35a7f755d297bc553d0308c5c69020d14 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Thu, 22 Aug 2024 15:43:19 +0200 Subject: [PATCH 33/35] remove `K8S_VERSION` --- .github/workflows/logzio-monitoring-test.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/logzio-monitoring-test.yaml b/.github/workflows/logzio-monitoring-test.yaml index ab3d2476..8387bd49 100644 --- a/.github/workflows/logzio-monitoring-test.yaml +++ b/.github/workflows/logzio-monitoring-test.yaml @@ -51,14 +51,13 @@ jobs: - name: Provision Cluster run: | - K8S_VERSION=${{ matrix.kubernetes_version }} if [ "${{ matrix.environment }}" == "eks-linux" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version $K8S_VERSION --nodes ${{ env.NUMBER_OF_NODES }} \ + --version ${{ matrix.kubernetes_version }} --nodes ${{ env.NUMBER_OF_NODES }} \ --node-type ${{ env.NODE_TYPE }} --with-oidc elif [ "${{ matrix.environment }}" == "eks-fargate" ]; then eksctl create cluster --name ${{ env.ENV_ID }}-${{ matrix.environment }} --region ${{ env.AWS_REGION }} \ - --version $K8S_VERSION --fargate + --version ${{ matrix.kubernetes_version }} --fargate fi - name: Update kubeconfig From 094a0a0056aa53a62cd8c2e0d660e6f3c07cdcbf Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 25 Aug 2024 13:21:09 +0200 Subject: [PATCH 34/35] Use latest `logzio-monitoring` version --- charts/logzio-monitoring/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/logzio-monitoring/Chart.yaml b/charts/logzio-monitoring/Chart.yaml index aa98e44d..8db2d70c 100644 --- a/charts/logzio-monitoring/Chart.yaml +++ b/charts/logzio-monitoring/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: logzio-monitoring description: logzio-monitoring allows you to ship logs, metrics, traces and security reports from your Kubernetes cluster using the OpenTelemetry collector for metrics and traces, Fluentd for logs, and Trivy for security reports. type: application -version: 6.0.9 +version: 6.1.0 sources: @@ -29,7 +29,7 @@ dependencies: repository: "https://logzio.github.io/logzio-helm/" condition: deployEvents.enabled - name: logzio-logs-collector - version: "1.0.8" + version: "1.0.9" repository: "https://logzio.github.io/logzio-helm/" condition: logs.enabled maintainers: From 3508fb382e076a4ee67c1bb3f853dee1956634d9 Mon Sep 17 00:00:00 2001 From: Yotam loewenbach Date: Sun, 25 Aug 2024 19:27:59 +0200 Subject: [PATCH 35/35] space --- charts/logzio-monitoring/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/logzio-monitoring/Chart.yaml b/charts/logzio-monitoring/Chart.yaml index 8db2d70c..b92958e2 100644 --- a/charts/logzio-monitoring/Chart.yaml +++ b/charts/logzio-monitoring/Chart.yaml @@ -5,6 +5,7 @@ type: application version: 6.1.0 + sources: - https://github.com/logzio/logzio-helm dependencies: