From dadf0da0ee276bbb44366aadc250c170b8625bd2 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Sun, 17 Aug 2025 20:40:51 +0530 Subject: [PATCH 01/14] Create ci.yml --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ca06711 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: ["main", "develop"] + pull_request: + branches: ["main", "develop"] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Run go fmt + run: go fmt ./... + + - name: Run go vet + run: go vet ./... + + - name: Run unit tests + run: go test ./... -v From 0f79d6129b08d99b4f7170c19aa788e58eb7fcbe Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Sun, 17 Aug 2025 23:30:25 +0530 Subject: [PATCH 02/14] Update ci.yml --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca06711..93d7cc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,12 +2,12 @@ name: CI on: push: - branches: ["main", "develop"] + branches: [ "main" ] pull_request: - branches: ["main", "develop"] + branches: [ "main" ] jobs: - build-and-test: + test: runs-on: ubuntu-latest steps: @@ -17,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.24' + go-version: '1.22' - name: Cache Go modules uses: actions/cache@v4 @@ -36,4 +36,25 @@ jobs: run: go vet ./... - name: Run unit tests - run: go test ./... -v + run: go test ./... -coverprofile=coverage.out + + - name: Set up KinD cluster + uses: helm/kind-action@v1.10.0 + with: + version: v0.24.0 + node_image: kindest/node:v1.30.0 + wait: 120s + + - name: Install Kubectl + uses: azure/setup-kubectl@v4 + with: + version: 'v1.30.0' + + - name: Build and load Docker image into Kind + run: | + make docker-build IMG=example.com/auto-mtls:v0.0.1 + kind load docker-image example.com/auto-mtls:v0.0.1 + + - name: Run E2E tests + run: | + go test ./test/e2e/... -v From c9ffa7b00e562eee7364bb45369489274c2a1cb6 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Sun, 17 Aug 2025 23:48:49 +0530 Subject: [PATCH 03/14] Update ci.yml --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93d7cc5..8f13311 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,22 +2,22 @@ name: CI on: push: - branches: [ "main" ] + branches: [ main ] pull_request: - branches: [ "main" ] + branches: [ main ] jobs: - test: + build-test: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout repo uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: 1.22 - name: Cache Go modules uses: actions/cache@v4 @@ -35,26 +35,36 @@ jobs: - name: Run go vet run: go vet ./... - - name: Run unit tests + - name: Run unit tests with coverage run: go test ./... -coverprofile=coverage.out - - name: Set up KinD cluster + # ---------- E2E Setup ---------- + - name: Set up kind cluster uses: helm/kind-action@v1.10.0 with: - version: v0.24.0 - node_image: kindest/node:v1.30.0 - wait: 120s + cluster_name: kind - - name: Install Kubectl + - name: Install kubectl uses: azure/setup-kubectl@v4 with: - version: 'v1.30.0' + version: v1.30.0 - - name: Build and load Docker image into Kind + - name: Install cert-manager run: | - make docker-build IMG=example.com/auto-mtls:v0.0.1 - kind load docker-image example.com/auto-mtls:v0.0.1 + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml + kubectl rollout status deployment/cert-manager -n cert-manager --timeout=120s || true + kubectl rollout status deployment/cert-manager-webhook -n cert-manager --timeout=120s || true - - name: Run E2E tests + - name: Build Docker image run: | - go test ./test/e2e/... -v + docker build -t auto-mtls:latest . + + - name: Load image into kind + run: kind load docker-image auto-mtls:latest --name kind + + - name: Deploy manifests + run: | + kubectl apply -f config/deploy/ + + - name: Run e2e tests + run: go test ./test/e2e -v From 7a510700cd7e5f37dddb7d9152505449e5fd6ca0 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Sun, 17 Aug 2025 23:54:02 +0530 Subject: [PATCH 04/14] Update ci.yml --- .github/workflows/ci.yml | 55 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f13311..1aa7cc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Go CI on: push: @@ -7,20 +7,20 @@ on: branches: [ main ] jobs: - build-test: + build: runs-on: ubuntu-latest steps: - - name: Checkout repo - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v4 with: go-version: 1.22 - name: Cache Go modules - uses: actions/cache@v4 + uses: actions/cache@v3 with: path: | ~/go/pkg/mod @@ -38,33 +38,36 @@ jobs: - name: Run unit tests with coverage run: go test ./... -coverprofile=coverage.out - # ---------- E2E Setup ---------- - - name: Set up kind cluster - uses: helm/kind-action@v1.10.0 - with: - cluster_name: kind + e2e-tests: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v3 - - name: Install kubectl - uses: azure/setup-kubectl@v4 + - name: Set up Go + uses: actions/setup-go@v4 with: - version: v1.30.0 + go-version: 1.22 - - name: Install cert-manager + - name: Install Kind & Kubectl run: | - kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.yaml - kubectl rollout status deployment/cert-manager -n cert-manager --timeout=120s || true - kubectl rollout status deployment/cert-manager-webhook -n cert-manager --timeout=120s || true + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 + chmod +x ./kind + sudo mv ./kind /usr/local/bin/kind + curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + sudo mv kubectl /usr/local/bin/ - - name: Build Docker image - run: | - docker build -t auto-mtls:latest . + - name: Create Kind cluster + run: kind create cluster --name kind - - name: Load image into kind - run: kind load docker-image auto-mtls:latest --name kind + - name: Build Docker image for tests + run: make docker-build IMG=example.com/auto-mtls:v0.0.1 - - name: Deploy manifests - run: | - kubectl apply -f config/deploy/ + - name: Load image into Kind + run: kind load docker-image example.com/auto-mtls:v0.0.1 --name kind - name: Run e2e tests run: go test ./test/e2e -v From 41bd8625b7e9dc8d027801e18593aecaaba5cc16 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Sun, 17 Aug 2025 23:59:17 +0530 Subject: [PATCH 05/14] Update ci.yml --- .github/workflows/ci.yml | 42 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1aa7cc1..d11c8fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,23 +1,21 @@ -name: Go CI +name: CI on: push: - branches: [ main ] + branches: [ "main" ] pull_request: - branches: [ main ] + branches: [ "main" ] jobs: build: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.22 + go-version: '1.21' - name: Cache Go modules uses: actions/cache@v3 @@ -35,38 +33,32 @@ jobs: - name: Run go vet run: go vet ./... - - name: Run unit tests with coverage + - name: Run unit tests run: go test ./... -coverprofile=coverage.out - e2e-tests: + e2e: runs-on: ubuntu-latest needs: build - steps: - - name: Checkout code - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.22 + go-version: '1.21' - - name: Install Kind & Kubectl - run: | - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 - chmod +x ./kind - sudo mv ./kind /usr/local/bin/kind - curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - chmod +x kubectl - sudo mv kubectl /usr/local/bin/ + - name: Install KinD + uses: engineerd/setup-kind@v0.5.0 + with: + version: v0.20.0 - - name: Create Kind cluster - run: kind create cluster --name kind + - name: Create KinD cluster + run: kind create cluster --name kind --wait 60s - - name: Build Docker image for tests + - name: Build Operator Docker image run: make docker-build IMG=example.com/auto-mtls:v0.0.1 - - name: Load image into Kind + - name: Load image into KinD run: kind load docker-image example.com/auto-mtls:v0.0.1 --name kind - name: Run e2e tests From 4ee233e208f1c9385e316fbcb2504360adadc6ea Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 00:11:32 +0530 Subject: [PATCH 06/14] Update ci.yml --- .github/workflows/ci.yml | 43 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d11c8fd..fd60214 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,18 +7,20 @@ on: branches: [ "main" ] jobs: - build: + build-and-test: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: '1.22' - name: Cache Go modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/go/pkg/mod @@ -30,36 +32,21 @@ jobs: - name: Run go fmt run: go fmt ./... - - name: Run go vet - run: go vet ./... - - name: Run unit tests run: go test ./... -coverprofile=coverage.out - e2e: - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v3 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.21' - - - name: Install KinD - uses: engineerd/setup-kind@v0.5.0 + # Setup Kubernetes cluster for e2e + - name: Install Kind + uses: helm/kind-action@v1.10.0 with: - version: v0.20.0 - - - name: Create KinD cluster - run: kind create cluster --name kind --wait 60s + cluster_name: kind + wait: 120s - - name: Build Operator Docker image + - name: Build Docker image for operator run: make docker-build IMG=example.com/auto-mtls:v0.0.1 - - name: Load image into KinD + - name: Load image into Kind cluster run: kind load docker-image example.com/auto-mtls:v0.0.1 --name kind - name: Run e2e tests - run: go test ./test/e2e -v + run: go test ./test/e2e -v -ginkgo.v From fefaffd38bab09c65589cd3eef211d9dd4ac4caf Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 00:23:38 +0530 Subject: [PATCH 07/14] Update ci.yml --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd60214..93b38a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,20 +7,20 @@ on: branches: [ "main" ] jobs: - build-and-test: + build-test: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout repository uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: 1.22 - name: Cache Go modules - uses: actions/cache@v4 + uses: actions/cache@v3 with: path: | ~/go/pkg/mod @@ -32,21 +32,29 @@ jobs: - name: Run go fmt run: go fmt ./... - - name: Run unit tests - run: go test ./... -coverprofile=coverage.out + - name: Run go vet + run: go vet ./... - # Setup Kubernetes cluster for e2e - - name: Install Kind - uses: helm/kind-action@v1.10.0 - with: - cluster_name: kind - wait: 120s + - name: Install Kind & Kubectl + run: | + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 + chmod +x ./kind + sudo mv ./kind /usr/local/bin/kind + curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + sudo mv kubectl /usr/local/bin/ - - name: Build Docker image for operator - run: make docker-build IMG=example.com/auto-mtls:v0.0.1 + - name: Create Kind Cluster + run: kind create cluster --name kind --wait 120s - - name: Load image into Kind cluster - run: kind load docker-image example.com/auto-mtls:v0.0.1 --name kind + - name: Verify Cluster + run: kubectl get nodes - - name: Run e2e tests - run: go test ./test/e2e -v -ginkgo.v + - name: Run Tests + run: go test ./... -coverprofile=coverage.out + + - name: Upload coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage.out From cb6abf6582a4a566902f7884e9445c9ce3c65a57 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 00:31:28 +0530 Subject: [PATCH 08/14] Update ci.yml --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93b38a7..5d188e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,12 +37,14 @@ jobs: - name: Install Kind & Kubectl run: | - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 - chmod +x ./kind - sudo mv ./kind /usr/local/bin/kind + curl -Lo kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 + chmod +x kind + sudo mv kind /usr/local/bin/kind + curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x kubectl - sudo mv kubectl /usr/local/bin/ + sudo mv kubectl /usr/local/bin/kubectl + - name: Create Kind Cluster run: kind create cluster --name kind --wait 120s From 499c40b7b8f42c903422588c1003bd1925bb67e2 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 00:35:36 +0530 Subject: [PATCH 09/14] Update ci.yml --- .github/workflows/ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d188e4..972b9dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,17 +35,21 @@ jobs: - name: Run go vet run: go vet ./... - - name: Install Kind & Kubectl + - name: Install kind and kubectl run: | + # Install kind curl -Lo kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 chmod +x kind sudo mv kind /usr/local/bin/kind - - curl -LO "https://dl.k8s.io/release/$(curl -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + + # Install kubectl + KUBECTL_VERSION=$(curl -s https://dl.k8s.io/release/stable.txt) + curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" chmod +x kubectl sudo mv kubectl /usr/local/bin/kubectl + - name: Create Kind Cluster run: kind create cluster --name kind --wait 120s From cce4e3e82990e570222b133e63a96940c1ac464e Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 11:23:25 +0530 Subject: [PATCH 10/14] Update ci.yml --- .github/workflows/ci.yml | 70 ++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 972b9dc..6671d10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,65 +2,51 @@ name: CI on: push: - branches: [ "main" ] + branches: + - main pull_request: - branches: [ "main" ] jobs: - build-test: + build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.22 - - - name: Cache Go modules - uses: actions/cache@v3 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: Run go fmt - run: go fmt ./... - - - name: Run go vet - run: go vet ./... - - - name: Install kind and kubectl + # Install kind + - name: Install kind run: | - # Install kind curl -Lo kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 chmod +x kind sudo mv kind /usr/local/bin/kind - # Install kubectl - KUBECTL_VERSION=$(curl -s https://dl.k8s.io/release/stable.txt) + # Install kubectl (fixed version issue) + - name: Install kubectl + run: | + KUBECTL_VERSION=$(curl -s https://dl.k8s.io/release/stable.txt | tr -d '\n') + echo "Downloading kubectl version $KUBECTL_VERSION" curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" chmod +x kubectl sudo mv kubectl /usr/local/bin/kubectl + # Create Kubernetes cluster with kind + - name: Create kind cluster + run: | + kind create cluster --name ci-cluster + # Load Docker image into kind cluster + - name: Build Docker image + run: | + docker build -t myapp:latest . - - name: Create Kind Cluster - run: kind create cluster --name kind --wait 120s - - - name: Verify Cluster - run: kubectl get nodes - - - name: Run Tests - run: go test ./... -coverprofile=coverage.out + - name: Load image into kind + run: | + kind load docker-image myapp:latest --name ci-cluster - - name: Upload coverage - uses: actions/upload-artifact@v4 - with: - name: coverage-report - path: coverage.out + # Deploy to kind + - name: Deploy to Kubernetes + run: | + kubectl apply -f k8s/deployment.yaml + kubectl apply -f k8s/service.yaml + kubectl rollout status deployment/myapp-deployment From 6e8787f1a1d706721084c4ffc8be6356901c42d6 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 11:28:32 +0530 Subject: [PATCH 11/14] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6671d10..35a0a87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,12 +24,13 @@ jobs: # Install kubectl (fixed version issue) - name: Install kubectl run: | - KUBECTL_VERSION=$(curl -s https://dl.k8s.io/release/stable.txt | tr -d '\n') + KUBECTL_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt | tr -d '\n') echo "Downloading kubectl version $KUBECTL_VERSION" curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" chmod +x kubectl sudo mv kubectl /usr/local/bin/kubectl + # Create Kubernetes cluster with kind - name: Create kind cluster run: | From 4a78a79b0237699559c2ed10a6e8b738f8befd30 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 12:24:26 +0530 Subject: [PATCH 12/14] Update ci.yml --- .github/workflows/ci.yml | 49 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35a0a87..2ff228c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: - branches: - - main + branches: [main] pull_request: + workflow_dispatch: jobs: build-and-deploy: @@ -12,42 +12,27 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - # Install kind - - name: Install kind - run: | - curl -Lo kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 - chmod +x kind - sudo mv kind /usr/local/bin/kind - - # Install kubectl (fixed version issue) - - name: Install kubectl - run: | - KUBECTL_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt | tr -d '\n') - echo "Downloading kubectl version $KUBECTL_VERSION" - curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" - chmod +x kubectl - sudo mv kubectl /usr/local/bin/kubectl + - name: Set up Kubernetes Cluster + uses: helm/kind-action@v1.8.0 + with: + cluster_name: ci-cluster + - name: Build Docker Image + run: docker build -t myapp:latest . - # Create Kubernetes cluster with kind - - name: Create kind cluster - run: | - kind create cluster --name ci-cluster + - name: Load Image into Cluster + run: kind load docker-image myapp:latest --name ci-cluster - # Load Docker image into kind cluster - - name: Build Docker image + - name: Deploy to Kubernetes run: | - docker build -t myapp:latest . + kubectl apply -f deploy/auto-mtls-deploy.yaml - - name: Load image into kind + - name: Wait for Deployment run: | - kind load docker-image myapp:latest --name ci-cluster + kubectl rollout status deployment/myapp-deployment --timeout=120s - # Deploy to kind - - name: Deploy to Kubernetes + - name: Wait for Pods to be Ready run: | - kubectl apply -f k8s/deployment.yaml - kubectl apply -f k8s/service.yaml - kubectl rollout status deployment/myapp-deployment + kubectl wait --for=condition=ready pod -l app=myapp --timeout=120s From c831a2a91c54f6346994da8c896c43574149b0a3 Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 12:32:14 +0530 Subject: [PATCH 13/14] Update ci.yml --- .github/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ff228c..aaa78e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: branches: [main] pull_request: - workflow_dispatch: + workflow_dispatch: # Manual trigger support jobs: build-and-deploy: @@ -14,25 +14,33 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + # Set up Kubernetes Cluster using kind - name: Set up Kubernetes Cluster uses: helm/kind-action@v1.8.0 with: cluster_name: ci-cluster + # Build Docker image (optional if using existing image) - name: Build Docker Image - run: docker build -t myapp:latest . + run: docker build -t kupher/auto-mtls-operator:v0.0.1 . + # Load Docker image into kind cluster - name: Load Image into Cluster - run: kind load docker-image myapp:latest --name ci-cluster + run: kind load docker-image kupher/auto-mtls-operator:v0.0.1 --name ci-cluster + # Deploy Kubernetes manifest - name: Deploy to Kubernetes run: | kubectl apply -f deploy/auto-mtls-deploy.yaml + # Wait for deployment rollout - name: Wait for Deployment run: | - kubectl rollout status deployment/myapp-deployment --timeout=120s + kubectl rollout status deployment/auto-mtls-operator \ + -n auto-mtls-system --timeout=120s + # Wait for pods to be ready - name: Wait for Pods to be Ready run: | - kubectl wait --for=condition=ready pod -l app=myapp --timeout=120s + kubectl wait --for=condition=ready pod \ + -l app.kubernetes.io/name=auto-mtls -n auto-mtls-system --timeout=120s From 3e35e962de90852ad9ffc5e64355702fd35e8b7a Mon Sep 17 00:00:00 2001 From: Aravindan M Date: Mon, 18 Aug 2025 12:41:42 +0530 Subject: [PATCH 14/14] Update ci.yml Checkout the code Set up Go Run linting --- .github/workflows/ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaa78e2..88437f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,10 @@ name: CI on: push: - branches: [main] + branches: ["main","develop"] pull_request: - workflow_dispatch: # Manual trigger support - + workflow_dispatch: + jobs: build-and-deploy: runs-on: ubuntu-latest @@ -14,32 +14,36 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - # Set up Kubernetes Cluster using kind + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: Run Go Lint + run: | + go install golang.org/x/lint/golint@latest + golint ./... + - name: Set up Kubernetes Cluster uses: helm/kind-action@v1.8.0 with: cluster_name: ci-cluster - # Build Docker image (optional if using existing image) - name: Build Docker Image run: docker build -t kupher/auto-mtls-operator:v0.0.1 . - # Load Docker image into kind cluster - name: Load Image into Cluster run: kind load docker-image kupher/auto-mtls-operator:v0.0.1 --name ci-cluster - # Deploy Kubernetes manifest - name: Deploy to Kubernetes run: | kubectl apply -f deploy/auto-mtls-deploy.yaml - # Wait for deployment rollout - name: Wait for Deployment run: | kubectl rollout status deployment/auto-mtls-operator \ -n auto-mtls-system --timeout=120s - # Wait for pods to be ready - name: Wait for Pods to be Ready run: | kubectl wait --for=condition=ready pod \