diff --git a/infra/jenkins-cluster/Dockerfile b/infra/jenkins-cluster/Dockerfile index d87970c17..024119e79 100644 --- a/infra/jenkins-cluster/Dockerfile +++ b/infra/jenkins-cluster/Dockerfile @@ -21,5 +21,14 @@ USER root ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get upgrade -y -# /var/run/docker.sock will be bound to a pod. -RUN apt-get install -y docker.io +# should not be newer than container's. +ENV DOCKER_ENGINE_VERSION="1.11.2-0~jessie" + +# Install docker +# /var/run/docker.sock will be mounted to a host. +RUN apt-get install -y apt-transport-https ca-certificates +RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D +RUN echo "deb https://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list +RUN apt-get update +RUN apt-cache policy docker-engine +RUN apt-get install -y docker-engine=$DOCKER_ENGINE_VERSION diff --git a/infra/jenkins-cluster/build-images.sh b/infra/jenkins-cluster/build-images.sh index 1ed9e6a64..f594066d3 100755 --- a/infra/jenkins-cluster/build-images.sh +++ b/infra/jenkins-cluster/build-images.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -eux # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,10 +15,8 @@ # ################################################################################ -set -e -x - PROJECT="gcr.io/meta-iterator-105109" DIR=$(dirname $0) docker build --pull -t $PROJECT/jenkins $DIR/ -gcloud docker push $PROJECT/jenkins +gcloud docker -- push $PROJECT/jenkins diff --git a/infra/jenkins-cluster/create-cluster.sh b/infra/jenkins-cluster/create-cluster.sh deleted file mode 100755 index abe452bb3..000000000 --- a/infra/jenkins-cluster/create-cluster.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright 2016 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -################################################################################ - -set -x - -DIR=$(dirname $0) -$DIR/build-images.sh - -# delete jenkins-master if it exists before starting -kubectl get rc jenkins-master -if [ $? -eq 0 ] -then - kubectl delete -f $DIR/jenkins-master.yaml -fi -kubectl create -f $DIR/jenkins-master.yaml - -# do not restart services to keep IP addresses stable. -kubectl get service jenkins-http -if [ $? -ne 0 ] -then - kubectl create -f $DIR/service-jenkins-http.yaml -fi -kubectl get service jenkins-master -if [ $? -ne 0 ] -then - kubectl create -f $DIR/service-jenkins-master.yaml -fi - -kubectl describe rc jenkins-master -kubectl describe service jenkins-http diff --git a/infra/jenkins-cluster/jenkins-master.yaml b/infra/jenkins-cluster/jenkins.yaml similarity index 74% rename from infra/jenkins-cluster/jenkins-master.yaml rename to infra/jenkins-cluster/jenkins.yaml index 2c001be14..e60668c2a 100644 --- a/infra/jenkins-cluster/jenkins-master.yaml +++ b/infra/jenkins-cluster/jenkins.yaml @@ -1,12 +1,9 @@ -kind: ReplicationController -apiVersion: v1 +apiVersion: extensions/v1beta1 +kind: Deployment metadata: - name: jenkins-master - + name: jenkins spec: replicas: 1 - selector: - app: jenkins-master template: metadata: name: jenkins-master @@ -14,7 +11,7 @@ spec: app: jenkins-master spec: containers: - - name: jenkins-master + - name: jenkins image: gcr.io/meta-iterator-105109/jenkins env: - name: KUB_POD_NAME @@ -31,12 +28,12 @@ spec: - containerPort: 8080 - containerPort: 50000 volumeMounts: - - name: jenkins-work + - name: jenkins-home mountPath: "/var/jenkins_home" - name: docker-sock mountPath: "/var/run/docker.sock" - - name: dockerhub-login-secret - mountPath: "/var/secrets/dockerhub-login" + # - name: dockerhub-login-secret + # mountPath: "/var/secrets/dockerhub-login" livenessProbe: httpGet: path: "/login" @@ -49,13 +46,13 @@ spec: securityContext: privileged: true volumes: - - name: jenkins-work + - name: jenkins-home gcePersistentDisk: - pdName: jenkins-work + pdName: oss-cluster-jenkins-work fsType: ext4 - name: docker-sock hostPath: path: /var/run/docker.sock - - name: dockerhub-login-secret - secret: - secretName: dockerhub-login + # - name: dockerhub-login-secret + # secret: + # secretName: dockerhub-login