mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +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/pflag"
|
||||
internalapi "k8s.io/cri-api/pkg/apis"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
@ -70,6 +71,7 @@ type hollowNodeConfig struct {
|
||||
RegisterWithTaints []core.Taint
|
||||
MaxPods int
|
||||
ExtendedResources map[string]string
|
||||
UseHostImageService bool
|
||||
}
|
||||
|
||||
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.")
|
||||
bindableExtendedResources := cliflag.ConfigurationMap(c.ExtendedResources)
|
||||
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) {
|
||||
@ -241,9 +244,12 @@ func run(cmd *cobra.Command, config *hollowNodeConfig) {
|
||||
klog.Fatalf("Failed to init runtime service %v.", err)
|
||||
}
|
||||
|
||||
remoteImageService, err := remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed to init image service %v.", err)
|
||||
var imageService internalapi.ImageManagerService = fakeRemoteRuntime.ImageService
|
||||
if config.UseHostImageService {
|
||||
imageService, err = remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second)
|
||||
if err != nil {
|
||||
klog.Fatalf("Failed to init image service %v.", err)
|
||||
}
|
||||
}
|
||||
|
||||
hollowKubelet := kubemark.NewHollowKubelet(
|
||||
@ -251,7 +257,7 @@ func run(cmd *cobra.Command, config *hollowNodeConfig) {
|
||||
client,
|
||||
heartbeatClient,
|
||||
cadvisorInterface,
|
||||
remoteImageService,
|
||||
imageService,
|
||||
runtimeService,
|
||||
containerManager,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user