mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
pkg/kubelet: kill a TODO in util.go
Move kubelet.CapabilitiesSetup to capabilities.Setup
This commit is contained in:
parent
d577db9987
commit
cea38a2f4e
@ -29,6 +29,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/clientauth"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/clientauth"
|
||||||
@ -406,7 +407,7 @@ func RunKubelet(kcfg *KubeletConfig, builder KubeletBuilder) {
|
|||||||
} else {
|
} else {
|
||||||
glog.Infof("No api server defined - no events will be sent to API server.")
|
glog.Infof("No api server defined - no events will be sent to API server.")
|
||||||
}
|
}
|
||||||
kubelet.SetupCapabilities(kcfg.AllowPrivileged, kcfg.HostNetworkSources)
|
capabilities.Setup(kcfg.AllowPrivileged, kcfg.HostNetworkSources)
|
||||||
|
|
||||||
credentialprovider.SetPreferredDockercfgPath(kcfg.RootDirectory)
|
credentialprovider.SetPreferredDockercfgPath(kcfg.RootDirectory)
|
||||||
|
|
||||||
|
@ -40,6 +40,14 @@ func Initialize(c Capabilities) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup the capability set. It wraps Initialize for improving usibility.
|
||||||
|
func Setup(allowPrivileged bool, hostNetworkSources []string) {
|
||||||
|
Initialize(Capabilities{
|
||||||
|
AllowPrivileged: allowPrivileged,
|
||||||
|
HostNetworkSources: hostNetworkSources,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// SetCapabilitiesForTests. Convenience method for testing. This should only be called from tests.
|
// SetCapabilitiesForTests. Convenience method for testing. This should only be called from tests.
|
||||||
func SetForTests(c Capabilities) {
|
func SetForTests(c Capabilities) {
|
||||||
capabilities = &c
|
capabilities = &c
|
||||||
|
@ -19,18 +19,9 @@ package kubelet
|
|||||||
import (
|
import (
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
|
||||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: move this into pkg/capabilities
|
|
||||||
func SetupCapabilities(allowPrivileged bool, hostNetworkSources []string) {
|
|
||||||
capabilities.Initialize(capabilities.Capabilities{
|
|
||||||
AllowPrivileged: allowPrivileged,
|
|
||||||
HostNetworkSources: hostNetworkSources,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func CapacityFromMachineInfo(info *cadvisorApi.MachineInfo) api.ResourceList {
|
func CapacityFromMachineInfo(info *cadvisorApi.MachineInfo) api.ResourceList {
|
||||||
c := api.ResourceList{
|
c := api.ResourceList{
|
||||||
api.ResourceCPU: *resource.NewMilliQuantity(
|
api.ResourceCPU: *resource.NewMilliQuantity(
|
||||||
|
Loading…
Reference in New Issue
Block a user