blob: 88d6ad8c0bf7b37ee142070f5a0bf5f911cefb12 [file] [log] [blame]
Jackie Huang57fdea72020-04-23 11:29:15 +08001#
2## Copyright (C) 2019 Wind River Systems, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
17PV = "1.16.2+git${SRCREV_kubernetes}"
18SRCREV_kubernetes = "c97fe5036ef3df2967d086711e6c0c405941e14b"
19
20SRC_URI = "git://github.com/kubernetes/kubernetes.git;branch=release-1.16;name=kubernetes \
21 file://0001-hack-lib-golang.sh-use-CC-from-environment.patch \
22 file://0001-cross-don-t-build-tests-by-default.patch \
23 file://kubernetes-accounting.conf \
24 file://kubeadm.conf \
25 file://kubelet-cgroup-setup.sh \
26 file://contrib/* \
27 "
28
29INSANE_SKIP_${PN} += "textrel"
30INSANE_SKIP_${PN}-misc += "textrel"
31INSANE_SKIP_kubelet += "textrel"
32
33inherit useradd
34
35USERADD_PACKAGES = "${PN}"
36USERADD_PARAM_${PN} = "-r -g kube -d / -s /sbin/nologin -c 'Kubernetes user' kube"
37GROUPADD_PARAM_${PN} = "-r kube"
38
39do_install () {
40 install -d ${D}${bindir}
41 install -d ${D}${systemd_system_unitdir}/
42
43 # Install binaries
44 install -m 755 -D ${S}/src/import/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir}
45
46 # kubeadm:
47 install -d -m 0755 ${D}/${sysconfdir}/systemd/system/kubelet.service.d
48 install -m 0644 ${WORKDIR}/kubeadm.conf ${D}/${sysconfdir}/systemd/system/kubelet.service.d
49
50 # kubelete-cgroup-setup.sh
51 install -m 0700 ${WORKDIR}/kubelet-cgroup-setup.sh ${D}/${bindir}
52
53 # install the bash completion
54 install -d -m 0755 ${D}${datadir}/bash-completion/completions/
55 ${D}${bindir}/kubectl completion bash > ${D}${datadir}/bash-completion/completions/kubectl
56
57 # install config files
58 install -d -m 0755 ${D}${sysconfdir}/${BPN}
59 install -m 644 -t ${D}${sysconfdir}/${BPN} ${WORKDIR}/contrib/init/systemd/environ/*
60
61 # install service files
62 install -d -m 0755 ${D}${systemd_system_unitdir}
63 install -m 0644 -t ${D}${systemd_system_unitdir} ${WORKDIR}/contrib/init/systemd/*.service
64
65 # install the place the kubelet defaults to put volumes
66 install -d ${D}${localstatedir}/lib/kubelet
67
68 # install systemd tmpfiles
69 install -d -m 0755 ${D}${sysconfdir}/tmpfiles.d
70 install -p -m 0644 -t ${D}${sysconfdir}/tmpfiles.d ${WORKDIR}/contrib/init/systemd/tmpfiles.d/kubernetes.conf
71
72 # enable CPU and Memory accounting
73 install -d -m 0755 ${D}/${sysconfdir}/systemd/system.conf.d
74 install -m 0644 ${WORKDIR}/kubernetes-accounting.conf ${D}/${sysconfdir}//systemd/system.conf.d/
75}
76
77SYSTEMD_PACKAGES += "${PN} kube-proxy"
78SYSTEMD_SERVICE_kube-proxy = "kube-proxy.service"
79SYSTEMD_SERVICE_${PN} = "\
80 kube-scheduler.service \
81 kube-apiserver.service \
82 kube-controller-manager.service \
83 "
84SYSTEMD_AUTO_ENABLE_${PN} = "disable"
85SYSTEMD_AUTO_ENABLE_kubelet = "disable"
86SYSTEMD_AUTO_ENABLE_kube-proxy = "disable"
87
88FILES_${PN} += "\
89 ${bindir}/kube-scheduler \
90 ${bindir}/kube-apiserver \
91 ${bindir}/kube-controller-manager \
92 ${bindir}/hyperkube \
93 ${bindir}/kubelet-cgroup-setup.sh \
94 "
95
96FILES_kubectl += "\
97 ${datadir}/bash-completion/completions/kubectl \
98 "
99
100FILES_${PN}-misc = "\
101 ${bindir}/conversion-gen \
102 ${bindir}/openapi-gen \
103 ${bindir}/apiextensions-apiserver \
104 ${bindir}/defaulter-gen \
105 ${bindir}/mounter \
106 ${bindir}/deepcopy-gen \
107 ${bindir}/go-bindata \
108 ${bindir}/go2make \
109 "
110
111RDEPENDS_${PN} += "\
112 bash \
113 kube-proxy \
114 "