fix: Nautobot Secret Refs annotation as it is required before Creation - #2186
fix: Nautobot Secret Refs annotation as it is required before Creation#2186geetikabatra wants to merge 1 commit into
Conversation
| namespace := "" | ||
| if ref.Namespace != nil && *ref.Namespace != "" { | ||
| namespace = *ref.Namespace | ||
| } else if nautobotCR.Spec.NautobotServiceRef.Namespace != "" { | ||
| namespace = nautobotCR.Spec.NautobotServiceRef.Namespace | ||
| } |
There was a problem hiding this comment.
Can be done like this, in that way we don't need else if
namespace := nautobotCR.Spec.NautobotServiceRef.Namespace
if ref.Namespace != nil && *ref.Namespace != "" {
namespace = *ref.Namespace
}
Code reviewFound 3 issues: 1. understack/go/nautobotop/api/v1alpha1/nautobot_types.go Lines 35 to 38 in 8c23494 2. Auth-fetch errors get swallowed as "not configured." Any understack/go/nautobotop/internal/controller/nautobot_controller.go Lines 187 to 193 in 8c23494 3. Namespace fallback contradicts the field's doc comment. understack/go/nautobotop/api/v1alpha1/secret_type.go Lines 10 to 16 in 8c23494 |
If nautobotSecretRef.Name is empty, the reconciler should skip gracefully: update .Status.Ready = false and .Status.Message with a clear “not configured” message, then requeue — instead of returning a raw error.
• If nautobotSecretRef.Namespace is empty but .Name is set, default to the CR’s own namespace rather than failing.
Fixes: 2183