kubelet: revamp the pod/container naming scheme
There are two main goals for this change. 1. Fix the naming scheme in kubelet so that it accepts DNS subdomain name/namespaces correctly (#4920). The design is discussed in #3453. 2. Prepare for syncing the static pods back to the apiserver(#4090). This includes - Eliminate the source component in the internal full pod name (#4922). Pods no longer need sources as they will all be sync'd via apiserver. - Changing the naming scheme for the static (file-, http-, and etcd-based) pods such that they are distinguishable when syncing back to the apiserver. The changes includes: * name = <pod.Name>-<hostname> * namespace = <cluster_namespace> (i.e. "default" for now). * container_name = k8s_<contianer_name>.<hash_of_container>_<pod_name>_<namespace>_<uid>_<random> Note that this is not backward-compatible, meaning the kubelet won't recognize existing running containers using the old naming scheme.
This commit is contained in:
@@ -76,7 +76,7 @@ func TestRunOnce(t *testing.T) {
|
||||
}
|
||||
podContainers := []docker.APIContainers{
|
||||
{
|
||||
Names: []string{"/k8s_bar." + strconv.FormatUint(dockertools.HashContainer(&api.Container{Name: "bar"}), 16) + "_foo.new.test_12345678_42"},
|
||||
Names: []string{"/k8s_bar." + strconv.FormatUint(dockertools.HashContainer(&api.Container{Name: "bar"}), 16) + "_foo_new_12345678_42"},
|
||||
ID: "1234",
|
||||
Status: "running",
|
||||
},
|
||||
@@ -130,10 +130,9 @@ func TestRunOnce(t *testing.T) {
|
||||
results, err := kb.runOnce([]api.BoundPod{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
UID: "12345678",
|
||||
Name: "foo",
|
||||
Namespace: "new",
|
||||
Annotations: map[string]string{ConfigSourceAnnotationKey: "test"},
|
||||
UID: "12345678",
|
||||
Name: "foo",
|
||||
Namespace: "new",
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
Containers: []api.Container{
|
||||
|
Reference in New Issue
Block a user