[infra][gke] using deployments

This commit is contained in:
Mike Aizatsky 2016-10-10 12:11:00 -07:00
parent 99ac73950e
commit 7b7af59e63
4 changed files with 25 additions and 65 deletions

View File

@ -21,5 +21,14 @@ USER root
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y RUN apt-get update && apt-get upgrade -y
# /var/run/docker.sock will be bound to a pod. # should not be newer than container's.
RUN apt-get install -y docker.io 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

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -eux
# Copyright 2016 Google Inc. # Copyright 2016 Google Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@ -15,10 +15,8 @@
# #
################################################################################ ################################################################################
set -e -x
PROJECT="gcr.io/meta-iterator-105109" PROJECT="gcr.io/meta-iterator-105109"
DIR=$(dirname $0) DIR=$(dirname $0)
docker build --pull -t $PROJECT/jenkins $DIR/ docker build --pull -t $PROJECT/jenkins $DIR/
gcloud docker push $PROJECT/jenkins gcloud docker -- push $PROJECT/jenkins

View File

@ -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

View File

@ -1,12 +1,9 @@
kind: ReplicationController apiVersion: extensions/v1beta1
apiVersion: v1 kind: Deployment
metadata: metadata:
name: jenkins-master name: jenkins
spec: spec:
replicas: 1 replicas: 1
selector:
app: jenkins-master
template: template:
metadata: metadata:
name: jenkins-master name: jenkins-master
@ -14,7 +11,7 @@ spec:
app: jenkins-master app: jenkins-master
spec: spec:
containers: containers:
- name: jenkins-master - name: jenkins
image: gcr.io/meta-iterator-105109/jenkins image: gcr.io/meta-iterator-105109/jenkins
env: env:
- name: KUB_POD_NAME - name: KUB_POD_NAME
@ -31,12 +28,12 @@ spec:
- containerPort: 8080 - containerPort: 8080
- containerPort: 50000 - containerPort: 50000
volumeMounts: volumeMounts:
- name: jenkins-work - name: jenkins-home
mountPath: "/var/jenkins_home" mountPath: "/var/jenkins_home"
- name: docker-sock - name: docker-sock
mountPath: "/var/run/docker.sock" mountPath: "/var/run/docker.sock"
- name: dockerhub-login-secret # - name: dockerhub-login-secret
mountPath: "/var/secrets/dockerhub-login" # mountPath: "/var/secrets/dockerhub-login"
livenessProbe: livenessProbe:
httpGet: httpGet:
path: "/login" path: "/login"
@ -49,13 +46,13 @@ spec:
securityContext: securityContext:
privileged: true privileged: true
volumes: volumes:
- name: jenkins-work - name: jenkins-home
gcePersistentDisk: gcePersistentDisk:
pdName: jenkins-work pdName: oss-cluster-jenkins-work
fsType: ext4 fsType: ext4
- name: docker-sock - name: docker-sock
hostPath: hostPath:
path: /var/run/docker.sock path: /var/run/docker.sock
- name: dockerhub-login-secret # - name: dockerhub-login-secret
secret: # secret:
secretName: dockerhub-login # secretName: dockerhub-login