Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug 1882304: oc adm must-gather: have must-gather pods run on master nodes if --node-name is not specified #595

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/cli/admin/mustgather/mustgather.go
Expand Up @@ -518,6 +518,14 @@ func (o *MustGatherOptions) newClusterRoleBinding(ns string) *rbacv1.ClusterRole
// - copy: no-op container we can exec into
func (o *MustGatherOptions) newPod(node, image string) *corev1.Pod {
zero := int64(0)

nodeSelector := map[string]string{
corev1.LabelOSStable: "linux",
}
if node == "" {
nodeSelector["node-role.kubernetes.io/master"] = ""
}

ret := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "must-gather-",
Expand Down Expand Up @@ -565,7 +573,7 @@ func (o *MustGatherOptions) newPod(node, image string) *corev1.Pod {
},
},
},
NodeSelector: map[string]string{corev1.LabelOSStable: "linux"},
NodeSelector: nodeSelector,
TerminationGracePeriodSeconds: &zero,
Tolerations: []corev1.Toleration{
{
Expand Down