mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
kubelet/rkt: Inject dependencies to rkt.
Add necessary components rkt.
This commit is contained in:
parent
fccfa5cab2
commit
dee060c8fd
@ -34,6 +34,7 @@ import (
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider"
|
||||
kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/prober"
|
||||
@ -89,15 +90,18 @@ const (
|
||||
// uses systemd, so in order to run this runtime, systemd must be installed
|
||||
// on the machine.
|
||||
type runtime struct {
|
||||
generator kubecontainer.RunContainerOptionsGenerator
|
||||
readinessManager *kubecontainer.ReadinessManager
|
||||
prober prober.Prober
|
||||
systemd *dbus.Conn
|
||||
systemd *dbus.Conn
|
||||
// The absolute path to rkt binary.
|
||||
rktBinAbsPath string
|
||||
config *Config
|
||||
// TODO(yifan): Refactor this to be generic keyring.
|
||||
dockerKeyring credentialprovider.DockerKeyring
|
||||
|
||||
containerRefManager *kubecontainer.RefManager
|
||||
generator kubecontainer.RunContainerOptionsGenerator
|
||||
recorder record.EventRecorder
|
||||
prober prober.Prober
|
||||
readinessManager *kubecontainer.ReadinessManager
|
||||
}
|
||||
|
||||
var _ kubecontainer.Runtime = &runtime{}
|
||||
@ -105,7 +109,12 @@ var _ kubecontainer.Runtime = &runtime{}
|
||||
// New creates the rkt container runtime which implements the container runtime interface.
|
||||
// It will test if the rkt binary is in the $PATH, and whether we can get the
|
||||
// version of it. If so, creates the rkt container runtime, otherwise returns an error.
|
||||
func New(config *Config) (kubecontainer.Runtime, error) {
|
||||
func New(config *Config,
|
||||
generator kubecontainer.RunContainerOptionsGenerator,
|
||||
recorder record.EventRecorder,
|
||||
containerRefManager *kubecontainer.RefManager,
|
||||
readinessManager *kubecontainer.ReadinessManager) (kubecontainer.Runtime, error) {
|
||||
|
||||
systemdVersion, err := getSystemdVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -130,11 +139,16 @@ func New(config *Config) (kubecontainer.Runtime, error) {
|
||||
}
|
||||
|
||||
rkt := &runtime{
|
||||
systemd: systemd,
|
||||
rktBinAbsPath: rktBinAbsPath,
|
||||
config: config,
|
||||
dockerKeyring: credentialprovider.NewDockerKeyring(),
|
||||
systemd: systemd,
|
||||
rktBinAbsPath: rktBinAbsPath,
|
||||
config: config,
|
||||
dockerKeyring: credentialprovider.NewDockerKeyring(),
|
||||
containerRefManager: containerRefManager,
|
||||
generator: generator,
|
||||
recorder: recorder,
|
||||
readinessManager: readinessManager,
|
||||
}
|
||||
rkt.prober = prober.New(rkt, readinessManager, containerRefManager, recorder)
|
||||
|
||||
// Test the rkt version.
|
||||
version, err := rkt.Version()
|
||||
|
@ -34,6 +34,14 @@ var _ kubecontainer.Runtime = &unsupportedRuntime{}
|
||||
|
||||
var unsupportedError = fmt.Errorf("rkt runtime is unsupported in this platform")
|
||||
|
||||
func New(config *Config,
|
||||
generator kubecontainer.RunContainerOptionsGenerator,
|
||||
recorder record.EventRecorder,
|
||||
containerRefManager *kubecontainer.RefManager,
|
||||
readinessManager *kubecontainer.ReadinessManager) (kubecontainer.Runtime, error) {
|
||||
return nil, unsupportedError
|
||||
}
|
||||
|
||||
func (ur *unsupportedRuntime) Version() (kubecontainer.Version, error) {
|
||||
return nil, unsupportedError
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user