integ/kubernetes/registry-token-server/centos/registry-token-server.spec
Jerry Sun 6714d6b8d7 Add Docker Registry Token Server
As part of setting up Keystone authentication with Docker registry,
a token server needs to be deployed and managed by SM. This commit
adds the source code and spec files to build the token server used by
Docker registry for authentication with Keystone. The token server is
a modified version of the example token server provided by Docker
Distribution. The changes uses the Gophercloud library to communicate
with Keystone as opposed to checking the user credentials against an
existing HTPASSWD file.

Story: 2002840
Task: 22783
Depends-On: https://review.openstack.org/#/c/625335/

Change-Id: I00f5aa1073d496aa0b08223c6fa1fcbaf9d5b89b
Signed-off-by: Jerry Sun <jerry.sun@windriver.com>
2019-01-08 11:42:04 -05:00

62 lines
1.7 KiB
RPMSpec

%if ! 0%{?gobuild:1}
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
%endif
Name: registry-token-server
Version: 1.0.0
Release: 1%{?_tis_dist}.%{tis_patch_ver}
Summary: Token server for use with Docker registry with Openstack Keystone back end
License: ASL 2.0
Source0: registry-token-server-%{version}.tar.gz
Source1: %{name}.service
Source2: token_server.conf
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: golang >= 1.6
BuildRequires: golang-dep
ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
%description
%{summary}
%prep
%setup -q -n registry-token-server-%{version}
%build
mkdir -p ./_build/src/
ln -s $(pwd) ./_build/src/registry-token-server
export GOPATH=$(pwd)/_build:%{gopath}
cd ./_build/src/registry-token-server
dep ensure
%gobuild -o bin/registry-token-server registry-token-server
%install
install -d -p %{buildroot}%{_bindir}
install -p -m 0755 bin/registry-token-server %{buildroot}%{_bindir}
# install systemd/init scripts
install -d %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}
# install directory to install default certificate
install -d -p %{buildroot}%{_sysconfdir}/ssl/private
# install environment variables file for service file
install -d -p %{buildroot}%{_sysconfdir}/%{name}/registry
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/registry
#define license tag if not already defined
%{!?_licensedir:%global license %doc}
%files
%doc LICENSE
%{_bindir}/registry-token-server
%{_unitdir}/%{name}.service
%{_sysconfdir}/%{name}/registry/token_server.conf