mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Merge pull request #33488 from resouer/infra-image
Automatic merge from submit-queue CRI: Enable custom infra container image A minor fix to enable custom infra container image ref #29478 - Need to address: Not sure how do deal with infra image credential, leave it as it is today. Should we allow user to specify credentials in pod yaml?
This commit is contained in:
commit
d26b4ca285
@ -45,9 +45,14 @@ const (
|
|||||||
// Note: docker doesn't use LogDirectory (yet).
|
// Note: docker doesn't use LogDirectory (yet).
|
||||||
func (ds *dockerService) RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
|
func (ds *dockerService) RunPodSandbox(config *runtimeApi.PodSandboxConfig) (string, error) {
|
||||||
// Step 1: Pull the image for the sandbox.
|
// Step 1: Pull the image for the sandbox.
|
||||||
// TODO: How should we handle pulling custom pod infra container image
|
|
||||||
// (with credentials)?
|
|
||||||
image := defaultSandboxImage
|
image := defaultSandboxImage
|
||||||
|
podSandboxImage := ds.podSandboxImage
|
||||||
|
if len(podSandboxImage) != 0 {
|
||||||
|
image = podSandboxImage
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: To use a custom sandbox image in a private repository, users need to configure the nodes with credentials properly.
|
||||||
|
// see: http://kubernetes.io/docs/user-guide/images/#configuring-nodes-to-authenticate-to-a-private-repository
|
||||||
if err := ds.client.PullImage(image, dockertypes.AuthConfig{}, dockertypes.ImagePullOptions{}); err != nil {
|
if err := ds.client.PullImage(image, dockertypes.AuthConfig{}, dockertypes.ImagePullOptions{}); err != nil {
|
||||||
return "", fmt.Errorf("unable to pull image for the sandbox container: %v", err)
|
return "", fmt.Errorf("unable to pull image for the sandbox container: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,11 @@ const (
|
|||||||
var internalLabelKeys []string = []string{containerTypeLabelKey, sandboxIDLabelKey}
|
var internalLabelKeys []string = []string{containerTypeLabelKey, sandboxIDLabelKey}
|
||||||
|
|
||||||
// NOTE: Anything passed to DockerService should be eventually handled in another way when we switch to running the shim as a different process.
|
// NOTE: Anything passed to DockerService should be eventually handled in another way when we switch to running the shim as a different process.
|
||||||
func NewDockerService(client dockertools.DockerInterface, seccompProfileRoot string) DockerLegacyService {
|
func NewDockerService(client dockertools.DockerInterface, seccompProfileRoot string, podSandboxImage string) DockerLegacyService {
|
||||||
return &dockerService{
|
return &dockerService{
|
||||||
seccompProfileRoot: seccompProfileRoot,
|
seccompProfileRoot: seccompProfileRoot,
|
||||||
client: dockertools.NewInstrumentedDockerInterface(client),
|
client: dockertools.NewInstrumentedDockerInterface(client),
|
||||||
|
podSandboxImage: podSandboxImage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +81,7 @@ type DockerLegacyService interface {
|
|||||||
type dockerService struct {
|
type dockerService struct {
|
||||||
seccompProfileRoot string
|
seccompProfileRoot string
|
||||||
client dockertools.DockerInterface
|
client dockertools.DockerInterface
|
||||||
|
podSandboxImage string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version returns the runtime name, runtime version and runtime API version
|
// Version returns the runtime name, runtime version and runtime API version
|
||||||
|
@ -507,7 +507,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
|
|||||||
case "cri":
|
case "cri":
|
||||||
// Use the new CRI shim for docker. This is need for testing the
|
// Use the new CRI shim for docker. This is need for testing the
|
||||||
// docker integration through CRI, and may be removed in the future.
|
// docker integration through CRI, and may be removed in the future.
|
||||||
dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot)
|
dockerService := dockershim.NewDockerService(klet.dockerClient, kubeCfg.SeccompProfileRoot, kubeCfg.PodInfraContainerImage)
|
||||||
klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager(
|
klet.containerRuntime, err = kuberuntime.NewKubeGenericRuntimeManager(
|
||||||
kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
|
kubecontainer.FilterEventRecorder(kubeDeps.Recorder),
|
||||||
klet.livenessManager,
|
klet.livenessManager,
|
||||||
|
Loading…
Reference in New Issue
Block a user