Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
fly2wind committed Dec 2, 2015
1 parent 1540af8 commit 7a219f7
Show file tree
Hide file tree
Showing 23 changed files with 440 additions and 107 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*~
*.DS_Store
.env/*
.vagrant/*
provisioning/*
build/*
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "1.0/kubernetes"]
path = 1.0/kubernetes
[submodule "build/kubernetes"]
path = build/kubernetes
url = https://github.com/kubernetes/kubernetes.git
[submodule "1.0/etcd"]
path = 1.0/etcd
[submodule "build/etcd"]
path = build/etcd
url = https://github.com/coreos/etcd.git
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sudo: required
language: go
go:
- 1.4
env:
- GOOS=linux
- GOARCH=amd64
before_install:
- make clone
install:
- make build_kubernetes
before_script:

script:

services:
- docker

26 changes: 0 additions & 26 deletions 1.0/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions 1.0/config/supervisord.conf

This file was deleted.

36 changes: 0 additions & 36 deletions 1.0/docker-entrypoint.sh

This file was deleted.

27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM baselibrary/ruby:2.2
MAINTAINER ShawnMa <[email protected]>

## Version
ENV KUBERNETES_MAJOR 1.1
ENV KUBERNETES_RELEASE 1.1.2

## Packages
RUN \
apt-get update &&\
apt-get install -y supervisor &&\
rm -rf /var/lib/apt/lists/*
RUN \
gem install tiller
ADD etcd /usr/bin/
ADD etcdctl /usr/bin/
ADD km /usr/bin/
ADD kubectl /usr/bin/

## Configurations
ADD config /etc/tiller

VOLUME ["/var/lib/kubernetes"]

CMD ["/usr/local/bin/tiller" , "-v"]


22 changes: 0 additions & 22 deletions Dockerfile.template

This file was deleted.

34 changes: 22 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
NAME = baselibrary/kubernetes
REPO = [email protected]:baselibrary/docker-kubernetes.git
VERSIONS = $(foreach df,$(wildcard */Dockerfile),$(df:%/Dockerfile=%))
VERSION = 1.1.2

all: build
# input variables
BUILD_DIR = build
ETCD_BINARIES = etcd etcdctl
KUBERNETES_BINARIES = km kubectl

build: $(VERSIONS)
all: build

release: $(VERSIONS)
build: $(BUILD_DIR)

release:
docker push ${NAME}

update:
docker run --rm -v $$(pwd):/work -w /work buildpack-deps ./update.sh

branches:
git fetch $(REPO) master
@$(foreach tag, $(VERSIONS), git branch -f $(tag) FETCH_HEAD;)
@$(foreach tag, $(VERSIONS), git push $(REPO) $(tag);)
@$(foreach tag, $(VERSIONS), git branch -D $(tag);)
.PHONY: all clone build
$(ETCD_BINARIES):
@cd $(BUILD_DIR)/etcd && GOOS=linux GOARCH=amd64 ./build
@cp -pv $(addprefix $(BUILD_DIR)/etcd/bin/, $(ETCD_BINARIES)) .
$(KUBERNETES_BINARIES):
@cd $(BUILD_DIR)/kubernetes && GOOS=linux GOARCH=amd64 KUBERNETES_CONTRIB=mesos ./hack/build-cross.sh
@cp -pv $(addprefix $(BUILD_DIR)/kubernetes/_output/local/bin/linux/amd64/, $(KUBERNETES_BINARIES)) .
$(BUILD_DIR): $(ETCD_BINARIES) $(KUBERNETES_BINARIES)
docker build --rm -t $(NAME):$(VERSION) .





.PHONY: all build library $(VERSIONS)
$(VERSIONS):
docker build --rm -t $(NAME):$@ $@
Submodule etcd updated from 000000 to b4bddf
53 changes: 53 additions & 0 deletions config/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
exec: [ "/usr/bin/supervisord", "-n" ]
data_sources: [ 'defaults', 'file', 'environment' ]
template_sources: [ file ]
defaults:
global:
env_k8sm_http_client_timeout: '5s'
env_k8sm_state_cache_ttl: '20s'
env_k8sm_dns_server: '10.10.10.10'
env_k8sm_dns_domain: 'cluster.local'

