[infra] using replication controller for jenkins-master

This commit is contained in:
Mike Aizatsky 2016-07-20 15:51:51 -07:00
parent b9e00ed4ba
commit 06d7cf1d41
4 changed files with 49 additions and 22 deletions

View File

@ -15,4 +15,11 @@
################################################################################
FROM jenkins
MAINTAINER mike.aizatsky@gmail.com
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

View File

@ -0,0 +1,24 @@
#!/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 -e -x
PROJECT="gcr.io/meta-iterator-105109"
DIR=$(dirname $0)
docker build --pull -t $PROJECT/jenkins $DIR/
gcloud docker push $PROJECT/jenkins

View File

@ -17,14 +17,11 @@
set -x
PROJECT="gcr.io/meta-iterator-105109"
DIR=$(dirname $0)
docker build --pull -t $PROJECT/jenkins $DIR/
gcloud docker push $PROJECT/jenkins
$DIR/build-images.sh
# delete jenkins-master if it exists before starting
kubectl get petset jenkins-master
kubectl get rc jenkins-master
if [ $? -eq 0 ]
then
kubectl delete -f $DIR/jenkins-master.yaml
@ -43,5 +40,5 @@ then
kubectl create -f $DIR/service-jenkins-master.yaml
fi
kubectl describe petset jenkins-master
kubectl describe rc jenkins-master
kubectl describe service jenkins-http

View File

@ -1,19 +1,18 @@
apiVersion: apps/v1alpha1
kind: PetSet
kind: ReplicationController
apiVersion: v1
metadata:
name: jenkins-master
spec:
serviceName: "jenkins-master"
replicas: 1
selector:
app: jenkins-master
template:
metadata:
name: jenkins-master
labels:
app: jenkins-master
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
terminationGracePeriodSeconds: 0
containers:
- name: jenkins-master
image: gcr.io/meta-iterator-105109/jenkins
@ -34,6 +33,8 @@ spec:
volumeMounts:
- name: jenkins-work
mountPath: "/var/jenkins_home"
- name: docker-sock
mountPath: "/var/run/docker.sock"
livenessProbe:
httpGet:
path: "/login"
@ -45,13 +46,11 @@ spec:
memory: "4Gi"
securityContext:
privileged: true
volumeClaimTemplates:
- metadata:
name: jenkins-work
annotations:
volume.alpha.kubernetes.io/storage-class: anything
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 250Gi
volumes:
- name: jenkins-work
gcePersistentDisk:
pdName: jenkins-work
fsType: ext4
- name: docker-sock
hostPath:
path: /var/run/docker.sock