mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #20383 from smarterclayton/allow_prefix_changes
Auto commit by PR queue bot
This commit is contained in:
commit
230f593058
@ -81,6 +81,17 @@ type KubeletContainerName struct {
|
|||||||
ContainerName string
|
ContainerName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// containerNamePrefix is used to identify the containers on the node managed by this
|
||||||
|
// process.
|
||||||
|
var containerNamePrefix = "k8s"
|
||||||
|
|
||||||
|
// SetContainerNamePrefix allows the container prefix name for this process to be changed.
|
||||||
|
// This is intended to support testing and bootstrapping experimentation. It cannot be
|
||||||
|
// changed once the Kubelet starts.
|
||||||
|
func SetContainerNamePrefix(prefix string) {
|
||||||
|
containerNamePrefix = prefix
|
||||||
|
}
|
||||||
|
|
||||||
// DockerPuller is an abstract interface for testability. It abstracts image pull operations.
|
// DockerPuller is an abstract interface for testability. It abstracts image pull operations.
|
||||||
type DockerPuller interface {
|
type DockerPuller interface {
|
||||||
Pull(image string, secrets []api.Secret) error
|
Pull(image string, secrets []api.Secret) error
|
||||||
@ -209,8 +220,6 @@ func (p throttledDockerPuller) IsImagePresent(name string) (bool, error) {
|
|||||||
return p.puller.IsImagePresent(name)
|
return p.puller.IsImagePresent(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
const containerNamePrefix = "k8s"
|
|
||||||
|
|
||||||
// Creates a name which can be reversed to identify both full pod name and container name.
|
// Creates a name which can be reversed to identify both full pod name and container name.
|
||||||
func BuildDockerName(dockerName KubeletContainerName, container *api.Container) (string, string) {
|
func BuildDockerName(dockerName KubeletContainerName, container *api.Container) (string, string) {
|
||||||
containerName := dockerName.ContainerName + "." + strconv.FormatUint(kubecontainer.HashContainer(container), 16)
|
containerName := dockerName.ContainerName + "." + strconv.FormatUint(kubecontainer.HashContainer(container), 16)
|
||||||
|
Loading…
Reference in New Issue
Block a user