mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
Update k8s manifest
This commit is contained in:
@@ -2,12 +2,12 @@ name: Build and Deploy to Kubernetes
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ] # Trigger the action on push to main branch
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
K8S_NAMESPACE: default # Replace with your Kubernetes namespace
|
||||
K8S_NAMESPACE: apps
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
@@ -33,10 +33,12 @@ jobs:
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
# Build and push main application image
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: |-
|
||||
${{ steps.meta.outputs.tags }}
|
||||
@@ -50,7 +52,7 @@ jobs:
|
||||
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
|
||||
with:
|
||||
args: |-
|
||||
# Update the deployment.yaml with the new image tag
|
||||
# Update both deployments with new image tags
|
||||
sed -i 's|image: .*|image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:1.0.${{ github.run_number }}|' k8s/manifest.yaml
|
||||
# Apply Kubernetes manifests
|
||||
kubectl apply -n apps -f k8s/manifest.yaml
|
||||
kubectl apply -n ${{ env.K8S_NAMESPACE }} -f k8s/manifest.yaml
|
||||
|
||||
@@ -155,3 +155,88 @@ spec:
|
||||
number: 80
|
||||
path: /
|
||||
pathType: Prefix
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: links-worker
|
||||
labels:
|
||||
tags.datadoghq.com/env: "prod"
|
||||
tags.datadoghq.com/service: "links-worker"
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: links-worker
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: links-worker
|
||||
tags.datadoghq.com/env: "prod"
|
||||
tags.datadoghq.com/service: "links-worker"
|
||||
spec:
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: links-pvc
|
||||
containers:
|
||||
- name: celery-worker
|
||||
image: "ghcr.io/wahyd4/links:main"
|
||||
command: ["celery"]
|
||||
args: ["-A", "core", "worker", "--loglevel=info"]
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: new-postgres-postgresql.db.svc.cluster.local
|
||||
- name: DB_NAME
|
||||
value: badges
|
||||
- name: DB_USERNAME
|
||||
value: postgres
|
||||
- name: CELERY_BROKER_URL
|
||||
value: "redis://redis-master.db.svc.cluster.local:6379"
|
||||
- name: CELERY_RESULT_BACKEND
|
||||
value: "redis://redis-master.db.svc.cluster.local:6379"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
|
||||
- name: celery-beat
|
||||
image: "ghcr.io/wahyd4/links:main"
|
||||
command: ["celery"]
|
||||
args: ["-A", "core", "beat", "-s", "/app/data/celerybeat-schedule", "--loglevel=info"]
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /app/data
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: new-postgres-postgresql.db.svc.cluster.local
|
||||
- name: DB_NAME
|
||||
value: badges
|
||||
- name: DB_USERNAME
|
||||
value: postgres
|
||||
- name: CELERY_BROKER_URL
|
||||
value: "redis://redis-master.db.svc.cluster.local:6379"
|
||||
- name: CELERY_RESULT_BACKEND
|
||||
value: "redis://redis-master.db.svc.cluster.local:6379"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
imagePullSecrets:
|
||||
- name: github-image-pull-secret
|
||||
|
||||
Reference in New Issue
Block a user