mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #7849 from yifan-gu/rkt_components
kubelet/rkt: Inject dependencies to rkt.
This commit is contained in:
commit
d6ea33fbb5
@ -34,6 +34,7 @@ import (
|
|||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/credentialprovider"
|
||||||
kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
|
kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/prober"
|
"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
|
// uses systemd, so in order to run this runtime, systemd must be installed
|
||||||
// on the machine.
|
// on the machine.
|
||||||
type runtime struct {
|
type runtime struct {
|
||||||
generator kubecontainer.RunContainerOptionsGenerator
|
|
||||||
readinessManager *kubecontainer.ReadinessManager
|
|
||||||
prober prober.Prober
|
|
||||||
systemd *dbus.Conn
|
systemd *dbus.Conn
|
||||||
// The absolute path to rkt binary.
|
// The absolute path to rkt binary.
|
||||||
rktBinAbsPath string
|
rktBinAbsPath string
|
||||||
config *Config
|
config *Config
|
||||||
// TODO(yifan): Refactor this to be generic keyring.
|
// TODO(yifan): Refactor this to be generic keyring.
|
||||||
dockerKeyring credentialprovider.DockerKeyring
|
dockerKeyring credentialprovider.DockerKeyring
|
||||||
|
|
||||||
|
containerRefManager *kubecontainer.RefManager
|
||||||
|
generator kubecontainer.RunContainerOptionsGenerator
|
||||||
|
recorder record.EventRecorder
|
||||||
|
prober prober.Prober
|
||||||
|
readinessManager *kubecontainer.ReadinessManager
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ kubecontainer.Runtime = &runtime{}
|
var _ kubecontainer.Runtime = &runtime{}
|
||||||
@ -105,7 +109,12 @@ var _ kubecontainer.Runtime = &runtime{}
|
|||||||
// New creates the rkt container runtime which implements the container runtime interface.
|
// 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
|
// 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.
|
// 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()
|
systemdVersion, err := getSystemdVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -134,7 +143,12 @@ func New(config *Config) (kubecontainer.Runtime, error) {
|
|||||||
rktBinAbsPath: rktBinAbsPath,
|
rktBinAbsPath: rktBinAbsPath,
|
||||||
config: config,
|
config: config,
|
||||||
dockerKeyring: credentialprovider.NewDockerKeyring(),
|
dockerKeyring: credentialprovider.NewDockerKeyring(),
|
||||||
|
containerRefManager: containerRefManager,
|
||||||
|
generator: generator,
|
||||||
|
recorder: recorder,
|
||||||
|
readinessManager: readinessManager,
|
||||||
}
|
}
|
||||||
|
rkt.prober = prober.New(rkt, readinessManager, containerRefManager, recorder)
|
||||||
|
|
||||||
// Test the rkt version.
|
// Test the rkt version.
|
||||||
version, err := 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")
|
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) {
|
func (ur *unsupportedRuntime) Version() (kubecontainer.Version, error) {
|
||||||
return nil, unsupportedError
|
return nil, unsupportedError
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user