Merge pull request #8166 from BlaineEXE/tidy-apply-multus

core: clean up ApplyMultus()
This commit is contained in:
Sébastien Han authored and GitHub committed 2021-10-13 11:58:34 +02:00
commit 720a96e0cd
1 file changed
+14 -5
+14 -5
View File
@@ -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