diff --git a/.env.secret.example b/.env.secret.example index b6bd307..292663e 100644 --- a/.env.secret.example +++ b/.env.secret.example @@ -16,5 +16,5 @@ VC_PASSWORD_DEFAULT=secret # VC_PASSWORD= # Registry credentials (only needed for private registries) -# REGISTRY=ghcr.io/yourorg +# REGISTRY=ghcr.io/dagrigorev # TAG=latest diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index bd623f0..1c4b1b4 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -24,6 +24,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up kubectl + uses: azure/setup-kubectl@v3 + + - name: Validate Kubernetes manifests + run: | + kubectl kustomize k8s/overlays/dev > /dev/null + kubectl kustomize k8s/overlays/prod > /dev/null + - name: Install build dependencies run: sudo apt-get install -y gcc make libssl-dev @@ -113,49 +121,6 @@ jobs: with: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - # ── Deploy to dev (on every push to develop) ─────────────────────────────── - deploy-dev: - name: Deploy → dev - runs-on: ubuntu-24.04 - needs: docker - if: github.ref == 'refs/heads/develop' && github.event_name == 'push' - environment: dev - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up kubectl - uses: azure/setup-kubectl@v3 - - - name: Configure kubeconfig - run: | - mkdir -p ~/.kube - echo "${{ secrets.KUBE_CONFIG_DEV }}" | base64 -d > ~/.kube/config - chmod 600 ~/.kube/config - - - name: Set image tag in dev overlay - run: | - cd k8s/overlays/dev - # Update the image tag to the exact SHA that was just built - IMAGE_TAG="sha-$(echo '${{ github.sha }}' | cut -c1-7)" - sed -i "s/newTag: .*/newTag: \"${IMAGE_TAG}\"/" kustomization.yaml - - - name: Deploy to dev - run: kubectl apply -k k8s/overlays/dev --server-side - - - name: Wait for rollout - run: | - kubectl rollout status statefulset/vcache -n voidcache --timeout=180s - kubectl rollout status deployment/vcache-haproxy -n voidcache --timeout=60s - - - name: Smoke test against dev cluster - run: | - kubectl port-forward svc/vcache 16399:6379 -n voidcache & - sleep 3 - ./vcli -p 16399 --no-color PING - kill %1 - # ── Deploy to prod (on semver tag v*.*.*) ────────────────────────────────── deploy-prod: name: Deploy → prod diff --git a/docker/docker-compose.k8s.yml b/docker/docker-compose.k8s.yml index 9c84a9c..78af12b 100644 --- a/docker/docker-compose.k8s.yml +++ b/docker/docker-compose.k8s.yml @@ -23,7 +23,7 @@ name: voidcache x-vcache-node: &vcache-node - image: ${REGISTRY:-ghcr.io/yourorg}/voidcache:${TAG:-latest} + image: ${REGISTRY:-ghcr.io/dagrigorev/voidcache:${TAG:-latest} build: context: .. dockerfile: Dockerfile diff --git a/k8s/README.md b/k8s/README.md index 6b24a3c..bc9c523 100644 --- a/k8s/README.md +++ b/k8s/README.md @@ -249,7 +249,7 @@ one at a time. HAProxy removes the pod from rotation during restart. ```bash # Update image -kubectl set image statefulset/vcache vcache=ghcr.io/yourorg/voidcache:2.1.0 -n voidcache +kubectl set image statefulset/vcache vcache=ghcr.io/dagrigorev/voidcache:2.1.0 -n voidcache # Watch the ordered rollout kubectl rollout status statefulset/vcache -n voidcache --timeout=300s diff --git a/k8s/base/04-statefulset.yaml b/k8s/base/04-statefulset.yaml index 6de0e8c..d5e0a1a 100644 --- a/k8s/base/04-statefulset.yaml +++ b/k8s/base/04-statefulset.yaml @@ -88,9 +88,9 @@ spec: containers: - name: vcache # Replace with your registry after pushing: - # docker build -t ghcr.io/yourorg/voidcache:2.0.0 . - # docker push ghcr.io/yourorg/voidcache:2.0.0 - image: ghcr.io/yourorg/voidcache:2.0.0 + # docker build -t ghcr.io/dagrigorev/voidcache:2.0.0 . + # docker push ghcr.io/dagrigorev/voidcache:2.0.0 + image: ghcr.io/dagrigorev/voidcache:2.0.0 imagePullPolicy: IfNotPresent ports: diff --git a/k8s/base/05-haproxy.yaml b/k8s/base/05-haproxy.yaml index ba43b00..c47034e 100644 --- a/k8s/base/05-haproxy.yaml +++ b/k8s/base/05-haproxy.yaml @@ -41,9 +41,7 @@ spec: matchLabels: app.kubernetes.io/component: proxy topologyKey: kubernetes.io/hostname - # Prefer to avoid nodes that already have a cache pod - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: + # Prefer to avoid nodes that already have a cache pod - weight: 50 podAffinityTerm: labelSelector: diff --git a/k8s/helm/voidcache/Chart.yaml b/k8s/helm/voidcache/Chart.yaml index 166cd4c..1a1f253 100644 --- a/k8s/helm/voidcache/Chart.yaml +++ b/k8s/helm/voidcache/Chart.yaml @@ -9,12 +9,12 @@ keywords: - redis - in-memory - voidcache -home: https://github.com/yourorg/voidcache +home: https://github.com/dagrigorev/voidcache sources: - - https://github.com/yourorg/voidcache + - https://github.com/dagrigorev/voidcache maintainers: - - name: yourorg - email: you@example.com + - name: dagrigorev + email: jabberwooky@bk.ru annotations: artifacthub.io/license: MIT artifacthub.io/category: database diff --git a/k8s/helm/voidcache/values.yaml b/k8s/helm/voidcache/values.yaml index 90d0f4f..2c6e915 100644 --- a/k8s/helm/voidcache/values.yaml +++ b/k8s/helm/voidcache/values.yaml @@ -3,7 +3,7 @@ # ── Image ────────────────────────────────────────────────────────────────────── image: - repository: ghcr.io/yourorg/voidcache + repository: ghcr.io/dagrigorev/voidcache tag: "2.0.0" pullPolicy: IfNotPresent pullSecrets: [] diff --git a/k8s/overlays/dev/kustomization.yaml b/k8s/overlays/dev/kustomization.yaml index 4622332..acafc93 100644 --- a/k8s/overlays/dev/kustomization.yaml +++ b/k8s/overlays/dev/kustomization.yaml @@ -10,7 +10,7 @@ nameSuffix: "" # Dev-specific image — built locally and loaded into minikube/kind images: - - name: ghcr.io/yourorg/voidcache + - name: ghcr.io/dagrigorev/voidcache newName: voidcache # local image name after docker build newTag: latest diff --git a/k8s/overlays/prod/kustomization.yaml b/k8s/overlays/prod/kustomization.yaml index 58bde79..f6f0616 100644 --- a/k8s/overlays/prod/kustomization.yaml +++ b/k8s/overlays/prod/kustomization.yaml @@ -6,8 +6,8 @@ bases: # Point to your actual registry + version tag images: - - name: ghcr.io/yourorg/voidcache - newName: ghcr.io/yourorg/voidcache # replace yourorg + - name: ghcr.io/dagrigorev/voidcache + newName: ghcr.io/dagrigorev/voidcache newTag: "2.0.0" # pin to an exact release tag patches: