本文整理匯總了Golang中k8s/io/kubernetes/test/e2e/framework.PodClient.CreateBatch方法的典型用法代碼示例。如果您正苦於以下問題:Golang PodClient.CreateBatch方法的具體用法?Golang PodClient.CreateBatch怎麽用?Golang PodClient.CreateBatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/test/e2e/framework.PodClient
的用法示例。
在下文中一共展示了PodClient.CreateBatch方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createSummaryTestPods
func createSummaryTestPods(podClient *framework.PodClient, podNamePrefix string, count int, volumeNamePrefix string) (sets.String, sets.String) {
podNames := sets.NewString()
volumes := sets.NewString(volumeNamePrefix)
for i := 0; i < count; i++ {
podNames.Insert(fmt.Sprintf("%s%v", podNamePrefix, i))
}
var pods []*api.Pod
for _, podName := range podNames.List() {
pods = append(pods, &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: podName,
},
Spec: api.PodSpec{
// Don't restart the Pod since it is expected to exit
RestartPolicy: api.RestartPolicyNever,
Containers: []api.Container{
{
Image: ImageRegistry[busyBoxImage],
Command: []string{"sh", "-c", "while true; do echo 'hello world' | tee /test-empty-dir-mnt/file ; sleep 1; done"},
Name: podName + containerSuffix,
VolumeMounts: []api.VolumeMount{
{MountPath: "/test-empty-dir-mnt", Name: volumeNamePrefix},
},
},
},
SecurityContext: &api.PodSecurityContext{
SELinuxOptions: &api.SELinuxOptions{
Level: "s0",
},
},
Volumes: []api.Volume{
// TODO: Test secret volumes
// TODO: Test hostpath volumes
{Name: volumeNamePrefix, VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}},
},
},
})
}
podClient.CreateBatch(pods)
return podNames, volumes
}