diff --git a/pkg/operator/k8sutil/network.go b/pkg/operator/k8sutil/network.go index 7c7c53ccd..a5b111f14 100644 --- a/pkg/operator/k8sutil/network.go +++ b/pkg/operator/k8sutil/network.go @@ -81,13 +81,22 @@ func ApplyMultus(net cephv1.NetworkSpec, objectMeta *metav1.ObjectMeta) error { shortSyntax = true } - var isExcluded bool - for _, clusterNetworkApps := range getClusterNetworkApps() { - isExcluded = strings.Contains(objectMeta.Labels["app"], clusterNetworkApps) + app, ok := objectMeta.Labels["app"] + if !ok { + app = "" // unknown app } - if isExcluded { + isClusterNetApp := false + for _, clusterNetworkApp := range getClusterNetworkApps() { + if app == clusterNetworkApp { + isClusterNetApp = true + break + } + } + if isClusterNetApp { + // append all networks to apps that are cluster network apps v = append(v, string(ns)) } else { + // only append public networks to apps that are not cluster network apps if k == publicNetworkSelectorKeyName { v = append(v, string(ns)) } @@ -116,7 +125,7 @@ func ApplyMultus(net cephv1.NetworkSpec, objectMeta *metav1.ObjectMeta) error { // getClusterNetworkApps returns the list of ceph apps that utilize cluster network func getClusterNetworkApps() []string { - return []string{"osd"} + return []string{"rook-ceph-osd"} } // GetNetworkAttachmentConfig returns the NetworkAttachmentDefinitions configuration