jiebi/CodeConvo huggingface dataset:
}, { evictionPriority: 0, <del> pod: diskConsumingPod("guaranteed-disk", 299 /* Mb */, nil, v1.ResourceRequirements{ </del> <ins> // Only require 99% accuracy (297/300 Mb) because on some OS distributions, the file itself (excluding contents), consumes disk space. pod: diskConsumingPod("guaranteed-disk", 297 /* Mb */, nil, v1.ResourceRequirements{ </ins> Requests: v1.ResourceList{ v1.ResourceEphemeralStorage: resource.MustParse("300Mi"), },
Skip("Nvidia GPUs do not exist on the node. Skipping test.") } <ins> framework.WaitForAllNodesSchedulable(f.ClientSet, framework.TestContext.NodeSchedulableTimeout) </ins> By("Creating the Google Device Plugin pod for NVIDIA GPU in GKE") devicePluginPod = f.PodClient().CreateSync(framework.NVIDIADevicePlugin(f.Namespace.Name))
f.PodClient().Delete(devicePluginPod.Name, &metav1.DeleteOptions{}) By("Waiting for GPUs to become unavailable on the local node") Eventually(func() bool { <del> return framework.NumberOfNVIDIAGPUs(getLocalNode(f)) <= 0 </del> <ins> node, err := f.ClientSet.CoreV1().Nodes().Get(framework.TestContext.NodeName, metav1.GetOptions{}) framework.ExpectNoError(err) return framework.NumberOfNVIDIAGPUs(node) <= 0 </ins> }, 10*time.Minute, framework.Poll).Should(BeTrue()) By("Checking that scheduled pods can continue to run even after we delete device plugin.") count1, devIdRestart1 = getDeviceId(f, p1.Name, p1.Name, count1+1)
// File system resize was requested, proceed glog.V(4).Infof(volumeToMount.GenerateMsgDetailed("MountVolume.resizeFileSystem entering", fmt.Sprintf("DevicePath %q", volumeToMount.DevicePath))) <ins> if volumeToMount.VolumeSpec.ReadOnly { simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.resizeFileSystem failed", "requested read-only file system") glog.Warningf(detailedMsg) og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeWarning, kevents.FileSystemResizeFailed, simpleMsg) return nil } </ins> diskFormatter := &mount.SafeFormatAndMount{ Interface: mounter, Exec:      og.volumePluginMgr.Host.GetExec(expandableVolumePlugin.GetPluginName()),
Accelerators utilfeature.Feature = "Accelerators" // owner: @jiayingz <del> // alpha: v1.8 </del> <ins> // beta: v1.10 </ins> // // Enables support for Device Plugins <del> // Only Nvidia GPUs are tested as of v1.8. </del> DevicePlugins utilfeature.Feature = "DevicePlugins" // owner: @gmarek
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta}, ExperimentalCriticalPodAnnotation:           {Default: false, PreRelease: utilfeature.Alpha}, Accelerators:                                {Default: false, PreRelease: utilfeature.Alpha}, <del> DevicePlugins:                               {Default: false, PreRelease: utilfeature.Alpha}, </del> <ins> DevicePlugins:                               {Default: true, PreRelease: utilfeature.Beta}, </ins> TaintBasedEvictions:                         {Default: false, PreRelease: utilfeature.Alpha}, RotateKubeletServerCertificate:              {Default: false, PreRelease: utilfeature.Alpha}, RotateKubeletClientCertificate:              {Default: true, PreRelease: utilfeature.Beta},
// This is a temporary workaround to get stats for cri-o from cadvisor // and should be removed. // Related to https://github.com/kubernetes/kubernetes/issues/51798 <del> if i.runtimeEndpoint == "/var/run/crio.sock" { </del> <ins> if i.runtimeEndpoint == CrioSocket { </ins> return cadvisorfs.LabelCrioImages, nil } }
kubetypes "k8s.io/kubernetes/pkg/kubelet/types" ) <ins> const ( // Please keep this in sync with the one in: // github.com/google/cadvisor/container/crio/client.go CrioSocket = "/var/run/crio/crio.sock" ) </ins> func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) v1.ResourceList { c := v1.ResourceList{ v1.ResourceCPU: *resource.NewMilliQuantity(
var _ Manager = &manager{} // NewManager creates new cpu manager based on provided policy <del> func NewManager( cpuPolicyName string, reconcilePeriod time.Duration, machineInfo *cadvisorapi.MachineInfo, nodeAllocatableReservation v1.ResourceList, stateFileDirecory string, ) (Manager, error) { </del> <ins> func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo *cadvisorapi.MachineInfo, nodeAllocatableReservation v1.ResourceList, stateFileDirecory string) (Manager, error) { </ins> var policy Policy switch policyName(cpuPolicyName) {
glog.Infof("[cpumanager] detected CPU topology: %v", topo) reservedCPUs, ok := nodeAllocatableReservation[v1.ResourceCPU] if !ok { <del> // The static policy cannot initialize without this information. Panic! panic("[cpumanager] unable to determine reserved CPU resources for static policy") </del> <ins> // The static policy cannot initialize without this information. return nil, fmt.Errorf("[cpumanager] unable to determine reserved CPU resources for static policy") </ins> } if reservedCPUs.IsZero() { <del> // Panic! // </del> // The static policy requires this to be nonzero. Zero CPU reservation // would allow the shared pool to be completely exhausted. At that point // either we would violate our guarantee of exclusivity or need to evict // any pod that has at least one container that requires zero CPUs. // See the comments in policy_static.go for more details. <del> panic("[cpumanager] the static policy requires systemreserved.cpu + kubereserved.cpu to be greater than zero") </del> <ins> return nil, fmt.Errorf("[cpumanager] the static policy requires systemreserved.cpu + kubereserved.cpu to be greater than zero") </ins> } // Take the ceiling of the reservation, since fractional CPUs cannot be
description:                "static policy - broken reservation", cpuPolicyName:              "static", nodeAllocatableReservation: v1.ResourceList{}, <del> panicMsg:                   "unable to determine reserved CPU resources for static policy", </del> <ins> expectedError:              fmt.Errorf("unable to determine reserved CPU resources for static policy"), </ins> skipIfPermissionsError:     true, }, { description:                "static policy - no CPU resources", cpuPolicyName:              "static", nodeAllocatableReservation: v1.ResourceList{v1.ResourceCPU: *resource.NewQuantity(0, resource.DecimalSI)}, <del> panicMsg:                   "the static policy requires systemreserved.cpu + kubereserved.cpu to be greater than zero", </del> <ins> expectedError:              fmt.Errorf("the static policy requires systemreserved.cpu + kubereserved.cpu to be greater than zero"), </ins> skipIfPermissionsError:     true, }, }
t.Errorf("cannot create state file: %s", err.Error()) } defer os.RemoveAll(sDir) <del> defer func() { if err := recover(); err != nil { if testCase.panicMsg != "" { if !strings.Contains(err.(string), testCase.panicMsg) { t.Errorf("Unexpected panic message. Have: %q wants %q", err, testCase.panicMsg) } } else { t.Errorf("Unexpected panic: %q", err) } } else if testCase.panicMsg != "" { t.Error("Expected panic hasn't been raised") } }() </del> mgr, err := NewManager(testCase.cpuPolicyName, 5*time.Second, machineInfo, testCase.nodeAllocatableReservation, sDir) if testCase.expectedError != nil {
EnableLogsHandler:      true, EventTTL:               1 * time.Hour, MasterCount:            1, <del> EndpointReconcilerType: string(reconcilers.MasterCountReconcilerType), </del> <ins> EndpointReconcilerType: string(reconcilers.LeaseEndpointReconcilerType), </ins> KubeletConfig: kubeletclient.KubeletClientConfig{ Port:         ports.KubeletPort, ReadOnlyPort: ports.KubeletReadOnlyPort,
"Currently only applies to long-running requests.") fs.IntVar(&s.MasterCount, "apiserver-count", s.MasterCount, <del> "The number of apiservers running in the cluster, must be a positive number.") </del> <ins> "The number of apiservers running in the cluster, must be a positive number. (In use when --endpoint-reconciler-type=master-count is enabled.)") </ins> fs.StringVar(&s.EndpointReconcilerType, "endpoint-reconciler-type", string(s.EndpointReconcilerType), "Use an endpoint reconciler ("+strings.Join(reconcilers.AllTypes.Names(), ", ")+")")
"--enable-aggregator-routing=true", "--enable-logs-handler=false", "--enable-swagger-ui=true", <del> "--endpoint-reconciler-type=" + string(reconcilers.MasterCountReconcilerType), </del> <ins> "--endpoint-reconciler-type=" + string(reconcilers.LeaseEndpointReconcilerType), </ins> "--etcd-quorum-read=false", "--etcd-keyfile=/var/run/kubernetes/etcd.key", "--etcd-certfile=/var/run/kubernetes/etcdce.crt",
ServiceNodePortRange:   kubeoptions.DefaultServiceNodePortRange, ServiceClusterIPRange:  kubeoptions.DefaultServiceIPCIDR, MasterCount:            5, <del> EndpointReconcilerType: string(reconcilers.MasterCountReconcilerType), </del> <ins> EndpointReconcilerType: string(reconcilers.LeaseEndpointReconcilerType), </ins> AllowPrivileged:        false, GenericServerRunOptions: &apiserveroptions.ServerRunOptions{ AdvertiseAddress:            net.ParseIP("192.168.10.10"),
print('File %s is missing the year' % filename, file=verbose_out) return False <del> # Replace all occurrences of the regex "2017|2016|2015|2014" with "YEAR" </del> <ins> # Replace all occurrences of the regex "2014|2015|2016|2017|2018" with "YEAR" </ins> p = regexs["date"] for i, d in enumerate(data): (data[i], found) = p.subn('YEAR', d)
regexs = {} # Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing regexs["year"] = re.compile( 'YEAR' ) <del> # dates can be 2014, 2015, 2016, or 2017; company holder names can be anything regexs["date"] = re.compile( '(2014|2015|2016|2017)' ) </del> <ins> # dates can be 2014, 2015, 2016, 2017, or 2018; company holder names can be anything regexs["date"] = re.compile( '(2014|2015|2016|2017|2018)' ) </ins> # strip // +build nn build constraints regexs["go_build_constraints"] = re.compile(r"^(// +build.*n)+n", re.MULTILINE) # strip #!.* from shell scripts
} service, err := e.serviceLister.Services(namespace).Get(name) if err != nil { <del> // Delete the corresponding endpoint, as the service has been deleted. // TODO: Please note that this will delete an endpoint when a // service is deleted. However, if we're down at the time when // the service is deleted, we will miss that deletion, so this // doesn't completely solve the problem. See #6877. err = e.client.CoreV1().Endpoints(namespace).Delete(name, nil) if err != nil && !errors.IsNotFound(err) { return err } </del> <ins> // Service has been deleted. So no need to do any more operations. </ins> return nil }
// See http://docs.openstack.org/user-guide/cli_config_drive.html type Metadata struct { Uuid             string           `json:"uuid"` <del> Name             string           `json:"name"` </del> <ins> Hostname         string           `json:"hostname"` </ins> AvailabilityZone string           `json:"availability_zone"` Devices          []DeviceMetadata `json:"devices,omitempty"` // .. and other fields we don't care about.  Expand as necessary.
t.Fatalf("Should succeed when provided with valid data: %s", err) } <del> if md.Name != "test" { t.Errorf("incorrect name: %s", md.Name) </del> <ins> if md.Hostname != "test.novalocal" { t.Errorf("incorrect hostname: %s", md.Hostname) </ins> } if md.Uuid != "83679162-1378-4288-a2d4-70e13ec132aa" {
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" <ins> utilflag "k8s.io/apiserver/pkg/util/flag" </ins> clientset "k8s.io/client-go/kubernetes" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
) flagSet.StringVar(featureGatesString, "feature-gates", *featureGatesString, "A set of key=value pairs that describe feature gates for various features. "+ "Options are:n"+strings.Join(features.KnownFeatures(&features.InitFeatureGates), "n")) <ins> flagSet.Var(utilflag.NewMapStringString(&cfg.APIServerExtraArgs), "apiserver-extra-args", "A set of extra flags to pass to the API Server or override default ones in form of <flagname>=<value>") flagSet.Var(utilflag.NewMapStringString(&cfg.ControllerManagerExtraArgs), "controller-manager-extra-args", "A set of extra flags to pass to the Controller Manager or override default ones in form of <flagname>=<value>") flagSet.Var(utilflag.NewMapStringString(&cfg.SchedulerExtraArgs), "scheduler-extra-args", "A set of extra flags to pass to the Scheduler or override default ones in form of <flagname>=<value>") </ins> } // AddInitOtherFlags adds init flags that are not bound to a configuration file to the given flagset
"//vendor/github.com/spf13/pflag:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", <ins> "//vendor/k8s.io/apiserver/pkg/util/flag:go_default_library", </ins> "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/tools/bootstrap/token/api:go_default_library", "//vendor/k8s.io/client-go/tools/bootstrap/token/util:go_default_library",
"github.com/spf13/cobra" <ins> utilflag "k8s.io/apiserver/pkg/util/flag" </ins> kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
cmd.Flags().StringVar(&cfg.Networking.ServiceSubnet, "service-cidr", cfg.Networking.ServiceSubnet, "The range of IP address used for service VIPs") cmd.Flags().StringVar(&featureGatesString, "feature-gates", featureGatesString, "A set of key=value pairs that describe feature gates for various features. "+ "Options are:n"+strings.Join(features.KnownFeatures(&features.InitFeatureGates), "n")) <ins> cmd.Flags().Var(utilflag.NewMapStringString(&cfg.APIServerExtraArgs), "apiserver-extra-args", "A set of extra flags to pass to the API Server or override default ones in form of <flagname>=<value>") </ins> } if properties.use == "all" || properties.use == "controller-manager" { cmd.Flags().StringVar(&cfg.Networking.PodSubnet, "pod-network-cidr", cfg.Networking.PodSubnet, "The range of IP addresses used for the Pod network") <ins> cmd.Flags().Var(utilflag.NewMapStringString(&cfg.ControllerManagerExtraArgs), "controller-manager-extra-args", "A set of extra flags to pass to the Controller Manager or override default ones in form of <flagname>=<value>") } if properties.use == "all" || properties.use == "scheduler" { cmd.Flags().Var(utilflag.NewMapStringString(&cfg.SchedulerExtraArgs), "scheduler-extra-args", "A set of extra flags to pass to the Scheduler or override default ones in form of <flagname>=<value>") </ins> } cmd.Flags().StringVar(&cfgPath, "config", cfgPath, "Path to kubeadm config file (WARNING: Usage of a configuration file is experimental)")
} func (plugin *fcPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { <del> fcVolume := &v1.Volume{ Name: volumeName, VolumeSource: v1.VolumeSource{ FC: &v1.FCVolumeSource{}, }, </del> <ins> // Find globalPDPath from pod volume directory(mountPath) // examples: //   mountPath:     pods/{podUid}/volumes/kubernetes.io~fc/{volumeName} //   globalPDPath : plugins/kubernetes.io/fc/50060e801049cfd1-lun-0 var globalPDPath string mounter := plugin.host.GetMounter(plugin.GetPluginName()) paths, err := mount.GetMountRefs(mounter, mountPath) if err != nil { return nil, err } for _, path := range paths { if strings.Contains(path, plugin.host.GetPluginDir(fcPluginName)) { globalPDPath = path break } } // Couldn't fetch globalPDPath if len(globalPDPath) == 0 { return nil, fmt.Errorf("couldn't fetch globalPDPath. failed to obtain volume spec") } arr := strings.Split(globalPDPath, "/") if len(arr) < 1 { return nil, fmt.Errorf("failed to retrieve volume plugin information from globalPDPath: %v", globalPDPath) } volumeInfo := arr[len(arr)-1] // Create volume from wwn+lun or wwid var fcVolume *v1.Volume if strings.Contains(volumeInfo, "-lun-") { wwnLun := strings.Split(volumeInfo, "-lun-") if len(wwnLun) < 2 { return nil, fmt.Errorf("failed to retrieve TargetWWN and Lun. volumeInfo is invalid: %v", volumeInfo) } lun, err := strconv.Atoi(wwnLun[1]) if err != nil { return nil, err } lun32 := int32(lun) fcVolume = &v1.Volume{ Name: volumeName, VolumeSource: v1.VolumeSource{ FC: &v1.FCVolumeSource{TargetWWNs: []string{wwnLun[0]}, Lun: &lun32}, }, } glog.V(5).Infof("ConstructVolumeSpec: TargetWWNs: %v, Lun: %v", fcVolume.VolumeSource.FC.TargetWWNs, *fcVolume.VolumeSource.FC.Lun) } else { fcVolume = &v1.Volume{ Name: volumeName, VolumeSource: v1.VolumeSource{ FC: &v1.FCVolumeSource{WWIDs: []string{volumeInfo}}, }, } glog.V(5).Infof("ConstructVolumeSpec: WWIDs: %v", fcVolume.VolumeSource.FC.WWIDs) </ins> } return volume.NewSpecFromVolume(fcVolume), nil }
//   - If a file is found, then retreives volumePluginDependentPath from globalMapPathUUID. //   - Once volumePluginDependentPath is obtained, store volume information to VolumeSource // examples: <del> //   mapPath: pods/{podUid}}/{DefaultKubeletVolumeDevicesDirName}/{escapeQualifiedPluginName}/{volumeName} </del> <ins> //   mapPath: pods/{podUid}/{DefaultKubeletVolumeDevicesDirName}/{escapeQualifiedPluginName}/{volumeName} </ins> //   globalMapPathUUID : plugins/kubernetes.io/{PluginName}/{DefaultKubeletVolumeDevicesDirName}/{volumePluginDependentPath}/{pod uuid} func (plugin *fcPlugin) ConstructBlockVolumeSpec(podUID types.UID, volumeName, mapPath string) (*volume.Spec, error) { pluginDir := plugin.host.GetVolumeDevicePluginDir(fcPluginName)
v1.FCVolumeSource{TargetWWNs: []string{wwnLun[0]}, Lun: &lun32}) glog.V(5).Infof("ConstructBlockVolumeSpec: TargetWWNs: %v, Lun: %v", fcPV.Spec.PersistentVolumeSource.FC.TargetWWNs, <del> fcPV.Spec.PersistentVolumeSource.FC.Lun) </del> <ins> *fcPV.Spec.PersistentVolumeSource.FC.Lun) </ins> } else { fcPV = createPersistentVolumeFromFCVolumeSource(volumeName, v1.FCVolumeSource{WWIDs: []string{volumeInfo}})
t.Errorf("unexpected fc disk found") } } <ins> func Test_ConstructVolumeSpec(t *testing.T) { fm := &mount.FakeMounter{ MountPoints: []mount.MountPoint{ {Device: "/dev/sdb", Path: "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod1"}, {Device: "/dev/sdb", Path: "/var/lib/kubelet/plugins/kubernetes.io/fc/50060e801049cfd1-lun-0"}, {Device: "/dev/sdc", Path: "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod2"}, {Device: "/dev/sdc", Path: "/var/lib/kubelet/plugins/kubernetes.io/fc/volumeDevices/3600508b400105e210000900000490000"}, }, } mountPaths := []string{ "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod1", "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod2", } for _, path := range mountPaths { refs, _ := mount.GetMountRefs(fm, path) var globalPDPath string for _, ref := range refs { if strings.Contains(ref, "kubernetes.io/fc") { globalPDPath = ref break } } if len(globalPDPath) == 0 { t.Errorf("couldn't fetch mountrefs") } arr := strings.Split(globalPDPath, "/") if len(arr) < 1 { t.Errorf("failed to retrieve volume plugin information from globalPDPath: %v", globalPDPath) } volumeInfo := arr[len(arr)-1] if strings.Contains(volumeInfo, "-lun-") { wwnLun := strings.Split(volumeInfo, "-lun-") if len(wwnLun) < 2 { t.Errorf("failed to retrieve TargetWWN and Lun. volumeInfo is invalid: %v", volumeInfo) } lun, _ := strconv.Atoi(wwnLun[1]) lun32 := int32(lun) if wwnLun[0] != "50060e801049cfd1" || lun32 != 0 { t.Errorf("failed to retrieve TargetWWN and Lun") } } else { if volumeInfo != "3600508b400105e210000900000490000" { t.Errorf("failed to retrieve WWIDs") } } } } func Test_ConstructVolumeSpecNoRefs(t *testing.T) { fm := &mount.FakeMounter{ MountPoints: []mount.MountPoint{ {Device: "/dev/sdd", Path: "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod1"}, }, } mountPaths := []string{ "/var/lib/kubelet/pods/some-pod/volumes/kubernetes.io~fc/fc-in-pod1", } for _, path := range mountPaths { refs, _ := mount.GetMountRefs(fm, path) var globalPDPath string for _, ref := range refs { if strings.Contains(ref, "kubernetes.io/fc") { globalPDPath = ref break } } if len(globalPDPath) != 0 { t.Errorf("invalid globalPDPath") } } } </ins>
GetStats(path string, stats *libcontainercgroups.Stats) error } <del> // getSupportedSubsystems returns list of subsystems supported func getSupportedSubsystems() []subsystem { supportedSubsystems := []subsystem{ &cgroupfs.MemoryGroup{}, &cgroupfs.CpuGroup{}, </del> <ins> // getSupportedSubsystems returns a map of subsystem and if it must be mounted for the kubelet to function. func getSupportedSubsystems() map[subsystem]bool { supportedSubsystems := map[subsystem]bool{ &cgroupfs.MemoryGroup{}: true, &cgroupfs.CpuGroup{}:    true, </ins> } <ins> // not all hosts support hugetlb cgroup, and in the absent of hugetlb, we will fail silently by reporting no capacity. </ins> if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.HugePages) { <del> supportedSubsystems = append(supportedSubsystems, &cgroupfs.HugetlbGroup{}) </del> <ins> supportedSubsystems[&cgroupfs.HugetlbGroup{}] = false </ins> } if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.SupportPodPidsLimit) { <del> supportedSubsystems = append(supportedSubsystems, &cgroupfs.PidsGroup{}) </del> <ins> supportedSubsystems[&cgroupfs.PidsGroup{}] = true </ins> } return supportedSubsystems }
// but this is not possible with libcontainers Set() method // See https://github.com/opencontainers/runc/issues/932 func setSupportedSubsystems(cgroupConfig *libcontainerconfigs.Cgroup) error { <del> for _, sys := range getSupportedSubsystems() { </del> <ins> for sys, required := range getSupportedSubsystems() { </ins> if _, ok := cgroupConfig.Paths[sys.Name()]; !ok { <del> return fmt.Errorf("Failed to find subsystem mount for subsystem: %v", sys.Name()) </del> <ins> if required { return fmt.Errorf("Failed to find subsystem mount for required subsystem: %v", sys.Name()) } // the cgroup is not mounted, but its not required so continue... glog.V(6).Infof("Unable to find subsystem mount for optional subsystem: %v", sys.Name()) continue </ins> } if err := sys.Set(cgroupConfig.Paths[sys.Name()], cgroupConfig); err != nil { return fmt.Errorf("Failed to set config for supported subsystems : %v", err)
func getStatsSupportedSubsystems(cgroupPaths map[string]string) (*libcontainercgroups.Stats, error) { stats := libcontainercgroups.NewStats() <del> for _, sys := range getSupportedSubsystems() { </del> <ins> for sys, required := range getSupportedSubsystems() { </ins> if _, ok := cgroupPaths[sys.Name()]; !ok { <del> return nil, fmt.Errorf("Failed to find subsystem mount for subsystem: %v", sys.Name()) </del> <ins> if required { return nil, fmt.Errorf("Failed to find subsystem mount for required subsystem: %v", sys.Name()) } // the cgroup is not mounted, but its not required so continue... glog.V(6).Infof("Unable to find subsystem mount for optional subsystem: %v", sys.Name()) continue </ins> } if err := sys.GetStats(cgroupPaths[sys.Name()], stats); err != nil { return nil, fmt.Errorf("Failed to get stats for supported subsystems : %v", err)
if !(runtime.IsMissingVersion(err) || runtime.IsMissingKind(err) || runtime.IsNotRegisteredError(err)) { return nil, err } <ins> // Only tolerate load errors if the file appears to be one of the two legacy plugin configs unstructuredData := map[string]interface{}{} if err2 := yaml.Unmarshal(data, &unstructuredData); err2 != nil { return nil, err } _, isLegacyImagePolicy := unstructuredData["imagePolicy"] _, isLegacyPodNodeSelector := unstructuredData["podNodeSelectorPluginConfig"] if !isLegacyImagePolicy && !isLegacyPodNodeSelector { return nil, err } </ins> // convert the legacy format to the new admission control format // in order to preserve backwards compatibility, we set plugins that // previously read input from a non-versioned file configuration to the
"k8s.io/client-go/rest" ) <del> var scheme = runtime.NewScheme() </del> <ins> var configScheme = runtime.NewScheme() </ins> func init() { <del> apiserverapi.AddToScheme(scheme) apiserverapiv1alpha1.AddToScheme(scheme) </del> <ins> apiserverapi.AddToScheme(configScheme) apiserverapiv1alpha1.AddToScheme(configScheme) </ins> } // AdmissionOptions holds the admission options