File kubernetes.spec of Package kubernetes

%define realname kubernetes
%define srcext   tar.xz

%if ! 0%{?go_os:1}
%define go_os %(go env GOOS)
%endif
%if ! 0%{?go_arch:1}
%define go_arch %(go env GOARCH)
%endif

# Common info
Name:          %{realname}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       Apache-2.0
Group:         System/Management
URL:           https://kubernetes.io/
Summary:       Production-Grade Container Scheduling and Management

# Build-time parameters
BuildRequires: go >= 1.14.4
BuildRequires: gcc binutils-gold
BuildRequires: rsync
BuildRequires: pkg-config
BuildRequires: pkgconfig(libseccomp)
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       %{realname}-%{version}.%{srcext}
# Completions
Source11:      kubectl-completions

%description
Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.

%package -n kube-apiserver
Group:         System/Management
Summary:       Main api server and master for the Kubernetes cluster
Provides:      kubernetes-apiserver = %{version}-%{release}
%description -n kube-apiserver
The Kubernetes API server validates and configures data for the api objects
which include pods, services, replicationcontrollers, and others. The API Server
services REST operations and provides the frontend to the cluster's shared state
through which all other components interact.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kube-apiserver
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/kube-apiserver

%package -n kube-controller-manager
Group:         System/Management
Summary:       The Kubernetes controller manager
Provides:      kubernetes-controller-manager = %{version}-%{release}
%description -n kube-controller-manager
The Kubernetes controller manager is a daemon that embeds
the core control loops shipped with Kubernetes. In applications of robotics and
automation, a control loop is a non-terminating loop that regulates the state of
the system. In Kubernetes, a controller is a control loop that watches the shared
state of the cluster through the apiserver and makes changes attempting to move the
current state towards the desired state. Examples of controllers that ship with
Kubernetes today are the replication controller, endpoints controller, namespace
controller, and serviceaccounts controller.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kube-controller-manager
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/kube-controller-manager

%package -n kube-apiextensions-apiserver
Group:         System/Management
Summary:       API extensions for the Kubernetes API server
Provides:      apiextensions-apiserver = %{version}-%{release}
Provides:      kubernetes-apiextensions-apiserver = %{version}-%{release}
%description -n kube-apiextensions-apiserver
This API server provides the implementation for CustomResourceDefinitions which
is included as delegate server inside of kube-apiserver.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kube-apiextensions-apiserver
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/apiextensions-apiserver

%package -n cloud-controller-manager
Group:         System/Management
Summary:       Cloud-specific control logic for the Kubernetes cluster
%description -n cloud-controller-manager
The Cloud controller manager is a daemon that embeds the cloud specific control
loops shipped with Kubernetes.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n cloud-controller-manager
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/cloud-controller-manager

%package -n kube-scheduler
Group:         System/Management
Summary:       The Kubernetes pod scheduler
Provides:      kubernetes-scheduler = %{version}-%{release}
%description -n kube-scheduler
The Kubernetes scheduler is a policy-rich, topology-aware,
workload-specific function that significantly impacts availability, performance,
and capacity. The scheduler needs to take into account individual and collective
resource requirements, quality of service requirements, hardware/software/policy
constraints, affinity and anti-affinity specifications, data locality, inter-workload
interference, deadlines, and so on. Workload-specific requirements will be exposed
through the API as necessary. See https://kubernetes.io/docs/concepts/scheduling/
for more information about scheduling and the kube-scheduler component.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kube-scheduler
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/kube-scheduler

%package -n kubelet
Group:         System/Management
Summary:       The primary "node agent" that runs on each kubernetes node
Provides:      kubernetes-kubelet = %{version}-%{release}
%description -n kubelet
The kubelet is the primary "node agent" that runs on each
node. It can register the node with the apiserver using one of: the hostname; a flag to
override the hostname; or specific logic for a cloud provider.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kubelet
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/kubelet

