mirror of
https://github.com/siderolabs/talos.git
synced 2026-05-05 20:36:18 +02:00
feat: add support for disabling time
Adds the capability to diasable NTP when it cannot be provided in the deployed network Signed-off-by: Niklas Wik <niklas.wik@nokia.com> add document update. Signed-off-by: Niklas Wik <niklas.wik@nokia.com>
This commit is contained in:
parent
21f1bc6853
commit
eb9ee06dbc
@ -870,6 +870,13 @@ Valid Values:
|
||||
|
||||
### TimeConfig
|
||||
|
||||
#### enabled
|
||||
|
||||
Indicates if time (ntp) is enabled for the machine
|
||||
Defaults to `true`.
|
||||
|
||||
Type: `bool`
|
||||
|
||||
#### servers
|
||||
|
||||
Specifies time (ntp) servers to use for setting system time.
|
||||
|
||||
@ -613,7 +613,7 @@ func StartAllServices(seq runtime.Sequence, data interface{}) (runtime.TaskExecu
|
||||
&services.Kubelet{},
|
||||
)
|
||||
|
||||
if r.State().Platform().Mode() != runtime.ModeContainer {
|
||||
if r.State().Platform().Mode() != runtime.ModeContainer && r.Config().Machine().Time().Enabled() {
|
||||
svcs.Load(
|
||||
&services.Timed{},
|
||||
)
|
||||
|
||||
@ -63,7 +63,7 @@ func (o *APID) Condition(r runtime.Runtime) conditions.Condition {
|
||||
|
||||
// DependsOn implements the Service interface.
|
||||
func (o *APID) DependsOn(r runtime.Runtime) []string {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer || !r.Config().Machine().Time().Enabled() {
|
||||
return []string{"containerd", "networkd"}
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ func (e *Etcd) Condition(r runtime.Runtime) conditions.Condition {
|
||||
|
||||
// DependsOn implements the Service interface.
|
||||
func (e *Etcd) DependsOn(r runtime.Runtime) []string {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer || !r.Config().Machine().Time().Enabled() {
|
||||
return []string{"containerd", "networkd"}
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ func (k *Kubelet) Condition(r runtime.Runtime) conditions.Condition {
|
||||
|
||||
// DependsOn implements the Service interface.
|
||||
func (k *Kubelet) DependsOn(r runtime.Runtime) []string {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer || !r.Config().Machine().Time().Enabled() {
|
||||
return []string{"cri", "networkd"}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ func (t *Trustd) Condition(r runtime.Runtime) conditions.Condition {
|
||||
|
||||
// DependsOn implements the Service interface.
|
||||
func (t *Trustd) DependsOn(r runtime.Runtime) []string {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer {
|
||||
if r.State().Platform().Mode() == runtime.ModeContainer || !r.Config().Machine().Time().Enabled() {
|
||||
return []string{"containerd", "networkd"}
|
||||
}
|
||||
|
||||
|
||||
@ -167,6 +167,7 @@ type Route interface {
|
||||
// Time defines the requirements for a config that pertains to time related
|
||||
// options.
|
||||
type Time interface {
|
||||
Enabled() bool
|
||||
Servers() []string
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,9 @@ func (m *MachineConfig) Network() config.MachineNetwork {
|
||||
// Time implements the config.Provider interface.
|
||||
func (m *MachineConfig) Time() config.Time {
|
||||
if m.MachineTime == nil {
|
||||
return &TimeConfig{}
|
||||
return &TimeConfig{
|
||||
TimeEnabled: true,
|
||||
}
|
||||
}
|
||||
|
||||
return m.MachineTime
|
||||
@ -920,6 +922,11 @@ func (v *Vlan) ID() uint16 {
|
||||
return v.VlanID
|
||||
}
|
||||
|
||||
// Enabled implements the config.Provider interface.
|
||||
func (t *TimeConfig) Enabled() bool {
|
||||
return t.TimeEnabled
|
||||
}
|
||||
|
||||
// Servers implements the config.Provider interface.
|
||||
func (t *TimeConfig) Servers() []string {
|
||||
return t.TimeServers
|
||||
|
||||
@ -530,6 +530,10 @@ type InstallConfig struct {
|
||||
|
||||
// TimeConfig represents the options for configuring time on a node.
|
||||
type TimeConfig struct {
|
||||
// description: |
|
||||
// Indicates if time (ntp) is enabled for the machine
|
||||
// Defaults to `true`.
|
||||
TimeEnabled bool `yaml:"enabled"`
|
||||
// description: |
|
||||
// Specifies time (ntp) servers to use for setting system time.
|
||||
// Defaults to `pool.ntp.org`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user