bez ispravljeni koda
Some checks failed
CI/CD Pipeline popravak / build (push) Successful in 1m31s
CI/CD Pipeline popravak / deploy (push) Failing after 1m5s

This commit is contained in:
2026-05-03 11:39:58 +02:00
parent 994fd12a47
commit c5ed7929dd
2 changed files with 18 additions and 49 deletions

View File

@@ -53,7 +53,8 @@ jobs:
version: 'latest'
- name: Postavi kubeconfig
run: |
echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig
# 1. Uzimamo tvoj plavi kod i pretvaramo ga nazad u pravu datoteku
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > kubeconfig
chmod 600 kubeconfig
- name: Update image tag u manifestu
@@ -61,11 +62,9 @@ jobs:
TAG=$(cat tag.txt)
IMAGE="ghcr.io/sz11zs/hello-cicd"
sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml
- name: Deploy na k3s
run: |
# Sada se putanje podudaraju (./kubeconfig)
kubectl --kubeconfig=./kubeconfig apply -f k8s/ --validate=false
kubectl --kubeconfig=./kubeconfig rollout status deployment/hello-cicd \
-n student-sz11zs --timeout=120s
# 2. DODATAK: Prisiljavamo kubectl da gleda baš tu datoteku, a ne 127.0.0.1
export KUBECONFIG=$GITHUB_WORKSPACE/kubeconfig
kubectl apply -f k8s/ --validate=false
kubectl rollout status deployment/hello-cicd -n student-sz11zs --timeout=120s

View File

@@ -1,58 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: moj-servis
name: hello-cicd
namespace: student-sz11zs
spec:
replicas: 1
selector:
matchLabels:
app: moj-servis
app: hello-cicd
template:
metadata:
labels:
app: moj-servis
app: hello-cicd
spec:
imagePullSecrets:
- name: gitea-creds
containers:
- name: moj-servis
image: git.fpmoz.sum.ba/sz11zs/moj-servis:1.1
- name: hello-cicd
image: git.fpmoz.sum.ba/sz11zs/hello-cicd:latest
ports:
- containerPort: 8000
# 1. POVEZIVANJE S OKOLINSKIM VARIJABLAMA (Secret i ConfigMap)
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
envFrom:
- configMapRef:
name: moj-servis-config
# 2. LIVENESS PROBE: Dodano za Korak 1.4
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 3
failureThreshold: 3
# 3. READINESS PROBE: Dodano za Korak 1.4
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 2
- name: APP_VERSION
value: "latest"
resources:
requests: {cpu: 50m, memory: 64Mi}
limits: {cpu: 200m, memory: 128Mi}