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

MESOS: fix flaky TestPlugin_LifeCycle #14271

Merged
Merged
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions contrib/mesos/pkg/scheduler/plugin.go
Expand Up @@ -52,6 +52,11 @@ const (
pluginRecoveryDelay = 100 * time.Millisecond // delay after scheduler plugin crashes, before we resume scheduling
)

const (
FailedScheduling = "FailedScheduling"
Scheduled = "Scheduled"
)

// scheduler abstraction to allow for easier unit testing
type schedulerInterface interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a fan of this naming convention using -Interface.
Are we doing this throughout k8sm? Is the rest of k8s doing this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this :( I needed to stop the plugin from reaching directly for the
fields of KubernetesScheduler. I wasn't feeling very creative or inspired.
schedulerInterface was named. Ideally the plugin stuff (the k8s side of the
scheduler) would live in a plugin/ package. I use the name "plugin" because
the upstream scheduler is in a "plugin/scheduler/..." set of packages so it
was easy for me to distinguish between the "mesos" side of the brain and
the "plugin" side of the brain.

On Tue, Sep 22, 2015 at 11:40 AM, Karl Isenberg notifications@github.com
wrote:

In contrib/mesos/pkg/scheduler/plugin.go
#14271 (comment)
:

@@ -52,6 +52,11 @@ const (
pluginRecoveryDelay = 100 * time.Millisecond // delay after scheduler plugin crashes, before we resume scheduling
)

+const (

  • FailedScheduling = "FailedScheduling"
  • Scheduled = "Scheduled"
    +)

// scheduler abstraction to allow for easier unit testing
type schedulerInterface interface {

I'm really not a fan of this naming convention using -Interface.
Are we doing this throughout k8sm? Is the rest of k8s doing this?


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/14271/files#r40102215.

sync.Locker // synchronize scheduler plugin operations
Expand Down Expand Up @@ -757,7 +762,7 @@ func (s *schedulingPlugin) scheduleOne() {
dest, err := s.config.Algorithm.Schedule(pod, s.config.NodeLister) // call kubeScheduler.Schedule
if err != nil {
log.V(1).Infof("Failed to schedule: %+v", pod)
s.config.Recorder.Eventf(pod, "FailedScheduling", "Error scheduling: %v", err)
s.config.Recorder.Eventf(pod, FailedScheduling, "Error scheduling: %v", err)
s.config.Error(pod, err)
return
}
Expand All @@ -770,11 +775,11 @@ func (s *schedulingPlugin) scheduleOne() {
}
if err := s.config.Binder.Bind(b); err != nil {
log.V(1).Infof("Failed to bind pod: %+v", err)
s.config.Recorder.Eventf(pod, "FailedScheduling", "Binding rejected: %v", err)
s.config.Recorder.Eventf(pod, FailedScheduling, "Binding rejected: %v", err)
s.config.Error(pod, err)
return
}
s.config.Recorder.Eventf(pod, "Scheduled", "Successfully assigned %v to %v", pod.Name, dest)
s.config.Recorder.Eventf(pod, Scheduled, "Successfully assigned %v to %v", pod.Name, dest)
}

// this pod may be out of sync with respect to the API server registry:
Expand Down