commit 74ff5d3e49cbbbc60f92cee860d1677c5ceca7e40499bde530f40f7983236e53 Author: Christian Goll Date: Mon Oct 4 13:57:59 2021 +0000 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 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/LocalStateDir-is-configureable-to-meet-FHS.patch b/LocalStateDir-is-configureable-to-meet-FHS.patch new file mode 100644 index 0000000..012670d --- /dev/null +++ b/LocalStateDir-is-configureable-to-meet-FHS.patch @@ -0,0 +1,128 @@ +From b670e183470c97e7fc0a266866ec3e9964084d12 Mon Sep 17 00:00:00 2001 +From: Christian Goll +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 + diff --git a/vendor.tar.gz b/vendor.tar.gz new file mode 100644 index 0000000..4ded365 --- /dev/null +++ b/vendor.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65783e69b83be9ce0a2bede542ae5983b23c15994c8e4487ed83adb1c1745808 +size 3526332 diff --git a/warewulf-4.2.0rc1.tar.gz b/warewulf-4.2.0rc1.tar.gz new file mode 100644 index 0000000..bf4e11d --- /dev/null +++ b/warewulf-4.2.0rc1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:170863dc9933cd03139230f1e9248a32995774433697dd7a50a4751c2d954b35 +size 1298108 diff --git a/warewulf.conf b/warewulf.conf new file mode 100644 index 0000000..1c1dbb7 --- /dev/null +++ b/warewulf.conf @@ -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 diff --git a/warewulf4-rpmlintrc b/warewulf4-rpmlintrc new file mode 100644 index 0000000..c43e4f0 --- /dev/null +++ b/warewulf4-rpmlintrc @@ -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.*") diff --git a/warewulf4.changes b/warewulf4.changes new file mode 100644 index 0000000..da52457 --- /dev/null +++ b/warewulf4.changes @@ -0,0 +1,46 @@ +------------------------------------------------------------------- +Mon Oct 4 09:33:34 UTC 2021 - Christian Goll + +- 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 + +- 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 + +- updated to warewulf-v4.1.0 prerelease instead of HEAD + +------------------------------------------------------------------- +Wed Jul 21 15:40:15 UTC 2021 - Christian Goll + +- 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 diff --git a/warewulf4.spec b/warewulf4.spec new file mode 100644 index 0000000..f81608d --- /dev/null +++ b/warewulf4.spec @@ -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