#debuginfo not supported with Go %global debug_package %{nil} # modifying the Go binaries breaks the DWARF debugging %global __os_install_post %{_rpmconfigdir}/brp-compress %global gopath %{_datadir}/gocode %global import_path github.com/openshift/origin %global sdn_import_path github.com/openshift/openshift-sdn # The following should only be used for cleanup of sdn-ovs upgrades %global kube_plugin_path /usr/libexec/kubernetes/kubelet-plugins/net/exec/redhat~openshift-ovs-subnet # docker_version is the version of docker requires by packages %global docker_version 1.9.1 # tuned_version is the version of tuned requires by packages %global tuned_version 2.3 # openvswitch_version is the version of openvswitch requires by packages %global openvswitch_version 2.3.1 # this is the version we obsolete up to. The packaging changed for Origin # 1.0.6 and OSE 3.1 such that 'openshift' package names were no longer used. %global package_refector_version 3.0.2.900 # %commit and %ldflags are intended to be set by tito custom builders provided # in the .tito/lib directory. The values in this spec file will not be kept up to date. %{!?commit: %global commit 86b5e46426ba828f49195af21c56f7c6674b48f7 } %global shortcommit %(c=%{commit}; echo ${c:0:7}) # ldflags from hack/common.sh os::build:ldflags %{!?ldflags: %global ldflags -X github.com/openshift/origin/pkg/version.majorFromGit 0 -X github.com/openshift/origin/pkg/version.minorFromGit 0+ -X github.com/openshift/origin/pkg/version.versionFromGit v0.0.1 -X github.com/openshift/origin/pkg/version.commitFromGit 86b5e46 -X k8s.io/kubernetes/pkg/version.gitCommit 6241a21 -X k8s.io/kubernetes/pkg/version.gitVersion v0.11.0-330-g6241a21 } %if 0%{?fedora} || 0%{?epel} %global make_redistributable 0 %else %global make_redistributable 1 %endif %if "%{dist}" == ".el7aos" %global package_name atomic-openshift %global product_name Atomic OpenShift %else %global package_name origin %global product_name Origin %endif Name: %{package_name} # Version is not kept up to date and is intended to be set by tito custom # builders provided in the .tito/lib directory of this project Version: 0.0.1 Release: 0%{?dist} Summary: Open Source Container Management by Red Hat License: ASL 2.0 URL: https://%{import_path} ExclusiveArch: x86_64 Source0: https://%{import_path}/archive/%{commit}/%{name}-%{version}.tar.gz BuildRequires: systemd BuildRequires: golang >= 1.4 Requires: %{name}-clients = %{version}-%{release} Requires: iptables Obsoletes: openshift < %{package_refector_version} # # The following Bundled Provides entries are populated automatically by the # OpenShift Origin tito custom builder found here: # https://github.com/openshift/origin/blob/master/.tito/lib/origin/builder/ # # These are defined as per: # https://fedoraproject.org/wiki/Packaging:Guidelines#Bundling_and_Duplication_of_system_libraries # ### AUTO-BUNDLED-GEN-ENTRY-POINT %description Origin is a distribution of Kubernetes optimized for enterprise application development and deployment, used by OpenShift 3 and Atomic Enterprise. Origin adds developer and operational centric tools on top of Kubernetes to enable rapid application development, easy deployment and scaling, and long-term lifecycle maintenance for small and large teams and applications. %package master Summary: %{product_name} Master Requires: %{name} = %{version}-%{release} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Obsoletes: openshift-master < %{package_refector_version} %description master %{summary} %package tests Summary: %{product_name} Test Suite Requires: %{name} = %{version}-%{release} %description tests %{summary} %package node Summary: %{product_name} Node Requires: %{name} = %{version}-%{release} Requires: docker >= %{docker_version} Requires: tuned-profiles-%{name}-node = %{version}-%{release} Requires: util-linux Requires: socat Requires: nfs-utils Requires: ethtool Requires(post): systemd Requires(preun): systemd Requires(postun): systemd Obsoletes: openshift-node < %{package_refector_version} %description node %{summary} %package -n tuned-profiles-%{name}-node Summary: Tuned profiles for %{product_name} Node hosts Requires: tuned >= %{tuned_version} Obsoletes: tuned-profiles-openshift-node < %{package_refector_version} %description -n tuned-profiles-%{name}-node %{summary} %package clients Summary: %{product_name} Client binaries for Linux Obsoletes: openshift-clients < %{package_refector_version} Requires: git %description clients %{summary} %if 0%{?make_redistributable} %package clients-redistributable Summary: %{product_name} Client binaries for Linux, Mac OSX, and Windows BuildRequires: golang-pkg-darwin-amd64 BuildRequires: golang-pkg-windows-386 Obsoletes: openshift-clients-redistributable < %{package_refector_version} %description clients-redistributable %{summary} %endif %package dockerregistry Summary: Docker Registry v2 for %{product_name} Requires: %{name} = %{version}-%{release} %description dockerregistry %{summary} %package pod Summary: %{product_name} Pod %description pod %{summary} %package recycle Summary: %{product_name} Recycler Requires: %{name} = %{version}-%{release} %description recycle %{summary} %package sdn-ovs Summary: %{product_name} SDN Plugin for Open vSwitch Requires: openvswitch >= %{openvswitch_version} Requires: %{name}-node = %{version}-%{release} Requires: bridge-utils Requires: ethtool Requires: procps-ng Requires: iproute Obsoletes: openshift-sdn-ovs < %{package_refector_version} %description sdn-ovs %{summary} %prep %setup -q %build # Don't judge me for this ... it's so bad. mkdir _build # Horrid hack because golang loves to just bundle everything pushd _build mkdir -p src/github.com/openshift ln -s $(dirs +1 -l) src/%{import_path} popd # Gaming the GOPATH to include the third party bundled libs at build # time. mkdir _thirdpartyhacks pushd _thirdpartyhacks ln -s \ $(dirs +1 -l)/Godeps/_workspace/src/ \ src popd export GOPATH=$(pwd)/_build:$(pwd)/_thirdpartyhacks:%{buildroot}%{gopath}:%{gopath} # Build all linux components we care about for cmd in oc openshift dockerregistry recycle do go install -ldflags "%{ldflags}" %{import_path}/cmd/${cmd} done go test -c -o _build/bin/extended.test -ldflags "%{ldflags}" %{import_path}/test/extended %if 0%{?make_redistributable} # Build clients for other platforms GOOS=windows GOARCH=386 go install -ldflags "%{ldflags}" %{import_path}/cmd/oc GOOS=darwin GOARCH=amd64 go install -ldflags "%{ldflags}" %{import_path}/cmd/oc %endif #Build our pod pushd images/pod/ go build -ldflags "%{ldflags}" pod.go popd %install install -d %{buildroot}%{_bindir} # Install linux components for bin in oc openshift dockerregistry recycle do echo "+++ INSTALLING ${bin}" install -p -m 755 _build/bin/${bin} %{buildroot}%{_bindir}/${bin} done install -d %{buildroot}%{_libexecdir}/%{name} install -p -m 755 _build/bin/extended.test %{buildroot}%{_libexecdir}/%{name}/ %if 0%{?make_redistributable} # Install client executable for windows and mac install -d %{buildroot}%{_datadir}/%{name}/{linux,macosx,windows} install -p -m 755 _build/bin/oc %{buildroot}%{_datadir}/%{name}/linux/oc install -p -m 755 _build/bin/darwin_amd64/oc %{buildroot}/%{_datadir}/%{name}/macosx/oc install -p -m 755 _build/bin/windows_386/oc.exe %{buildroot}/%{_datadir}/%{name}/windows/oc.exe %endif #Install pod install -p -m 755 images/pod/pod %{buildroot}%{_bindir}/ install -d -m 0755 %{buildroot}%{_unitdir} mkdir -p %{buildroot}%{_sysconfdir}/sysconfig for cmd in \ atomic-enterprise \ kube-apiserver \ kube-controller-manager \ kube-proxy \ kube-scheduler \ kubelet \ kubernetes \ oadm \ openshift-deploy \ openshift-docker-build \ openshift-f5-router \ openshift-router \ openshift-sti-build \ origin do ln -s %{_bindir}/openshift %{buildroot}%{_bindir}/$cmd done ln -s oc %{buildroot}%{_bindir}/kubectl install -d -m 0755 %{buildroot}%{_sysconfdir}/origin/{master,node} # different service for origin vs aos install -m 0644 contrib/systemd/%{name}-master.service %{buildroot}%{_unitdir}/%{name}-master.service install -m 0644 contrib/systemd/%{name}-node.service %{buildroot}%{_unitdir}/%{name}-node.service # same sysconfig files for origin vs aos install -m 0644 contrib/systemd/origin-master.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}-master install -m 0644 contrib/systemd/origin-node.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name}-node install -d -m 0755 %{buildroot}%{_prefix}/lib/tuned/%{name}-node-{guest,host} install -m 0644 contrib/tuned/origin-node-guest/tuned.conf %{buildroot}%{_prefix}/lib/tuned/%{name}-node-guest/tuned.conf install -m 0644 contrib/tuned/origin-node-host/tuned.conf %{buildroot}%{_prefix}/lib/tuned/%{name}-node-host/tuned.conf install -d -m 0755 %{buildroot}%{_mandir}/man7 # Patch the manpage for tuned profiles on aos %if "%{dist}" == ".el7aos" %{__sed} -e 's|origin-node|atomic-openshift-node|g' \ -e 's|ORIGIN_NODE|ATOMIC_OPENSHIFT_NODE|' \ contrib/tuned/man/tuned-profiles-origin-node.7 > %{buildroot}%{_mandir}/man7/tuned-profiles-%{name}-node.7 %else install -m 0644 contrib/tuned/man/tuned-profiles-origin-node.7 %{buildroot}%{_mandir}/man7/tuned-profiles-%{name}-node.7 %endif mkdir -p %{buildroot}%{_sharedstatedir}/origin # Install sdn scripts install -d -m 0755 %{buildroot}%{_unitdir}/docker.service.d install -p -m 0644 contrib/systemd/docker-sdn-ovs.conf %{buildroot}%{_unitdir}/docker.service.d/ pushd _thirdpartyhacks/src/%{sdn_import_path}/plugins/osdn/ovs/bin install -p -m 755 openshift-sdn-ovs %{buildroot}%{_bindir}/openshift-sdn-ovs install -p -m 755 openshift-sdn-docker-setup.sh %{buildroot}%{_bindir}/openshift-sdn-docker-setup.sh popd install -d -m 0755 %{buildroot}%{_unitdir}/%{name}-node.service.d install -p -m 0644 contrib/systemd/openshift-sdn-ovs.conf %{buildroot}%{_unitdir}/%{name}-node.service.d/openshift-sdn-ovs.conf # Install bash completions install -d -m 755 %{buildroot}%{_sysconfdir}/bash_completion.d/ install -p -m 644 contrib/completions/bash/* %{buildroot}%{_sysconfdir}/bash_completion.d/ # Generate atomic-enterprise bash completions %{__sed} -e "s|openshift|atomic-enterprise|g" contrib/completions/bash/openshift > %{buildroot}%{_sysconfdir}/bash_completion.d/atomic-enterprise %files %doc README.md %license LICENSE %{_bindir}/openshift %{_bindir}/atomic-enterprise %{_bindir}/kube-apiserver %{_bindir}/kube-controller-manager %{_bindir}/kube-proxy %{_bindir}/kube-scheduler %{_bindir}/kubelet %{_bindir}/kubernetes %{_bindir}/oadm %{_bindir}/openshift-deploy %{_bindir}/openshift-docker-build %{_bindir}/openshift-f5-router %{_bindir}/openshift-router %{_bindir}/openshift-sti-build %{_bindir}/origin %{_sharedstatedir}/origin %{_sysconfdir}/bash_completion.d/atomic-enterprise %{_sysconfdir}/bash_completion.d/oadm %{_sysconfdir}/bash_completion.d/openshift %defattr(0700,-,-) %dir %config(noreplace) %{_sysconfdir}/origin %ghost %dir %config(noreplace) %{_sysconfdir}/origin %ghost %config(noreplace) %{_sysconfdir}/origin/.config_managed %pre # If /etc/openshift exists and /etc/origin doesn't, symlink it to /etc/origin if [ -d "%{_sysconfdir}/openshift" ]; then if ! [ -d "%{_sysconfdir}/origin" ]; then ln -s %{_sysconfdir}/openshift %{_sysconfdir}/origin fi fi if [ -d "%{_sharedstatedir}/openshift" ]; then if ! [ -d "%{_sharedstatedir}/origin" ]; then ln -s %{_sharedstatedir}/openshift %{_sharedstatedir}/origin fi fi %files tests %{_libexecdir}/%{name} %{_libexecdir}/%{name}/extended.test %files master %{_unitdir}/%{name}-master.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-master %defattr(0700,-,-) %config(noreplace) %{_sysconfdir}/origin/master %ghost %config(noreplace) %{_sysconfdir}/origin/admin.crt %ghost %config(noreplace) %{_sysconfdir}/origin/admin.key %ghost %config(noreplace) %{_sysconfdir}/origin/admin.kubeconfig %ghost %config(noreplace) %{_sysconfdir}/origin/ca.crt %ghost %config(noreplace) %{_sysconfdir}/origin/ca.key %ghost %config(noreplace) %{_sysconfdir}/origin/ca.serial.txt %ghost %config(noreplace) %{_sysconfdir}/origin/etcd.server.crt %ghost %config(noreplace) %{_sysconfdir}/origin/etcd.server.key %ghost %config(noreplace) %{_sysconfdir}/origin/master-config.yaml %ghost %config(noreplace) %{_sysconfdir}/origin/master.etcd-client.crt %ghost %config(noreplace) %{_sysconfdir}/origin/master.etcd-client.key %ghost %config(noreplace) %{_sysconfdir}/origin/master.kubelet-client.crt %ghost %config(noreplace) %{_sysconfdir}/origin/master.kubelet-client.key %ghost %config(noreplace) %{_sysconfdir}/origin/master.server.crt %ghost %config(noreplace) %{_sysconfdir}/origin/master.server.key %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-master.crt %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-master.key %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-master.kubeconfig %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-registry.crt %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-registry.key %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-registry.kubeconfig %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-router.crt %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-router.key %ghost %config(noreplace) %{_sysconfdir}/origin/openshift-router.kubeconfig %ghost %config(noreplace) %{_sysconfdir}/origin/policy.json %ghost %config(noreplace) %{_sysconfdir}/origin/serviceaccounts.private.key %ghost %config(noreplace) %{_sysconfdir}/origin/serviceaccounts.public.key %ghost %config(noreplace) %{_sysconfdir}/origin/.config_managed %post master %systemd_post %{name}-master.service # Create master config and certs if both do not exist if [[ ! -e %{_sysconfdir}/origin/master/master-config.yaml && ! -e %{_sysconfdir}/origin/master/ca.crt ]]; then %{_bindir}/openshift start master --write-config=%{_sysconfdir}/origin/master # Create node configs if they do not already exist if ! find %{_sysconfdir}/origin/ -type f -name "node-config.yaml" | grep -E "node-config.yaml"; then %{_bindir}/oadm create-node-config --node-dir=%{_sysconfdir}/origin/node/ --node=localhost --hostnames=localhost,127.0.0.1 --node-client-certificate-authority=%{_sysconfdir}/origin/master/ca.crt --signer-cert=%{_sysconfdir}/origin/master/ca.crt --signer-key=%{_sysconfdir}/origin/master/ca.key --signer-serial=%{_sysconfdir}/origin/master/ca.serial.txt --certificate-authority=%{_sysconfdir}/origin/master/ca.crt fi # Generate a marker file that indicates config and certs were RPM generated echo "# Config generated by RPM at "`date -u` > %{_sysconfdir}/origin/.config_managed fi %preun master %systemd_preun %{name}-master.service %postun master %systemd_postun %files node %{_unitdir}/%{name}-node.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-node %defattr(0700,-,-) %config(noreplace) %{_sysconfdir}/origin/node %ghost %config(noreplace) %{_sysconfdir}/origin/node/node-config.yaml %ghost %config(noreplace) %{_sysconfdir}/origin/.config_managed %post node %systemd_post %{name}-node.service %preun node %systemd_preun %{name}-node.service %postun node %systemd_postun %files sdn-ovs %dir %{_unitdir}/docker.service.d/ %dir %{_unitdir}/%{name}-node.service.d/ %{_bindir}/openshift-sdn-ovs %{_bindir}/openshift-sdn-docker-setup.sh %{_unitdir}/%{name}-node.service.d/openshift-sdn-ovs.conf %{_unitdir}/docker.service.d/docker-sdn-ovs.conf %posttrans sdn-ovs # This path was installed by older packages but the directory wasn't owned by # RPM so we need to clean it up otherwise kubelet throws an error trying to # load the directory as a plugin if [ -d %{kube_plugin_path} ]; then rmdir %{kube_plugin_path} fi %files -n tuned-profiles-%{name}-node %license LICENSE %{_prefix}/lib/tuned/%{name}-node-host %{_prefix}/lib/tuned/%{name}-node-guest %{_mandir}/man7/tuned-profiles-%{name}-node.7* %post -n tuned-profiles-%{name}-node recommended=`/usr/sbin/tuned-adm recommend` if [[ "${recommended}" =~ guest ]] ; then /usr/sbin/tuned-adm profile %{name}-node-guest > /dev/null 2>&1 else /usr/sbin/tuned-adm profile %{name}-node-host > /dev/null 2>&1 fi %preun -n tuned-profiles-%{name}-node # reset the tuned profile to the recommended profile # $1 = 0 when we're being removed > 0 during upgrades if [ "$1" = 0 ]; then recommended=`/usr/sbin/tuned-adm recommend` /usr/sbin/tuned-adm profile $recommended > /dev/null 2>&1 fi %files clients %license LICENSE %{_bindir}/oc %{_bindir}/kubectl %{_sysconfdir}/bash_completion.d/oc %if 0%{?make_redistributable} %files clients-redistributable %dir %{_datadir}/%{name}/linux/ %dir %{_datadir}/%{name}/macosx/ %dir %{_datadir}/%{name}/windows/ %{_datadir}/%{name}/linux/oc %{_datadir}/%{name}/macosx/oc %{_datadir}/%{name}/windows/oc.exe %endif %files dockerregistry %{_bindir}/dockerregistry %files pod %{_bindir}/pod %files recycle %{_bindir}/recycle %changelog * Fri Sep 18 2015 Scott Dodson 0.2-9 - Rename from openshift -> origin - Symlink /var/lib/origin to /var/lib/openshift if /var/lib/openshift exists * Wed Aug 12 2015 Steve Milner 0.2-8 - Master configs will be generated if none are found when the master is installed. - Node configs will be generated if none are found when the master is installed. - Additional notice file added if config is generated by the RPM. - All-In-One services removed. * Wed Aug 12 2015 Steve Milner 0.2-7 - Added new ovs script(s) to file lists. * Wed Aug 5 2015 Steve Milner 0.2-6 - Using _unitdir instead of _prefix for unit data * Fri Jul 31 2015 Steve Milner 0.2-5 - Configuration location now /etc/origin - Default configs created upon installation * Tue Jul 28 2015 Steve Milner 0.2-4 - Added AEP packages * Mon Jan 26 2015 Scott Dodson 0.2-3 - Update to 21fb40637c4e3507cca1fcab6c4d56b06950a149 - Split packaging of openshift-master and openshift-node * Mon Jan 19 2015 Scott Dodson 0.2-2 - new package built with tito * Fri Jan 09 2015 Adam Miller - 0.2-2 - Add symlink for osc command line tooling (merged in from jhonce@redhat.com) * Wed Jan 07 2015 Adam Miller - 0.2-1 - Update to latest upstream release - Restructured some of the golang deps build setup for restructuring done upstream * Thu Oct 23 2014 Adam Miller - 0-0.0.9.git562842e - Add new patches from jhonce for systemd units * Mon Oct 20 2014 Adam Miller - 0-0.0.8.git562842e - Update to latest master snapshot * Wed Oct 15 2014 Adam Miller - 0-0.0.7.git7872f0f - Update to latest master snapshot * Fri Oct 03 2014 Adam Miller - 0-0.0.6.gite4d4ecf - Update to latest Alpha nightly build tag 20141003 * Wed Oct 01 2014 Adam Miller - 0-0.0.5.git6d9f1a9 - Switch to consistent naming, patch by jhonce * Tue Sep 30 2014 Adam Miller - 0-0.0.4.git6d9f1a9 - Add systemd and sysconfig entries from jhonce * Tue Sep 23 2014 Adam Miller - 0-0.0.3.git6d9f1a9 - Update to latest upstream. * Mon Sep 15 2014 Adam Miller - 0-0.0.2.git2647df5 - Update to latest upstream.