SHA256
1
0
forked from pool/warewulf4

Accepting request 923039 from home:mslacken:pr

warewulf4 is rewirte of warewulf in go

OBS-URL: https://build.opensuse.org/request/show/923039
OBS-URL: https://build.opensuse.org/package/show/network:cluster/warewulf4?expand=0&rev=1
This commit is contained in:
Christian Goll 2021-10-04 13:57:59 +00:00 committed by Git OBS Bridge
commit 74ff5d3e49
9 changed files with 363 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,128 @@
From b670e183470c97e7fc0a266866ec3e9964084d12 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Wed, 21 Jul 2021 12:45:16 +0200
Subject: [PATCH] LocalStateDir is configureable to meet FHS
---
Makefile | 27 +++++++++++-----------
internal/app/wwctl/configure/nfs/main.go | 2 +-
internal/pkg/config/config.go | 16 ++++++++++---
internal/pkg/warewulfconf/datastructure.go | 1 +
4 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
index 0babd54..7169b6c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
.PHONY: all
VERSION := 4.2.0
+LOCALSTATE ?= /var/warewulf/
# auto installed tooling
TOOLS_DIR := .tools
@@ -52,8 +53,8 @@ debian: all
files: all
install -d -m 0755 $(DESTDIR)/usr/bin/
- install -d -m 0755 $(DESTDIR)/var/warewulf/
- install -d -m 0755 $(DESTDIR)/var/warewulf/chroots
+ install -d -m 0755 $(DESTDIR)$(LOCALSTATE)/
+ install -d -m 0755 $(DESTDIR)$(LOCALSTATE)/chroots
install -d -m 0755 $(DESTDIR)/etc/warewulf/
install -d -m 0755 $(DESTDIR)/etc/warewulf/ipxe
install -d -m 0755 $(DESTDIR)/var/lib/tftpboot/warewulf/ipxe/
@@ -63,12 +64,12 @@ files: all
test -f $(DESTDIR)/etc/warewulf/hosts.tmpl || install -m 644 etc/hosts.tmpl $(DESTDIR)/etc/warewulf/
cp -r etc/dhcp $(DESTDIR)/etc/warewulf/
cp -r etc/ipxe $(DESTDIR)/etc/warewulf/
- cp -r overlays $(DESTDIR)/var/warewulf/
- chmod +x $(DESTDIR)/var/warewulf/overlays/system/default/init
- chmod 600 $(DESTDIR)/var/warewulf/overlays/system/default/etc/ssh/ssh*
- chmod 644 $(DESTDIR)/var/warewulf/overlays/system/default/etc/ssh/ssh*.pub.ww
- mkdir -p $(DESTDIR)/var/warewulf/overlays/system/default/warewulf/bin/
- cp wwclient $(DESTDIR)/var/warewulf/overlays/system/default/warewulf/bin/
+ cp -r overlays $(DESTDIR)$(LOCALSTATE)/
+ chmod +x $(DESTDIR)$(LOCALSTATE)/overlays/system/default/init
+ chmod 600 $(DESTDIR)$(LOCALSTATE)/overlays/system/default/etc/ssh/ssh*
+ chmod 644 $(DESTDIR)$(LOCALSTATE)/overlays/system/default/etc/ssh/ssh*.pub.ww
+ mkdir -p $(DESTDIR)$(LOCALSTATE)/overlays/system/default/warewulf/bin/
+ cp wwclient $(DESTDIR)$(LOCALSTATE)/overlays/system/default/warewulf/bin/
cp wwctl $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/lib/firewalld/services
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)/usr/lib/firewalld/services
@@ -82,11 +83,11 @@ files: all
# restorecon -r /var/lib/tftpboot/warewulf
debfiles: debian
- chmod +x $(DESTDIR)/var/warewulf/overlays/system/debian/init
- chmod 600 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh*
- chmod 644 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh*.pub.ww
- mkdir -p $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/
- cp wwclient $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/
+ chmod +x $(DESTDIR)$(LOCALSTATE)/overlays/system/debian/init
+ chmod 600 $(DESTDIR)$(LOCALSTATE)/overlays/system/debian/etc/ssh/ssh*
+ chmod 644 $(DESTDIR)$(LOCALSTATE)/overlays/system/debian/etc/ssh/ssh*.pub.ww
+ mkdir -p $(DESTDIR)$(LOCALSTATE)/overlays/system/debian/warewulf/bin/
+ cp wwclient $(DESTDIR)$(LOCALSTATE)/overlays/system/debian/warewulf/bin/
wwctl:
cd cmd/wwctl; GOOS=linux go build -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../wwctl
diff --git a/internal/app/wwctl/configure/nfs/main.go b/internal/app/wwctl/configure/nfs/main.go
index 7827b24..4657f66 100644
--- a/internal/app/wwctl/configure/nfs/main.go
+++ b/internal/app/wwctl/configure/nfs/main.go
@@ -40,7 +40,7 @@ func Configure(show bool) error {
}
defer exports.Close()
- fstab, err := os.OpenFile("/var/warewulf/overlays/system/default/etc/fstab", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
+ fstab, err := os.OpenFile(fmt.Sprintf("%s/overlays/system/default/etc/fstab",controller.LocalStateDir), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
wwlog.Printf(wwlog.ERROR, "%s\n", err)
os.Exit(1)
diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go
index 34a9f00..c08221d 100644
--- a/internal/pkg/config/config.go
+++ b/internal/pkg/config/config.go
@@ -6,11 +6,21 @@ import (
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
+ "github.com/hpcng/warewulf/internal/pkg/warewulfconf"
)
-const (
- LocalStateDir = "/var/warewulf"
-)
+var LocalStateDir = "/var/warewulf"
+
+func init() {
+ conf, err := warewulfconf.New()
+ if err != nil {
+ wwlog.Printf(wwlog.ERROR, "%s\n", err)
+ return
+ }
+ if conf.LocalStateDir != "" {
+ LocalStateDir = conf.LocalStateDir
+ }
+}
func OverlayDir() string {
return fmt.Sprintf("%s/overlays/", LocalStateDir)
diff --git a/internal/pkg/warewulfconf/datastructure.go b/internal/pkg/warewulfconf/datastructure.go
index 8315ddd..a688617 100644
--- a/internal/pkg/warewulfconf/datastructure.go
+++ b/internal/pkg/warewulfconf/datastructure.go
@@ -13,6 +13,7 @@ type ControllerConf struct {
Netmask string `yaml:"netmask"`
Network string `yaml:"network,omitempty"`
Fqdn string `yaml:"fqdn,omitempty"`
+ LocalStateDir string `yaml:"localstatedir"`
Warewulf *WarewulfConf `yaml:"warewulf"`
Dhcp *DhcpConf `yaml:"dhcp"`
Tftp *TftpConf `yaml:"tftp"`
--
2.33.0

3
vendor.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65783e69b83be9ce0a2bede542ae5983b23c15994c8e4487ed83adb1c1745808
size 3526332

3
warewulf-4.2.0rc1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:170863dc9933cd03139230f1e9248a32995774433697dd7a50a4751c2d954b35
size 1298108

23
warewulf.conf Normal file
View File

@ -0,0 +1,23 @@
ipaddr: 10.10.93.254
netmask: 255.255.255.0
localstatedir: /var/lib/warewulf
warewulf:
port: 9873
secure: true
update interval: 60
dhcp:
enabled: true
range start: 10.10.93.10
range end: 10.10.93.250
template: default
systemd name: dhcpd
config file: /etc/dhcpd.conf
tftp:
enabled: true
tftproot: /srv/tftpboot
systemd name: tftp
nfs:
systemd name: nfs-server
exports:
- /home
- /var/lib/warewulf

10
warewulf4-rpmlintrc Normal file
View File

@ -0,0 +1,10 @@
# ignore hidden files and executable bits in overlay
# directories, as this files are meant to be run on
# compute nodes
addFilter("hidden-file-or-dir /var/lib/warewulf/overlays/,*")
addFilter("non-executable-script /var/lib/warewulf/overlays/.*")
# wwclient is called on a compute *before* systemd in
# order to provision the system, so it *must* be statically linked
addFilter("statically-linked-binary /var/lib/warewulf/overlays/system/default/warewulf/bin/wwclient")
# go binaries are hard to strip
addFilter("unstripped-binary-or-object.*")

46
warewulf4.changes Normal file
View File

@ -0,0 +1,46 @@
-------------------------------------------------------------------
Mon Oct 4 09:33:34 UTC 2021 - Christian Goll <cgoll@suse.com>
- updated to warewulf-v4.2.0rc1 with following new features:
* bash_completion can add nodes, container and other stuff
* kernels can now have arbitray names
* using syslog instead of logfile
* kernels get uncompresses on import
- Utilize sysuser infrastructure to set user/group warewulf
-------------------------------------------------------------------
Tue Aug 31 14:44:51 UTC 2021 - Christian Goll <cgoll@suse.com>
- updating to actual HEAD on github, as this version incorporates
some of the patches
- removed patches which are now in upstream:
* bash_completion.patch
* build-position-independent-code.patch
* install-creates-needed-dirs-and-checks-for-systemd.patch
* added-wicked-xml-configuration.patch
* added-configureable-ipmiinterface-used-by-ipmitool.patch
* preserve-ownership-for-overlays.patch
- added patch:
* added-function-CopyUIDGID-for-file-file-ownerships.patch
-------------------------------------------------------------------
Tue Aug 10 09:13:00 UTC 2021 - Christian Goll <cgoll@suse.com>
- updated to warewulf-v4.1.0 prerelease instead of HEAD
-------------------------------------------------------------------
Wed Jul 21 15:40:15 UTC 2021 - Christian Goll <cgoll@suse.com>
- inital commit of warewulf4 which is a rewrite of warewulf in
go thus the new name
* including vector.tar.gz which are the deps
* warewulf.conf is the SUSE specific configuration file
- patches with new functionality, might be included upstream
* bash_completion.patch
* build-position-independent-code.patch
* install-creates-needed-dirs-and-checks-for-systemd.patch
* LocalStateDir-is-configureable-to-meet-FHS.patch
* added-wicked-xml-configuration.patch
* added-configureable-ipmiinterface-used-by-ipmitool.patch
* preserve-ownership-for-overlays.patch

126
warewulf4.spec Normal file
View File

@ -0,0 +1,126 @@
#
# spec file for package warewulf4
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global provider github
%global provider_tld com
%global project hpcng
%global repo warewulf
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
ExclusiveArch: x86_64 aarch64
Name: warewulf4
Version: 4.2.0rc1
Release: 0
Summary: A suite of tools for clustering
License: BSD-3-Clause
Group: Productivity/Clustering/Computing
URL: https://warewulf.hpcng.org/docs/
Source0: https://github.com/hpcng/warewulf/archive/v%{version}.tar.gz#/warewulf-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: warewulf.conf
Source3: warewulf4-rpmlintrc
# no firewalld in sle12
%if 0%{?sle_version} >= 150000 || 0%{?suse_version} > 1500
BuildRequires: firewalld
%endif
BuildRequires: go >= 1.15
BuildRequires: golang-packaging
BuildRequires: make
BuildRequires: sysuser-tools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch0: LocalStateDir-is-configureable-to-meet-FHS.patch
Requires: %{name}-overlay
Requires: dhcp-server
Requires: ipmitool
Requires: tftp
%{go_nostrip}
%description
Warewulf v4 combines ultra scalability, flexibility, and simplicity with being light weight, non-intrusive, and a great tool for scientists and seasoned system administrators alike. Warewulf empowers you to scalably and easily manage thousands of compute resources.
%package overlay
Requires(pre): %{name}
Summary: Default overlay for warewulf
Group: Productivity/Clustering/Computing
%description overlay
Includes the default overlays so that they can be updated seprately.
%prep
%setup -q -n warewulf-%{version}
%setup -q -D -T -a 1 -n warewulf-%{version}
%autopatch -p1
%build
%goprep %{import_path}
make %{?_smp_mflags}
%install
LOCALSTATE=%{_localstatedir}/lib/warewulf/ %{makeinstall}
mkdir -p %{buildroot}%{_sbindir}/
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcwarewulfd
chmod 755 %{buildroot}%{_localstatedir}/lib/warewulf/overlays/system/default/warewulf/init.d/*
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
mv -v %{buildroot}%{_sysconfdir}/bash_completion.d/warewulf %{buildroot}%{_datadir}/bash-completion/completions/wwctl
cp %{S:2} %{buildroot}%{_sysconfdir}/warewulf/warewulf.conf
# create systemuser
echo "u warewulf -" > system-user-%{name}.conf
echo "g warewulf -" >> system-user-%{name}.conf
%sysusers_generate_pre system-user-%{name}.conf %{name} system-user-%{name}.conf
install -D -m 644 system-user-%{name}.conf %{buildroot}%{_sysusersdir}/system-user-%{name}.conf
%pre -f %{name}.pre
%service_add_pre warewulfd.service
%post
%service_add_post warewulfd.service
%preun
%service_del_preun warewulfd.service
%postun
%service_del_postun warewulfd.service
%files
%defattr(-,root,root)
%doc README.md LICENSE.md
%attr(0755, root, warewulf) %dir %{_sysconfdir}/warewulf
%attr(0755, root, warewulf) %dir %{_sysconfdir}/warewulf/dhcp
%attr(0755, root, warewulf) %dir %{_sysconfdir}/warewulf/ipxe
%{_datadir}/bash-completion/completions/wwctl
%{_mandir}/man1/wwctl*1.gz
%config(noreplace) %{_sysconfdir}/warewulf/warewulf.conf
%config(noreplace) %{_sysconfdir}/warewulf/hosts.tmpl
%config(noreplace) %{_sysconfdir}/warewulf/dhcp/*.conf
%config(noreplace) %{_sysconfdir}/warewulf/ipxe/*.ipxe
%{_prefix}/lib/firewalld/services/warewulf.xml
%{_localstatedir}/lib/warewulf
%exclude %{_localstatedir}/lib/warewulf/overlays
%{_bindir}/wwctl
%{_sbindir}/rcwarewulfd
%{_unitdir}/warewulfd.service
%{_sysusersdir}/system-user-%{name}.conf
%files overlay
%attr(0755, root, warewulf) %{_localstatedir}/lib/warewulf/overlays
%changelog