mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
More dockertools cleanup
Move some constants/functions to dockershim and remove unused tests.
This commit is contained in:
parent
80f26fa8a8
commit
5644587e07
@ -151,7 +151,7 @@ func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeapi
|
|||||||
if rOpts != nil {
|
if rOpts != nil {
|
||||||
hc.Resources = dockercontainer.Resources{
|
hc.Resources = dockercontainer.Resources{
|
||||||
Memory: rOpts.MemoryLimitInBytes,
|
Memory: rOpts.MemoryLimitInBytes,
|
||||||
MemorySwap: dockertools.DefaultMemorySwap(),
|
MemorySwap: DefaultMemorySwap(),
|
||||||
CPUShares: rOpts.CpuShares,
|
CPUShares: rOpts.CpuShares,
|
||||||
CPUQuota: rOpts.CpuQuota,
|
CPUQuota: rOpts.CpuQuota,
|
||||||
CPUPeriod: rOpts.CpuPeriod,
|
CPUPeriod: rOpts.CpuPeriod,
|
||||||
|
@ -578,7 +578,7 @@ func sharesHostIpc(container *dockertypes.ContainerJSON) bool {
|
|||||||
|
|
||||||
func setSandboxResources(hc *dockercontainer.HostConfig) {
|
func setSandboxResources(hc *dockercontainer.HostConfig) {
|
||||||
hc.Resources = dockercontainer.Resources{
|
hc.Resources = dockercontainer.Resources{
|
||||||
MemorySwap: dockertools.DefaultMemorySwap(),
|
MemorySwap: DefaultMemorySwap(),
|
||||||
CPUShares: defaultSandboxCPUshares,
|
CPUShares: defaultSandboxCPUshares,
|
||||||
// Use docker's default cpu quota/period.
|
// Use docker's default cpu quota/period.
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dockertools
|
package dockershim
|
||||||
|
|
||||||
func DefaultMemorySwap() int64 {
|
func DefaultMemorySwap() int64 {
|
||||||
return 0
|
return 0
|
@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dockertools
|
package dockershim
|
||||||
|
|
||||||
func DefaultMemorySwap() int64 {
|
func DefaultMemorySwap() int64 {
|
||||||
return -1
|
return -1
|
@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dockertools
|
package dockershim
|
||||||
|
|
||||||
func DefaultMemorySwap() int64 {
|
func DefaultMemorySwap() int64 {
|
||||||
return 0
|
return 0
|
@ -23,7 +23,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
runtimeapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/dockertools"
|
|
||||||
"k8s.io/kubernetes/pkg/kubelet/leaky"
|
"k8s.io/kubernetes/pkg/kubelet/leaky"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,9 +50,9 @@ const (
|
|||||||
// Delimiter used to construct docker container names.
|
// Delimiter used to construct docker container names.
|
||||||
nameDelimiter = "_"
|
nameDelimiter = "_"
|
||||||
// DockerImageIDPrefix is the prefix of image id in container status.
|
// DockerImageIDPrefix is the prefix of image id in container status.
|
||||||
DockerImageIDPrefix = dockertools.DockerPrefix
|
DockerImageIDPrefix = "docker://"
|
||||||
// DockerPullableImageIDPrefix is the prefix of pullable image id in container status.
|
// DockerPullableImageIDPrefix is the prefix of pullable image id in container status.
|
||||||
DockerPullableImageIDPrefix = dockertools.DockerPullablePrefix
|
DockerPullableImageIDPrefix = "docker-pullable://"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeSandboxName(s *runtimeapi.PodSandboxConfig) string {
|
func makeSandboxName(s *runtimeapi.PodSandboxConfig) string {
|
||||||
|
@ -37,15 +37,21 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/credentialprovider"
|
"k8s.io/kubernetes/pkg/credentialprovider"
|
||||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/images"
|
"k8s.io/kubernetes/pkg/kubelet/images"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/leaky"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PodInfraContainerName = leaky.PodInfraContainerName
|
|
||||||
DockerPrefix = "docker://"
|
|
||||||
DockerPullablePrefix = "docker-pullable://"
|
|
||||||
LogSuffix = "log"
|
LogSuffix = "log"
|
||||||
ext4MaxFileNameLen = 255
|
ext4MaxFileNameLen = 255
|
||||||
|
|
||||||
|
DockerType = "docker"
|
||||||
|
|
||||||
|
// https://docs.docker.com/engine/reference/api/docker_remote_api/
|
||||||
|
// docker version should be at least 1.10.x
|
||||||
|
minimumDockerAPIVersion = "1.22"
|
||||||
|
|
||||||
|
statusRunningPrefix = "Up"
|
||||||
|
statusExitedPrefix = "Exited"
|
||||||
|
statusCreatedPrefix = "Created"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DockerInterface is an abstract interface for testability. It abstracts the interface of docker client.
|
// DockerInterface is an abstract interface for testability. It abstracts the interface of docker client.
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2015 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package dockertools
|
|
||||||
|
|
||||||
const (
|
|
||||||
DockerType = "docker"
|
|
||||||
|
|
||||||
// https://docs.docker.com/engine/reference/api/docker_remote_api/
|
|
||||||
// docker version should be at least 1.10.x
|
|
||||||
minimumDockerAPIVersion = "1.22"
|
|
||||||
|
|
||||||
statusRunningPrefix = "Up"
|
|
||||||
statusExitedPrefix = "Exited"
|
|
||||||
statusCreatedPrefix = "Created"
|
|
||||||
)
|
|
@ -19,7 +19,6 @@ package e2e_node
|
|||||||
import (
|
import (
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/dockertools"
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
@ -62,6 +61,6 @@ var _ = framework.KubeDescribe("ImageID", func() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect(status.ContainerStatuses[0].ImageID).To(Equal(dockertools.DockerPullablePrefix + busyBoxImage))
|
Expect(status.ContainerStatuses[0].ImageID).To(ContainSubstring(busyBoxImage))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user