From 5726d4628478257be34c34b5a0fc5b5cbca3905b Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 10 Jul 2019 09:47:01 +0800 Subject: [PATCH] Feature/refactor k8s names (#39) * chore: rename * chore: rename deployment * docs: rename --- .../k8s-rolling-update/README.md | 22 +++++++++---------- .../{osrm_cron => osrm-backend-cronjob} | 2 +- .../{osrm.yaml => osrm-backend.yaml} | 2 +- .../{osrm_svc.yaml => service.yaml} | 0 4 files changed, 13 insertions(+), 13 deletions(-) rename docker-orchestration/k8s-rolling-update/{osrm_cron => osrm-backend-cronjob} (64%) rename docker-orchestration/k8s-rolling-update/{osrm.yaml => osrm-backend.yaml} (98%) rename docker-orchestration/k8s-rolling-update/{osrm_svc.yaml => service.yaml} (100%) diff --git a/docker-orchestration/k8s-rolling-update/README.md b/docker-orchestration/k8s-rolling-update/README.md index be00d8750..9f543f8d9 100644 --- a/docker-orchestration/k8s-rolling-update/README.md +++ b/docker-orchestration/k8s-rolling-update/README.md @@ -5,23 +5,23 @@ Use kubernetes rolling update deployment strategy for timed replace container wi ```bash # NOTE: prepare your image and fill into osrm.yaml -$ sed -i "s#TELENAV_OSRM_BACKEND_DOCKER_IMAGE##g" ./osrm.yaml +$ sed -i "s#TELENAV_OSRM_BACKEND_DOCKER_IMAGE##g" ./osrm-backend.yaml # create deployment -$ kubectl create -f osrm.yaml -deployment.extensions/osrm created +$ kubectl create -f osrm-backend.yaml +deployment.extensions/osrm-backend created # create loadbalancer -$ kubectl create -f osrm_svc.yaml +$ kubectl create -f service.yaml service/routing-osrm-service created # OPTIONAL: checking deployment status, wait READY $ kubectl get deployments -n routing-osrm NAME READY UP-TO-DATE AVAILABLE AGE -osrm 0/1 1 0 20s +osrm-backend 0/1 1 0 20s $ kubectl get pods -n routing-osrm NAME READY STATUS RESTARTS AGE -osrm-67b55f46c9-tpfgs 0/1 Running 0 22s +osrm-backend-67b55f46c9-tpfgs 0/1 Running 0 22s # OPTIONAL: check deployment details for troubleshooting $ kubectl describe deployments -n routing-osrm @@ -30,18 +30,18 @@ $ kubectl describe pods -n routing-osrm ... # OPTIONAL: check container running log for troubleshooting -$ kubectl logs -f --timestamps=true -n routing-osrm osrm-67b55f46c9-tpfgs +$ kubectl logs -f --timestamps=true -n routing-osrm osrm-backend-67b55f46c9-tpfgs ... # start timed rolling update for traffic updating -$ crontab osrm_cron +$ crontab osrm-backend-cronjob $ crontab -l -*/30 * * * * export PATH=$HOME/bin:$PATH && kubectl set env --env="LAST_MANUAL_RESTART=$(date -u +\%Y\%m\%dT\%H\%M\%S)" deploy/osrm -n routing-osrm >> ${HOME}/osrm_cron.log 2>&1 +*/20 * * * * export PATH=$HOME/bin:$PATH && kubectl set env --env="LAST_MANUAL_RESTART=$(date -u +\%Y\%m\%dT\%H\%M\%S)" deploy/osrm-backend -n routing-osrm >> ${HOME}/osrm-backend-cronjob.log 2>&1 # OPTIONAL: if want to stop $ crontab -r -$ kubectl delete deployment osrm -n routing-osrm -deployment.extensions "osrm" deleted +$ kubectl delete deployment osrm-backend -n routing-osrm +deployment.extensions "osrm-backend" deleted $ kubectl delete routing-osrm-service -n routing-osrm service "routing-osrm-service" deleted diff --git a/docker-orchestration/k8s-rolling-update/osrm_cron b/docker-orchestration/k8s-rolling-update/osrm-backend-cronjob similarity index 64% rename from docker-orchestration/k8s-rolling-update/osrm_cron rename to docker-orchestration/k8s-rolling-update/osrm-backend-cronjob index 06f91e690..38b0c41fc 100644 --- a/docker-orchestration/k8s-rolling-update/osrm_cron +++ b/docker-orchestration/k8s-rolling-update/osrm-backend-cronjob @@ -1 +1 @@ -*/20 * * * * export PATH=$HOME/bin:$PATH && kubectl set env --env="LAST_MANUAL_RESTART=$(date -u +\%Y\%m\%dT\%H\%M\%S)" deploy/osrm -n routing-osrm >> ${HOME}/osrm_cron.log 2>&1 +*/20 * * * * export PATH=$HOME/bin:$PATH && kubectl set env --env="LAST_MANUAL_RESTART=$(date -u +\%Y\%m\%dT\%H\%M\%S)" deploy/osrm-backend -n routing-osrm >> ${HOME}/osrm-backend-cronjob.log 2>&1 diff --git a/docker-orchestration/k8s-rolling-update/osrm.yaml b/docker-orchestration/k8s-rolling-update/osrm-backend.yaml similarity index 98% rename from docker-orchestration/k8s-rolling-update/osrm.yaml rename to docker-orchestration/k8s-rolling-update/osrm-backend.yaml index a8203db41..35472fa4a 100644 --- a/docker-orchestration/k8s-rolling-update/osrm.yaml +++ b/docker-orchestration/k8s-rolling-update/osrm-backend.yaml @@ -1,7 +1,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: osrm + name: osrm-backend namespace: routing-osrm spec: replicas: 1 diff --git a/docker-orchestration/k8s-rolling-update/osrm_svc.yaml b/docker-orchestration/k8s-rolling-update/service.yaml similarity index 100% rename from docker-orchestration/k8s-rolling-update/osrm_svc.yaml rename to docker-orchestration/k8s-rolling-update/service.yaml