fix: correctly handle partial configs in DNSUpstreamController

Prevent `DNSUpstreamController` from panicking by checking if the `machine` section in the config is `nil`. This is the case when a machine has partial configuration, e.g., when the machine has only a `SideroLinkConfig` in its config.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
Utku Ozdemir 2024-02-16 10:31:21 +01:00
parent 6deb10ae25
commit 493bb60f81
No known key found for this signature in database
GPG Key ID: 65933E76F0549B0D

View File

@ -90,7 +90,8 @@ func (ctrl *DNSUpstreamController) run(ctx context.Context, r controller.Runtime
return err
}
if !mc.Config().Machine().Features().LocalDNSEnabled() {
machineConfig := mc.Config().Machine()
if machineConfig == nil || !machineConfig.Features().LocalDNSEnabled() {
return nil
}