mirror of
https://github.com/ubuntu/microk8s.git
synced 2021-05-23 02:23:41 +03:00
545 lines
14 KiB
YAML
545 lines
14 KiB
YAML
name: microk8s
|
|
adopt-info: microk8s
|
|
summary: Kubernetes for workstations and appliances
|
|
description: |-
|
|
MicroK8s is a small, fast, secure, single node Kubernetes that installs on
|
|
just about any Linux box. Use it for offline development, prototyping,
|
|
testing, or use it on a VM as a small, cheap, reliable k8s for CI/CD. It's
|
|
also a great k8s for appliances - develop your IoT apps for k8s and deploy
|
|
them to MicroK8s on your boxes.
|
|
|
|
grade: stable
|
|
confinement: classic
|
|
base: core18
|
|
|
|
apps:
|
|
microk8s:
|
|
command: microk8s.wrapper
|
|
daemon-etcd:
|
|
command: run-etcd-with-args
|
|
daemon: simple
|
|
daemon-flanneld:
|
|
command: run-flanneld-with-args
|
|
daemon: simple
|
|
daemon-containerd:
|
|
command: run-containerd-with-args
|
|
daemon: simple
|
|
plugs: [kubernetes-support]
|
|
daemon-kubelite:
|
|
command: run-kubelite-with-args
|
|
daemon: simple
|
|
daemon-apiserver:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
daemon-apiserver-kicker:
|
|
command: apiservice-kicker
|
|
daemon: simple
|
|
daemon-control-plane-kicker:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
daemon-cluster-agent:
|
|
command: run-cluster-agent-with-args
|
|
daemon: simple
|
|
daemon-controller-manager:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
daemon-scheduler:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
daemon-kubelet:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
daemon-proxy:
|
|
command: run-null-daemon
|
|
daemon: simple
|
|
dashboard-proxy:
|
|
command: microk8s-dashboard-proxy.wrapper
|
|
kubectl:
|
|
command: microk8s-kubectl.wrapper
|
|
completer: kubectl.bash
|
|
add-node:
|
|
command: microk8s-add-node.wrapper
|
|
refresh-certs:
|
|
command: microk8s-refresh-certs.wrapper
|
|
join:
|
|
command: microk8s-join.wrapper
|
|
remove-node:
|
|
command: microk8s-remove-node.wrapper
|
|
leave:
|
|
command: microk8s-leave.wrapper
|
|
ctr:
|
|
command: microk8s-ctr.wrapper
|
|
inspect:
|
|
command: sudo SNAP_DATA=${SNAP_DATA} ${SNAP}/inspect.sh
|
|
enable:
|
|
command: microk8s-enable.wrapper
|
|
disable:
|
|
command: microk8s-disable.wrapper
|
|
start:
|
|
command: microk8s-start.wrapper
|
|
stop:
|
|
command: microk8s-stop.wrapper
|
|
status:
|
|
command: microk8s-status.wrapper
|
|
config:
|
|
command: microk8s-config.wrapper
|
|
reset:
|
|
command: microk8s-reset.wrapper
|
|
istioctl:
|
|
command: microk8s-istioctl.wrapper
|
|
linkerd:
|
|
command: microk8s-linkerd.wrapper
|
|
helm:
|
|
command: microk8s-helm.wrapper
|
|
helm3:
|
|
command: microk8s-helm3.wrapper
|
|
cilium:
|
|
command: microk8s-cilium.wrapper
|
|
juju:
|
|
command: microk8s-juju.wrapper
|
|
dbctl:
|
|
command: microk8s-dbctl.wrapper
|
|
|
|
parts:
|
|
raft:
|
|
source: https://github.com/canonical/raft
|
|
build-attributes: [no-patchelf]
|
|
source-type: git
|
|
plugin: autotools
|
|
stage-packages:
|
|
- libuv1
|
|
organize:
|
|
usr/lib/: lib/
|
|
include/: usr/include/
|
|
prime:
|
|
- lib/libraft*so*
|
|
- usr/include/
|
|
|
|
sqlite:
|
|
source: https://github.com/sqlite/sqlite
|
|
source-type: git
|
|
source-depth: 1
|
|
source-tag: version-3.33.0
|
|
build-attributes: [no-patchelf]
|
|
plugin: autotools
|
|
build-packages:
|
|
- tcl
|
|
override-build: |-
|
|
set -ex
|
|
git log -1 --format=format:%ci%n | sed -e 's/ [-+].*$//;s/ /T/;s/^/D /' > manifest
|
|
git log -1 --format=format:%H > manifest.uuid
|
|
cp /usr/share/misc/config.guess .
|
|
cp /usr/share/misc/config.sub .
|
|
autoreconf -f -i
|
|
set +ex
|
|
snapcraftctl build
|
|
organize:
|
|
include/: usr/include/
|
|
prime:
|
|
- bin/sqlite3
|
|
- lib/libsqlite3*so*
|
|
- usr/include/
|
|
|
|
dqlite:
|
|
after:
|
|
- raft
|
|
- sqlite
|
|
source: https://github.com/canonical/dqlite
|
|
build-attributes: [no-patchelf]
|
|
source-type: git
|
|
plugin: autotools
|
|
stage-packages:
|
|
- libuv1
|
|
build-packages:
|
|
- libuv1-dev
|
|
- pkg-config
|
|
organize:
|
|
usr/lib/: lib/
|
|
include/: usr/include/
|
|
prime:
|
|
- lib/libdqlite*so*
|
|
- lib/*/libuv*
|
|
- usr/include/
|
|
|
|
dqlite-client:
|
|
build-snaps: [go]
|
|
after: [sqlite, dqlite]
|
|
source: https://github.com/canonical/go-dqlite
|
|
source-type: git
|
|
plugin: go
|
|
go-channel: 1.15/stable
|
|
build-packages:
|
|
- libsqlite3-dev
|
|
go-importpath: github.com/canonical/go-dqlite
|
|
override-build: |
|
|
set -eux
|
|
snap refresh go --channel=1.15/stable || true
|
|
go version
|
|
export GOPATH=${SNAPCRAFT_STAGE}
|
|
CGO_CFLAGS="-I${SNAPCRAFT_STAGE}/usr/include/" CGO_LDFLAGS="-L${SNAPCRAFT_STAGE}/lib" go get -tags libsqlite3 github.com/canonical/go-dqlite/cmd/dqlite
|
|
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
|
cp $GOPATH/bin/dqlite $SNAPCRAFT_PART_INSTALL/bin/
|
|
|
|
etcd:
|
|
plugin: dump
|
|
source: build-scripts/
|
|
build-snaps: [go]
|
|
override-build: |
|
|
. ./set-env-variables.sh
|
|
case ${SNAPCRAFT_ARCH_TRIPLET%%-*} in
|
|
x86_64|aarch64)
|
|
echo "Supported arch by etcd - use official binary"
|
|
curl -LO https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-$KUBE_ARCH.tar.gz
|
|
tar -xzvf etcd-*.tar.gz --strip-components=1
|
|
;;
|
|
*)
|
|
echo "Unsupported arch by etcd - build from sources"
|
|
curl -LO https://github.com/etcd-io/etcd/archive/${ETCD_VERSION}.tar.gz
|
|
tar -xzf *.tar.gz
|
|
cd etcd-*
|
|
go mod vendor
|
|
./build
|
|
cp -av bin/* ../
|
|
echo "End of build"
|
|
esac
|
|
snapcraftctl build
|
|
stage:
|
|
- etcd
|
|
- etcdctl
|
|
|
|
cni:
|
|
plugin: dump
|
|
source: build-scripts/
|
|
override-build: |
|
|
. ./set-env-variables.sh
|
|
rm -rf cni*
|
|
curl -LO https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-$KUBE_ARCH-${CNI_VERSION}.tgz
|
|
mkdir cni
|
|
tar -xzvf cni-*.tgz -C cni/
|
|
snapcraftctl build
|
|
organize:
|
|
./cni/*: opt/cni/bin/
|
|
filesets:
|
|
bins: [./opt/cni/bin/*]
|
|
stage: [$bins]
|
|
|
|
flanneld:
|
|
plugin: dump
|
|
source: build-scripts/
|
|
override-build: |
|
|
. ./set-env-variables.sh
|
|
curl -LO https://github.com/coreos/flannel/releases/download/${FLANNELD_VERSION}/flannel-${FLANNELD_VERSION}-linux-${KUBE_ARCH}.tar.gz
|
|
tar -xzvf flannel-*.tar.gz
|
|
snapcraftctl build
|
|
organize:
|
|
flanneld: opt/cni/bin/
|
|
stage:
|
|
- opt/cni/bin/flanneld
|
|
|
|
k8s-binaries:
|
|
after: [dqlite]
|
|
build-snaps: [go]
|
|
plugin: dump
|
|
build-attributes: [no-patchelf]
|
|
source: build-scripts/
|
|
build-packages:
|
|
- build-essential
|
|
- curl
|
|
- git
|
|
override-build: |
|
|
set -eux
|
|
snap refresh go --channel=1.16/stable || true
|
|
. ./set-env-variables.sh
|
|
|
|
# if "${KUBE_SNAP_BINS}" exist we have to use the binaries from there
|
|
# if "${KUBE_SNAP_BINS}" does not exist but it is set we will put the k8s binaries there
|
|
# if "${KUBE_SNAP_BINS}" does not exist and it is not set we do not need to keep the created binaries
|
|
if [ ! -e "${KUBE_SNAP_BINS}" ]; then
|
|
if [ -z "${KUBE_SNAP_BINS}" ]; then
|
|
. ./set-env-binaries-location.sh
|
|
fi
|
|
echo "Building k8s binaries"
|
|
. ./build-k8s-binaries.sh
|
|
else
|
|
echo "Binaries provided in $KUBE_SNAP_BINS"
|
|
fi
|
|
mkdir -p bins/
|
|
cp build/kube_bins/$KUBERNETES_TAG/$KUBE_ARCH/* bins/
|
|
|
|
# Add bash completion for microk8s kubectl.
|
|
bins/kubectl completion bash | sed "s/complete -o default -F __start_kubectl kubectl/complete -o default -F __start_kubectl microk8s kubectl/g" | sed "s/complete -o default -o nospace -F __start_kubectl kubectl/complete -o default -o nospace -F __start_kubectl kubectl/g" > kubectl.bash
|
|
bins/kubectl completion bash | sed "s/complete -o default -F __start_kubectl kubectl/complete -o default -F __start_kubectl microk8s.kubectl/g" | sed "s/complete -o default -o nospace -F __start_kubectl kubectl/complete -o default -o nospace -F __start_kubectl kubectl/g" > kubectl.bash
|
|
|
|
snapcraftctl build
|
|
organize:
|
|
bins/*: .
|
|
stage:
|
|
- kubelite
|
|
- kubectl
|
|
- kubectl.bash
|
|
|
|
libmnl:
|
|
plugin: autotools
|
|
source: https://www.netfilter.org/pub/libmnl/libmnl-1.0.4.tar.bz2
|
|
|
|
libnftnl:
|
|
after:
|
|
- libmnl
|
|
plugin: autotools
|
|
source: https://www.netfilter.org/projects/libnftnl/files/libnftnl-1.1.8.tar.bz2
|
|
build-packages:
|
|
- libjansson-dev
|
|
|
|
iptables:
|
|
after:
|
|
- libnftnl
|
|
source: https://www.netfilter.org/projects/iptables/files/iptables-1.8.6.tar.bz2
|
|
plugin: autotools
|
|
build-packages:
|
|
- bison
|
|
- flex
|
|
- libnfnetlink-dev
|
|
- libnetfilter-conntrack3
|
|
- libnetfilter-conntrack-dev
|
|
configflags:
|
|
- "--disable-shared"
|
|
- "--enable-static"
|
|
prime: [-bin/iptables-xml]
|
|
|
|
migrator:
|
|
build-snaps: [go]
|
|
source: https://github.com/ktsakalozos/go-migrator
|
|
source-type: git
|
|
plugin: go
|
|
go-channel: 1.15/stable
|
|
go-importpath: github.com/ktsakalozos/go-migrator
|
|
build-packages:
|
|
- gcc
|
|
prime:
|
|
- bin/migrator
|
|
|
|
containerd:
|
|
build-snaps: [go]
|
|
after: [iptables, runc]
|
|
build-attributes: [no-patchelf]
|
|
source: build-scripts/
|
|
plugin: dump
|
|
build-packages:
|
|
- btrfs-tools
|
|
- libseccomp-dev
|
|
override-build: |
|
|
set -eux
|
|
. $SNAPCRAFT_PART_SRC/set-env-variables.sh
|
|
snap refresh go --channel=1.15/stable || true
|
|
go version
|
|
export GOPATH=$(realpath ../go)
|
|
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
|
|
|
# Build containerd
|
|
rm -rf $GOPATH
|
|
mkdir -p $GOPATH
|
|
go get -d github.com/containerd/containerd
|
|
(
|
|
cd $GOPATH/src/github.com/containerd/containerd
|
|
git checkout -f ${CONTAINERD_COMMIT}
|
|
# building the btrfs driver can be disabled via the
|
|
# build tag no_btrfs, removing this dependency
|
|
make
|
|
)
|
|
cp $GOPATH/src/github.com/containerd/containerd/bin/* $SNAPCRAFT_PART_INSTALL/bin/
|
|
rm $SNAPCRAFT_PART_INSTALL/bin/containerd-stress
|
|
|
|
# Assemble the snap
|
|
snapcraftctl build
|
|
organize:
|
|
containerd/install/bin/*: bin/
|
|
stage-packages:
|
|
- libnss-myhostname
|
|
- libnss-resolve
|
|
- libnss-mymachines
|
|
- conntrack
|
|
- libssl1.0.0
|
|
stage:
|
|
- -sbin/xtables-multi
|
|
- -sbin/iptables*
|
|
- -lib/xtables
|
|
|
|
runc:
|
|
build-snaps: [go]
|
|
after: [iptables]
|
|
source: build-scripts/
|
|
plugin: dump
|
|
build-packages:
|
|
- btrfs-tools
|
|
- libseccomp-dev
|
|
override-build: |
|
|
set -eux
|
|
. $SNAPCRAFT_PART_SRC/set-env-variables.sh
|
|
snap refresh go --channel=1.15/stable || true
|
|
go version
|
|
export GOPATH=$(realpath ../go)
|
|
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
|
|
|
|
# Build runc
|
|
go get -d github.com/opencontainers/runc
|
|
(
|
|
cd $GOPATH/src/github.com/opencontainers/runc
|
|
git checkout ${RUNC_COMMIT}
|
|
make BUILDTAGS='seccomp apparmor'
|
|
)
|
|
cp $GOPATH/src/github.com/opencontainers/runc/runc $SNAPCRAFT_PART_INSTALL/bin/
|
|
|
|
# Assemble the snap
|
|
snapcraftctl build
|
|
stage:
|
|
- -sbin/xtables-multi
|
|
- -sbin/iptables*
|
|
- -lib/xtables
|
|
|
|
bash-utils:
|
|
source: snap
|
|
plugin: dump
|
|
stage-packages:
|
|
- curl
|
|
- aufs-tools
|
|
- gawk
|
|
- sed
|
|
- socat
|
|
- grep
|
|
- jq
|
|
- hostname
|
|
- squashfs-tools
|
|
- tar
|
|
- coreutils
|
|
- diffutils
|
|
- iproute2
|
|
- ethtool
|
|
- net-tools
|
|
- util-linux
|
|
- libatm1
|
|
- zfsutils-linux
|
|
|
|
cluster-agent:
|
|
plugin: python
|
|
python-version: python3
|
|
source: .
|
|
python-packages:
|
|
- flask == 1.1.2
|
|
- PyYAML == 5.3.1
|
|
- netifaces == 0.10.9
|
|
stage-packages:
|
|
- python3-openssl
|
|
- openssl
|
|
- python3-requests
|
|
- gunicorn3
|
|
- python3-click
|
|
- python3-dateutil
|
|
|
|
microk8s:
|
|
after: [containerd, dqlite, k8s-binaries]
|
|
plugin: dump
|
|
build-attributes: [no-patchelf]
|
|
build-packages:
|
|
- make
|
|
- mercurial
|
|
- git
|
|
- rsync
|
|
- openssl
|
|
- file
|
|
- dpkg
|
|
source: .
|
|
prime:
|
|
- -README*
|
|
- -installer*
|
|
- -tests*
|
|
- -docs*
|
|
- -build*
|
|
- -go*
|
|
- -snap*
|
|
override-build: |
|
|
set -eux
|
|
|
|
. build-scripts/set-env-variables.sh
|
|
|
|
snapcraftctl set-version "${KUBE_VERSION}"
|
|
|
|
echo "Setting default daemon configs"
|
|
cp -r $KUBE_SNAP_ROOT/microk8s-resources/default-args .
|
|
|
|
echo "Building certs"
|
|
cp -r $KUBE_SNAP_ROOT/microk8s-resources/certs .
|
|
cp -r $KUBE_SNAP_ROOT/microk8s-resources/certs-beta .
|
|
|
|
echo "Preparing containerd"
|
|
cp $KUBE_SNAP_ROOT/microk8s-resources/containerd-profile .
|
|
|
|
echo "Preparing user config"
|
|
cp $KUBE_SNAP_ROOT/microk8s-resources/client.config.template .
|
|
|
|
echo "Creating commands and wrappers"
|
|
cp $KUBE_SNAP_ROOT/microk8s-resources/wrappers/* .
|
|
|
|
cp -r $KUBE_SNAP_ROOT/microk8s-resources/actions .
|
|
if [ "${ARCH}" != "amd64" ]
|
|
then
|
|
# Some actions are only available on amd64
|
|
# Nvidia support
|
|
rm "actions/enable.gpu.sh"
|
|
rm "actions/disable.gpu.sh"
|
|
rm "actions/gpu.yaml"
|
|
# Istio support
|
|
rm "actions/enable.istio.sh"
|
|
rm "actions/disable.istio.sh"
|
|
# Knative support
|
|
rm "actions/enable.knative.sh"
|
|
rm "actions/disable.knative.sh"
|
|
# Fluentd support
|
|
rm "actions/enable.fluentd.sh"
|
|
rm "actions/disable.fluentd.sh"
|
|
rm -rf "actions/fluentd"
|
|
# Jeager support
|
|
rm "actions/enable.jaeger.sh"
|
|
rm "actions/disable.jaeger.sh"
|
|
rm -rf "actions/jaeger"
|
|
# Juju support
|
|
rm "actions/enable.juju.sh"
|
|
rm "actions/disable.juju.sh"
|
|
# Kubeflow support
|
|
rm "actions/enable.kubeflow.sh"
|
|
rm "actions/disable.kubeflow.sh"
|
|
# Kubeflow support
|
|
rm "actions/enable.multus.sh"
|
|
rm "actions/disable.multus.sh"
|
|
rm "actions/multus.yaml"
|
|
# KEDA support
|
|
rm "actions/enable.keda.sh"
|
|
rm "actions/disable.keda.sh"
|
|
# OpenEBS support
|
|
rm "actions/enable.openebs.sh"
|
|
rm "actions/disable.openebs.sh"
|
|
# OpenFaaS support
|
|
rm "actions/enable.openfaas.sh"
|
|
rm "actions/disable.openfaas.sh"
|
|
fi
|
|
|
|
echo "Creating inspect hook"
|
|
cp $KUBE_SNAP_ROOT/scripts/inspect.sh .
|
|
|
|
snapcraftctl build
|
|
|
|
juju:
|
|
plugin: dump
|
|
source: https://launchpad.net/juju/2.9/2.9.0/+download/juju-2.9.0-k8s.tar.xz
|
|
source-type: tar
|
|
organize:
|
|
juju: bin/juju
|
|
prime:
|
|
- bin/juju
|
|
|
|
slots:
|
|
microk8s:
|
|
interface: content
|
|
content: microk8s
|
|
source:
|
|
read: [$SNAP/.microk8s-info/microk8s]
|