fix: address nil pointer panic

If the config does not have the kubelet field, we should return a default struct.

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
This commit is contained in:
Andrew Rynhard 2020-10-19 12:22:49 -07:00 committed by talos-bot
parent 4c47fa259c
commit 73d4bf1f6e

View File

@ -124,6 +124,10 @@ func (m *MachineConfig) Time() config.Time {
// Kubelet implements the config.Provider interface.
func (m *MachineConfig) Kubelet() config.Kubelet {
if m.MachineKubelet == nil {
return &KubeletConfig{}
}
return m.MachineKubelet
}