Documentation ¶
Index ¶
Constants ¶
const ( ComponentName = "frameworkbarrier" FrameworkObjectFilePath = "./framework.json" InjectorFilePath = "./injector.sh" EnvNameBarrierCheckIntervalSec = "BARRIER_CHECK_INTERVAL_SEC" EnvNameBarrierCheckTimeoutSec = "BARRIER_CHECK_TIMEOUT_SEC" )
///////////////////////////////////////////////////////////////////////////////////// Constants /////////////////////////////////////////////////////////////////////////////////////
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // See the same fields in pkg/apis/frameworkcontroller/v1/config.go KubeApiServerAddress string `yaml:"kubeApiServerAddress"` KubeConfigFilePath string `yaml:"kubeConfigFilePath"` // The Framework for which the barrier waits. FrameworkNamespace string `yaml:"frameworkNamespace"` FrameworkName string `yaml:"frameworkName"` // Check interval and timeout to expect all Tasks in the Framework reach the // barrier, i.e. are ready with not nil PodIP. BarrierCheckIntervalSec int64 `yaml:"barrierCheckIntervalSec"` BarrierCheckTimeoutSec int64 `yaml:"barrierCheckTimeoutSec"` }
///////////////////////////////////////////////////////////////////////////////////// Config /////////////////////////////////////////////////////////////////////////////////////
type FrameworkBarrier ¶
type FrameworkBarrier struct {
// contains filtered or unexported fields
}
FrameworkController Extension: FrameworkBarrier
Best Practice: It is usually used as the initContainer to provide a simple way to:
- Do Gang Execution without resource deadlock. So that the AppContainers of all Tasks in the Framework will be executed in an all-or-nothing fashion without the need for Gang Scheduling.
- Start the AppContainers in the Pod only after its PodUID is persisted in the Framework object by FrameworkController. So that the completion or deletion event of a Pod with started AppContainers will never be missed by FrameworkController to further trigger RetryPolicy or FrameworkAttemptCompletionPolicy.
- Inject peer-to-peer service discovery information into the AppContainers. So that any Task in the Framework is able to discover all other Tasks in the same Framework without the need for k8s DNS.
Usage: It waits until all Tasks in the specified Framework object are ready with not nil PodIP and then dumps the Framework object to local file: ./framework.json, besides it also generates the injector script to local file: ./injector.sh which provides a default way to inject some Framework information into caller process.
./injector.sh exports below environment variables: For each {TaskRoleName} in the Framework:
FB_{UpperCase({TaskRoleName})}_IPS= {Task[0].PodIP},..., {Task[TaskRole.TaskNumber-1].PodIP} FB_{UpperCase({TaskRoleName})}_ADDRESSES= {Task[0].PodIP}:${FB_{UpperCase({TaskRoleName})}_PORT},..., {Task[TaskRole.TaskNumber-1].PodIP}:${FB_{UpperCase({TaskRoleName})}_PORT} Note, the environment variable FB_{UpperCase({TaskRoleName})}_PORT should be provided by the caller in advance.
Caller can also write its own injector script to inject other Framework information from the ./framework.json.
func NewFrameworkBarrier ¶
func NewFrameworkBarrier() *FrameworkBarrier
///////////////////////////////////////////////////////////////////////////////////// Methods /////////////////////////////////////////////////////////////////////////////////////
func (*FrameworkBarrier) Run ¶
func (b *FrameworkBarrier) Run()