environments:
staging:
bootstrap.sh.erb:
target: /usr/local/bin/bootstrap.sh
user: root
group: root
perms: 0755
cloud.cfg.erb:
target: /var/lib/kubernetes/cloud.cfg
kube-dns-rc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-rc.yaml
kube-dns-svc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-svc.yaml
supervisord.conf.erb:
target: /etc/supervisor/conf.d/supervisord.conf
production:
bootstrap.sh.erb:
target: /usr/local/bin/bootstrap.sh
user: root
group: root
perms: 0755
cloud.cfg.erb:
target: /var/lib/kubernetes/cloud.cfg
kube-dns-rc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-rc.yaml
kube-dns-svc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-svc.yaml
supervisord.conf.erb:
target: /etc/supervisor/conf.d/supervisord.conf
development:
bootstrap.sh.erb:
target: /usr/local/bin/bootstrap.sh
user: root
group: root
perms: 0755
cloud.cfg.erb:
target: /var/lib/kubernetes/cloud.cfg
kube-dns-rc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-rc.yaml
kube-dns-svc.yaml.erb:
target: /var/lib/kubernetes/kube-dns-svc.yaml
supervisord.conf.erb:
target: /etc/supervisor/conf.d/supervisord.conf
6 changes: 6 additions & 0 deletions config/templates/bootstrap.sh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export KUBERNETES_MASTER=http://<%= env_host %>:8080

/usr/bin/kubectl get rc --namespace=kube-system -l k8s-app=kube-dns | grep kube-dns >/dev/null && /usr/bin/kubectl get service --namespace=kube-system kube-dns >/dev/null && touch kill && exit 0

/usr/bin/kubectl create -f /var/lib/kubernetes/skydns-rc.yaml
/usr/bin/kubectl create -f /var/lib/kubernetes/skydns-svc.yaml
4 changes: 4 additions & 0 deletions config/templates/cloud.cfg.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[mesos-cloud]
mesos-master = <%= env_k8sm_mesos_master %>
http-client-timeout = <%= env_k8sm_http_client_timeout %>
state-cache-ttl = <%= env_k8sm_state_cache_ttl %>
100 changes: 100 additions & 0 deletions config/templates/kube-dns-rc.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: kube-dns-v9
namespace: kube-system
labels:
k8s-app: kube-dns
version: v9
kubernetes.io/cluster-service: "true"
spec:
replicas: 1
selector:
k8s-app: kube-dns
version: v9
template:
metadata:
labels:
k8s-app: kube-dns
version: v9
kubernetes.io/cluster-service: "true"
spec:
containers:
- name: etcd
image: gcr.io/google_containers/etcd:2.0.9
resources:
limits:
cpu: 100m
memory: 50Mi
command:
- /usr/local/bin/etcd
- -data-dir
- /var/etcd/data
- -listen-client-urls
- http://127.0.0.1:2379,http://127.0.0.1:4001
- -advertise-client-urls
- http://127.0.0.1:2379,http://127.0.0.1:4001
- -initial-cluster-token
- skydns-etcd
volumeMounts:
- name: etcd-storage
mountPath: /var/etcd/data
- name: kube2sky
image: gcr.io/google_containers/kube2sky:1.11
resources:
limits:
cpu: 100m
memory: 50Mi
args:
# command = "/kube2sky"
- -kube_master_url=http://<%= env_host %>:8080
- -domain=<%= env_k8sm_dns_domain %>
- name: skydns
image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c
resources:
limits:
cpu: 100m
memory: 50Mi
args:
# command = "/skydns"
- -machines=http://127.0.0.1:4001
- -addr=0.0.0.0:53
- -ns-rotate=false
- -domain=<%= env_k8sm_dns_domain %>.
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 1
timeoutSeconds: 5
- name: healthz
image: gcr.io/google_containers/exechealthz:1.0
resources:
limits:
cpu: 10m
memory: 20Mi
args:
- -cmd=nslookup kubernetes.default.svc.<%= env_k8sm_dns_domain %> 127.0.0.1 >/dev/null
- -port=8080
ports:
- containerPort: 8080
protocol: TCP
volumes:
- name: etcd-storage
emptyDir: {}
dnsPolicy: Default # Don't use cluster DNS.
Loading

0 comments on commit 7a219f7

Please sign in to comment.