SPECS/kubernetes/kubernetes.spec
d62c1188
 %global commit		e310e619fc1ac4f3238bf5ebe9e7033bf5d47ee2
f4d17450
 %global shortcommit	%(c=%{commit}; echo ${c:0:7})
 
 Summary:	Kubernetes cluster management
 Name:		kubernetes
f14e6e41
 Version:	1.1.8
c3a3fd12
 Release:	4%{?dist}
f4d17450
 License:	ASL 2.0
 URL:		https://github.com/GoogleCloudPlatform/kubernetes
d62c1188
 Source0:	https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v%{version}/%{name}-v%{version}.tar.gz
f14e6e41
 %define sha1 kubernetes-v%{version}.tar.gz=496e4e214804df9271c1065150a9e553b518dd42
d62c1188
 Source1:	https://github.com/GoogleCloudPlatform/kubernetes/archive/%{commit}/kubernetes-e310e61.tar.gz
 %define sha1 kubernetes-e310e61=a77e22b1677450c94f7b5eaf50586bb6adcf7e6d
f4d17450
 Group:		Development/Tools
 Vendor:		VMware, Inc.
 Distribution: 	Photon
 Requires:	etcd >= 2.0.0
 Requires:	shadow
d0fc675c
 
f4d17450
 %description
 Kubernetes is an open source implementation of container cluster management.
d0fc675c
 
f4d17450
 %prep -p exit
f14e6e41
 %setup -qn %{name}
f4d17450
 tar xf %{SOURCE1}
d0fc675c
 
f4d17450
 %build
d0fc675c
 
f4d17450
 %install
 install -vdm644 %{buildroot}/etc/profile.d
 install -vdm755 tmp
d62c1188
 tar -C tmp/ -xvf server/kubernetes-server-linux-amd64.tar.gz
f4d17450
 
 install -m 755 -d %{buildroot}%{_bindir}
 
f14e6e41
 binaries=(kube-apiserver kube-controller-manager kube-scheduler kube-proxy kubelet kubectl hyperkube)
f4d17450
 for bin in "${binaries[@]}"; do
   echo "+++ INSTALLING ${bin}"
   install -p -m 755 -t %{buildroot}%{_bindir} tmp/kubernetes/server/bin/${bin}
 done
 
 # install the bash completion
 install -d -m 0755 %{buildroot}%{_datadir}/bash-completion/completions/
 install -t %{buildroot}%{_datadir}/bash-completion/completions/ kubernetes-%{commit}/contrib/completions/bash/kubectl
 
 # install config files
 install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}
 install -m 644 -t %{buildroot}%{_sysconfdir}/%{name} kubernetes-%{commit}/contrib/init/systemd/environ/*
 
 # install service files
 install -d -m 0755 %{buildroot}/usr/lib/systemd/system
 install -m 0644 -t %{buildroot}/usr/lib/systemd/system kubernetes-%{commit}/contrib/init/systemd/*.service
 
 # install manpages
 install -d %{buildroot}%{_mandir}/man1
 install -p -m 644 kubernetes-%{commit}/docs/man/man1/* %{buildroot}%{_mandir}/man1
 
 # install the place the kubelet defaults to put volumes
 install -d %{buildroot}/var/lib/kubelet
 
 %check
 make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
d0fc675c
 
f4d17450
 %clean
 rm -rf %{buildroot}/*
d0fc675c
 
f4d17450
 %pre
4aa873d5
 if [ $1 -eq 1 ]; then
d45b7400
     # Initial installation.
     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
 fi
 
 %postun
4aa873d5
 if [ $1 -eq 0 ]; then
d45b7400
     # Package deletion
     userdel kube
     groupdel kube 
 fi
d0fc675c
 
f4d17450
 %files
 %defattr(-,root,root)
 %{_bindir}/*
 %{_mandir}/man1/*
 /usr/lib/systemd/system/kube-apiserver.service
 /usr/lib/systemd/system/kubelet.service
 /usr/lib/systemd/system/kube-scheduler.service
 /usr/lib/systemd/system/kube-controller-manager.service
 /usr/lib/systemd/system/kube-proxy.service
 %dir %{_sysconfdir}/%{name}
 %{_datadir}/bash-completion/completions/kubectl
 %dir /var/lib/kubelet
 %config(noreplace) %{_sysconfdir}/%{name}/config
 %config(noreplace) %{_sysconfdir}/%{name}/apiserver
 %config(noreplace) %{_sysconfdir}/%{name}/controller-manager
 %config(noreplace) %{_sysconfdir}/%{name}/proxy
 %config(noreplace) %{_sysconfdir}/%{name}/kubelet
 %config(noreplace) %{_sysconfdir}/%{name}/scheduler
d0fc675c
 
f4d17450
 %changelog
c3a3fd12
 *	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.1.8-4
 -	GA - Bump release of all rpms
4aa873d5
 *       Wed May 18 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.1.8-3
 -       Fix if syntax
d45b7400
 *       Thu May 05 2016 Kumar Kaushik <kaushikk@vmware.com> 1.1.8-2
 -       Adding support to pre/post/un scripts for package upgrade.
 *       Tue Feb 23 2016 Harish Udaiya Kumar <hudaiyakumar@vmware.com> 1.1.8-1
 -       Upgraded to version 1.1.8
d62c1188
 *	Mon Aug 3 2015 Tom Scanlan <tscanlan@vmware.com> 1.0.2-1
 -	bump up to latest release
d0fc675c
 *	Thu Jul 23 2015 Vinay Kulkarni <kulkarniv@vmware.com> 1.0.1-1
 -	Upgrade to kubernetes v1.0.1
f4d17450
 *	Tue Mar 10 2015 Divya Thaluru <dthaluru@vmware.com> 0.12.1-1
 -	Initial build. First version