diff --git a/pkg/operator/k8sutil/network.go b/pkg/operator/k8sutil/network.go index bbb3a936c..b56532799 100644 --- a/pkg/operator/k8sutil/network.go +++ b/pkg/operator/k8sutil/network.go @@ -80,13 +80,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)) } @@ -115,7 +124,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