From 8b0120898be9cf4917aae72c286b8d640a74cb49 Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Fri, 7 Jul 2017 09:45:05 -0700 Subject: [PATCH 1/9] import from rawhide --- Dockerfile | 26 ++++++ config.json.template | 184 +++++++++++++++++++++++++++++++++++++++++++ launch.sh | 8 ++ service.template | 12 +++ 4 files changed, 230 insertions(+) create mode 100644 Dockerfile create mode 100644 config.json.template create mode 100644 launch.sh create mode 100644 service.template diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..24dee14 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM registry.fedoraproject.org/f26/kubernetes-master:latest +MAINTAINER "Jason Brooks" + +ENV container=docker + +ENV NAME=kubernetes-apiserver VERSION=0.1 RELEASE=8 ARCH=x86_64 +LABEL BZComponent="$NAME" \ + name="$FGC/$NAME" \ + version="$VERSION" \ + release="$RELEASE.$DISTTAG" \ + architecture="$ARCH" \ + atomic.type='system' + +COPY launch.sh /usr/bin/kube-apiserver-docker.sh + +RUN chmod +x /usr/bin/kube-apiserver + +LABEL RUN /usr/bin/docker/ run -d --net=host -p 443:443 + +COPY service.template config.json.template /exports/ + +RUN mkdir -p /exports/hostfs/usr/local/bin/ && cp /usr/bin/kubectl /exports/hostfs/usr/local/bin/kubectl + +RUN mkdir -p /exports/hostfs/etc/kubernetes && cp /etc/kubernetes/{config,apiserver} /exports/hostfs/etc/kubernetes + +ENTRYPOINT ["/usr/bin/kube-apiserver-docker.sh"] diff --git a/config.json.template b/config.json.template new file mode 100644 index 0000000..8a58c2a --- /dev/null +++ b/config.json.template @@ -0,0 +1,184 @@ +{ + "ociVersion": "1.0.0", + "platform": { + "os": "linux", + "arch": "amd64" + }, + "process": { + "terminal": false, + "user": { + "uid": 994, + "gid": 996 + }, + "args": [ + "/usr/bin/kube-apiserver-docker.sh" + ], + "env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "TERM=xterm" + ], + "cwd": "/", + "capabilities": { + "bounding": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_DAC_READ_SEARCH" + ], + "permitted": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_DAC_READ_SEARCH" + ], + "inheritable": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_DAC_READ_SEARCH" + ], + "effective": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_DAC_READ_SEARCH" + ], + "ambient": [ + "CAP_AUDIT_WRITE", + "CAP_KILL", + "CAP_NET_BIND_SERVICE", + "CAP_DAC_READ_SEARCH" + ] + }, + "rlimits": [ + { + "type": "RLIMIT_NOFILE", + "hard": 1024, + "soft": 1024 + } + ] + }, + "root": { + "path": "rootfs", + "readonly": true + }, + "mounts": [ + { + "destination": "/proc", + "type": "proc", + "source": "proc" + }, + { + "destination": "/dev", + "type": "tmpfs", + "source": "tmpfs", + "options": [ + "nosuid", + "strictatime", + "mode=755", + "size=65536k" + ] + }, + { + "destination": "/dev/pts", + "type": "devpts", + "source": "devpts", + "options": [ + "nosuid", + "noexec", + "newinstance", + "ptmxmode=0666", + "mode=0620", + "gid=5" + ] + }, + { + "destination": "/dev/shm", + "type": "tmpfs", + "source": "shm", + "options": [ + "nosuid", + "noexec", + "nodev", + "mode=1777", + "size=65536k" + ] + }, + { + "destination": "/dev/mqueue", + "type": "mqueue", + "source": "mqueue", + "options": [ + "nosuid", + "noexec", + "nodev" + ] + }, + { + "destination": "/sys", + "type": "sysfs", + "source": "sysfs", + "options": [ + "nosuid", + "noexec", + "nodev" + ] + }, + { + "destination": "/sys/fs/cgroup", + "type": "cgroup", + "source": "cgroup", + "options": [ + "nosuid", + "noexec", + "nodev", + "relatime", + "ro" + ] + }, + { + "type": "bind", + "source": "/etc/kubernetes", + "destination": "/etc/kubernetes", + "options": [ + "rbind", + "ro", + "rprivate" + ] + }, + { + "destination": "/etc/resolv.conf", + "type": "bind", + "source": "/etc/resolv.conf", + "options": [ + "ro", + "rbind", + "rprivate" + ] + } + ], + "linux": { + "resources": { + "devices": [ + { + "allow": false, + "access": "rwm" + } + ] + }, + "namespaces": [ + { + "type": "pid" + }, + { + "type": "ipc" + }, + { + "type": "mount" + } + ], + "devices": null, + "apparmorProfile": "", + "selinuxProcessLabel": "" + } +} diff --git a/launch.sh b/launch.sh new file mode 100644 index 0000000..feb0ebd --- /dev/null +++ b/launch.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +source /etc/kubernetes/apiserver +source /etc/kubernetes/config + +ARGS=$(echo "$@ $KUBE_LOGTOSTDERR $KUBE_LOG_LEVEL $KUBE_ETCD_SERVERS $KUBE_API_ADDRESS $KUBE_API_PORT $KUBELET_PORT $KUBE_ALLOW_PRIV $KUBE_SERVICE_ADDRESSES $KUBE_ADMISSION_CONTROL $KUBE_API_ARGS" | xargs -n1 | sort -u -t = -k 1,1 | xargs) + +exec /usr/bin/kube-apiserver $ARGS diff --git a/service.template b/service.template new file mode 100644 index 0000000..d895a99 --- /dev/null +++ b/service.template @@ -0,0 +1,12 @@ +[Unit] +Description=kubernetes-apiserver + +[Service] +ExecStart=$EXEC_START +ExecStop=$EXEC_STOP +Restart=on-failure +WorkingDirectory=$DESTDIR + +[Install] +WantedBy=multi-user.target + From 6bc5d7545d2950ace46144966163f832d8a4cf3f Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Fri, 7 Jul 2017 09:47:00 -0700 Subject: [PATCH 2/9] reset version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 24dee14..fbce94d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0.1 RELEASE=8 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=0 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \ From 3867ab9f43466847a47fa020cd78ab9161c5f331 Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Mon, 24 Jul 2017 18:12:00 -0700 Subject: [PATCH 3/9] don't sort args --- launch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch.sh b/launch.sh index feb0ebd..534fa58 100644 --- a/launch.sh +++ b/launch.sh @@ -3,6 +3,6 @@ source /etc/kubernetes/apiserver source /etc/kubernetes/config -ARGS=$(echo "$@ $KUBE_LOGTOSTDERR $KUBE_LOG_LEVEL $KUBE_ETCD_SERVERS $KUBE_API_ADDRESS $KUBE_API_PORT $KUBELET_PORT $KUBE_ALLOW_PRIV $KUBE_SERVICE_ADDRESSES $KUBE_ADMISSION_CONTROL $KUBE_API_ARGS" | xargs -n1 | sort -u -t = -k 1,1 | xargs) +ARGS="$@ $KUBE_LOGTOSTDERR $KUBE_LOG_LEVEL $KUBE_ETCD_SERVERS $KUBE_API_ADDRESS $KUBE_API_PORT $KUBELET_PORT $KUBE_ALLOW_PRIV $KUBE_SERVICE_ADDRESSES $KUBE_ADMISSION_CONTROL $KUBE_API_ARGS" exec /usr/bin/kube-apiserver $ARGS From c3911abed78d0aa005c2814fd972b0de957cc679 Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Wed, 16 Aug 2017 21:22:36 -0700 Subject: [PATCH 4/9] make init file executable --- Dockerfile | 2 +- launch.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 launch.sh diff --git a/Dockerfile b/Dockerfile index fbce94d..c68b717 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=0 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=1 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \ diff --git a/launch.sh b/launch.sh old mode 100644 new mode 100755 From 3cc453237d5ed28de56a2f71c2c6cc6ca4cfb860 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 24 Aug 2017 18:01:38 -0500 Subject: [PATCH 5/9] Bump RELEASE for automatic rebuild --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c68b717..70d0565 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=1 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=2 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \ From 304339a542edc589042e049a04139454c08ee9ce Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Tue, 5 Sep 2017 10:47:03 -0700 Subject: [PATCH 6/9] make /var/run/kubernetes writeable --- Dockerfile | 2 +- config.json.template | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c68b717..8471aea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN chmod +x /usr/bin/kube-apiserver LABEL RUN /usr/bin/docker/ run -d --net=host -p 443:443 -COPY service.template config.json.template /exports/ +COPY service.template config.json.template tmpfiles.template /exports/ RUN mkdir -p /exports/hostfs/usr/local/bin/ && cp /usr/bin/kubectl /exports/hostfs/usr/local/bin/kubectl diff --git a/config.json.template b/config.json.template index 8a58c2a..ec6bae5 100644 --- a/config.json.template +++ b/config.json.template @@ -7,8 +7,8 @@ "process": { "terminal": false, "user": { - "uid": 994, - "gid": 996 + "uid": 996, + "gid": 994 }, "args": [ "/usr/bin/kube-apiserver-docker.sh" @@ -155,6 +155,15 @@ "rbind", "rprivate" ] + }, + { + "destination": "/var/run/kubernetes", + "type": "bind", + "source": "/var/run/kubernetes", + "options": [ + "rw", + "rbind" + ] } ], "linux": { From df814a1baa0f64a501062e6c94fdfdc2c06ca81a Mon Sep 17 00:00:00 2001 From: Jason Brooks Date: Tue, 5 Sep 2017 10:48:24 -0700 Subject: [PATCH 7/9] make /var/run/kubernetes writeable --- Dockerfile | 2 +- tmpfiles.template | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 tmpfiles.template diff --git a/Dockerfile b/Dockerfile index 9303697..239c3d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=2 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=3 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \ diff --git a/tmpfiles.template b/tmpfiles.template new file mode 100644 index 0000000..0fc3bdf --- /dev/null +++ b/tmpfiles.template @@ -0,0 +1 @@ +d /var/run/kubernetes 0755 kube kube - From 4cb7736c5dc8160ebde175ea257b03ab394525ff Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Thu, 21 Sep 2017 15:06:25 -0500 Subject: [PATCH 8/9] Bump RELEASE for automatic rebuild --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 239c3d0..7aa420b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=3 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=4 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \ From fc5c0aa891038174f3571cd062fc5ae0b0fc5e69 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Tue, 14 Nov 2017 16:42:46 -0600 Subject: [PATCH 9/9] Bump RELEASE for automatic rebuild --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7aa420b..620f193 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER "Jason Brooks" ENV container=docker -ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=4 ARCH=x86_64 +ENV NAME=kubernetes-apiserver VERSION=0 RELEASE=5 ARCH=x86_64 LABEL BZComponent="$NAME" \ name="$FGC/$NAME" \ version="$VERSION" \