%package -n kube-proxy
Group:         System/Management
Summary:       The Kubernetes network proxy
Provides:      kubernetes-proxy = %{version}-%{release}
%description -n kube-proxy
The Kubernetes network proxy runs on each node. This
reflects services as defined in the Kubernetes API on each node and can do simple
TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends.
Service cluster IPs and ports are currently found through Docker-links-compatible
environment variables specifying ports opened by the service proxy. There is an optional
addon that provides cluster DNS for these cluster IPs. The user must create a service
with the apiserver API to configure the proxy.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kube-proxy
%defattr(-,root,root)
%dir %{_sysconfdir}/kubernetes
%{_sbindir}/kube-proxy

%package -n kubeadm
Group:         System/Management
Summary:       Tool to easily bootstrap a secure Kubernetes cluster
Provides:      kubernetes-kubeadm = %{version}-%{release}
%description -n kubeadm
kubeadm also supports other cluster lifecycle functions, such as bootstrap
tokens and cluster upgrades.

The kubeadm tool is good if you need:

  * A simple way for you to try out Kubernetes, possibly for the first time.
  * A way for existing users to automate setting up a cluster and test
    their application.
  * A building block in other ecosystem and/or installer tools with a
    larger scope.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kubeadm
%defattr(-,root,root)
%{_bindir}/kubeadm

%package -n kubectl
Group:         System/Management
Summary:       Tool for controlling Kubernetes clusters
Provides:      kubernetes-client = %{version}-%{release}
%description -n kubectl
Kubectl is a command line tool for controlling Kubernetes clusters.

Kubernetes is an open source system for managing containerized applications
across multiple hosts. It provides basic mechanisms for deployment, maintenance,
and scaling of applications.
%files -n kubectl
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/profile.d/kubectl.sh
%{_bindir}/kubectl

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}

# Build step (compile/build binaries, documentation, etc)
%build
# Version file
PKG_VERSION=%{version}
KUBE_GIT_MINOR=${PKG_VERSION#*.}
KUBE_GIT_MAJOR=${PKG_VERSION%.${KUBE_GIT_MINOR}}
KUBE_GIT_MINOR=${KUBE_GIT_MINOR%%.*}
cat > version <<EOF
KUBE_GIT_COMMIT=refs/tags/v%{version}
KUBE_GIT_TREE_STATE=clean
KUBE_GIT_VERSION=v%{version}
KUBE_GIT_MAJOR=$KUBE_GIT_MAJOR
KUBE_GIT_MINOR=$KUBE_GIT_MINOR
EOF
# Build
export CGO_ENABLED=1
export CC=gcc
export CGO_CFLAGS='%{optflags} %{?gcc_lto}'
export CGO_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
export GOFLAGS='-a -v -buildmode=pie -mod=vendor -tags=apparmor,seccomp,tools,v1alpha1'
export GOGCFLAGS='-dwarf=false'
export GOLDFLAGS='-linkmode external -extld gcc -extldflags "-fuse-ld=gold -Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"'
export KUBE_GIT_VERSION_FILE=$(pwd -P)/version
%{__make} generated_files
bash -x hack/make-rules/build.sh
bash -x hack/make-rules/build.sh cmd/cloud-controller-manager

# Install built stuff
%install
%{__install} -d -m0755 %{buildroot}%{_bindir}
%{__install} -d -m0755 %{buildroot}%{_sbindir}
%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/kubernetes
for binary in kubeadm kubectl; do
  %{__install} -m0755 _output/local/bin/%{go_os}/%{go_arch}/$binary %{buildroot}%{_bindir}/$binary
done
for daemon in apiextensions-apiserver cloud-controller-manager kube-apiserver kube-controller-manager kube-proxy kube-scheduler kubelet; do
  %{__install} -m0755 _output/local/bin/%{go_os}/%{go_arch}/$daemon %{buildroot}%{_sbindir}/$daemon
done
# Completions
%{__install} -D -m0644 %{S:11} %{buildroot}%{_sysconfdir}/profile.d/kubectl.sh

# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%changelog
openSUSE Build Service is sponsored by