From 40b2efee6811c01ef2dca69c58a0f804afd43ddd Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Wed, 14 Aug 2024 11:49:46 +0200 Subject: [PATCH] initial package creation Signed-off-by: Toshaan Bharvani --- SOURCES/icinga-kubernetes.service | 11 +++++ SPECS/icinga-kubernetes.spec | 79 +++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 SOURCES/icinga-kubernetes.service create mode 100644 SPECS/icinga-kubernetes.spec diff --git a/SOURCES/icinga-kubernetes.service b/SOURCES/icinga-kubernetes.service new file mode 100644 index 0000000..9041f2e --- /dev/null +++ b/SOURCES/icinga-kubernetes.service @@ -0,0 +1,11 @@ +[Unit] +Description=Icinga for Kubernetes +After=syslog.target network-online.target mariadb.service postgresql.service + +[Service] +Type=notify +ExecStart=/usr/sbin/icinga-kubernetes --config /etc/icinga-kubernetes/config.yml +User=icinga-kubernetes + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/icinga-kubernetes.spec b/SPECS/icinga-kubernetes.spec new file mode 100644 index 0000000..4743c16 --- /dev/null +++ b/SPECS/icinga-kubernetes.spec @@ -0,0 +1,79 @@ +%global provider github +%global provider_tld com +%global project Icinga +%global repo icinga-kubernetes +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%define debug_package %nil +%define configdir %{_sysconfdir}/%{name} +%define service %{name}.service + +Name: icinga-kubernetes +Version: 0.1.0 +Release: 1%{?dist} +Summary: Icinga Kubernetes +Group: System Environment/Daemons +License: AGPLv3+ +URL: https://%{provider_prefix} +Source1: icinga-kubernetes.service +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildRequires: gcc +BuildRequires: git +BuildRequires: systemd +Requires(pre): shadow-utils + + +%description +Icinga Kubernetes + + +%prep +%setup -q -T -c %{name}-%{version} +git clone https://%{provider_prefix} . +git checkout v%{version} + + +%build +go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}"" -buildvcs=false -trimpath ./cmd/... + + +%install +install -d -m 0755 %{buildroot}%{_sbindir} +install -d -m 0755 %{buildroot}%{configdir} +install -d -m 0755 %{buildroot}%{_unitdir} +install -d -m 0755 %{buildroot}%{_libexecdir}/%{name} +install -m 0755 icinga-kubernetes %{buildroot}%{_sbindir}/ +install -m 0644 config.example.yml %{buildroot}%{configdir}/config.yml +install -m 0644 %{S:1} %{buildroot}%{_unitdir}/ +install -d -m 0755 %{buildroot}%{_datadir}/%{name} +(umask 0022 && cp -rv schema %{buildroot}%{_datadir}/%{name}/) + + +%pre +getent group icingakubernetes >/dev/null || groupadd -r icingakubernetes +getent passwd icingakubernetes >/dev/null || useradd -r -g icingakubernetes -d /etc/icingakubernetes -s /sbin/nologin -c 'Icinga Kubernetes' icingakubernetes +%post +%systemd_post %{service} +%preun +%systemd_preun %{service} +%postun +%systemd_postun %{service} + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root) +%doc LICENSE README.md +%{_sbindir}/icinga-kubernetes +%{_unitdir}/%{service} +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/schema +%defattr(0644,icingakubernetes,icingakubernetes,0755) +%dir %{configdir} +%config(noreplace) %{configdir}/config.yml + + +%changelog