added warewuld configure option
Co-authored-by: Jonathon Anderson <janderson@ciq.com> Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
f2d06d5928
commit
2c51ca7fff
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Support If-None-Match header in `PUT /api/nodes/{id}`
|
- Support If-None-Match header in `PUT /api/nodes/{id}`
|
||||||
- Added `PUT|DELETE /api/overlays/{name}/file?path={path}`
|
- Added `PUT|DELETE /api/overlays/{name}/file?path={path}`
|
||||||
- Added `DELETE /api/overlays/{name}/file?path={path}`
|
- Added `DELETE /api/overlays/{name}/file?path={path}`
|
||||||
|
- Added `wwctl configure warewulfd`
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
|
|
||||||
- Fixed a bug when cloning an overlay to site when parent is missing
|
- Fixed a bug when cloning an overlay to site when parent is missing
|
||||||
- Fixed `wwctl upgrade nodes` to properly handle kernel argument lists. #1938
|
- Fixed `wwctl upgrade nodes` to properly handle kernel argument lists. #1938
|
||||||
|
- Improved netplan support. #1873
|
||||||
|
|
||||||
## v4.6.2, 2025-07-09
|
## v4.6.2, 2025-07-09
|
||||||
|
|
||||||
|
|||||||
@@ -20,33 +20,32 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if allFunctions {
|
if allFunctions {
|
||||||
|
err = configure.WAREWULFD()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
err = configure.DHCP()
|
err = configure.DHCP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = configure.NFS()
|
err = configure.NFS()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = configure.SSH(warewulfconf.Get().SSH.KeyTypes...)
|
err = configure.SSH(warewulfconf.Get().SSH.KeyTypes...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = configure.TFTP()
|
err = configure.TFTP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
err = configure.Hostfile()
|
err = configure.Hostfile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wwlog.Error("%s", err)
|
return err
|
||||||
os.Exit(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/warewulf/warewulf/internal/app/wwctl/configure/nfs"
|
"github.com/warewulf/warewulf/internal/app/wwctl/configure/nfs"
|
||||||
"github.com/warewulf/warewulf/internal/app/wwctl/configure/ssh"
|
"github.com/warewulf/warewulf/internal/app/wwctl/configure/ssh"
|
||||||
"github.com/warewulf/warewulf/internal/app/wwctl/configure/tftp"
|
"github.com/warewulf/warewulf/internal/app/wwctl/configure/tftp"
|
||||||
|
"github.com/warewulf/warewulf/internal/app/wwctl/configure/warewulfd"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -28,6 +29,7 @@ func init() {
|
|||||||
baseCmd.AddCommand(ssh.GetCommand())
|
baseCmd.AddCommand(ssh.GetCommand())
|
||||||
baseCmd.AddCommand(nfs.GetCommand())
|
baseCmd.AddCommand(nfs.GetCommand())
|
||||||
baseCmd.AddCommand(hostfile.GetCommand())
|
baseCmd.AddCommand(hostfile.GetCommand())
|
||||||
|
baseCmd.AddCommand(warewulfd.GetCommand())
|
||||||
|
|
||||||
baseCmd.Flags().BoolVarP(&allFunctions, "all", "a", false, "Configure all services")
|
baseCmd.Flags().BoolVarP(&allFunctions, "all", "a", false, "Configure all services")
|
||||||
}
|
}
|
||||||
|
|||||||
10
internal/app/wwctl/configure/warewulfd/main.go
Normal file
10
internal/app/wwctl/configure/warewulfd/main.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package warewulfd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/warewulf/warewulf/internal/pkg/configure"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CobraRunE(cmd *cobra.Command, args []string) error {
|
||||||
|
return configure.WAREWULFD()
|
||||||
|
}
|
||||||
23
internal/app/wwctl/configure/warewulfd/root.go
Normal file
23
internal/app/wwctl/configure/warewulfd/root.go
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package warewulfd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
baseCmd = &cobra.Command{
|
||||||
|
DisableFlagsInUseLine: true,
|
||||||
|
Use: "warewulfd [OPTIONS]",
|
||||||
|
Short: "Enable and start warewulfd",
|
||||||
|
Long: "Enable and starts the warewulfd service.",
|
||||||
|
RunE: CobraRunE,
|
||||||
|
Args: cobra.NoArgs,
|
||||||
|
ValidArgsFunction: completions.None,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetRootCommand returns the root cobra.Command for the application.
|
||||||
|
func GetCommand() *cobra.Command {
|
||||||
|
return baseCmd
|
||||||
|
}
|
||||||
@@ -40,12 +40,13 @@ func (conf TFTPConf) Enabled() bool {
|
|||||||
// WarewulfConf adds additional Warewulf-specific configuration to
|
// WarewulfConf adds additional Warewulf-specific configuration to
|
||||||
// BaseConf.
|
// BaseConf.
|
||||||
type WarewulfConf struct {
|
type WarewulfConf struct {
|
||||||
Port int `yaml:"port,omitempty" default:"9873"`
|
Port int `yaml:"port,omitempty" default:"9873"`
|
||||||
SecureP *bool `yaml:"secure,omitempty" default:"true"`
|
SecureP *bool `yaml:"secure,omitempty" default:"true"`
|
||||||
UpdateInterval int `yaml:"update interval,omitempty" default:"60"`
|
UpdateInterval int `yaml:"update interval,omitempty" default:"60"`
|
||||||
AutobuildOverlaysP *bool `yaml:"autobuild overlays,omitempty" default:"true"`
|
AutobuildOverlaysP *bool `yaml:"autobuild overlays,omitempty" default:"true"`
|
||||||
EnableHostOverlayP *bool `yaml:"host overlay,omitempty" default:"true"`
|
EnableHostOverlayP *bool `yaml:"host overlay,omitempty" default:"true"`
|
||||||
GrubBootP *bool `yaml:"grubboot,omitempty" default:"false"`
|
GrubBootP *bool `yaml:"grubboot,omitempty" default:"false"`
|
||||||
|
SystemdName string `yaml:"systemd name,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (conf WarewulfConf) Secure() bool {
|
func (conf WarewulfConf) Secure() bool {
|
||||||
|
|||||||
22
internal/pkg/configure/warewulfd.go
Normal file
22
internal/pkg/configure/warewulfd.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package configure
|
||||||
|
|
||||||
|
import (
|
||||||
|
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
|
||||||
|
"github.com/warewulf/warewulf/internal/pkg/util"
|
||||||
|
"github.com/warewulf/warewulf/internal/pkg/wwlog"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WAREWULFD() (err error) {
|
||||||
|
controller := warewulfconf.Get()
|
||||||
|
if controller.Warewulf.SystemdName != "" {
|
||||||
|
wwlog.Info("Enabling and restarting the Warewulf server")
|
||||||
|
err = util.SystemdStart(controller.Warewulf.SystemdName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wwlog.Warn("Not (re)starting Warewulf server: no systemd name configured")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -97,6 +97,7 @@ type WarewulfConf struct {
|
|||||||
Syslog *bool `yaml:"syslog"`
|
Syslog *bool `yaml:"syslog"`
|
||||||
DataStore string `yaml:"datastore"`
|
DataStore string `yaml:"datastore"`
|
||||||
GrubBoot *bool `yaml:"grubboot"`
|
GrubBoot *bool `yaml:"grubboot"`
|
||||||
|
SystemdName string `yaml:"systemd name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (legacy *WarewulfConf) Upgrade() (upgraded *config.WarewulfConf) {
|
func (legacy *WarewulfConf) Upgrade() (upgraded *config.WarewulfConf) {
|
||||||
@@ -110,6 +111,7 @@ func (legacy *WarewulfConf) Upgrade() (upgraded *config.WarewulfConf) {
|
|||||||
wwlog.Warn("syslog configuration ignored: all logs now go to stdout/stderr")
|
wwlog.Warn("syslog configuration ignored: all logs now go to stdout/stderr")
|
||||||
}
|
}
|
||||||
upgraded.GrubBootP = legacy.GrubBoot
|
upgraded.GrubBootP = legacy.GrubBoot
|
||||||
|
upgraded.SystemdName = legacy.SystemdName
|
||||||
return upgraded
|
return upgraded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -483,6 +483,103 @@ image mounts:
|
|||||||
readonly: true
|
readonly: true
|
||||||
paths:
|
paths:
|
||||||
datadir: /usr/share
|
datadir: /usr/share
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "v4.6.3",
|
||||||
|
legacyYaml: `
|
||||||
|
ipaddr: 10.0.0.1
|
||||||
|
netmask: 255.255.252.0
|
||||||
|
network: 10.0.0.0
|
||||||
|
warewulf:
|
||||||
|
port: 9873
|
||||||
|
secure: false
|
||||||
|
update interval: 60
|
||||||
|
autobuild overlays: true
|
||||||
|
host overlay: true
|
||||||
|
syslog: false
|
||||||
|
datastore: /usr/share
|
||||||
|
systemd name: warewulfd
|
||||||
|
dhcp:
|
||||||
|
enabled: true
|
||||||
|
range start: 10.0.1.1
|
||||||
|
range end: 10.0.1.255
|
||||||
|
systemd name: dhcpd
|
||||||
|
tftp:
|
||||||
|
enabled: true
|
||||||
|
systemd name: tftp
|
||||||
|
ipxe:
|
||||||
|
00:0B: arm64-efi/snponly.efi
|
||||||
|
"00:00": undionly.kpxe
|
||||||
|
"00:07": ipxe-snponly-x86_64.efi
|
||||||
|
"00:09": ipxe-snponly-x86_64.efi
|
||||||
|
nfs:
|
||||||
|
enabled: true
|
||||||
|
export paths:
|
||||||
|
- path: /home
|
||||||
|
export options: rw,sync
|
||||||
|
mount options: defaults
|
||||||
|
mount: true
|
||||||
|
- path: /opt
|
||||||
|
export options: ro,sync,no_root_squash
|
||||||
|
mount options: defaults
|
||||||
|
mount: false
|
||||||
|
systemd name: nfs-server
|
||||||
|
ssh:
|
||||||
|
key types:
|
||||||
|
- rsa
|
||||||
|
- dsa
|
||||||
|
- ecdsa
|
||||||
|
- ed25519
|
||||||
|
container mounts:
|
||||||
|
- source: /etc/resolv.conf
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
readonly: true
|
||||||
|
`,
|
||||||
|
upgradedYaml: `
|
||||||
|
ipaddr: 10.0.0.1
|
||||||
|
netmask: 255.255.252.0
|
||||||
|
network: 10.0.0.0
|
||||||
|
warewulf:
|
||||||
|
port: 9873
|
||||||
|
secure: false
|
||||||
|
update interval: 60
|
||||||
|
autobuild overlays: true
|
||||||
|
host overlay: true
|
||||||
|
systemd name: warewulfd
|
||||||
|
dhcp:
|
||||||
|
enabled: true
|
||||||
|
range start: 10.0.1.1
|
||||||
|
range end: 10.0.1.255
|
||||||
|
systemd name: dhcpd
|
||||||
|
tftp:
|
||||||
|
enabled: true
|
||||||
|
systemd name: tftp
|
||||||
|
ipxe:
|
||||||
|
00:0B: arm64-efi/snponly.efi
|
||||||
|
"00:00": undionly.kpxe
|
||||||
|
"00:07": ipxe-snponly-x86_64.efi
|
||||||
|
"00:09": ipxe-snponly-x86_64.efi
|
||||||
|
nfs:
|
||||||
|
enabled: true
|
||||||
|
export paths:
|
||||||
|
- path: /home
|
||||||
|
export options: rw,sync
|
||||||
|
- path: /opt
|
||||||
|
export options: ro,sync,no_root_squash
|
||||||
|
systemd name: nfs-server
|
||||||
|
ssh:
|
||||||
|
key types:
|
||||||
|
- rsa
|
||||||
|
- dsa
|
||||||
|
- ecdsa
|
||||||
|
- ed25519
|
||||||
|
image mounts:
|
||||||
|
- source: /etc/resolv.conf
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
readonly: true
|
||||||
|
paths:
|
||||||
|
datadir: /usr/share
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user