jiebi/CodeConvo huggingface dataset:
func (f fakeRL) TryAccept() bool { return bool(f) } func (f fakeRL) Accept()         {} <del> func expectHTTP(url string, code int, t *testing.T) { </del> <ins> func expectHTTP(url string, code int) error { </ins> r, err := http.Get(url) if err != nil { <del> t.Errorf("unexpected error: %v", err) return </del> <ins> return fmt.Errorf("unexpected error: %v", err) </ins> } if r.StatusCode != code { <del> t.Errorf("unexpected response: %v", r.StatusCode) </del> <ins> return fmt.Errorf("unexpected response: %v", r.StatusCode) </ins> } <ins> return nil </ins> } func getPath(resource, namespace, name string) string {
// 'short' accounted ones. calls := &sync.WaitGroup{} calls.Add(AllowedInflightRequestsNo * 2) <ins> // Responses is used to wait until all responses are // received. This prevents some async requests getting EOF // errors from prematurely closing the server responses := sync.WaitGroup{} responses.Add(AllowedInflightRequestsNo * 2) </ins> // Block is used to keep requests in flight for as long as we need to. All requests will // be unblocked at the same time. block := sync.WaitGroup{}
for i := 0; i < AllowedInflightRequestsNo; i++ { // These should hang waiting on block... go func() { <del> expectHTTP(server.URL+"/foo/bar/watch", http.StatusOK, t) </del> <ins> if err := expectHTTP(server.URL+"/foo/bar/watch", http.StatusOK); err != nil { t.Error(err) } responses.Done() </ins> }() } // Check that sever is not saturated by not-accounted calls <del> expectHTTP(server.URL+"/dontwait", http.StatusOK, t) oneAccountedFinished := sync.WaitGroup{} oneAccountedFinished.Add(1) var once sync.Once </del> <ins> if err := expectHTTP(server.URL+"/dontwait", http.StatusOK); err != nil { t.Error(err) } </ins> // These should hang and be accounted, i.e. saturate the server for i := 0; i < AllowedInflightRequestsNo; i++ { // These should hang waiting on block... go func() { <del> expectHTTP(server.URL, http.StatusOK, t) once.Do(oneAccountedFinished.Done) </del> <ins> if err := expectHTTP(server.URL, http.StatusOK); err != nil { t.Error(err) } responses.Done() </ins> }() } // We wait for all calls to be received by the server
// Do this multiple times to show that it rate limit rejected requests don't block. for i := 0; i < 2; i++ { <del> expectHTTP(server.URL, errors.StatusTooManyRequests, t) </del> <ins> if err := expectHTTP(server.URL, errors.StatusTooManyRequests); err != nil { t.Error(err) } </ins> } // Validate that non-accounted URLs still work <del> expectHTTP(server.URL+"/dontwait/watch", http.StatusOK, t) </del> <ins> if err := expectHTTP(server.URL+"/dontwait/watch", http.StatusOK); err != nil { t.Error(err) } </ins> // Let all hanging requests finish block.Done() // Show that we recover from being blocked up. // Too avoid flakyness we need to wait until at least one of the requests really finishes. <del> oneAccountedFinished.Wait() expectHTTP(server.URL, http.StatusOK, t) </del> <ins> responses.Wait() if err := expectHTTP(server.URL, http.StatusOK); err != nil { t.Error(err) } </ins> } func TestReadOnly(t *testing.T) {
create-node-instance-template $template_name } <del> function create-nodes() { local template_name="${NODE_INSTANCE_PREFIX}-template" </del> <ins> # Assumes: # - MAX_INSTANCES_PER_MIG # - NUM_NODES # exports: # - NUM_MIGS function set_num_migs() { </ins> local defaulted_max_instances_per_mig=${MAX_INSTANCES_PER_MIG:-500} if [[ ${defaulted_max_instances_per_mig} -le "0" ]]; then echo "MAX_INSTANCES_PER_MIG cannot be negative. Assuming default 500" defaulted_max_instances_per_mig=500 fi <del> local num_migs=$(((${NUM_NODES} + ${defaulted_max_instances_per_mig} - 1) / ${defaulted_max_instances_per_mig})) local instances_per_mig=$(((${NUM_NODES} + ${num_migs} - 1) / ${num_migs})) local last_mig_size=$((${NUM_NODES} - (${num_migs} - 1) * ${instances_per_mig})) </del> <ins> export NUM_MIGS=$(((${NUM_NODES} + ${defaulted_max_instances_per_mig} - 1) / ${defaulted_max_instances_per_mig})) } # Assumes: # - NUM_MIGS # - NODE_INSTANCE_PREFIX # - NUM_NODES # - PROJECT # - ZONE function create-nodes() { local template_name="${NODE_INSTANCE_PREFIX}-template" local instances_per_mig=$(((${NUM_NODES} + ${NUM_MIGS} - 1) / ${NUM_MIGS})) local last_mig_size=$((${NUM_NODES} - (${NUM_MIGS} - 1) * ${instances_per_mig})) </ins> #TODO: parallelize this loop to speed up the process <del> for i in $(seq $((${num_migs} - 1))); do </del> <ins> for i in $(seq $((${NUM_MIGS} - 1))); do </ins> gcloud compute instance-groups managed  create "${NODE_INSTANCE_PREFIX}-group-$i"  --project "${PROJECT}"
echo -e "${color_yellow}Attempt ${attempt} failed to create instance template $template_name. Retrying.${color_norm}" >&2 attempt=$(($attempt+1)) sleep $(($attempt * 5)) <ins> # In case the previous attempt failed with something like a # Backend Error and left the entry laying around, delete it # before we try again. gcloud compute instance-templates delete "$template_name" --project "${PROJECT}" &>/dev/null || true </ins> else break fi
fi } <ins> # Deletes a security group # usage: delete_security_group <sgid> function delete_security_group { local -r sg_id=${1} echo "Deleting security group: ${sg_id}" # We retry in case there's a dependent resource - typically an ELB n=0 until [ $n -ge 20 ]; do $AWS_CMD delete-security-group --group-id ${sg_id} > $LOG && return n=$[$n+1] sleep 3 done echo "Unable to delete security group: ${sg_id}" exit 1 } </ins> function ssh-key-setup { if [[ ! -f "$AWS_SSH_KEY" ]]; then ssh-keygen -f "$AWS_SSH_KEY" -N ''
}, "targetPort": { "type": "string", <del> "description": "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of Port is used (an identity map). Defaults to the service port. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service" </del> <ins> "description": "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service" </ins> }, "nodePort": { "type": "integer",
</tr> <tr> <td class="tableblock halign-left valign-top"><p class="tableblock">targetPort</p></td> <del> <td class="tableblock halign-left valign-top"><p class="tableblock">Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod&#8217;s container ports. If this is not specified, the value of Port is used (an identity map). Defaults to the service port. More info: <a href="http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service">http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service</a></p></td> </del> <ins> <td class="tableblock halign-left valign-top"><p class="tableblock">Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod&#8217;s container ports. If this is not specified, the value of the <em>port</em> field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the <em>port</em> field. More info: <a href="http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service">http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service</a></p></td> </ins> <td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td> <td class="tableblock halign-left valign-top"></td>
// Optional: The target port on pods selected by this service.  If this // is a string, it will be looked up as a named port in the target <del> // Pod's container ports.  If this is not specified, the default value // is the sames as the Port field (an identity map). </del> <ins> // Pod's container ports.  If this is not specified, the value // of the 'port' field is used (an identity map). // This field is ignored for services with clusterIP=None, and should be // omitted or set equal to the 'port' field. </ins> TargetPort intstr.IntOrString `json:"targetPort"` // The port on each node on which this service is exposed.
// Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. // If this is a string, it will be looked up as a named port in the // target Pod's container ports. If this is not specified, the value <del> // of Port is used (an identity map). // Defaults to the service port. </del> <ins> // of the 'port' field is used (an identity map). // This field is ignored for services with clusterIP=None, and should be // omitted or set equal to the 'port' field. </ins> // More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service TargetPort intstr.IntOrString `json:"targetPort,omitempty"`
"name":       "The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. This maps to the 'Name' field in EndpointPort objects. Optional if only one ServicePort is defined on this service.", "protocol":   "The IP protocol for this port. Supports "TCP" and "UDP". Default is TCP.", "port":       "The port that will be exposed by this service.", <del> "targetPort": "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of Port is used (an identity map). Defaults to the service port. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service", </del> <ins> "targetPort": "Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#defining-a-service", </ins> "nodePort":   "The port on each node on which this service is exposed when type=NodePort or LoadBalancer. Usually assigned by the system. If specified, it will be allocated to the service if unused or else creation of the service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one. More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#type--nodeport", }
allErrs = append(allErrs, field.Invalid(fldPath.Child("targetPort"), sp.TargetPort, PortNameErrorMsg)) } <del> if isHeadlessService { if sp.TargetPort.Type == intstr.String || (sp.TargetPort.Type == intstr.Int && sp.Port != sp.TargetPort.IntValue()) { allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), sp.Port, "must be equal to targetPort when clusterIP = None")) } } </del> <ins> // in the v1 API, targetPorts on headless services were tolerated. // once we have version-specific validation, we can reject this on newer API versions, but until then, we have to tolerate it for compatibility. // // if isHeadlessService { // 	if sp.TargetPort.Type == intstr.String || (sp.TargetPort.Type == intstr.Int && sp.Port != sp.TargetPort.IntValue()) { // 		allErrs = append(allErrs, field.Invalid(fldPath.Child("targetPort"), sp.TargetPort, "must be equal to the value of 'port' when clusterIP = None")) // 	} // } </ins> return allErrs }
numErrs: 0, }, { <del> name: "invalid port headless", </del> <ins> name: "invalid port headless 1", </ins> tweakSvc: func(s *api.Service) { s.Spec.Ports[0].Port = 11722 s.Spec.Ports[0].TargetPort = intstr.FromInt(11721) s.Spec.ClusterIP = api.ClusterIPNone }, <del> numErrs: 1, </del> <ins> // in the v1 API, targetPorts on headless services were tolerated. // once we have version-specific validation, we can reject this on newer API versions, but until then, we have to tolerate it for compatibility. // numErrs: 1, numErrs: 0, </ins> }, { <del> name: "invalid port headless", </del> <ins> name: "invalid port headless 2", </ins> tweakSvc: func(s *api.Service) { s.Spec.Ports[0].Port = 11722 s.Spec.Ports[0].TargetPort = intstr.FromString("target") s.Spec.ClusterIP = api.ClusterIPNone }, <del> numErrs: 1, </del> <ins> // in the v1 API, targetPorts on headless services were tolerated. // once we have version-specific validation, we can reject this on newer API versions, but until then, we have to tolerate it for compatibility. // numErrs: 1, numErrs: 0, </ins> }, { name: "invalid publicIPs localhost",
# use JENKINS_PUBLISHED_VERSION, default to 'ci/latest', since that's # usually what we're testing. check_dirty_workspace <del> fetch_published_version_tars "${JENKINS_PUBLISHED_VERSION:-'ci/latest'}" </del> <ins> fetch_published_version_tars "${JENKINS_PUBLISHED_VERSION:-ci/latest}" </ins> fi # Copy GCE keys so we don't keep cycling them.
// Return all the security groups that are tagged as being part of our cluster func (s *AWSCloud) getTaggedSecurityGroups() (map[string]*ec2.SecurityGroup, error) { request := &ec2.DescribeSecurityGroupsInput{} <del> filters := []*ec2.Filter{} request.Filters = s.addFilters(filters) </del> <ins> request.Filters = s.addFilters(nil) </ins> groups, err := s.ec2.DescribeSecurityGroups(request) if err != nil { return nil, fmt.Errorf("error querying security groups: %v", err)
describeRequest.Filters = s.addFilters(filters) actualGroups, err := s.ec2.DescribeSecurityGroups(describeRequest) if err != nil { <del> return fmt.Errorf("error querying security groups: %v", err) </del> <ins> return fmt.Errorf("error querying security groups for ELB: %v", err) </ins> } taggedSecurityGroups, err := s.getTaggedSecurityGroups()
return vh.kubelet.kubeClient } <ins> // NewWrapperMounter attempts to create a volume mounter // from a volume Spec, pod and volume options. // Returns a new volume Mounter or an error. </ins> func (vh *volumeHost) NewWrapperMounter(volName string, spec volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { // The name of wrapper volume is set to "wrapped_{wrapped_volume_name}" wrapperVolumeName := "wrapped_" + volName
spec.Volume.Name = wrapperVolumeName } <del> b, err := vh.kubelet.newVolumeMounterFromPlugins(&spec, pod, opts) if err == nil && b == nil { return nil, errUnsupportedVolumeType } return b, nil </del> <ins> return vh.kubelet.newVolumeMounterFromPlugins(&spec, pod, opts) </ins> } <ins> // NewWrapperUnmounter attempts to create a volume unmounter // from a volume name and pod uid. // Returns a new volume Unmounter or an error. </ins> func (vh *volumeHost) NewWrapperUnmounter(volName string, spec volume.Spec, podUID types.UID) (volume.Unmounter, error) { // The name of wrapper volume is set to "wrapped_{wrapped_volume_name}" wrapperVolumeName := "wrapped_" + volName
if err != nil { return nil, err } <del> if plugin == nil { // Not found but not an error return nil, nil } c, err := plugin.NewUnmounter(spec.Name(), podUID) if err == nil && c == nil { return nil, errUnsupportedVolumeType } return c, nil </del> <ins> return plugin.NewUnmounter(spec.Name(), podUID) </ins> } func (vh *volumeHost) GetCloudProvider() cloudprovider.Interface {
glog.Errorf("Could not create volume unmounter for %s: %v", volume.Name, err) continue } <del> if unmounter == nil { glog.Errorf("Could not create volume unmounter for %s: %v", volume.Name, errUnsupportedVolumeType) continue } </del> tuple := cleanerTuple{Unmounter: unmounter} detacher, err := kl.newVolumeDetacherFromPlugins(volume.Kind, volume.Name, podUID)
return currentVolumes } <ins> // newVolumeMounterFromPlugins attempts to find a plugin by volume spec, pod // and volume options and then creates a Mounter. // Returns a valid Unmounter or an error. </ins> func (kl *Kubelet) newVolumeMounterFromPlugins(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Mounter, error) { plugin, err := kl.volumePluginMgr.FindPluginBySpec(spec) if err != nil { return nil, fmt.Errorf("can't use volume plugins for %s: %v", spec.Name(), err) } <del> if plugin == nil { // Not found but not an error return nil, nil } </del> physicalMounter, err := plugin.NewMounter(spec, pod, opts) if err != nil { <del> return nil, fmt.Errorf("failed to instantiate volume physicalMounter for %s: %v", spec.Name(), err) </del> <ins> return nil, fmt.Errorf("failed to instantiate mounter for volume: %s using plugin: %s with a root cause: %v", spec.Name(), plugin.Name(), err) </ins> } glog.V(10).Infof("Used volume plugin %q to mount %s", plugin.Name(), spec.Name()) return physicalMounter, nil } <ins> // newVolumeAttacherFromPlugins attempts to find a plugin from a volume spec // and then create an Attacher. // Returns: //  - an attacher if one exists //  - an error if no plugin was found for the volume //    or the attacher failed to instantiate //  - nil if there is no appropriate attacher for this volume </ins> func (kl *Kubelet) newVolumeAttacherFromPlugins(spec *volume.Spec, pod *api.Pod, opts volume.VolumeOptions) (volume.Attacher, error) { plugin, err := kl.volumePluginMgr.FindAttachablePluginBySpec(spec) if err != nil {
return attacher, nil } <ins> // newVolumeUnmounterFromPlugins attempts to find a plugin by name and then // create an Unmounter. // Returns a valid Unmounter or an error. </ins> func (kl *Kubelet) newVolumeUnmounterFromPlugins(kind string, name string, podUID types.UID) (volume.Unmounter, error) { plugName := strings.UnescapeQualifiedNameForDisk(kind) plugin, err := kl.volumePluginMgr.FindPluginByName(plugName)
// TODO: Maybe we should launch a cleanup of this dir? return nil, fmt.Errorf("can't use volume plugins for %s/%s: %v", podUID, kind, err) } <del> if plugin == nil { // Not found but not an error. return nil, nil } </del> unmounter, err := plugin.NewUnmounter(name, podUID) if err != nil { return nil, fmt.Errorf("failed to instantiate volume plugin for %s/%s: %v", podUID, kind, err)
return unmounter, nil } <ins> // newVolumeDetacherFromPlugins attempts to find a plugin by a name and then // create a Detacher. // Returns: //  - a detacher if one exists //  - an error if no plugin was found for the volume //    or the detacher failed to instantiate //  - nil if there is no appropriate detacher for this volume </ins> func (kl *Kubelet) newVolumeDetacherFromPlugins(kind string, name string, podUID types.UID) (volume.Detacher, error) { plugName := strings.UnescapeQualifiedNameForDisk(kind) plugin, err := kl.volumePluginMgr.FindAttachablePluginByName(plugName)
deleted := false timeout := false var lastPod *api.Pod <del> timer := time.After(30 * time.Second) </del> <ins> // The 30s grace period is not an upper-bound of the time it takes to // delete the pod from etcd. timer := time.After(60 * time.Second) </ins> for !deleted && !timeout { select { case event, _ := <-w.ResultChan():
} } <ins> const defaultCobraMessage = "default message from cobra command" const defaultCobraSubMessage = "default sub-message from cobra command" const cobraMessageDesc = "message to print" const cobraSubMessageDesc = "sub-message to print" func testCobraCommand(n string) *Server { var cobraServer *Server var msg string cmd := &cobra.Command{ Use:   n, Long:  n, Short: n, Run: func(cmd *cobra.Command, args []string) { cobraServer.hk.Printf("msg: %sn", msg) }, } cmd.PersistentFlags().StringVar(&msg, "msg", defaultCobraMessage, cobraMessageDesc) var subMsg string subCmdName := "subcommand" subCmd := &cobra.Command{ Use:   subCmdName, Long:  subCmdName, Short: subCmdName, Run: func(cmd *cobra.Command, args []string) { cobraServer.hk.Printf("submsg: %s", subMsg) }, } subCmd.PersistentFlags().StringVar(&subMsg, "submsg", defaultCobraSubMessage, cobraSubMessageDesc) cmd.AddCommand(subCmd) localFlags := cmd.LocalFlags() localFlags.SetInterspersed(false) s := &Server{ SimpleUsage: n, Long:        fmt.Sprintf("A server named %s which uses a cobra command", n), Run: func(s *Server, args []string) error { cobraServer = s cmd.SetOutput(s.hk.Out()) cmd.SetArgs(args) return cmd.Execute() }, flags: localFlags, } return s } </ins> func runFull(t *testing.T, args string) *result { buf := new(bytes.Buffer) hk := HyperKube{
assert.Contains(t, x.output, "test-error Run") assert.EqualError(t, x.err, "Server returning error") } <ins> func TestCobraCommandHelp(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command --help") assert.NoError(t, x.err) assert.Contains(t, x.output, "A server named test-cobra-command which uses a cobra command") assert.Contains(t, x.output, cobraMessageDesc) } func TestCobraCommandDefaultMessage(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command") assert.Contains(t, x.output, fmt.Sprintf("msg: %s", defaultCobraMessage)) } func TestCobraCommandMessage(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command --msg foobar") assert.Contains(t, x.output, "msg: foobar") } func TestCobraSubCommandHelp(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command subcommand --help") assert.NoError(t, x.err) assert.Contains(t, x.output, cobraSubMessageDesc) } func TestCobraSubCommandDefaultMessage(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command subcommand") assert.Contains(t, x.output, fmt.Sprintf("submsg: %s", defaultCobraSubMessage)) } func TestCobraSubCommandMessage(t *testing.T) { x := runFull(t, "hyperkube test-cobra-command subcommand --submsg foobar") assert.Contains(t, x.output, "submsg: foobar") } </ins>
import ( "os" <del> "k8s.io/kubernetes/cmd/kubectl/app" </del> <ins> "k8s.io/kubernetes/pkg/kubectl/cmd" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" </ins> ) func NewKubectlServer() *Server { <ins> cmd := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr) localFlags := cmd.LocalFlags() localFlags.SetInterspersed(false) </ins> return &Server{ name:        "kubectl", SimpleUsage: "Kubernetes command line client", Long:        "Kubernetes command line client", Run: func(s *Server, args []string) error { <del> os.Args = os.Args[1:] if err := app.Run(); err != nil { os.Exit(1) } os.Exit(0) return nil </del> <ins> cmd.SetArgs(args) return cmd.Execute() </ins> }, <ins> flags: localFlags, </ins> } }
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" ) <ins> /* WARNING: this logic is duplicated, with minor changes, in cmd/hyperkube/kubectl.go Any salient changes here will need to be manually reflected in that file. */ </ins> func Run() error { cmd := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr) return cmd.Execute()
"k8s.io/kubernetes/pkg/kubelet/network" proberesults "k8s.io/kubernetes/pkg/kubelet/prober/results" kubetypes "k8s.io/kubernetes/pkg/kubelet/types" <del> "k8s.io/kubernetes/pkg/kubelet/util/cache" </del> "k8s.io/kubernetes/pkg/types" "k8s.io/kubernetes/pkg/util/flowcontrol" "k8s.io/kubernetes/pkg/util/oom"
burst, containerLogsDir, osInterface, networkPlugin, runtimeHelper, httpClient, &NativeExecHandler{}, fakeOOMAdjuster, fakeProcFs, false, imageBackOff, false, false, true) dm.dockerPuller = &FakeDockerPuller{} <del> dm.versionCache = cache.NewVersionCache(func() (kubecontainer.Version, kubecontainer.Version, error) { return dm.getVersionInfo() }) </del> return dm }
optf(dm) } <del> // initialize versionCache with a updater dm.versionCache = cache.NewVersionCache(func() (kubecontainer.Version, kubecontainer.Version, error) { return dm.getVersionInfo() }) // update version cache periodically. if dm.machineInfo != nil { dm.versionCache.UpdateCachePeriodly(dm.machineInfo.MachineID) } </del> return dm }