From cb8ce3150ff9b608adfe6690a0900f329dac72e6 Mon Sep 17 00:00:00 2001 From: Gatete-Bruno Date: Mon, 10 May 2021 19:36:29 +0200 Subject: [PATCH 1/3] added my docker username --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 58c734b2b..1a7526d46 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any environment { //be sure to replace "willbla" with your own Docker Hub username - DOCKER_IMAGE_NAME = "willbla/train-schedule" + DOCKER_IMAGE_NAME = "bruno74t/train-schedule" } stages { stage('Build') { From 0a08c2335015637b7e5b47b20d760525d219b01f Mon Sep 17 00:00:00 2001 From: Gatete-Bruno Date: Mon, 10 May 2021 19:45:37 +0200 Subject: [PATCH 2/3] added yml file for k8s deployment --- train-schedule-kube.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 train-schedule-kube.yml diff --git a/train-schedule-kube.yml b/train-schedule-kube.yml new file mode 100644 index 000000000..cb78c2ef4 --- /dev/null +++ b/train-schedule-kube.yml @@ -0,0 +1,36 @@ +kind: Service +apiVersion: v1 +metadata: + name: train-schedule-service +spec: + type: NodePort + selector: + app: train-schedule + ports: + - protocol: TCP + port: 8080 + nodePort: 8080 + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: train-schedule-deployment + labels: + app: train-schedule +spec: + replicas: 2 + selector: + matchLabels: + app: train-schedule + template: + metadata: + labels: + app: train-schedule + spec: + containers: + - name: train-schedule + image: $DOCKER_IMAGE_NAME:$BUILD_NUMBER + ports: + - containerPort: 8080 From 396a5337c3c71bbe5d3ff31e743e8c36f2318a22 Mon Sep 17 00:00:00 2001 From: Gatete-Bruno Date: Mon, 10 May 2021 20:38:59 +0200 Subject: [PATCH 3/3] Deployment Configs --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1a7526d46..54972cc92 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,7 +45,11 @@ pipeline { steps { input 'Deploy to Production?' milestone(1) - //implement Kubernetes deployment here + kubernetesDeploy( + kubeconfigId: 'kubeconfig', + configs: 'train-schedule-kube.yml', + enableConfigSubstitution: true + ) } } }