Split kubernetes into versioned stages and unversioned package

This packages kubernetes in versioned subdirectories to be able to
support upgrading multiple versions of kubernetes without collisions.
Common configuration/environment files are moved to the new
kubernetes-unversioned package.

This creates directories:
/usr/local/kubernetes/<version>/stage1
/usr/local/kubernetes/<version>/stage2

The binaries and configuration or kubernetes-node, kubernetes-kubeadm,
and kube-client are placed in new locations, e.g.,
/usr/local/kubernetes/1.18/stage1/usr/bin/kubeadm
/usr/local/kubernetes/1.18/stage2/usr/bin/{kubelet,kubectl}

A new package kubernetes-unversioned contains directories:
/usr/local/kubernetes/current/stage1
/usr/local/kubernetes/current/stage2

This package contains symlinks of all the expected binaries and
configuration needed to run kubernetes. For example, /usr/bin/kubelet
is a symlink to /usr/local/kubernetes/current/stage2/user/bin/kubelet.

At ansible install time and during subsequent boots, there is code in
place to bind-mount /usr/local/kubernetes/<version>/stageX onto
/usr/local/kubernetes/current/stageX .

This removes redundant doc and man pages from the production rpms.

Story: 2008972
Task: 43002
Depends-On: https://review.opendev.org/c/starlingx/ansible-playbooks/+/802898
Signed-off-by: Jim Gauld <james.gauld@windriver.com>
Change-Id: I74dc867faea6759906a687cef0b0ebf9555829ee
This commit is contained in:
Jim Gauld 2021-08-11 09:49:49 -04:00
parent 8d4adc7c9f
commit 8e7ce96e0e
9 changed files with 385 additions and 106 deletions

View File

@ -155,8 +155,7 @@ tboot
memcached memcached
# kubernetes # kubernetes
kubernetes kubernetes-unversioned
kubernetes-master
kubernetes-node kubernetes-node
kubernetes-kubeadm kubernetes-kubeadm
kubernetes-client kubernetes-client

View File

@ -54,6 +54,7 @@ security/tboot
docker/python-docker docker/python-docker
kubernetes/containerd kubernetes/containerd
kubernetes/kubernetes kubernetes/kubernetes
kubernetes/kubernetes-unversioned
kubernetes/docker-distribution kubernetes/docker-distribution
kubernetes/etcd kubernetes/etcd
kubernetes/helm kubernetes/helm

View File

