Skip to content

Commit ad9b168

Browse files
ormergijcaamano
authored andcommitted
cni: Do not expose the node's OVN bridge-mappings
In case the desired OVN bridge-mapping does not exist, the CNI will return an error that includes the existing OVN bridge-mapping on the node. The error is propagated by kubelet in form of event on the connected pod which is accessible to non-admin users (using kubectl describe pod ...). The existing OVN bridge-mapping on the node should not be exposed to non-admin users. Hence, omit the node existing OVN bridge-mapping from the error message. Log the error including the existing OVN mapping on the node to allow troubleshooting. Signed-off-by: Or Mergi <[email protected]>
1 parent 3b4d481 commit ad9b168

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

go-controller/pkg/cni/cni.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,6 @@ func checkBridgeMapping(ovsClient client.Client, topology string, networkName st
455455
return nil
456456
}
457457
}
458-
459-
return fmt.Errorf("failed to find bridge mapping for network: %q; Current ovn-bridge-mappings: %q", networkName, ovnBridgeMappings)
458+
klog.V(5).Infof("Failed to find bridge mapping for network: %q, current OVN bridge-mappings: (%s)", networkName, ovnBridgeMappings)
459+
return fmt.Errorf("failed to find OVN bridge-mapping for network: %q", networkName)
460460
}

go-controller/pkg/cni/cni_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ var _ = Describe("checkBridgeMapping", func() {
372372
})
373373
Expect(err).NotTo(HaveOccurred())
374374
Expect(checkBridgeMapping(ovsClient, ovntypes.LocalnetTopology, networkName).Error()).To(
375-
Equal(`failed to find bridge mapping for network: "test-network"; Current ovn-bridge-mappings: "other-network:br-int"`))
375+
Equal(`failed to find OVN bridge-mapping for network: "test-network"`))
376376
})
377377
})
378378
})

0 commit comments

Comments
 (0)