Skip to content

Commit

Permalink
Merge pull request #168 from sunya-ch/v1.2.2
Browse files Browse the repository at this point in the history
check active namespace before creating NAD
  • Loading branch information
sunya-ch authored Jan 10, 2024
2 parents 7d0ee02 + ce7c7b8 commit 77176db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/net_attach_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/containernetworking/cni/pkg/types"
multinicv1 "github.com/foundation-model-stack/multi-nic-cni/api/v1"
"github.com/foundation-model-stack/multi-nic-cni/controllers/vars"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -147,7 +148,9 @@ func (h *NetAttachDefHandler) getNamespace(net *multinicv1.MultiNicNetwork) ([]s
namespaceList, err := h.Clientset.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
if err == nil {
for _, ns := range namespaceList.Items {
namespaces = append(namespaces, ns.Name)
if ns.Status.Phase == v1.NamespaceActive {
namespaces = append(namespaces, ns.Name)
}
}
} else {
return namespaces, err
Expand Down

0 comments on commit 77176db

Please sign in to comment.