Last active
August 10, 2018 16:45
-
-
Save misterikkit/b5c5d56f55a52df48839f3e1aa5ec48b to your computer and use it in GitHub Desktop.
Kubernetes Scheduler Startup and Configuration Sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title K8S Scheduler Configuration Handling | |
# Paste into https://sequencediagram.org/ | |
participant "command line\nflags" as flags | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/options\n++**Options**++" as Options | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/config\n++**Config**++" as Config | |
participant "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1\n++**KubeSchedulerConfiguration**++" as componentConfig | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/config\n++**CompletedConfig**++" as CompletedConfig | |
participant "k8s.io/kubernetes/pkg/scheduler/api\n++**Policy**++" as Policy | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Configurator**++" as Configurator | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Config**++" as schedConfig | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Scheduler**++" as Scheduler | |
flags --> Options: parsed into fields of | |
destroysilent flags | |
Options -> *Config: | |
Options --> Config: ApplyTo() fills out some fields | |
Options -> *componentConfig: loadConfigFromFile() | |
componentConfig --> Options: member of | |
destroysilent componentConfig | |
Options --> Config: Config() fills out other fields | |
destroysilent Options | |
Config -> *CompletedConfig: Complete() applies some defaults | |
destroysilent Config | |
CompletedConfig -> *Configurator: NewConfigFactory() | |
abox left of CompletedConfig: Either a provider name or a Policy object is used | |
CompletedConfig -> *Policy: reads from ComponentConfig or separate file | |
destroysilent CompletedConfig | |
Configurator ->(3) *schedConfig: CreateFromProvider(string)\n or\nCreateFromConfig(Policy) | |
destroysilent Configurator | |
space -7.1 | |
Policy -> *schedConfig: | |
destroysilent Policy | |
schedConfig -> *Scheduler: NewFromConfig() | |
destroysilent schedConfig | |
note over Scheduler: now we can call Run() | |
==made with https://sequencediagram.org/== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title K8S Scheduler Application Lifecycle | |
# Paste into https://sequencediagram.org/ | |
participant "main()" as main | |
participant "command" as command | |
participant "anonymous\nfunc" as anonFunc | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/options\n++**Options**++" as Options | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/config\n++**Config**++" as Config | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/config\n++**CompletedConfig**++" as CompletedConfig | |
participant "k8s.io/kubernetes/cmd/kube-scheduler/app\n++**func Run(CompletedConfig)**++" as appPkg | |
participant "k8s.io/client-go/tools/leaderelection\n++**LeaderElector**++" as LeaderElector | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Configurator**++" as Configurator | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Config**++" as schedulerConfig | |
participant "k8s.io/kubernetes/pkg/scheduler\n++**Scheduler**++" as scheduler | |
activate main | |
main->*command: NewSchedulerCommand() | |
note left of command:This is a\nCobra command | |
space -5 | |
command->*anonFunc:value of `Run` field | |
#space -6 | |
#rbox over main: flags get parsed\ninto `Options` | |
main->*Options: flags get parsed | |
main->command: Execute() | |
activate command | |
command->anonFunc: | |
activate anonFunc | |
anonFunc->>Options: Validate() | |
linear on | |
anonFunc->Options: Config() | |
space -5 | |
Options->*Config: | |
destroysilent Options | |
linear off | |
linear on | |
anonFunc->Config:Complete() | |
space -5 | |
Config->*CompletedConfig: | |
destroysilent Config | |
linear off | |
CompletedConfig-->(3)appPkg: | |
space -3 | |
destroysilent CompletedConfig | |
activate appPkg | |
space -2 | |
anonFunc->appPkg: | |
#activate appPkg | |
appPkg->*Configurator: NewConfigFactory(CompletedConfig) | |
abox over Configurator:++Informer event handlers\nare added here++ | |
linear on | |
appPkg->Configurator: NewSchedulerConfig() | |
destroysilent Configurator | |
space -5 | |
Configurator->*schedulerConfig: | |
schedulerConfig-->(4)*scheduler: | |
linear off | |
space -7.1 | |
destroysilent schedulerConfig | |
appPkg->*scheduler:NewFromConfig(Config) | |
abox over appPkg:++Informers and broadcasters\nare started here++ | |
appPkg->*LeaderElector:NewLeaderElector() | |
appPkg->LeaderElector: Run() | |
activate LeaderElector | |
LeaderElector->LeaderElector: acquire leadership | |
LeaderElector->scheduler: Run() | |
activate scheduler | |
rbox over scheduler:++This is the\n run loop!++ | |
# Unroll the stack here | |
scheduler->LeaderElector: crash or lost leadership | |
deactivate scheduler | |
LeaderElector->appPkg: | |
deactivate LeaderElector | |
appPkg->anonFunc: | |
deactivate appPkg | |
anonFunc->command: | |
deactivate anonFunc | |
command->main: | |
deactivate command | |
deactivate main | |
==made with https://sequencediagram.org/== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment