Kubernetes Mesos integration
This commit includes the fundamental components of the Kubernetes Mesos integration: * Kubernetes-Mesos scheduler * Kubernetes-Mesos executor * Supporting libs Dependencies and upstream changes are included in a separate commit for easy review. After this initial upstream, there'll be two PRs following. * km (hypercube) and k8sm-controller-manager #9265 * Static pods support #9077 Fixes applied: - Precise metrics subsystems definitions - mesosphere/kubernetes-mesos#331 - https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion_r31875232 - https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion_r31875240 - Improve comments and add clarifications - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875208 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875226 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875227 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875228 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875239 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875243 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875234 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875256 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875255 - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875251 - Clarify which Schedule function is actually called - Fixes https://github.com/GoogleCloudPlatform/kubernetes/pull/8882#discussion-diff-31875246
This commit is contained in:
103
contrib/mesos/pkg/queue/interface.go
Normal file
103
contrib/mesos/pkg/queue/interface.go
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
Copyright 2015 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package queue
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/cache"
|
||||
)
|
||||
|
||||
type EventType int
|
||||
|
||||
const (
|
||||
ADD_EVENT EventType = 1 << iota
|
||||
UPDATE_EVENT
|
||||
DELETE_EVENT
|
||||
POP_EVENT
|
||||
)
|
||||
|
||||
type Entry interface {
|
||||
Copyable
|
||||
Value() UniqueCopyable
|
||||
// types is a logically OR'd combination of EventType, e.g. ADD_EVENT|UPDATE_EVENT
|
||||
Is(types EventType) bool
|
||||
}
|
||||
|
||||
type Copyable interface {
|
||||
// return an independent copy (deep clone) of the current object
|
||||
Copy() Copyable
|
||||
}
|
||||
|
||||
type UniqueID interface {
|
||||
GetUID() string
|
||||
}
|
||||
|
||||
type UniqueCopyable interface {
|
||||
Copyable
|
||||
UniqueID
|
||||
}
|
||||
|
||||
type FIFO interface {
|
||||
cache.Store
|
||||
|
||||
// Pop waits until an item is ready and returns it. If multiple items are
|
||||
// ready, they are returned in the order in which they were added/updated.
|
||||
// The item is removed from the queue (and the store) before it is returned,
|
||||
// so if you don't succesfully process it, you need to add it back with Add().
|
||||
Pop() interface{}
|
||||
|
||||
// Await attempts to Pop within the given interval; upon success the non-nil
|
||||
// item is returned, otherwise nil
|
||||
Await(timeout time.Duration) interface{}
|
||||
|
||||
// Is there an entry for the id that matches the event mask?
|
||||
Poll(id string, types EventType) bool
|
||||
}
|
||||
|
||||
type Delayed interface {
|
||||
// return the remaining delay; a non-positive value indicates no delay
|
||||
GetDelay() time.Duration
|
||||
}
|
||||
|
||||
type Deadlined interface {
|
||||
// when ok, returns the time when this object should be activated/executed/evaluated
|
||||
Deadline() (deadline time.Time, ok bool)
|
||||
}
|
||||
|
||||
// No objects are ever expected to be sent over this channel. References to BreakChan
|
||||
// instances may be nil (always blocking). Signalling over this channel is performed by
|
||||
// closing the channel. As such there can only ever be a single signal sent over the
|
||||
// lifetime of the channel.
|
||||
type BreakChan <-chan struct{}
|
||||
|
||||
// an optional interface to be implemented by Delayed objects; returning a nil
|
||||
// channel from Breaker() results in waiting the full delay duration
|
||||
type Breakout interface {
|
||||
// return a channel that signals early departure from a blocking delay
|
||||
Breaker() BreakChan
|
||||
}
|
||||
|
||||
type UniqueDelayed interface {
|
||||
UniqueID
|
||||
Delayed
|
||||
}
|
||||
|
||||
type UniqueDeadlined interface {
|
||||
UniqueID
|
||||
Deadlined
|
||||
}
|
Reference in New Issue
Block a user