Skip to content

Instantly share code, notes, and snippets.

@sroze
Created May 25, 2015 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sroze/59a8329f4795f1b628e8 to your computer and use it in GitHub Desktop.
Save sroze/59a8329f4795f1b628e8 to your computer and use it in GitHub Desktop.
Kubernetes patch
diff --git a/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml b/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml
index dab1fe1..153fa03 100644
--- a/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml
+++ b/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml
@@ -20,8 +20,9 @@ spec:
name: heapster
command:
- /heapster
- - --source=kubernetes:https://kubernetes
+ - --source=kubernetes:http://kubernetes-ro?auth=
- --sink=influxdb:http://monitoring-influxdb:8086
+ - --vmodule=*=5
volumeMounts:
- name: ssl-certs
mountPath: /etc/ssl/certs
diff --git a/cluster/addons/cluster-monitoring/influxdb/token-system-monitoring.yaml b/cluster/addons/cluster-monitoring/influxdb/token-system-monitoring.yaml
new file mode 100644
index 0000000..2a1c0e1
--- /dev/null
+++ b/cluster/addons/cluster-monitoring/influxdb/token-system-monitoring.yaml
@@ -0,0 +1,5 @@
+apiVersion: v1beta3
+kind: Secret
+metadata:
+ name: token-system-monitoring
+
diff --git a/cluster/addons/dns/secret-token-system-dns.yaml b/cluster/addons/dns/secret-token-system-dns.yaml
new file mode 100644
index 0000000..8f70d21
--- /dev/null
+++ b/cluster/addons/dns/secret-token-system-dns.yaml
@@ -0,0 +1,7 @@
+apiVersion: v1beta3
+kind: Secret
+metadata:
+ name: token-system-dns
+data:
+ kubeconfig: YXBpVmVyc2lvbjogdjENCmtpbmQ6IENvbmZpZw0K
+
diff --git a/cluster/addons/dns/skydns-rc.yaml b/cluster/addons/dns/skydns-rc.yaml
new file mode 100644
index 0000000..2bf0217
--- /dev/null
+++ b/cluster/addons/dns/skydns-rc.yaml
@@ -0,0 +1,68 @@
+apiVersion: v1beta3
+kind: ReplicationController
+metadata:
+ name: kube-dns-v1
+ namespace: default
+ labels:
+ k8s-app: kube-dns-v1
+ kubernetes.io/cluster-service: "true"
+spec:
+ replicas: 1
+ selector:
+ k8s-app: kube-dns
+ version: v1
+ template:
+ metadata:
+ labels:
+ k8s-app: kube-dns
+ version: v1
+ kubernetes.io/cluster-service: "true"
+ spec:
+ containers:
+ - name: etcd
+ image: gcr.io/google_containers/etcd:2.0.9
+ command:
+ - /usr/local/bin/etcd
+ - -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
+ - name: kube2sky
+ image: gcr.io/google_containers/kube2sky:1.6
+ args:
+ # command = "/kube2sky"
+ - -domain=kubernetes.cluster.local
+ - -kubecfg_file=/etc/dns_token/kubeconfig
+ volumeMounts:
+ - mountPath: /etc/dns_token
+ name: dns-token
+ readOnly: true
+ - name: skydns
+ image: gcr.io/google_containers/skydns:2015-03-11-001
+ args:
+ # command = "/skydns"
+ - -machines=http://localhost:4001
+ - -addr=0.0.0.0:53
+ - -domain=kubernetes.cluster.local.
+ ports:
+ - containerPort: 53
+ name: dns
+ protocol: UDP
+ - containerPort: 53
+ name: dns-tcp
+ protocol: TCP
+ livenessProbe:
+ exec:
+ command:
+ - /bin/sh
+ - -c
+ - nslookup kubernetes.default.kubernetes.cluster.local localhost >/dev/null
+ initialDelaySeconds: 30
+ timeoutSeconds: 5
+ dnsPolicy: Default # Don't use cluster DNS.
+ volumes:
+ - name: dns-token
+ secret:
+ secretName: token-system-dns
diff --git a/cluster/addons/dns/skydns-svc.yaml b/cluster/addons/dns/skydns-svc.yaml
new file mode 100644
index 0000000..1ae2830
--- /dev/null
+++ b/cluster/addons/dns/skydns-svc.yaml
@@ -0,0 +1,20 @@
+apiVersion: v1beta3
+kind: Service
+metadata:
+ name: kube-dns
+ namespace: default
+ labels:
+ k8s-app: kube-dns
+ kubernetes.io/cluster-service: "true"
+ kubernetes.io/name: "KubeDNS"
+spec:
+ selector:
+ k8s-app: kube-dns
+ portalIP: 10.0.0.10 # 5.196.89.122
+ ports:
+ - name: dns
+ port: 53
+ protocol: UDP
+ - name: dns-tcp
+ port: 53
+ protocol: TCP
diff --git a/cluster/images/hyperkube/hyperkube b/cluster/images/hyperkube/hyperkube
new file mode 100755
index 0000000..9ac108f
Binary files /dev/null and b/cluster/images/hyperkube/hyperkube differ
diff --git a/cluster/images/hyperkube/master.json b/cluster/images/hyperkube/master.json
index ff94d0f..49a34de 100644
--- a/cluster/images/hyperkube/master.json
+++ b/cluster/images/hyperkube/master.json
@@ -24,7 +24,7 @@
"/hyperkube",
"apiserver",
"--portal_net=10.0.0.1/24",
- "--address=127.0.0.1",
+ "--address=0.0.0.0",
"--etcd_servers=http://127.0.0.1:4001",
"--cluster_name=kubernetes",
"--v=2"
diff --git a/cluster/images/hyperkube/safe_format_and_mount b/cluster/images/hyperkube/safe_format_and_mount
new file mode 100644
index 0000000..90be230
--- /dev/null
+++ b/cluster/images/hyperkube/safe_format_and_mount
@@ -0,0 +1,147 @@
+#! /bin/bash
+# Copyright 2013 Google Inc. All Rights Reserved.
+#
+# 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.
+
+# Mount a disk, formatting it if necessary. If the disk looks like it may
+# have been formatted before, we will not format it.
+#
+# This script uses blkid and file to search for magic "formatted" bytes
+# at the beginning of the disk. Furthermore, it attempts to use fsck to
+# repair the filesystem before formatting it.
+
+FSCK=fsck.ext4
+MOUNT_OPTIONS="discard,defaults"
+MKFS="mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 -F"
+if [ -e /etc/redhat-release ]; then
+ if grep -q '6\..' /etc/redhat-release; then
+ # lazy_journal_init is not recognized in redhat 6
+ MKFS="mkfs.ext4 -E lazy_itable_init=0 -F"
+ elif grep -q '7\..' /etc/redhat-release; then
+ FSCK=fsck.xfs
+ MKFS=mkfs.xfs
+ fi
+fi
+
+LOGTAG=safe_format_and_mount
+LOGFACILITY=user
+
+function log() {
+ local readonly severity=$1; shift;
+ logger -t ${LOGTAG} -p ${LOGFACILITY}.${severity} -s "$@"
+}
+
+function log_command() {
+ local readonly log_file=$(mktemp)
+ local readonly retcode
+ log info "Running: $*"
+ $* > ${log_file} 2>&1
+ retcode=$?
+ # only return the last 1000 lines of the logfile, just in case it's HUGE.
+ tail -1000 ${log_file} | logger -t ${LOGTAG} -p ${LOGFACILITY}.info -s
+ rm -f ${log_file}
+ return ${retcode}
+}
+
+function help() {
+ cat >&2 <<EOF
+$0 [-f fsck_cmd] [-m mkfs_cmd] [-o mount_opts] <device> <mountpoint>
+EOF
+ exit 0
+}
+
+while getopts ":hf:o:m:" opt; do
+ case $opt in
+ h) help;;
+ f) FSCK=$OPTARG;;
+ o) MOUNT_OPTIONS=$OPTARG;;
+ m) MKFS=$OPTARG;;
+ -) break;;
+ \?) log error "Invalid option: -${OPTARG}"; exit 1;;
+ :) log "Option -${OPTARG} requires an argument."; exit 1;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+readonly DISK=$1
+readonly MOUNTPOINT=$2
+
+[[ -z ${DISK} ]] && help
+[[ -z ${MOUNTPOINT} ]] && help
+
+function disk_looks_unformatted() {
+ blkid ${DISK}
+ if [[ $? == 0 ]]; then
+ return 0
+ fi
+
+ local readonly file_type=$(file --special-files ${DISK})
+ case ${file_type} in
+ *filesystem*)
+ return 0;;
+ esac
+
+ return 1
+}
+
+function format_disk() {
+ log_command ${MKFS} ${DISK}
+}
+
+function try_repair_disk() {
+ log_command ${FSCK} -a ${DISK}
+ local readonly fsck_return=$?
+ if [[ ${fsck_return} -ge 8 ]]; then
+ log error "Fsck could not correct errors on ${DISK}"
+ return 1
+ fi
+ if [[ ${fsck_return} -gt 0 ]]; then
+ log warning "Fsck corrected errors on ${DISK}"
+ fi
+ return 0
+}
+
+function try_mount() {
+ local mount_retcode
+ try_repair_disk
+
+ log_command mount -o ${MOUNT_OPTIONS} ${DISK} ${MOUNTPOINT}
+ mount_retcode=$?
+ if [[ ${mount_retcode} == 0 ]]; then
+ return 0
+ fi
+
+ # Check to see if it looks like a filesystem before formatting it.
+ disk_looks_unformatted ${DISK}
+ if [[ $? == 0 ]]; then
+ log error "Disk ${DISK} looks formatted but won't mount. Giving up."
+ return ${mount_retcode}
+ fi
+
+ # The disk looks like it's not been formatted before.
+ format_disk
+ if [[ $? != 0 ]]; then
+ log error "Format of ${DISK} failed."
+ fi
+
+ log_command mount -o ${MOUNT_OPTIONS} ${DISK} ${MOUNTPOINT}
+ mount_retcode=$?
+ if [[ ${mount_retcode} == 0 ]]; then
+ return 0
+ fi
+ log error "Tried everything we could, but could not mount ${DISK}."
+ return ${mount_retcode}
+}
+
+try_mount
+exit $?
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index 96caa0a..318d653 100644
--- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh
@@ -50,8 +50,9 @@ readonly KUBE_TEST_TARGETS=(
cmd/genbashcomp
examples/k8petstore/web-server
github.com/onsi/ginkgo/ginkgo
- test/e2e/e2e.test
)
+# test/e2e/e2e.test
+
readonly KUBE_TEST_BINARIES=("${KUBE_TEST_TARGETS[@]##*/}")
readonly KUBE_TEST_BINARIES_WIN=("${KUBE_TEST_BINARIES[@]/%/.exe}")
readonly KUBE_TEST_PORTABLE=(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment