Skip to content

Commit

Permalink
Merge pull request #127 from andreaskaris/OCPBUGS-11427
Browse files Browse the repository at this point in the history
[release-4.13] OCPBUGS-11427: Fix network status annotation to k8s.v1.cni.cncf.io/network-status
  • Loading branch information
openshift-merge-robot committed Apr 13, 2023
2 parents ef215ab + d9fe6b0 commit 9f36752
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/reconciler/ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ func generatePodAnnotations(ipNetworks ...ipInNetwork) map[string]string {
networks = append(networks, ipNetworkInfo.networkName)
}
networkAnnotations := map[string]string{
MultusNetworkAnnotation: strings.Join(networks, ","),
MultusNetworkStatusAnnotation: generatePodNetworkStatusAnnotation(ipNetworks...),
multusv1.NetworkAttachmentAnnot: strings.Join(networks, ","),
multusv1.NetworkStatusAnnot: generatePodNetworkStatusAnnotation(ipNetworks...),
}
return networkAnnotations
}
Expand Down
9 changes: 1 addition & 8 deletions pkg/reconciler/wrappedPod.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ import (
v1 "k8s.io/api/core/v1"
)

const (
multusInterfaceNamePrefix = "net"
multusPrefixSize = len(multusInterfaceNamePrefix)
MultusNetworkAnnotation = "k8s.v1.cni.cncf.io/networks"
MultusNetworkStatusAnnotation = "k8s.v1.cni.cncf.io/networks-status"
)

type podWrapper struct {
ips map[string]void
phase v1.PodPhase
Expand Down Expand Up @@ -90,7 +83,7 @@ func getFlatIPSet(pod v1.Pod) (map[string]void, error) {
}

func networkStatusFromPod(pod v1.Pod) string {
networkStatusAnnotationValue, isStatusAnnotationPresent := pod.Annotations[MultusNetworkStatusAnnotation]
networkStatusAnnotationValue, isStatusAnnotationPresent := pod.Annotations[k8snetworkplumbingwgv1.NetworkStatusAnnot]
if !isStatusAnnotationPresent || len(networkStatusAnnotationValue) == 0 {
return "[]"
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/reconciler/wrappedPod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = Describe("Pod Wrapper operations", func() {
annotationString = []byte("")
}
return map[string]string{
MultusNetworkStatusAnnotation: string(annotationString),
k8snetworkplumbingwgv1.NetworkStatusAnnot: string(annotationString),
}
}

Expand All @@ -60,7 +60,7 @@ var _ = Describe("Pod Wrapper operations", func() {
annotationString = []byte("")
}
return map[string]string{
MultusNetworkStatusAnnotation: string(annotationString),
k8snetworkplumbingwgv1.NetworkStatusAnnot: string(annotationString),
}
}

Expand Down Expand Up @@ -117,7 +117,7 @@ var _ = Describe("Pod Wrapper operations", func() {
It("return an empty list when the network annotations of a pod are invalid", func() {
pod := v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{MultusNetworkStatusAnnotation: "this-wont-fly"},
Annotations: map[string]string{k8snetworkplumbingwgv1.NetworkStatusAnnot: "this-wont-fly"},
},
}
Expect(wrapPod(pod).ips).To(BeEmpty())
Expand Down

0 comments on commit 9f36752

Please sign in to comment.