1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-13 04:02:29 +00:00

Add k8s deployment

This commit is contained in:
J. Fernando Sánchez 2022-05-23 12:45:40 +02:00
parent a7849bb029
commit e9266af924
4 changed files with 36 additions and 13 deletions

View File

@ -7,7 +7,10 @@
stages:
- test
- publish
- check_published
- deploy
variables:
KUBENS: senpy
docker:
stage: publish
@ -63,9 +66,29 @@ check_pypi:
tags:
- docker
image: python:3.7
stage: check_published
stage: deploy
script:
- pip install senpy==$CI_COMMIT_TAG
# Allow PYPI to update its index before we try to install
when: delayed
start_in: 10 minutes
deploy:
only:
refs:
- master
tags:
- docker
image: alpine/k8s:1.22.6
stage: deploy
environment: production
variables:
KUBECONFIG_FILE: "/kubeconfig"
IMAGEWTAG: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
KUBEAPP: "senpy"
script:
- cat ${KUBECONFIG} > $KUBECONFIG_FILE
- kubectl version
- cd k8s/
- cat *.yaml *.tmpl 2>/dev/null | envsubst | kubectl --kubeconfig $KUBECONFIG_FILE apply --namespace ${KUBENS:-default} -f -
- kubectl --kubeconfig $KUBECONFIG_FILE get all,ing -l app=${KUBEAPP} --namespace=${KUBENS:-default}

View File

@ -9,7 +9,7 @@ spec:
metadata:
labels:
role: senpy-latest
app: test
app: senpy
spec:
containers:
- name: senpy-latest

View File

@ -1,21 +1,19 @@
---
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: senpy-ingress
labels:
app: senpy
spec:
rules:
- host: latest.senpy.gsi.upm.es
http:
paths:
- path: /
pathType: Prefix
backend:
serviceName: senpy-latest
servicePort: 5000
- host: latest.senpy.gsi.upm.es
http:
paths:
- path: /
backend:
serviceName: senpy-latest
servicePort: 5000
service:
name: senpy-latest
port:
number: 5000

View File

@ -3,6 +3,8 @@ apiVersion: v1
kind: Service
metadata:
name: senpy-latest
labels:
app: senpy
spec:
type: ClusterIP
ports: