From ac8debab22d5c57fd6b789fa95a204d037d7f8de Mon Sep 17 00:00:00 2001 From: Rafael Abdalla Date: Thu, 8 Aug 2024 10:34:31 +1000 Subject: [PATCH] Prune docker volumes --- .github/workflows/e2e.yaml | 88 +++++++++++++++++----------------- .github/workflows/preview.yaml | 33 ++++++++----- pkg/humio/client.go | 9 ++-- 3 files changed, 69 insertions(+), 61 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 1d3c50aa3..656014b4a 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -8,8 +8,8 @@ jobs: fail-fast: false matrix: kind-k8s-version: - - kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 - - kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2 + - kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 # Not officially supported by kind 0.22.0 + - kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2 # Not officially supported by kind 0.22.0 - kindest/node:v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3 - kindest/node:v1.24.17@sha256:bad10f9b98d54586cba05a7eaa1b61c6b90bfc4ee174fdc43a7b75ca75c95e51 - kindest/node:v1.25.16@sha256:e8b50f8e06b44bb65a93678a65a26248fae585b3d3c2a669e5ca6c90c69dc519 @@ -18,46 +18,44 @@ jobs: - kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58 - kindest/node:v1.29.2@sha256:51a1434a5397193442f0be2a297b488b6c919ce8a3931be0ce822606ea5ca245 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: '1.22.2' - - name: Install kind and kubectl - run: | - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 - chmod +x ./kind - curl -Lo ./kubectl https://dl.k8s.io/release/v1.23.3/bin/linux/amd64/kubectl - chmod +x ./kubectl - - name: Cleanup and prepare environment - run: | - ./kind delete cluster || true - make clean - docker system prune -af --volumes || true - docker network create -d=bridge --subnet=172.30.0.0/16 kind || true - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Get temp bin dir - id: bin_dir - run: echo "BIN_DIR=$(mktemp -d --tmpdir=${{ github.workspace }})" >> $GITHUB_OUTPUT - - name: Run e2e tests - env: - BIN_DIR: ${{ steps.bin_dir.outputs.BIN_DIR }} - HUMIO_E2E_LICENSE: ${{ secrets.HUMIO_E2E_LICENSE }} - E2E_KIND_K8S_VERSION: ${{ matrix.kind-k8s-version }} - E2E_LOGS_HUMIO_HOSTNAME: ${{ secrets.E2E_LOGS_HUMIO_HOSTNAME }} - E2E_LOGS_HUMIO_INGEST_TOKEN: ${{ secrets.E2E_LOGS_HUMIO_INGEST_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - GINKGO_NODES: "6" - run: | - hack/run-e2e-using-kind.sh - - name: Final cleanup - if: always() - run: | - ./kind delete cluster || true - make clean - docker system prune -af --volumes || true - docker network prune -f || true \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22.2' + - name: cleanup kind + run: | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 + chmod +x ./kind + ./kind delete cluster || true + make clean + docker system prune -af --volumes || true + docker network create -d=bridge --subnet=172.19.0.0/24 kind || true + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Get temp bin dir + id: bin_dir + run: echo "BIN_DIR=$(mktemp -d --tmpdir=${{ github.workspace }})" >> $GITHUB_OUTPUT + - name: run e2e tests + env: + BIN_DIR: ${{ steps.bin_dir.outputs.BIN_DIR }} + HUMIO_E2E_LICENSE: ${{ secrets.HUMIO_E2E_LICENSE }} + E2E_KIND_K8S_VERSION: ${{ matrix.kind-k8s-version }} + E2E_LOGS_HUMIO_HOSTNAME: ${{ secrets.E2E_LOGS_HUMIO_HOSTNAME }} + E2E_LOGS_HUMIO_INGEST_TOKEN: ${{ secrets.E2E_LOGS_HUMIO_INGEST_TOKEN }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + GINKGO_NODES: "6" + run: | + hack/run-e2e-using-kind.sh + - name: cleanup kind and docker files + if: always() + run: | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 + chmod +x ./kind + ./kind delete cluster || true + make clean + docker system prune -af volumes || true + docker network create -d=bridge --subnet=172.19.0.0/24 kind || true \ No newline at end of file diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 37ca8f26b..c018862f0 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -6,13 +6,13 @@ on: jobs: test-operator: name: ${{ matrix.kind-k8s-version }} - runs-on: [self-hosted, ops] + runs-on: [ self-hosted, ops ] strategy: fail-fast: false matrix: kind-k8s-version: - - kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 - - kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2 + - kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093 # Not officially supported by kind 0.22.0 + - kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2 # Not officially supported by kind 0.22.0 - kindest/node:v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3 - kindest/node:v1.24.17@sha256:bad10f9b98d54586cba05a7eaa1b61c6b90bfc4ee174fdc43a7b75ca75c95e51 - kindest/node:v1.25.16@sha256:e8b50f8e06b44bb65a93678a65a26248fae585b3d3c2a669e5ca6c90c69dc519 @@ -25,30 +25,29 @@ jobs: - uses: actions/setup-go@v5 with: go-version: '1.22.2' - - name: Install kind and kubectl + - name: cleanup kind run: | curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 chmod +x ./kind - curl -Lo ./kubectl https://dl.k8s.io/release/v1.23.3/bin/linux/amd64/kubectl - chmod +x ./kubectl - - name: Cleanup and prepare environment - run: | ./kind delete cluster || true make clean docker system prune -af --volumes || true - docker network create -d=bridge --subnet=172.30.0.0/16 kind || true + docker network create -d=bridge --subnet=172.19.0.0/24 kind || true - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Get temp bin dir + id: bin_dir + run: echo "BIN_DIR=$(mktemp -d --tmpdir=${{ github.workspace }})" >> $GITHUB_OUTPUT - name: Find latest Humio Core preview docker image id: docker_tag run: | docker pull humio/humio-core:preview LATEST_TAG=$(docker run --rm humio/humio-core:preview cat /tag.txt) echo "HUMIO_CORE_DEV_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT - - name: Run e2e tests + - name: run e2e tests env: HUMIO_CORE_DEV_TAG: ${{ steps.docker_tag.outputs.HUMIO_CORE_DEV_TAG }} BIN_DIR: ${{ steps.bin_dir.outputs.BIN_DIR }} @@ -62,11 +61,19 @@ jobs: run: | echo "Running operator tests against humio-core-dev:$HUMIO_CORE_DEV_TAG" sed -i "s/humio-core:[0-9.]*/humio-core-dev:$HUMIO_CORE_DEV_TAG/g" controllers/humiocluster_defaults.go + hack/run-e2e-using-kind.sh - - name: Final cleanup + - name: cleanup kind if: always() run: | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64 + chmod +x ./kind ./kind delete cluster || true make clean - docker system prune -af --volumes || true - docker network prune -f || true \ No newline at end of file + + echo cleaning up docker files as kind load docker-image seems to leave dangling files in the data directory that docker does not detect and so pruning with docker cli doesnt work + sudo systemctl stop docker + sudo rm -rf /var/lib/docker + sudo systemctl start docker + docker network create -d=bridge --subnet=172.19.0.0/24 kind || true + diff --git a/pkg/humio/client.go b/pkg/humio/client.go index fd4abe576..31e9f0120 100644 --- a/pkg/humio/client.go +++ b/pkg/humio/client.go @@ -867,12 +867,16 @@ func (h *ClientConfig) ValidateActionsForFilterAlert(config *humioapi.Config, re return nil } -<<<<<<< HEAD func (h *ClientConfig) ValidateActionsForScheduledSearch(config *humioapi.Config, req reconcile.Request, hss *humiov1alpha1.HumioScheduledSearch) error { for _, actionNameForScheduledSearch := range hss.Spec.Actions { if _, err := h.getAndValidateAction(config, req, actionNameForScheduledSearch, hss.Spec.ViewName); err != nil { return fmt.Errorf("problem getting action for scheduled search %s: %w", hss.Spec.Name, err) -======= + + } + } + return nil +} + func (h *ClientConfig) AddAggregateAlert(config *humioapi.Config, req reconcile.Request, haa *humiov1alpha1.HumioAggregateAlert) (*humioapi.AggregateAlert, error) { err := h.validateView(config, req, haa.Spec.ViewName) if err != nil { @@ -960,7 +964,6 @@ func (h *ClientConfig) ValidateActionsForAggregateAlert(config *humioapi.Config, for _, actionNameForAlert := range haa.Spec.Actions { if _, err := h.getAndValidateAction(config, req, actionNameForAlert, haa.Spec.ViewName); err != nil { return fmt.Errorf("problem getting action for aggregate alert %s: %w", haa.Spec.Name, err) ->>>>>>> 461e66a (Created AggregateAlerts Support) } } return nil