mirror of
https://github.com/Dannecron/netology-devops-gitlab.git
synced 2025-12-25 15:22:35 +03:00
add deploy config
This commit is contained in:
@@ -58,6 +58,8 @@ test-api:
|
||||
deploy:
|
||||
image: gcr.io/cloud-builders/kubectl:latest
|
||||
stage: deploy
|
||||
variables:
|
||||
DOCKER_IMAGE: "cr.yandex/${YA_DOCKER_REGISTRY}/${DOCKER_IMAGE}"
|
||||
needs:
|
||||
- pre-build
|
||||
- docker-build
|
||||
@@ -66,5 +68,6 @@ deploy:
|
||||
- kubectl config set-credentials admin --token="$KUBE_TOKEN"
|
||||
- kubectl config set-context default --cluster=k8s --user=admin
|
||||
- kubectl config use-context default
|
||||
- sed -i "s/__VERSION__/${DOCKER_IMAGE}/" k8s.yaml
|
||||
- kubectl apply -f k8s.yaml
|
||||
- sed -i "s/__YA_REGISTRY__/${YA_DOCKER_REGISTRY}/" docker/k8s.yaml
|
||||
- sed -i "s/__DOCKER_IMAGE__/${DOCKER_IMAGE}/" docker/k8s.yaml
|
||||
- kubectl apply -f docker/k8s.yaml
|
||||
|
||||
26
docker/k8s.yaml
Normal file
26
docker/k8s.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: python-api
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: python-api-deployment
|
||||
namespace: python-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hello
|
||||
template:
|
||||
metadata:
|
||||
namespace: hello-world
|
||||
labels:
|
||||
app: hello
|
||||
spec:
|
||||
containers:
|
||||
- name: python_api
|
||||
image: cr.yandex/__YA_REGISTRY__/__DOCKER_IMAGE__
|
||||
imagePullPolicy: Always
|
||||
Reference in New Issue
Block a user