本文整理匯總了Golang中k8s/io/kubernetes/pkg/kubelet/types.DockerID類的典型用法代碼示例。如果您正苦於以下問題:Golang DockerID類的具體用法?Golang DockerID怎麽用?Golang DockerID使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DockerID類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TearDownPod
func (plugin *cniNetworkPlugin) TearDownPod(namespace string, name string, id kubeletTypes.DockerID) error {
runtime, ok := plugin.host.GetRuntime().(*dockertools.DockerManager)
if !ok {
return fmt.Errorf("CNI execution called on non-docker runtime")
}
netns, err := runtime.GetNetNs(id.ContainerID())
if err != nil {
return err
}
return plugin.defaultNetwork.deleteFromNetwork(name, namespace, id.ContainerID(), netns)
}
示例2: SetUpPod
func (plugin *cniNetworkPlugin) SetUpPod(namespace string, name string, id kubeletTypes.DockerID) error {
runtime, ok := plugin.host.GetRuntime().(*dockertools.DockerManager)
if !ok {
return fmt.Errorf("CNI execution called on non-docker runtime")
}
netns, err := runtime.GetNetNs(id.ContainerID())
if err != nil {
return err
}
_, err = plugin.defaultNetwork.addToNetwork(name, namespace, id.ContainerID(), netns)
if err != nil {
glog.Errorf("Error while adding to cni network: %s", err)
return err
}
return err
}