Skip to content

Commit

Permalink
Merge pull request #86 from TheBeatles1994/remove-warning-log
Browse files Browse the repository at this point in the history
remove warning log
  • Loading branch information
TheBeatles1994 authored Aug 16, 2022
2 parents b864f7f + aa81c20 commit 128d043
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/simulator/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/pterm/pterm"
log "github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -101,7 +100,6 @@ func NewSimulator(opts ...Option) (*Simulator, error) {
// Step 3: Create the simulator
ctx, cancel := context.WithCancel(context.Background())
sim := &Simulator{
kubeclient: nil,
fakeclient: fakeClient,
simulatorStop: make(chan struct{}),
informerFactory: sharedInformerFactory,
Expand All @@ -115,7 +113,6 @@ func NewSimulator(opts ...Option) (*Simulator, error) {
sim.kubeclient, err = utils.CreateKubeClient(options.kubeconfig)
if err != nil {
sim.kubeclient = nil
log.Errorf("fail to create kube client: %s", err.Error())
}

// Step 5: add event handler for pods
Expand Down Expand Up @@ -203,9 +200,11 @@ func (sim *Simulator) ScheduleApp(app AppResource) (*SimulateResult, error) {
tolerationPriority := algo.NewTolerationQueue(appPods)
sort.Sort(tolerationPriority)

for _, patchPods := range sim.patchPodFuncMap {
if err := patchPods(appPods, sim.kubeclient); err != nil {
return nil, err
if sim.kubeclient != nil {
for _, patchPods := range sim.patchPodFuncMap {
if err := patchPods(appPods, sim.kubeclient); err != nil {
return nil, err
}
}
}

Expand Down

0 comments on commit 128d043

Please sign in to comment.