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

Fix runtime error when CtlplaneGateway is nil #949

Merged
merged 1 commit into from
Jul 18, 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
6 changes: 3 additions & 3 deletions apis/dataplane/v1beta1/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const (
NodeSetBaremetalProvisionReadyWaitingMessage = "NodeSetBaremetalProvisionReady not yet ready"

// NodeSetBaremetalProvisionErrorMessage error
NodeSetBaremetalProvisionErrorMessage = "NodeSetBaremetalProvisionReady error occurred"
NodeSetBaremetalProvisionErrorMessage = "NodeSetBaremetalProvisionReady error occurred %s"

// NodeSetIPReservationReadyCondition Status=True condition indicates
// IPSets reserved for all nodes in a NodeSet.
Expand All @@ -67,7 +67,7 @@ const (
NodeSetIPReservationReadyWaitingMessage = "NodeSetIPReservationReady not yet ready"

// NodeSetIPReservationReadyErrorMessage error
NodeSetIPReservationReadyErrorMessage = "NodeSetIPReservationReady error occurred"
NodeSetIPReservationReadyErrorMessage = "NodeSetIPReservationReady error occurred %s"

// NodeSetDNSDataReadyCondition Status=True condition indicates
// DNSData created for the NodeSet.
Expand All @@ -80,7 +80,7 @@ const (
NodeSetDNSDataReadyWaitingMessage = "NodeSetDNSDataReady not yet ready"

// NodeSetDNSDataReadyErrorMessage error
NodeSetDNSDataReadyErrorMessage = "NodeSetDNSDataReady error occurred"
NodeSetDNSDataReadyErrorMessage = "NodeSetDNSDataReady error occurred %s"

// NodeSetDNSDataMultipleDNSMasqErrorMessage error
NodeSetDNSDataMultipleDNSMasqErrorMessage = "NodeSet DNSData error occurred. Multiple DNSMasq resources exist."
Expand Down
6 changes: 5 additions & 1 deletion pkg/dataplane/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func DeployBaremetalSet(
}
ipPrefix, _ := ipNet.Mask.Size()
instanceSpec.CtlPlaneIP = fmt.Sprintf("%s/%d", res.Address, ipPrefix)
if res.Gateway == nil {
return fmt.Errorf("%s gateway is missing", CtlPlaneNetwork)
}
baremetalSet.Spec.CtlplaneGateway = *res.Gateway
baremetalSet.Spec.BootstrapDNS = dnsAddresses
baremetalSet.Spec.DNSSearchDomains = []string{res.DNSDomain}
Expand All @@ -89,7 +92,8 @@ func DeployBaremetalSet(
instance.Status.Conditions.MarkFalse(
dataplanev1.NodeSetBareMetalProvisionReadyCondition,
condition.ErrorReason, condition.SeverityError,
dataplanev1.NodeSetBaremetalProvisionErrorMessage)
dataplanev1.NodeSetBaremetalProvisionErrorMessage,
err.Error())
return false, err
}

Expand Down
9 changes: 6 additions & 3 deletions pkg/dataplane/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ func EnsureDNSData(ctx context.Context, helper *helper.Helper,
instance.Status.Conditions.MarkFalse(
dataplanev1.NodeSetDNSDataReadyCondition,
condition.ErrorReason, condition.SeverityError,
dataplanev1.NodeSetDNSDataReadyErrorMessage)
dataplanev1.NodeSetDNSDataReadyErrorMessage,
err.Error())
return dnsDetails, err
}

Expand All @@ -214,7 +215,8 @@ func EnsureDNSData(ctx context.Context, helper *helper.Helper,
instance.Status.Conditions.MarkFalse(
dataplanev1.NodeSetDNSDataReadyCondition,
condition.ErrorReason, condition.SeverityError,
dataplanev1.NodeSetDNSDataReadyErrorMessage)
dataplanev1.NodeSetDNSDataReadyErrorMessage,
err.Error())
return dnsDetails, err
}
if !dnsData.IsReady() {
Expand Down Expand Up @@ -242,7 +244,8 @@ func EnsureIPSets(ctx context.Context, helper *helper.Helper,
instance.Status.Conditions.MarkFalse(
dataplanev1.NodeSetIPReservationReadyCondition,
condition.ErrorReason, condition.SeverityError,
dataplanev1.NodeSetIPReservationReadyErrorMessage)
dataplanev1.NodeSetIPReservationReadyErrorMessage,
err.Error())
return nil, false, err
}

Expand Down
Loading