container_runtime.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Copyright 2017 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package options
  14. import (
  15. "runtime"
  16. "time"
  17. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  18. "k8s.io/kubernetes/pkg/kubelet/config"
  19. kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
  20. )
  21. const (
  22. // When these values are updated, also update test/e2e/framework/util.go
  23. defaultPodSandboxImageName = "k8s.gcr.io/pause"
  24. defaultPodSandboxImageVersion = "3.1"
  25. )
  26. var (
  27. defaultPodSandboxImage = defaultPodSandboxImageName +
  28. ":" + defaultPodSandboxImageVersion
  29. )
  30. // NewContainerRuntimeOptions will create a new ContainerRuntimeOptions with
  31. // default values.
  32. func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions {
  33. dockerEndpoint := ""
  34. if runtime.GOOS != "windows" {
  35. dockerEndpoint = "unix:///var/run/docker.sock"
  36. }
  37. return &config.ContainerRuntimeOptions{
  38. ContainerRuntime: kubetypes.DockerContainerRuntime,
  39. RedirectContainerStreaming: false,
  40. DockerEndpoint: dockerEndpoint,
  41. DockershimRootDirectory: "/var/lib/dockershim",
  42. PodSandboxImage: defaultPodSandboxImage,
  43. ImagePullProgressDeadline: metav1.Duration{Duration: 1 * time.Minute},
  44. ExperimentalDockershim: false,
  45. //Alpha feature
  46. CNIBinDir: "/opt/cni/bin",
  47. CNIConfDir: "/etc/cni/net.d",
  48. }
  49. }