@ -0,0 +1,7 @@
CON_VERSION=1.18.1
TAR_NAME=kubernetes-contrib
CONTRIB="$TAR_NAME-v$CON_VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$CONTRIB $FILES_BASE/*"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -0,0 +1,131 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (c) 2021 Wind River Systems, Inc.
#
%define debug_package %{nil}
%global _k8s_name kubernetes
# Used to simplify the paths for install and files
%global _curr_stage1 %{_exec_prefix}/local/kubernetes/current/stage1
%global _curr_stage2 %{_exec_prefix}/local/kubernetes/current/stage2
# https://github.com/kubernetes/contrib
%global con_provider github
%global con_provider_tld com
%global con_project kubernetes
%global con_repo kubernetes-contrib
%global con_commit 1.18.1
##############################################
Name: kubernetes-unversioned
Version: 1.0
Release: 1%{?_tis_dist}.%{tis_patch_ver}
Summary: Kubernetes unversioned common config and current version symlinks
License: Apache-2.0
Group: base
Packager: Wind River <info@windriver.com>
URL: unknown
Source0: LICENSE
Source1: %{con_repo}-v%{con_commit}.tar.gz
# systemd resource control enable CPU and Memory accounting for cgroups
Source2: kubernetes-accounting.conf
Patch1: kubelet-service-remove-docker-dependency.patch
BuildArch: noarch
BuildRequires: systemd-devel
Requires: /bin/bash
Requires: systemd
%description
%{summary}
%prep
%setup -q -n %{con_repo}-%{con_commit} -T -b 1
mkdir contrib
cp -r ../%{con_repo}-%{con_commit}/init contrib/.
%patch1 -p1
cp %{SOURCE0} .
%build
%install
stage1_link() {
ln -v -sf %{_curr_stage1}$1/$2 %{buildroot}$1/$2
}
stage2_link() {
ln -v -sf %{_curr_stage2}$1/$2 %{buildroot}$1/$2
}
# Current staged directories
install -v -m 755 -d %{buildroot}%{_curr_stage1}
install -v -m 755 -d %{buildroot}%{_curr_stage2}
# Symlink targets
install -v -m 755 -d %{buildroot}%{_bindir}
install -v -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d
install -v -m 755 -d %{buildroot}%{_datadir}/bash-completion/completions
stage1_link %{_bindir} kubeadm
stage2_link %{_sysconfdir}/systemd/system/kubelet.service.d kubeadm.conf
stage2_link %{_datadir}/bash-completion/completions kubectl
stage2_link %{_bindir} kubelet-cgroup-setup.sh
stage2_link %{_bindir} kubelet
stage2_link %{_bindir} kubectl
# install environment files
install -v -d -m 0755 %{buildroot}%{_sysconfdir}/%{_k8s_name}
install -v -m 644 -t %{buildroot}%{_sysconfdir}/%{_k8s_name} contrib/init/systemd/environ/{config,kubelet,kubelet.kubeconfig,proxy}
# install config files
install -v -d -m 0755 %{buildroot}%{_tmpfilesdir}
install -v -p -m 0644 -t %{buildroot}/%{_tmpfilesdir} contrib/init/systemd/tmpfiles.d/kubernetes.conf
mkdir -p %{buildroot}/run
install -v -d -m 0755 %{buildroot}/run/%{_k8s_name}/
# install service files
install -v -d -m 0755 %{buildroot}%{_unitdir}
install -v -m 0644 -t %{buildroot}%{_unitdir} contrib/init/systemd/kubelet.service
# install the place the kubelet defaults to put volumes (/var/lib/kubelet)
install -v -d %{buildroot}%{_sharedstatedir}/kubelet
# enable CPU and Memory accounting
install -v -d -m 0755 %{buildroot}/%{_sysconfdir}/systemd/system.conf.d
install -v -p -m 0644 -t %{buildroot}/%{_sysconfdir}/systemd/system.conf.d %{SOURCE2}
%files
%defattr(-,root,root,-)
%license LICENSE
%dir %{_curr_stage1}
%dir %{_curr_stage2}
# the following are symlinks
%{_bindir}/kubeadm
%{_bindir}/kubelet
%{_bindir}/kubelet-cgroup-setup.sh
%{_bindir}/kubectl
%dir %{_sysconfdir}/systemd/system/kubelet.service.d
%{_sysconfdir}/systemd/system/kubelet.service.d/kubeadm.conf
%{_datadir}/bash-completion/completions/kubectl
# the following are common config, environment, service
%{_unitdir}/kubelet.service
%dir %{_sharedstatedir}/kubelet
%dir %{_sysconfdir}/%{_k8s_name}
%config(noreplace) %{_sysconfdir}/%{_k8s_name}/config
%config(noreplace) %{_sysconfdir}/%{_k8s_name}/kubelet
%config(noreplace) %{_sysconfdir}/%{_k8s_name}/kubelet.kubeconfig
%config(noreplace) %{_sysconfdir}/%{_k8s_name}/proxy
%config(noreplace) %{_sysconfdir}/systemd/system.conf.d/kubernetes-accounting.conf
%{_tmpfilesdir}/kubernetes.conf
%verify(not size mtime md5) %attr(755, root,root) %dir /run/%{_k8s_name}
%changelog

View File

