Skip to content

Commit

Permalink
fix(support-bundle): pass node-selector to agent
Browse files Browse the repository at this point in the history
Ref: 5614

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang committed Mar 23, 2023
1 parent 0e366f8 commit 31db98f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions controller/support_bundle_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"reflect"
"strings"
"time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -615,6 +616,7 @@ func (c *SupportBundleController) createSupportBundleManagerDeployment(supportBu
func (c *SupportBundleController) newSupportBundleManager(supportBundle *longhorn.SupportBundle,
nodeSelector map[string]string, tolerations []corev1.Toleration,
imagePullPolicy corev1.PullPolicy, priorityClass, registrySecret string) *appsv1.Deployment {

supportBundleManagerName := GetSupportBundleManagerName(supportBundle)
deployment := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -687,6 +689,10 @@ func (c *SupportBundleController) newSupportBundleManager(supportBundle *longhor
Name: "SUPPORT_BUNDLE_COLLECTOR",
Value: "longhorn",
},
{
Name: "SUPPORT_BUNDLE_NODE_SELECTOR",
Value: c.getNodeSelectorString(nodeSelector),
},
},
Ports: []corev1.ContainerPort{
{
Expand All @@ -710,3 +716,11 @@ func (c *SupportBundleController) newSupportBundleManager(supportBundle *longhor

return deployment
}

func (c *SupportBundleController) getNodeSelectorString(nodeSelector map[string]string) string {
list := make([]string, 0, len(nodeSelector))
for k, v := range nodeSelector {
list = append(list, k+"="+v)
}
return strings.Join(list, ",")
}

0 comments on commit 31db98f

Please sign in to comment.