From 389aeb261f5b5a552b36c631c1b716c58da811f3 Mon Sep 17 00:00:00 2001 From: kleph Date: Sat, 15 Feb 2020 17:40:58 +0100 Subject: [PATCH] [CD] Add kube deployment --- .drone.yml | 30 +++++++++++++++++++++++++++++- kube/kubeconfig_template.yaml | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 kube/kubeconfig_template.yaml diff --git a/.drone.yml b/.drone.yml index 33fe1b3..39acf20 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,7 +31,7 @@ steps: - name: build image image: docker:stable environment: - DOCKER_HOST: tcp://docker:2375 + DOCKER_HOST: tcp://docker USERNAME: from_secret: dockerhub_username PASSWORD: @@ -51,3 +51,31 @@ services: depends_on: - lint + +--- +kind: pipeline +name: deploy + +steps: +- name: build image + image: docker:stable + environment: + DOCKER_HOST: tcp://docker:2375 + KUBE_USERNAME: + from_secret: kubectl_username + KUBE_PASSWORD: + from_secret: kubectl_password + KUBE_URI: + from_secret: kubectl_uri + KUBE_CA: + form_secret: kubectl_ca + commands: + - kubectl + - cat kube/kubeconfig_template.yaml | envsubst > /.kube/config + - kubectl get pods + - kubectl get deployments + - kubectl get svc + - kubectl apply -f kube/beer-deployment.yaml + +depends_on: + - build diff --git a/kube/kubeconfig_template.yaml b/kube/kubeconfig_template.yaml new file mode 100644 index 0000000..e2bd7e0 --- /dev/null +++ b/kube/kubeconfig_template.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +clusters: +- cluster: + certificate-authority-data: ${KUBE_CA} + server: ${KUBE_URI} + name: default +contexts: +- context: + cluster: default + user: default + name: default +current-context: default +kind: Config +preferences: {} +users: +- name: default + user: + password: ${KUBE_PASSWORD} + username: ${KUBE_USERNAME} +