@ -1,9 +1,5 @@
VERSION=1.18.1 VERSION=1.18.1
CON_VERSION=1.18.1
TAR_NAME=kubernetes TAR_NAME=kubernetes
TAR="$TAR_NAME-v$VERSION.tar.gz" TAR="$TAR_NAME-v$VERSION.tar.gz"
CONTRIB="$TAR_NAME-contrib-v$CON_VERSION.tar.gz" COPY_LIST="${CGCS_BASE}/downloads/$TAR $FILES_BASE/*"
COPY_LIST="${CGCS_BASE}/downloads/$TAR ${CGCS_BASE}/downloads/$CONTRIB $FILES_BASE/*"
TIS_PATCH_VER=PKG_GITREVCOUNT TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -25,13 +25,6 @@
%global import_path k8s.io/kubernetes %global import_path k8s.io/kubernetes
%global commit 1.18.1 %global commit 1.18.1
%global con_provider github
%global con_provider_tld com
%global con_project kubernetes
%global con_repo kubernetes-contrib
# https://github.com/kubernetes/contrib
%global con_commit 1.18.1
%global kube_version 1.18.1 %global kube_version 1.18.1
%global kube_git_version v%{kube_version} %global kube_git_version v%{kube_version}
@ -39,6 +32,10 @@
%global _buildshell /bin/bash %global _buildshell /bin/bash
%global _checkshell /bin/bash %global _checkshell /bin/bash
# Used to simplify the paths for install and files
%global _stage1 %{_exec_prefix}/local/kubernetes/%{kube_version}/stage1
%global _stage2 %{_exec_prefix}/local/kubernetes/%{kube_version}/stage2
############################################## ##############################################
Name: kubernetes Name: kubernetes
Version: %{kube_version} Version: %{kube_version}
@ -48,15 +45,12 @@ License: ASL 2.0
URL: https://%{import_path} URL: https://%{import_path}
ExclusiveArch: x86_64 aarch64 ppc64le s390x ExclusiveArch: x86_64 aarch64 ppc64le s390x
Source0: %{project}-v%{kube_version}.tar.gz Source0: %{project}-v%{kube_version}.tar.gz
Source1: %{con_repo}-v%{con_commit}.tar.gz
Source3: kubernetes-accounting.conf
Source4: kubeadm.conf Source4: kubeadm.conf
Source5: kubelet-cgroup-setup.sh Source5: kubelet-cgroup-setup.sh
Source33: genmanpages.sh Source33: genmanpages.sh
Patch1: 0001-Fix-pagesize-check-to-allow-for-options-already-endi.patch Patch1: 0001-Fix-pagesize-check-to-allow-for-options-already-endi.patch
Patch2: kubelet-service-remove-docker-dependency.patch
Patch3: fix_http2_erringroundtripper_handling.patch Patch3: fix_http2_erringroundtripper_handling.patch
Patch4: kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch Patch4: kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch
Patch5: kubelet-cpumanager-keep-normal-containers-off-reserv.patch Patch5: kubelet-cpumanager-keep-normal-containers-off-reserv.patch
@ -840,10 +834,16 @@ BuildRequires: go-bindata
%description client %description client
Kubernetes client tools like kubectl Kubernetes client tools like kubectl
##############################################
%package kube-misc
Summary: dummy package
%description kube-misc
Kubernetes dummy package for misc stuff we don't want to
install in production.
############################################## ##############################################
%prep %prep
%setup -q -n %{con_repo}-%{con_commit} -T -b 1
%setup -q -n %{repo}-%{commit} %setup -q -n %{repo}-%{commit}
%patch1 -p1 %patch1 -p1
%patch3 -p1 %patch3 -p1
@ -855,11 +855,6 @@ Kubernetes client tools like kubectl
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
# copy contrib folder
mkdir contrib
cp -r ../%{con_repo}-%{con_commit}/init contrib/.
%patch2 -p1
#src/k8s.io/kubernetes/pkg/util/certificates #src/k8s.io/kubernetes/pkg/util/certificates
# Patch the code to remove eliptic.P224 support # Patch the code to remove eliptic.P224 support
for dir in vendor/github.com/google/certificate-transparency/go/x509 pkg/util/certificates; do for dir in vendor/github.com/google/certificate-transparency/go/x509 pkg/util/certificates; do
@ -919,17 +914,19 @@ output_path="${KUBE_OUTPUT_BINPATH}/$(kube::golang::host_platform)"
%endif %endif
install -m 755 -d %{buildroot}%{_bindir} install -m 755 -d %{buildroot}%{_bindir}
install -m 755 -d %{buildroot}%{_stage1}%{_bindir}
install -m 755 -d %{buildroot}%{_stage2}%{_bindir}
echo "+++ INSTALLING kube-apiserver" echo "+++ INSTALLING kube-apiserver"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver
echo "+++ INSTALLING kubeadm" echo "+++ INSTALLING kubeadm"
install -p -m 755 -t %{buildroot}%{_bindir} ${output_path}/kubeadm install -p -m 755 -t %{buildroot}%{_stage1}%{_bindir} ${output_path}/kubeadm
install -d -m 0755 %{buildroot}/%{_sysconfdir}/systemd/system/kubelet.service.d install -d -m 0755 %{buildroot}%{_stage2}%{_sysconfdir}/systemd/system/kubelet.service.d
install -p -m 0644 -t %{buildroot}/%{_sysconfdir}/systemd/system/kubelet.service.d %{SOURCE4} install -p -m 0644 -t %{buildroot}%{_stage2}%{_sysconfdir}/systemd/system/kubelet.service.d %{SOURCE4}
echo "+++ INSTALLING kubelet-cgroup-setup.sh" echo "+++ INSTALLING kubelet-cgroup-setup.sh"
install -p -m 0700 -t %{buildroot}/%{_bindir} %{SOURCE5} install -p -m 0700 -t %{buildroot}%{_stage2}%{_bindir} %{SOURCE5}
echo "+++ INSTALLING kube-apiserver" echo "+++ INSTALLING kube-apiserver"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver
@ -944,18 +941,14 @@ echo "+++ INSTALLING kube-proxy"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-proxy install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-proxy
echo "+++ INSTALLING kubelet" echo "+++ INSTALLING kubelet"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kubelet install -p -m 754 -t %{buildroot}%{_stage2}%{_bindir} ${output_path}/kubelet
echo "+++ INSTALLING kubectl" echo "+++ INSTALLING kubectl"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kubectl install -p -m 754 -t %{buildroot}%{_stage2}%{_bindir} ${output_path}/kubectl
# install the bash completion # install the bash completion
install -d -m 0755 %{buildroot}%{_datadir}/bash-completion/completions/ install -d -m 0755 %{buildroot}%{_stage2}%{_datadir}/bash-completion/completions/
%{buildroot}%{_bindir}/kubectl completion bash > %{buildroot}%{_datadir}/bash-completion/completions/kubectl %{buildroot}%{_stage2}%{_bindir}/kubectl completion bash > %{buildroot}%{_stage2}%{_datadir}/bash-completion/completions/kubectl
# install config files
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}
install -m 644 -t %{buildroot}%{_sysconfdir}/%{name} contrib/init/systemd/environ/*
# install specific cluster addons for optional use # install specific cluster addons for optional use
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/addons install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/addons
@ -966,29 +959,12 @@ install -m 0644 -t %{buildroot}%{_sysconfdir}/%{name}/addons/volumesnapshots/crd
install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller
install -m 0644 -t %{buildroot}%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller cluster/addons/volumesnapshots/volume-snapshot-controller/* install -m 0644 -t %{buildroot}%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller cluster/addons/volumesnapshots/volume-snapshot-controller/*
# install service files
install -d -m 0755 %{buildroot}%{_unitdir}
install -m 0644 -t %{buildroot}%{_unitdir} contrib/init/systemd/*.service
# install manpages # install manpages
install -d %{buildroot}%{_mandir}/man1 install -d %{buildroot}%{_mandir}/man1
install -p -m 644 docs/man/man1/* %{buildroot}%{_mandir}/man1 install -p -m 644 docs/man/man1/* %{buildroot}%{_mandir}/man1
rm -Rf %{buildroot}%{_mandir}/man1/cloud-controller-manager.* rm -Rf %{buildroot}%{_mandir}/man1/cloud-controller-manager.*
# from k8s tarball copied docs/man/man1/*.1 # from k8s tarball copied docs/man/man1/*.1
# install the place the kubelet defaults to put volumes
install -d %{buildroot}%{_sharedstatedir}/kubelet
# place contrib/init/systemd/tmpfiles.d/kubernetes.conf to /usr/lib/tmpfiles.d/kubernetes.conf
install -d -m 0755 %{buildroot}%{_tmpfilesdir}
install -p -m 0644 -t %{buildroot}/%{_tmpfilesdir} contrib/init/systemd/tmpfiles.d/kubernetes.conf
mkdir -p %{buildroot}/run
install -d -m 0755 %{buildroot}/run/%{name}/
# enable CPU and Memory accounting
install -d -m 0755 %{buildroot}/%{_sysconfdir}/systemd/system.conf.d
install -p -m 0644 -t %{buildroot}/%{_sysconfdir}/systemd/system.conf.d %{SOURCE3}
# source codes for building projects # source codes for building projects
%if 0%{?with_devel} %if 0%{?with_devel}
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
@ -1052,20 +1028,10 @@ fi
%files master %files master
%license LICENSE %license LICENSE
%doc *.md %doc *.md
%{_mandir}/man1/kube-apiserver.1* %attr(754, -, root) %caps(cap_net_bind_service=ep) %{_bindir}/kube-apiserver
%{_mandir}/man1/kube-controller-manager.1*
%{_mandir}/man1/kube-scheduler.1*
%attr(754, -, kube) %caps(cap_net_bind_service=ep) %{_bindir}/kube-apiserver
%{_bindir}/kube-controller-manager %{_bindir}/kube-controller-manager
%{_bindir}/kube-scheduler %{_bindir}/kube-scheduler
%{_unitdir}/kube-apiserver.service
%{_unitdir}/kube-controller-manager.service
%{_unitdir}/kube-scheduler.service
%dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/apiserver
%config(noreplace) %{_sysconfdir}/%{name}/scheduler
%config(noreplace) %{_sysconfdir}/%{name}/config
%config(noreplace) %{_sysconfdir}/%{name}/controller-manager
%dir %{_sysconfdir}/%{name}/addons %dir %{_sysconfdir}/%{name}/addons
%dir %{_sysconfdir}/%{name}/addons/volumesnapshots %dir %{_sysconfdir}/%{name}/addons/volumesnapshots
%dir %{_sysconfdir}/%{name}/addons/volumesnapshots/crd %dir %{_sysconfdir}/%{name}/addons/volumesnapshots/crd
@ -1075,49 +1041,25 @@ fi
%dir %{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller %dir %{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller
%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller/volume-snapshot-controller-deployment.yaml %{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller/volume-snapshot-controller-deployment.yaml
%{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller/rbac-volume-snapshot-controller.yaml %{_sysconfdir}/%{name}/addons/volumesnapshots/volume-snapshot-controller/rbac-volume-snapshot-controller.yaml
%dir %{_sysconfdir}/%{name}/
%{_tmpfilesdir}/kubernetes.conf
%verify(not size mtime md5) %attr(755, kube,kube) %dir /run/%{name}
############################################## ##############################################
%files node %files node
%license LICENSE %license LICENSE
%doc *.md %{_stage2}%{_bindir}/kubelet
%{_mandir}/man1/kubelet.1* %{_stage2}%{_bindir}/kubelet-cgroup-setup.sh
%{_mandir}/man1/kube-proxy.1*
%{_bindir}/kubelet
%{_bindir}/kubelet-cgroup-setup.sh
%{_bindir}/kube-proxy
%{_unitdir}/kube-proxy.service
%{_unitdir}/kubelet.service
%dir %{_sharedstatedir}/kubelet
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/config
%config(noreplace) %{_sysconfdir}/%{name}/kubelet
%config(noreplace) %{_sysconfdir}/%{name}/kubelet.kubeconfig
%config(noreplace) %{_sysconfdir}/%{name}/proxy
%config(noreplace) %{_sysconfdir}/systemd/system.conf.d/kubernetes-accounting.conf
%{_tmpfilesdir}/kubernetes.conf
%verify(not size mtime md5) %attr(755, kube,kube) %dir /run/%{name}
############################################## ##############################################
%files kubeadm %files kubeadm
%license LICENSE %license LICENSE
%doc *.md %{_stage1}%{_bindir}/kubeadm
%{_mandir}/man1/kubeadm.1* %dir %{_stage2}%{_sysconfdir}/systemd/system/kubelet.service.d
%{_mandir}/man1/kubeadm-* %config(noreplace) %{_stage2}%{_sysconfdir}/systemd/system/kubelet.service.d/kubeadm.conf
%{_bindir}/kubeadm
%dir %{_sysconfdir}/systemd/system/kubelet.service.d
%config(noreplace) %{_sysconfdir}/systemd/system/kubelet.service.d/kubeadm.conf
############################################## ##############################################
%files client %files client
%license LICENSE %license LICENSE
%doc *.md %{_stage2}%{_bindir}/kubectl
%{_mandir}/man1/kubectl.1* %{_stage2}%{_datadir}/bash-completion/completions/kubectl
%{_mandir}/man1/kubectl-*
%{_bindir}/kubectl
%{_datadir}/bash-completion/completions/kubectl
############################################## ##############################################
%files unit-test %files unit-test
@ -1129,12 +1071,22 @@ fi
%dir %{gopath}/src/k8s.io %dir %{gopath}/src/k8s.io
%endif %endif
##############################################
%files kube-misc
%{_mandir}/man1/kube-apiserver.1*
%{_mandir}/man1/kube-controller-manager.1*
%{_mandir}/man1/kube-scheduler.1*
%{_mandir}/man1/kube-proxy.1*
%{_bindir}/kube-proxy
%{_mandir}/man1/kubelet.1*
%{_mandir}/man1/kubeadm.1*
%{_mandir}/man1/kubeadm-*
%{_mandir}/man1/kubectl.1*
%{_mandir}/man1/kubectl-*
############################################## ##############################################
%pre master %pre master
getent group kube >/dev/null || groupadd -r kube
getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
-c "Kubernetes user" kube
%post master %post master
%systemd_post kube-apiserver kube-scheduler kube-controller-manager %systemd_post kube-apiserver kube-scheduler kube-controller-manager
@ -1147,19 +1099,10 @@ getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
%pre node %pre node
getent group kube >/dev/null || groupadd -r kube
getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
-c "Kubernetes user" kube
%post node %post node
%systemd_post kubelet kube-proxy
# If accounting is not currently enabled systemd reexec
if [[ `systemctl show docker kubelet | grep -q -e CPUAccounting=no -e MemoryAccounting=no; echo $?` -eq 0 ]]; then
systemctl daemon-reexec
fi
%preun node %preun node
%systemd_preun kubelet kube-proxy
%postun node %postun node
%systemd_postun %systemd_postun