mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Kubemark: allow choosing image-service
This commit is contained in:
parent
dd6ee99f62
commit
a4c8a2ca35
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
internalapi "k8s.io/cri-api/pkg/apis"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
@ -70,6 +71,7 @@ type hollowNodeConfig struct {
|
|||||||
RegisterWithTaints []core.Taint
|
RegisterWithTaints []core.Taint
|
||||||
MaxPods int
|
MaxPods int
|
||||||
ExtendedResources map[string]string
|
ExtendedResources map[string]string
|
||||||
|
UseHostImageService bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -98,6 +100,7 @@ func (c *hollowNodeConfig) addFlags(fs *pflag.FlagSet) {
|
|||||||
fs.IntVar(&c.MaxPods, "max-pods", maxPods, "Number of pods that can run on this Kubelet.")
|
fs.IntVar(&c.MaxPods, "max-pods", maxPods, "Number of pods that can run on this Kubelet.")
|
||||||
bindableExtendedResources := cliflag.ConfigurationMap(c.ExtendedResources)
|
bindableExtendedResources := cliflag.ConfigurationMap(c.ExtendedResources)
|
||||||
fs.Var(&bindableExtendedResources, "extended-resources", "Register the node with extended resources (comma separated \"<name>=<quantity>\")")
|
fs.Var(&bindableExtendedResources, "extended-resources", "Register the node with extended resources (comma separated \"<name>=<quantity>\")")
|
||||||
|
fs.BoolVar(&c.UseHostImageService, "use-host-image-service", true, "Set to true if the hollow-kubelet should use the host image service. If set to false the fake image service will be used")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *hollowNodeConfig) createClientConfigFromFile() (*restclient.Config, error) {
|
func (c *hollowNodeConfig) createClientConfigFromFile() (*restclient.Config, error) {
|
||||||
@ -241,17 +244,20 @@ func run(cmd *cobra.Command, config *hollowNodeConfig) {
|
|||||||
klog.Fatalf("Failed to init runtime service %v.", err)
|
klog.Fatalf("Failed to init runtime service %v.", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteImageService, err := remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second)
|
var imageService internalapi.ImageManagerService = fakeRemoteRuntime.ImageService
|
||||||
|
if config.UseHostImageService {
|
||||||
|
imageService, err = remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("Failed to init image service %v.", err)
|
klog.Fatalf("Failed to init image service %v.", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hollowKubelet := kubemark.NewHollowKubelet(
|
hollowKubelet := kubemark.NewHollowKubelet(
|
||||||
f, c,
|
f, c,
|
||||||
client,
|
client,
|
||||||
heartbeatClient,
|
heartbeatClient,
|
||||||
cadvisorInterface,
|
cadvisorInterface,
|
||||||
remoteImageService,
|
imageService,
|
||||||
runtimeService,
|
runtimeService,
|
||||||
containerManager,
|
containerManager,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user