mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 23:30:10 +00:00
Create a kubernetes job with init-script.
This commit is contained in:
parent
72bb4adbeb
commit
3aa506a426
@ -1146,7 +1146,9 @@ deploy_staging_init-script:
|
||||
- sudo docker push registry.gitlab.com/fyipe-project/init-script:3.0.$CI_PIPELINE_IID
|
||||
- sudo docker push registry.gitlab.com/fyipe-project/init-script:master
|
||||
- sudo docker push fyipeproject/init-script:master
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl set image deployment/init-script init-script=registry.gitlab.com/fyipe-project/init-script:3.0.$CI_PIPELINE_IID
|
||||
## You cannot update a Kubernetes job. They are immutable. Delete it and then create one again.
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl delete job init-script
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl create -f ./kubernetes/init-script/staging.yaml
|
||||
# Cleanup
|
||||
- chmod +x ./kubernetes/ci/deployment-cleanup.sh
|
||||
- ./kubernetes/ci/deployment-cleanup.sh
|
||||
@ -1172,7 +1174,9 @@ deploy_production_init-script:
|
||||
- sudo docker push registry.gitlab.com/fyipe-project/init-script:3.0.$CI_PIPELINE_IID
|
||||
- sudo docker push registry.gitlab.com/fyipe-project/init-script:latest
|
||||
- sudo docker push fyipeproject/init-script:latest
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl set image deployment/init-script init-script=registry.gitlab.com/fyipe-project/init-script:3.0.$CI_PIPELINE_IID
|
||||
## You cannot update a Kubernetes job. They are immutable. Delete it and then create one again.
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl delete job init-script
|
||||
- sudo $HOME/google-cloud-sdk/bin/kubectl create -f ./kubernetes/init-script/production.yaml
|
||||
# Cleanup
|
||||
- chmod +x ./kubernetes/ci/deployment-cleanup.sh
|
||||
- ./kubernetes/ci/deployment-cleanup.sh
|
||||
|
@ -13,8 +13,8 @@ sudo k delete secret gitlabcredv2 || echo 'No gitlabcredv2 key found'
|
||||
echo "RUNNING COMMAND: sudo k create secret docker-registry gitlabcredv2 --docker-server=\$DOCKER_REGISTRY_SERVER --docker-username=\$DOCKER_USER --docker-password=\$DOCKER_PASSWORD --docker-email=\$DOCKER_EMAIL"
|
||||
sudo k create secret docker-registry gitlabcredv2 --docker-server=$DOCKER_REGISTRY_SERVER --docker-username=$DOCKER_USER --docker-password=$DOCKER_PASSWORD --docker-email=$DOCKER_EMAIL
|
||||
# Create the entire cluster.
|
||||
echo "RUNNING COMMAND: sudo k create -f ./kubernetes/test-server.yaml"
|
||||
sudo k create -f ./kubernetes/test-server.yaml
|
||||
echo "RUNNING COMMAND: sudo k create -f ./kubernetes/test.yaml"
|
||||
sudo k create -f ./kubernetes/test.yaml
|
||||
# Wait for all the services to come online.
|
||||
echo "RUNNING COMMAND: echo 'Wait for 5 mins....'"
|
||||
echo 'Wait for 5 mins....'
|
||||
|
29
kubernetes/init-script/production.yaml
Normal file
29
kubernetes/init-script/production.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
#########
|
||||
#Since Kubernetes jobs are immitable (you cannot update it with a new image).
|
||||
# To update these jobs, CI deletes the old jobs and recreates them using this file.
|
||||
#########
|
||||
|
||||
#########
|
||||
#UPDATE: Any update to this file should also be accompanied with ../production.yaml
|
||||
#########
|
||||
|
||||
########-INIT-SCRIPT-##########
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: init-script
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: init-script
|
||||
image: registry.gitlab.com/fyipe-project/init-script:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: MONGO_URL
|
||||
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
|
||||
restartPolicy: Never
|
||||
imagePullSecrets:
|
||||
- name: gitlabcredv2
|
||||
---
|
||||
###########################
|
29
kubernetes/init-script/staging.yaml
Normal file
29
kubernetes/init-script/staging.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
#########
|
||||
#Since Kubernetes jobs are immitable (you cannot update it with a new image).
|
||||
# To update these jobs, CI deletes the old jobs and recreates them using this file.
|
||||
#########
|
||||
|
||||
#########
|
||||
#UPDATE: Any update to this file should also be accompanied with ../staging.yaml
|
||||
#########
|
||||
|
||||
########-INIT-SCRIPT-##########
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: init-script
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: init-script
|
||||
image: registry.gitlab.com/fyipe-project/init-script:master
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: MONGO_URL
|
||||
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
|
||||
restartPolicy: Never
|
||||
imagePullSecrets:
|
||||
- name: gitlabcredv2
|
||||
---
|
||||
####################################
|
29
kubernetes/init-script/test.yaml
Normal file
29
kubernetes/init-script/test.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
#########
|
||||
#Since Kubernetes jobs are immitable (you cannot update it with a new image).
|
||||
# To update these jobs, CI deletes the old jobs and recreates them using this file.
|
||||
#########
|
||||
|
||||
#########
|
||||
#UPDATE: Any update to this file should also be accompanied with ../test.yaml
|
||||
#########
|
||||
|
||||
########-INIT-SCRIPT-##########
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: init-script
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: init-script
|
||||
image: localhost:32000/init-script:master
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: MONGO_URL
|
||||
value: "mongodb://admin:372b60f4-704c-4205-8e5c-45cdbf44b1fc@mongo-0.mongo-headless.default.svc.cluster.local:27017,mongo-1.mongo-headless.default.svc.cluster.local:27017,mongo-2.mongo-headless.default.svc.cluster.local:27017/fyipedb?replicaSet=fyipe"
|
||||
restartPolicy: Never
|
||||
imagePullSecrets:
|
||||
- name: gitlabcredv2
|
||||
---
|
||||
###########################
|
@ -2,7 +2,7 @@
|
||||
# PLEASE READ:
|
||||
# This is the production Kubectl config which is used to run the production cluster in Kubernetes.
|
||||
#
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, server.yaml, and production-server.yaml
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, server.yaml, and production.yaml
|
||||
##############
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This is the staging Kubectl config which is used to run the staging cluster in Kubernetes.
|
||||
#
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, staging-server.yaml, and production-server.yaml
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, staging.yaml, and production.yaml
|
||||
#
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This is the staging Kubectl config which is used to run the test cluster in Single Node Kubernetes (microk8s) and also in CI/CD.
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, staging-server.yaml, and production-server.yaml
|
||||
# IMPORTANT: ANY CHANGE TO THIS FILE SHOULD BE ACCOMPANIED WITH CHANGES TO ci-server.yaml, staging.yaml, and production.yaml
|
||||
# Images Tagged with localhost:32000 because of https://microk8s.io/docs/working
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user