Kubelet: pass pod name/namespace/uid to runtimes

This commit is contained in:
Pengfei Ni
2016-08-17 16:04:25 +08:00
parent 9de9405be7
commit 9bfa37f2ae
15 changed files with 617 additions and 420 deletions

View File

@@ -16,6 +16,20 @@ limitations under the License.
package testing
import (
"fmt"
runtimeApi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
)
func BuildContainerName(metadata *runtimeApi.ContainerMetadata) string {
return fmt.Sprintf("%s_%d", metadata.GetName(), metadata.GetAttempt())
}
func BuildSandboxName(metadata *runtimeApi.PodSandboxMetadata) string {
return fmt.Sprintf("%s_%s_%s_%d", metadata.GetName(), metadata.GetNamespace(), metadata.GetUid(), metadata.GetAttempt())
}
func filterInLabels(filter, labels map[string]string) bool {
for k, v := range filter {
if value, ok := labels[k]; ok {