Various fixes to enable kubelet to switch to kuberuntime/dockershim

This commit is contained in:
Yu-Ju Hong 2016-09-16 10:59:40 -07:00
parent 1c3c1ac514
commit bd357e9761
2 changed files with 8 additions and 5 deletions

View File

@ -17,8 +17,6 @@ limitations under the License.
package kuberuntime package kuberuntime
import ( import (
"fmt"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/credentialprovider" "k8s.io/kubernetes/pkg/credentialprovider"
@ -130,7 +128,8 @@ func (m *kubeGenericRuntimeManager) RemoveImage(image kubecontainer.ImageSpec) e
} }
// ImageStats returns the statistics of the image. // ImageStats returns the statistics of the image.
// TODO: Implement this function.
func (m *kubeGenericRuntimeManager) ImageStats() (*kubecontainer.ImageStats, error) { func (m *kubeGenericRuntimeManager) ImageStats() (*kubecontainer.ImageStats, error) {
// TODO: support image stats in new runtime interface var usageBytes uint64 = 0
return nil, fmt.Errorf("not implemented") return &kubecontainer.ImageStats{TotalStorageBytes: usageBytes}, nil
} }

View File

@ -27,6 +27,10 @@ import (
const ( const (
UnsupportedReason = "SysctlUnsupported" UnsupportedReason = "SysctlUnsupported"
// CRI uses semver-compatible API version, while docker does not
// (e.g., 1.24). Append the version with a ".0" so that it works
// with both the CRI and dockertools comparison logic.
dockerMinimumAPIVersion = "1.24.0"
) )
type runtimeAdmitHandler struct { type runtimeAdmitHandler struct {
@ -45,7 +49,7 @@ func NewRuntimeAdmitHandler(runtime container.Runtime) (*runtimeAdmitHandler, er
} }
// only Docker >= 1.12 supports sysctls // only Docker >= 1.12 supports sysctls
c, err := v.Compare(dockertools.DockerV112APIVersion) c, err := v.Compare(dockerMinimumAPIVersion)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to compare Docker version for sysctl support: %v", err) return nil, fmt.Errorf("failed to compare Docker version for sysctl support: %v", err)
} }