Skip to content
4 changes: 4 additions & 0 deletions cns/middlewares/k8sSwiftV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
errGetMTPNC = errors.New(NetworkNotReadyErrorMsg + " - failed to get MTPNC")
errInvalidSWIFTv2NICType = errors.New("invalid NIC type for SWIFT v2 scenario")
errInvalidMTPNCPrefixLength = errors.New("invalid prefix length for MTPNC primaryIP, must be 32")
errDeleteTimestampSet = errors.New("MTPNC deletion timestamp is set")
)

type K8sSWIFTv2Middleware struct {
Expand Down Expand Up @@ -193,6 +194,9 @@ func (k *K8sSWIFTv2Middleware) getMTPNC(ctx context.Context, podInfo cns.PodInfo
if err := k.Cli.Get(ctx, mtpncNamespacedName, &mtpnc); err != nil {
return v1alpha1.MultitenantPodNetworkConfig{}, types.UnexpectedError, errors.Wrap(err, errGetMTPNC.Error()).Error()
}
if mtpnc.DeletionTimestamp != nil {
return v1alpha1.MultitenantPodNetworkConfig{}, types.UnexpectedError, errDeleteTimestampSet.Error()
}
// Check if the MTPNC CRD is ready. If one of the fields is empty, return error
if !mtpnc.IsReady() {
return v1alpha1.MultitenantPodNetworkConfig{}, types.UnexpectedError, errMTPNCNotReady.Error()
Expand Down
Loading