From 744461565f031675c54532527b85af6c01080627 Mon Sep 17 00:00:00 2001 From: filip susak Date: Tue, 7 Apr 2026 11:33:02 +0200 Subject: [PATCH] add: configmap, ingress + update deployment with env refs --- argocd/apps/moj-servis.app.yaml | 3 ++- k8s/moj-servis/configmap.yaml | 9 +++++++++ k8s/moj-servis/deployment.yaml | 23 ++++++++++++++++++++++- k8s/moj-servis/ingress.yaml | 19 +++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 k8s/moj-servis/configmap.yaml create mode 100644 k8s/moj-servis/ingress.yaml diff --git a/argocd/apps/moj-servis.app.yaml b/argocd/apps/moj-servis.app.yaml index 0fee848..638b254 100644 --- a/argocd/apps/moj-servis.app.yaml +++ b/argocd/apps/moj-servis.app.yaml @@ -20,4 +20,5 @@ spec: prune: true selfHeal: true syncOptions: - - CreateNamespace=true \ No newline at end of file + - CreateNamespace=true + #kubectl apply -f argocd/apps/moj-servis.app.yaml -n argocd \ No newline at end of file diff --git a/k8s/moj-servis/configmap.yaml b/k8s/moj-servis/configmap.yaml new file mode 100644 index 0000000..20ff1a1 --- /dev/null +++ b/k8s/moj-servis/configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: moj-servis-config + namespace: student-fsusak03 +data: + SERVICE_NAME: "moj-servis" + LOG_LEVEL: "info" + WELCOME_MSG: "Pozdrav iz FPMOZ k3s clustera!" diff --git a/k8s/moj-servis/deployment.yaml b/k8s/moj-servis/deployment.yaml index 09b35d7..c3a8ace 100644 --- a/k8s/moj-servis/deployment.yaml +++ b/k8s/moj-servis/deployment.yaml @@ -17,4 +17,25 @@ spec: - name: filip-susak-moj-servis image: git.fpmoz.sum.ba/fsusak03/filipsusak:latest ports: - - containerPort: 8000 \ No newline at end of file + - containerPort: 8000 + envFrom: + - configMapRef: + name: moj-servis-config + env: + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: moj-servis-secret + key: DB_PASSWORD + - name: API_KEY + valueFrom: + secretKeyRef: + name: moj-servis-secret + key: API_KEY + resources: + requests: + memory: "64Mi" + cpu: "50m" + limits: + memory: "128Mi" + cpu: "200m" \ No newline at end of file diff --git a/k8s/moj-servis/ingress.yaml b/k8s/moj-servis/ingress.yaml new file mode 100644 index 0000000..848aca5 --- /dev/null +++ b/k8s/moj-servis/ingress.yaml @@ -0,0 +1,19 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: moj-servis-ingress + namespace: student-fsusak03 + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: web +spec: + rules: + - host: fsusak03.argocd.fpmoz.sum.ba + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: filip-susak-moj-servis-svc + port: + number: 80