Skip to content

Commit

Permalink
Use nodeName instead of affinity
Browse files Browse the repository at this point in the history
  • Loading branch information
edeNFed authored Aug 26, 2020
2 parents 2964cf6 + 7261670 commit 7914f36
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions cli/cmd/kubernetes/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package kubernetes
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/runtime"
"os"

"github.com/VerizonMedia/kubectl-flame/cli/cmd/data"
Expand Down Expand Up @@ -78,23 +77,7 @@ func LaunchFlameJob(targetPod *v1.Pod, targetDetails *data.TargetDetails, ctx co
},
},
RestartPolicy: "Never",
Affinity: &apiv1.Affinity{
NodeAffinity: &apiv1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &apiv1.NodeSelector{
NodeSelectorTerms: []apiv1.NodeSelectorTerm{
{
MatchExpressions: []apiv1.NodeSelectorRequirement{
{
Key: "kubernetes.io/hostname",
Operator: apiv1.NodeSelectorOpIn,
Values: []string{targetPod.Spec.NodeName},
},
},
},
},
},
},
},
NodeName: targetPod.Spec.NodeName,
},
},
},
Expand All @@ -118,13 +101,7 @@ func LaunchFlameJob(targetPod *v1.Pod, targetDetails *data.TargetDetails, ctx co
}

func printJob(job *batchv1.Job) error {
scheme := runtime.NewScheme()
err := metav1.AddMetaToScheme(scheme)
if err != nil {
return err
}

encoder := json.NewSerializerWithOptions(json.DefaultMetaFactory, scheme, scheme, json.SerializerOptions{
encoder := json.NewSerializerWithOptions(json.DefaultMetaFactory, nil, nil, json.SerializerOptions{
Yaml: true,
})

Expand Down

0 comments on commit 7914f36

Please sign in to comment.