bez ispravljeni koda
This commit is contained in:
@@ -53,19 +53,18 @@ jobs:
|
|||||||
version: 'latest'
|
version: 'latest'
|
||||||
- name: Postavi kubeconfig
|
- name: Postavi kubeconfig
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.KUBE_CONFIG }}" > kubeconfig
|
# 1. Uzimamo tvoj plavi kod i pretvaramo ga nazad u pravu datoteku
|
||||||
chmod 600 kubeconfig
|
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > kubeconfig
|
||||||
|
chmod 600 kubeconfig
|
||||||
|
|
||||||
- name: Update image tag u manifestu
|
- name: Update image tag u manifestu
|
||||||
run: |
|
run: |
|
||||||
TAG=$(cat tag.txt)
|
TAG=$(cat tag.txt)
|
||||||
IMAGE="ghcr.io/sz11zs/hello-cicd"
|
IMAGE="ghcr.io/sz11zs/hello-cicd"
|
||||||
sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml
|
sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml
|
||||||
|
|
||||||
- name: Deploy na k3s
|
- name: Deploy na k3s
|
||||||
run: |
|
run: |
|
||||||
# Sada se putanje podudaraju (./kubeconfig)
|
# 2. DODATAK: Prisiljavamo kubectl da gleda baš tu datoteku, a ne 127.0.0.1
|
||||||
kubectl --kubeconfig=./kubeconfig apply -f k8s/ --validate=false
|
export KUBECONFIG=$GITHUB_WORKSPACE/kubeconfig
|
||||||
|
kubectl apply -f k8s/ --validate=false
|
||||||
kubectl --kubeconfig=./kubeconfig rollout status deployment/hello-cicd \
|
kubectl rollout status deployment/hello-cicd -n student-sz11zs --timeout=120s
|
||||||
-n student-sz11zs --timeout=120s
|
|
||||||
@@ -1,58 +1,28 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: moj-servis
|
name: hello-cicd
|
||||||
namespace: student-sz11zs
|
namespace: student-sz11zs
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: moj-servis
|
app: hello-cicd
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: moj-servis
|
app: hello-cicd
|
||||||
spec:
|
spec:
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: gitea-creds
|
- name: gitea-creds
|
||||||
containers:
|
containers:
|
||||||
- name: moj-servis
|
- name: hello-cicd
|
||||||
image: git.fpmoz.sum.ba/sz11zs/moj-servis:1.1
|
image: git.fpmoz.sum.ba/sz11zs/hello-cicd:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
|
|
||||||
# 1. POVEZIVANJE S OKOLINSKIM VARIJABLAMA (Secret i ConfigMap)
|
|
||||||
env:
|
env:
|
||||||
- name: DB_PASSWORD
|
- name: APP_VERSION
|
||||||
valueFrom:
|
value: "latest"
|
||||||
secretKeyRef:
|
resources:
|
||||||
name: moj-servis-secret
|
requests: {cpu: 50m, memory: 64Mi}
|
||||||
key: DB_PASSWORD
|
limits: {cpu: 200m, memory: 128Mi}
|
||||||
- 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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user