Skip to content

Commit

Permalink
Fail net validation if the kind is unknown
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam committed Dec 2, 2024
1 parent cea94f9 commit f92be76
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/controller/plan/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ const (

// Kinds
const (
ConfigMap = "ConfigMap"
ConfigMap = "ConfigMap"
NetworkAttachmentDefinition = "NetworkAttachmentDefinition"
)

// Validate the plan resource.
Expand Down Expand Up @@ -713,8 +714,17 @@ func (r *Reconciler) validateTransferNetwork(plan *api.Plan) (err error) {
switch plan.Spec.TransferNetwork.Kind {
case ConfigMap:
err = r.validateTransferNetworkConfigMap(plan, key)
default:
case "", NetworkAttachmentDefinition:
err = r.validateTransferNetworkAttachmentDefinition(plan, key)
default:
unsupported := libcnd.Condition{
Type: TransferNetNotValid,
Status: True,
Category: Critical,
Reason: NotSupported,
Message: "Unsupported transfer network reference Kind.",
}
plan.Status.SetCondition(unsupported)
}
if err != nil {
err = liberr.Wrap(err)
Expand Down

0 comments on commit f92be76

Please sign in to comment.