Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.secret.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
51 changes: 8 additions & 43 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions k8s/base/04-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions k8s/base/05-haproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions k8s/helm/voidcache/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion k8s/helm/voidcache/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# ── Image ──────────────────────────────────────────────────────────────────────
image:
repository: ghcr.io/yourorg/voidcache
repository: ghcr.io/dagrigorev/voidcache
tag: "2.0.0"
pullPolicy: IfNotPresent
pullSecrets: []
Expand Down
2 changes: 1 addition & 1 deletion k8s/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions k8s/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading