Skip to content
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
17 changes: 17 additions & 0 deletions crd/multitenancy/api/v1alpha1/multitenantpodnetworkconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ const (
Failed InfinibandStatus = "Failed"
)

// MTPNCStatus indicates the high-level status of MultitenantPodNetworkConfig
// +kubebuilder:validation:Enum=Ready;Pending;InternalError;PNINotFound;PNINotReady;NodeCapacityExceeded;IPsExhausted
type MTPNCStatus string

const (
MTPNCStatusReady MTPNCStatus = "Ready"
MTPNCStatusPending MTPNCStatus = "Pending"
MTPNCStatusInternalError MTPNCStatus = "InternalError"
MTPNCStatusPNINotFound MTPNCStatus = "PNINotFound"
MTPNCStatusPNINotReady MTPNCStatus = "PNINotReady"
MTPNCStatusNodeCapacityExceeded MTPNCStatus = "NodeCapacityExceeded"
MTPNCStatusIPsExhausted MTPNCStatus = "IPsExhausted"
)

type InterfaceInfo struct {
// NCID is the network container id
NCID string `json:"ncID,omitempty"`
Expand Down Expand Up @@ -110,6 +124,9 @@ type MultitenantPodNetworkConfigStatus struct {
// NodeName is the name of the node where the pod is scheduled
// +kubebuilder:validation:Optional
NodeName string `json:"nodeName,omitempty"`
// Status represents the overall status of the MTPNC
// +kubebuilder:validation:Optional
Status MTPNCStatus `json:"status,omitempty"`
}

func init() {
Expand Down
8 changes: 4 additions & 4 deletions crd/multitenancy/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mtpncFilename = "manifests/multitenancy.acn.azure.com_multitenantpodnetwor
func TestEmbedMTPNC(t *testing.T) {
b, err := os.ReadFile(mtpncFilename)
assert.NoError(t, err)
assert.Equal(t, b, MultitenantPodNetworkConfigsYAML)
assert.YAMLEq(t, string(b), string(MultitenantPodNetworkConfigsYAML))
}

func TestGetMultitenantPodNetworkConfigs(t *testing.T) {
Expand All @@ -25,7 +25,7 @@ const nodeinfoFilename = "manifests/multitenancy.acn.azure.com_nodeinfo.yaml"
func TestEmbedNodeInfo(t *testing.T) {
b, err := os.ReadFile(nodeinfoFilename)
assert.NoError(t, err)
assert.Equal(t, b, NodeInfoYAML)
assert.YAMLEq(t, string(b), string(NodeInfoYAML))
}

func TestGetNodeInfo(t *testing.T) {
Expand All @@ -38,7 +38,7 @@ const podNetworkFilename = "manifests/multitenancy.acn.azure.com_podnetworks.yam
func TestEmbedPodNetwork(t *testing.T) {
b, err := os.ReadFile(podNetworkFilename)
assert.NoError(t, err)
assert.Equal(t, b, PodNetworkYAML)
assert.YAMLEq(t, string(b), string(PodNetworkYAML))
}

func TestGetPodNetworks(t *testing.T) {
Expand All @@ -51,7 +51,7 @@ const podNetworkInstanceFilename = "manifests/multitenancy.acn.azure.com_podnetw
func TestEmbedPodNetworkInstance(t *testing.T) {
b, err := os.ReadFile(podNetworkInstanceFilename)
assert.NoError(t, err)
assert.Equal(t, b, PodNetworkInstanceYAML)
assert.YAMLEq(t, string(b), string(PodNetworkInstanceYAML))
}

func TestGetPodNetworkInstances(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ spec:
primaryIP:
description: Deprecated - use InterfaceInfos
type: string
status:
description: Status represents the overall status of the MTPNC
enum:
- Ready
- Pending
- InternalError
- PNINotFound
- PNINotReady
- NodeCapacityExceeded
- IPsExhausted
type: string
type: object
type: object
served: true
Expand Down
Loading