diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39d2cb9..76f1e35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,3 +14,25 @@ build-oci: - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH variables: CTS_BUILD_TAG: $CI_COMMIT_SHORT_SHA + +deploy: + stage: deploy + needs: ["build-oci"] + resource_group: deploy-to-prod + image: + name: bitnami/kubectl:latest + entrypoint: [""] + environment: + name: production + variables: + WAIT: "false" + # IF FORCE true, NOW MUST BE false + FORCE: "true" + NOW: "false" + TIMEOUT: "300s" + script: + - kubectl config use-context aljaxus/upn-qr:upn-qr-agent + - kubectl delete --force=$FORCE --wait=$WAIT --now=$NOW --ignore-not-found=true --timeout=$TIMEOUT -f ./manifests/upn-qr.yaml + - kubectl create -f ./manifests/upn-qr.yaml + rules: + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH diff --git a/.gitlab/agent/upn-qr-agent/config.yaml b/.gitlab/agent/upn-qr-agent/config.yaml new file mode 100644 index 0000000..9e302e7 --- /dev/null +++ b/.gitlab/agent/upn-qr-agent/config.yaml @@ -0,0 +1,6 @@ +gitops: + manifest_projects: + - id: aljaxus/upn-qr + default_namespace: aljaxus-upn-qr + paths: + - glob: '/manifests/*.{yaml,yml,json}' diff --git a/manifests/upn-qr.yaml b/manifests/upn-qr.yaml new file mode 100644 index 0000000..387762e --- /dev/null +++ b/manifests/upn-qr.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: upn-qr-dpl + namespace: aljaxus-upn-qr + labels: + app: upn-qr +spec: + replicas: 1 + template: + metadata: + labels: + app: upn-qr + spec: + imagePullSecrets: + - name: upn-qr-registrypull + containers: + - name: upn-qr-ct + image: registry.gitplac.si/aljaxus/upn-qr + imagePullPolicy: Always + ports: + - containerPort: 80 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: upn-qr-svc + namespace: aljaxus-upn-qr +spec: + type: ClusterIP + selector: + app: upn-qr + ports: + - protocol: TCP + port: 80 + targetPort: 80 + +--- + +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: upn-qr- + namespace: aljaxus-upn-qr +spec: + rules: + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: upn-qr-svc + port: + number: 80