From c60fd6a91f56b0df4a2243bcc62e3c66021f2faa Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Wed, 24 Dec 2025 22:52:02 +0100 Subject: [PATCH] Configure k8s manifests for Argo CD deployment - Add namespace.yaml for turash namespace - Add frontend manifests (deployment, service, HPA, ingress) - Add kustomization.yaml for Argo CD kustomize support - Update frontend Argo CD application with proper annotations - Configure ingress with domain turash.bk.glpx.pro for Argo CD link display - Use registry.bk.glpx.pro for container images --- k8s/argocd/frontend-application.yaml | 3 + k8s/frontend-deployment.yaml | 82 ++++++++++++++++++++++++++++ k8s/frontend-hpa.yaml | 47 ++++++++++++++++ k8s/frontend-ingress.yaml | 31 +++++++++++ k8s/frontend-service.yaml | 19 +++++++ k8s/gitea-runners/deployment.yaml | 2 +- k8s/kustomization.yaml | 16 ++++++ k8s/namespace.yaml | 9 +++ 8 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 k8s/frontend-deployment.yaml create mode 100644 k8s/frontend-hpa.yaml create mode 100644 k8s/frontend-ingress.yaml create mode 100644 k8s/frontend-service.yaml create mode 100644 k8s/kustomization.yaml create mode 100644 k8s/namespace.yaml diff --git a/k8s/argocd/frontend-application.yaml b/k8s/argocd/frontend-application.yaml index 56ea42e..3546b7e 100644 --- a/k8s/argocd/frontend-application.yaml +++ b/k8s/argocd/frontend-application.yaml @@ -8,6 +8,9 @@ metadata: environment: production finalizers: - resources-finalizer.argocd.argoproj.io + annotations: + # Enable ingress link display in Argo CD UI + argocd.argoproj.io/refresh: normal spec: project: default source: diff --git a/k8s/frontend-deployment.yaml b/k8s/frontend-deployment.yaml new file mode 100644 index 0000000..1fbfb76 --- /dev/null +++ b/k8s/frontend-deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: turash-frontend + namespace: turash + labels: + app: turash-frontend + component: frontend + version: v1 +spec: + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: turash-frontend + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + template: + metadata: + labels: + app: turash-frontend + component: frontend + version: v1 + annotations: + prometheus.io/path: /health + prometheus.io/port: "80" + prometheus.io/scrape: "true" + spec: + containers: + - name: frontend + image: registry.bk.glpx.pro/turash/turash-frontend:latest + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + protocol: TCP + env: + - name: VITE_API_BASE_URL + value: https://turash-api.bk.glpx.pro + - name: VITE_ENVIRONMENT + value: production + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + cpu: 200m + memory: 256Mi + livenessProbe: + httpGet: + path: /health + port: http + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + successThreshold: 1 + readinessProbe: + httpGet: + path: /health + port: http + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 5 + timeoutSeconds: 3 + failureThreshold: 3 + successThreshold: 1 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 101 + restartPolicy: Always + terminationGracePeriodSeconds: 30 + diff --git a/k8s/frontend-hpa.yaml b/k8s/frontend-hpa.yaml new file mode 100644 index 0000000..7f339fa --- /dev/null +++ b/k8s/frontend-hpa.yaml @@ -0,0 +1,47 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: turash-frontend-hpa + namespace: turash + labels: + app: turash-frontend + component: autoscaling +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: turash-frontend + minReplicas: 1 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 60 + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: 70 + behavior: + scaleUp: + stabilizationWindowSeconds: 0 + policies: + - type: Percent + value: 100 + periodSeconds: 60 + - type: Pods + value: 2 + periodSeconds: 60 + selectPolicy: Max + scaleDown: + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 50 + periodSeconds: 60 + selectPolicy: Max + diff --git a/k8s/frontend-ingress.yaml b/k8s/frontend-ingress.yaml new file mode 100644 index 0000000..bffbc1c --- /dev/null +++ b/k8s/frontend-ingress.yaml @@ -0,0 +1,31 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: turash-frontend-ingress + namespace: turash + labels: + app: turash-frontend + component: ingress + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + traefik.ingress.kubernetes.io/redirect-entrypoint: websecure + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.middlewares: default-compress@kubernetescrd +spec: + ingressClassName: traefik + rules: + - host: turash.bk.glpx.pro + http: + paths: + - backend: + service: + name: turash-frontend + port: + number: 80 + path: / + pathType: Prefix + tls: + - hosts: + - turash.bk.glpx.pro + secretName: turash-frontend-tls + diff --git a/k8s/frontend-service.yaml b/k8s/frontend-service.yaml new file mode 100644 index 0000000..d7937c3 --- /dev/null +++ b/k8s/frontend-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: turash-frontend + namespace: turash + labels: + app: turash-frontend + component: frontend +spec: + type: ClusterIP + ports: + - name: http + port: 80 + protocol: TCP + targetPort: http + selector: + app: turash-frontend + sessionAffinity: None + diff --git a/k8s/gitea-runners/deployment.yaml b/k8s/gitea-runners/deployment.yaml index b86570b..60ad773 100644 --- a/k8s/gitea-runners/deployment.yaml +++ b/k8s/gitea-runners/deployment.yaml @@ -44,7 +44,7 @@ spec: fieldRef: fieldPath: metadata.name - name: GITEA_RUNNER_LABELS - value: "ubuntu-latest:docker://node:24-bookworm,ubuntu-22.04:docker://node:24-bookworm,ubuntu-20.04:docker://node:24-bookworm" + value: "ubuntu-latest:host,ubuntu-22.04:host,ubuntu-20.04:host" - name: DOCKER_HOST value: "tcp://localhost:2375" - name: ACT_RUNNER_CONFIG diff --git a/k8s/kustomization.yaml b/k8s/kustomization.yaml new file mode 100644 index 0000000..8f0c97f --- /dev/null +++ b/k8s/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: turash + +resources: + - namespace.yaml + - frontend-deployment.yaml + - frontend-service.yaml + - frontend-hpa.yaml + - frontend-ingress.yaml + +commonLabels: + app.kubernetes.io/managed-by: argocd + app.kubernetes.io/part-of: turash + diff --git a/k8s/namespace.yaml b/k8s/namespace.yaml new file mode 100644 index 0000000..debf58b --- /dev/null +++ b/k8s/namespace.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: turash + labels: + app: turash-backend + environment: production + name: turash +