Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure ntp servers #138

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Hammer is used to boot a bare metal server via PXE together with the Metal Stack kernel. Hammer is a initrd which runs a small golang binary as init process. This does the following actions:

- Ensures all interfaces are up
- Check if the server was booted in UEFI, if not modify the bios tu uefi and reboots
- Check if the server was booted in UEFI, if not modify the bios to uefi and reboots
- Wipes as existing disks by either:
- run secure erase if possible by using the mechanism in modern disks, this is true for most SSD´s and NVME disks.
- If not possible run mkfs.ext4 --discard on the disks.
Expand Down
8 changes: 6 additions & 2 deletions cmd/network/ntpdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
ntpServers = []string{
defaultNtpServers = []string{
"0.de.pool.ntp.org",
"1.de.pool.ntp.org",
"2.de.pool.ntp.org",
Expand All @@ -34,7 +34,11 @@ func getTime(log *slog.Logger, servers []string) (t time.Time, err error) {
}

// NtpDate set the system time to the time coming from a ntp source
func NtpDate(log *slog.Logger) {
func NtpDate(log *slog.Logger, ntpServers []string) {
if ntpServers == nil {
ntpServers = defaultNtpServers
}

t, err := getTime(log, ntpServers)
if err != nil {
log.Error("ntpdate", "unable to get time", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func Run(log *slog.Logger, spec *Specification, hal hal.InBand) (*event.EventEmi
}

// Set Time from ntp
network.NtpDate(log)
network.NtpDate(log, spec.MetalConfig.NTPServers)

reg := register.New(log, spec.MachineUUID, bootService, eventEmitter, n, hal)

Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ require (
github.com/jaypipes/ghw v0.12.0
github.com/metal-stack/go-hal v0.5.3
github.com/metal-stack/go-lldpd v0.4.7
github.com/metal-stack/metal-api v0.33.0
github.com/metal-stack/metal-api v0.34.0
github.com/metal-stack/metal-go v0.33.0
github.com/metal-stack/pixie v0.3.2
github.com/metal-stack/pixie v0.3.4
github.com/metal-stack/v v1.0.3
// archiver must stay in version v2.1.0, see replace below
github.com/mholt/archiver v3.1.1+incompatible
github.com/moby/sys/mountinfo v0.7.2
github.com/pierrec/lz4/v4 v4.1.21
github.com/prometheus/common v0.57.0
github.com/prometheus/common v0.59.1
github.com/samber/slog-loki/v3 v3.5.0
github.com/samber/slog-multi v1.2.1
github.com/u-root/u-root v0.14.0
github.com/vishvananda/netlink v1.3.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.24.0
golang.org/x/sys v0.25.0
google.golang.org/grpc v1.66.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -106,7 +106,7 @@ require (
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
github.com/prometheus/client_golang v1.20.3 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/prometheus/prometheus v0.54.1 // indirect
Expand All @@ -125,12 +125,12 @@ require (
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
howett.net/plist v1.0.1 // indirect
)
Loading
Loading