jiebi/CodeConvo huggingface dataset:
func (s *gcepdSource) createVolume(f *framework.Framework) volInfo { var err error <del> framework.Logf("Creating GCE PD volume") s.diskName, err = framework.CreatePDWithRetry() framework.ExpectNoError(err, "Error creating PD") </del> <ins> framework.Logf("Creating GCE PD volume via dynamic provisioning") testCase := storageClassTest{ name:      "subpath", claimSize: "2G", } pvc := newClaim(testCase, f.Namespace.Name, "subpath") s.pvc, err = framework.CreatePVC(f.ClientSet, f.Namespace.Name, pvc) framework.ExpectNoError(err, "Error creating PVC") </ins> return volInfo{ source: &v1.VolumeSource{ <del> GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{PDName: s.diskName}, </del> <ins> PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{ ClaimName: s.pvc.Name, }, </ins> }, } } func (s *gcepdSource) cleanupVolume(f *framework.Framework) { <del> if s.diskName != "" { err := framework.DeletePDWithRetry(s.diskName) framework.ExpectNoError(err, "Error deleting PD") </del> <ins> if s.pvc != nil { err := f.ClientSet.CoreV1().PersistentVolumeClaims(f.Namespace.Name).Delete(s.pvc.Name, nil) framework.ExpectNoError(err, "Error deleting PVC") </ins> } }
- --namespace=kube-system - --configmap=kube-dns-autoscaler # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base <del> - --target=Deployment/kube-dns </del> <ins> - --target={{.Target}} </ins> # When cluster is using large nodes(with more cores), "coresPerReplica" should dominate. # If using small nodes, "nodesPerReplica" should dominate. - --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"preventSinglePointFailure":true}}
apiVersion: v1 kind: Service metadata: <del> name: coredns </del> <ins> name: kube-dns </ins> namespace: kube-system labels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: selector: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> clusterIP: __PILLAR__DNS__SERVER__ ports: - name: dns
apiVersion: v1 kind: Service metadata: <del> name: coredns </del> <ins> name: kube-dns </ins> namespace: kube-system labels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: selector: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> clusterIP: {{ pillar['dns_server'] }} ports: - name: dns
name: coredns namespace: kube-system labels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: <del> replicas: 2 </del> <ins> # replicas: not specified here: # 1. In order to make Addon Manager do not reconcile this replicas parameter. # 2. Default is 1. # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. </ins> strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 selector: matchLabels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> template: metadata: labels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> spec: serviceAccountName: coredns tolerations:
apiVersion: v1 kind: Service metadata: <del> name: coredns </del> <ins> name: kube-dns </ins> namespace: kube-system labels: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "CoreDNS" spec: selector: <del> k8s-app: coredns </del> <ins> k8s-app: kube-dns </ins> clusterIP: $DNS_SERVER_IP ports: - name: dns
readonly UUID_MNT_PREFIX="/mnt/disks/by-uuid/google-local-ssds" readonly UUID_BLOCK_PREFIX="/dev/disk/by-uuid/google-local-ssds" <ins> readonly COREDNS_AUTOSCALER="Deployment/coredns" readonly KUBEDNS_AUTOSCALER="Deployment/kube-dns" </ins> # Use --retry-connrefused opt only if it's supported by curl. CURL_RETRY_CONNREFUSED=""
sed -i -e "s@{{ *pillar['dns_domain'] *}}@${DNS_DOMAIN}@g" "${coredns_file}" sed -i -e "s@{{ *pillar['dns_server'] *}}@${DNS_SERVER_IP}@g" "${coredns_file}" sed -i -e "s@{{ *pillar['service_cluster_ip_range'] *}}@${SERVICE_CLUSTER_IP_RANGE}@g" "${coredns_file}" <ins> if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then setup-addon-manifests "addons" "dns-horizontal-autoscaler" "gce" local -r dns_autoscaler_file="${dst_dir}/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml" sed -i'' -e "s@{{.Target}}@${COREDNS_AUTOSCALER}@g" "${dns_autoscaler_file}" fi </ins> } # Sets up the manifests of Fluentd configmap and yamls for k8s addons.
if [[ "${ENABLE_DNS_HORIZONTAL_AUTOSCALER:-}" == "true" ]]; then setup-addon-manifests "addons" "dns-horizontal-autoscaler" "gce" <ins> local -r dns_autoscaler_file="${dst_dir}/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml" sed -i'' -e "s@{{.Target}}@${KUBEDNS_AUTOSCALER}@g" "${dns_autoscaler_file}" </ins> fi }
defer cancel() vsi, err := vs.getVSphereInstance(nodeName) if err != nil { <ins> // If node doesn't exist, disk is already detached from node. if err == vclib.ErrNoVMFound { glog.Infof("Node %q does not exist, disk %s is already detached from node.", convertToString(nodeName), volPath) return nil } </ins> return err } // Ensure client is logged in and session is valid
go_library( name = "go_default_library", <del> srcs = ["validation.go"], </del> <ins> srcs = [ "validation.go", ] + select({ "@io_bazel_rules_go//go/platform:android": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:darwin": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:dragonfly": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:freebsd": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:linux": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:nacl": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:netbsd": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:openbsd": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:plan9": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:solaris": [ "validation_others.go", ], "@io_bazel_rules_go//go/platform:windows": [ "validation_windows.go", ], "//conditions:default": [], }), </ins> importpath = "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/validation", deps = [ "//pkg/features:go_default_library",
allErrors = append(allErrors, fmt.Errorf("invalid configuration: option %q specified for HairpinMode (--hairpin-mode). Valid options are %q, %q or %q", kc.HairpinMode, kubeletconfig.HairpinNone, kubeletconfig.HairpinVeth, kubeletconfig.PromiscuousBridge)) } <ins> if err := validateKubeletOSConfiguration(kc); err != nil { allErrors = append(allErrors, err) } </ins> return utilerrors.NewAggregate(allErrors) }
<ins> // +build !windows /* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package validation import ( "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig" ) // validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid. func validateKubeletOSConfiguration(kc *kubeletconfig.KubeletConfiguration) error { return nil } </ins>
<ins> // +build windows /* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package validation import ( "fmt" utilerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig" ) // validateKubeletOSConfiguration validates os specific kubelet configuration and returns an error if it is invalid. func validateKubeletOSConfiguration(kc *kubeletconfig.KubeletConfiguration) error { message := "invalid configuration: %v (%v) %v is not supported on Windows" allErrors := []error{} if kc.CgroupsPerQOS { allErrors = append(allErrors, fmt.Errorf(message, "CgroupsPerQOS", "--cgroups-per-qos", kc.CgroupsPerQOS)) } if len(kc.EnforceNodeAllocatable) > 0 { allErrors = append(allErrors, fmt.Errorf(message, "EnforceNodeAllocatable", "--enforce-node-allocatable", kc.EnforceNodeAllocatable)) } return utilerrors.NewAggregate(allErrors) } </ins>
// GetPods returns all pods bound to the kubelet and their spec, and the mirror // pods. func (kl *Kubelet) GetPods() []*v1.Pod { <del> return kl.podManager.GetPods() </del> <ins> pods := kl.podManager.GetPods() // a kubelet running without apiserver requires an additional // update of the static pod status. See #57106 for _, p := range pods { if status, ok := kl.statusManager.GetPodStatus(p.UID); ok { p.Status = status } } return pods </ins> } // GetRunningPods returns all pods running on kubelet from looking at the
cmd.Flags().StringVar(&o.SinceTime, "since-time", o.SinceTime, i18n.T("Only return logs after a specific date (RFC3339). Defaults to all logs. Only one of since-time / since may be used.")) cmd.Flags().DurationVar(&o.SinceSeconds, "since", o.SinceSeconds, "Only return logs newer than a relative duration like 5s, 2m, or 3h. Defaults to all logs. Only one of since-time / since may be used.") cmd.Flags().StringVarP(&o.Container, "container", "c", o.Container, "Print the logs of this container") <del> cmd.Flags().BoolVar(&o.Interactive, "interactive", o.Interactive, "If true, prompt the user for input when required.") cmd.Flags().MarkDeprecated("interactive", "This flag is no longer respected and there is no replacement.") </del> cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodLogsTimeout) cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on.") return cmd
expectNoEvent(watchB, watch.Added, testPodA) testPodA, err = updatePod(f, testPodA.GetName(), func(p *v1.Pod) { <del> p.Spec.ActiveDeadlineSeconds = int64ptr(10) </del> <ins> p.ObjectMeta.Labels["mutation"] = "1" </ins> }) Expect(err).NotTo(HaveOccurred()) expectEvent(watchA, watch.Modified, testPodA)
expectNoEvent(watchB, watch.Modified, testPodA) testPodA, err = updatePod(f, testPodA.GetName(), func(p *v1.Pod) { <del> p.Spec.ActiveDeadlineSeconds = int64ptr(5) </del> <ins> p.ObjectMeta.Labels["mutation"] = "2" </ins> }) Expect(err).NotTo(HaveOccurred()) expectEvent(watchA, watch.Modified, testPodA)
func (proxier *Proxier) OnEndpointsSynced() { proxier.mu.Lock() proxier.endpointsSynced = true <ins> proxier.setInitialized(proxier.servicesSynced && proxier.endpointsSynced) </ins> proxier.mu.Unlock() <ins> // Sync unconditionally - this is called once per lifetime. </ins> proxier.syncProxyRules() }
// GetModules returns all installed kernel modules. func (handle *LinuxKernelHandler) GetModules() ([]string, error) { <ins> // Check whether IPVS required kernel modules are built-in kernelVersionFile := "/proc/sys/kernel/osrelease" b, err := ioutil.ReadFile(kernelVersionFile) if err != nil { glog.Errorf("Failed to read file %s with error %v", kernelVersionFile, err) } kernelVersion := strings.TrimSpace(string(b)) builtinModsFilePath := fmt.Sprintf("/lib/modules/%s/modules.builtin", kernelVersion) b, err = ioutil.ReadFile(builtinModsFilePath) if err != nil { glog.Errorf("Failed to read file %s with error %v", builtinModsFilePath, err) } var bmods []string for _, module := range ipvsModules { if match, _ := regexp.Match(module+".ko", b); match { bmods = append(bmods, module) } } </ins> // Try to load IPVS required kernel modules using modprobe first for _, kmod := range ipvsModules { err := handle.executor.Command("modprobe", "--", kmod).Run()
// For this test, we'll actually cycle, "list/watch/create/delete" until we get an RV from list that observes the create and not an error. // This way all the tests that are checking for watches don't have to worry about RV too old problems because crazy things *could* happen // before like the created RV could be too old to watch. <del> for _, version := range servedVersions(crd) { err := wait.PollImmediate(500*time.Millisecond, 30*time.Second, func() (bool, error) { return isWatchCachePrimed(crd, dynamicClientSet, version) }) if err != nil { return nil, err } </del> <ins> err = wait.PollImmediate(500*time.Millisecond, 30*time.Second, func() (bool, error) { return isWatchCachePrimed(crd, dynamicClientSet) }) if err != nil { return nil, err </ins> } return crd, nil } <ins> func resourceClientForVersion(crd *apiextensionsv1beta1.CustomResourceDefinition, dynamicClientSet dynamic.Interface, namespace, version string) dynamic.ResourceInterface { gvr := schema.GroupVersionResource{Group: crd.Spec.Group, Version: version, Resource: crd.Spec.Names.Plural} if crd.Spec.Scope != apiextensionsv1beta1.ClusterScoped { return dynamicClientSet.Resource(gvr).Namespace(namespace) } else { return dynamicClientSet.Resource(gvr) } } </ins> // isWatchCachePrimed returns true if the watch is primed for an specified version of CRD watch <del> func isWatchCachePrimed(crd *apiextensionsv1beta1.CustomResourceDefinition, dynamicClientSet dynamic.Interface, version string) (bool, error) { </del> <ins> func isWatchCachePrimed(crd *apiextensionsv1beta1.CustomResourceDefinition, dynamicClientSet dynamic.Interface) (bool, error) { </ins> ns := "" if crd.Spec.Scope != apiextensionsv1beta1.ClusterScoped { ns = "aval" } <del> gvr := schema.GroupVersionResource{Group: crd.Spec.Group, Version: version, Resource: crd.Spec.Names.Plural} var resourceClient dynamic.ResourceInterface if crd.Spec.Scope != apiextensionsv1beta1.ClusterScoped { resourceClient = dynamicClientSet.Resource(gvr).Namespace(ns) } else { resourceClient = dynamicClientSet.Resource(gvr) </del> <ins> versions := servedVersions(crd) if len(versions) == 0 { return true, nil </ins> } <ins> resourceClient := resourceClientForVersion(crd, dynamicClientSet, ns, versions[0]) </ins> instanceName := "setup-instance" instance := &unstructured.Unstructured{ Object: map[string]interface{}{ <del> "apiVersion": crd.Spec.Group + "/" + version, </del> <ins> "apiVersion": crd.Spec.Group + "/" + versions[0], </ins> "kind":       crd.Spec.Names.Kind, "metadata": map[string]interface{}{ "namespace": ns,
return false, err } <del> noxuWatch, err := resourceClient.Watch(metav1.ListOptions{ResourceVersion: createdInstance.GetResourceVersion()}) if err != nil { return false, err } defer noxuWatch.Stop() select { case watchEvent := <-noxuWatch.ResultChan(): if watch.Error == watchEvent.Type { return false, nil </del> <ins> // Wait for all versions of watch cache to be primed and also make sure we consumed the DELETE event for all // versions so that any new watch with ResourceVersion=0 does not get those events. This is source of some flaky tests. // When a client creates a watch with resourceVersion=0, it will get an ADD event for any existing objects // but because they specified resourceVersion=0, there is no starting point in the cache buffer to return existing events // from, thus the server will return anything from current head of the cache to the end. By accessing the delete // events for all versions here, we make sure that the head of the cache is passed those events and they will not being // delivered to any future watch with resourceVersion=0. for _, v := range versions { noxuWatch, err := resourceClientForVersion(crd, dynamicClientSet, ns, v).Watch( metav1.ListOptions{ResourceVersion: createdInstance.GetResourceVersion()}) if err != nil { return false, err </ins> } <del> if watch.Deleted != watchEvent.Type { return false, fmt.Errorf("expected DELETE, but got %#v", watchEvent) </del> <ins> defer noxuWatch.Stop() select { case watchEvent := <-noxuWatch.ResultChan(): if watch.Error == watchEvent.Type { return false, nil } if watch.Deleted != watchEvent.Type { return false, fmt.Errorf("expected DELETE, but got %#v", watchEvent) } case <-time.After(5 * time.Second): return false, fmt.Errorf("gave up waiting for watch event") </ins> } <del> return true, nil case <-time.After(5 * time.Second): return false, fmt.Errorf("gave up waiting for watch event") </del> } <ins> return true, nil </ins> } func DeleteCustomResourceDefinition(crd *apiextensionsv1beta1.CustomResourceDefinition, apiExtensionsClient clientset.Interface) error {
kube::etcd::install() { ( <ins> local os </ins> cd "${KUBE_ROOT}/third_party" <del> if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-* ]]; then </del> <ins> os=$(uname | tr "[:upper:]" "[:lower:]") if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then </ins> return  # already installed fi <del> if [[ $(uname) == "Darwin" ]]; then </del> <ins> if [[ ${os} == "darwin" ]]; then </ins> download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip" url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}" kube::util::download_file "${url}" "${download_file}"
kube::util::download_file "${url}" "${download_file}" tar xzf "${download_file}" ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd <ins> rm "${download_file}" </ins> fi kube::log::info "etcd v${ETCD_VERSION} installed. To use:" kube::log::info "export PATH=$(pwd)/etcd:${PATH}"
func (s *Controller) getNodeConditionPredicate() NodeConditionPredicate { return func(node *v1.Node) bool { <del> // We add the master to the node list, but its unschedulable.  So we use this to filter // the master. if node.Spec.Unschedulable { return false } </del> if s.legacyNodeRoleFeatureEnabled { // As of 1.6, we will taint the master, but not necessarily mark it unschedulable. // Recognize nodes labeled as master, and filter them also, as we were doing previously.
input           *v1.Node want            bool }{ <ins> {want: false, input: &v1.Node{}}, {want: true, input: &v1.Node{Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}}, {want: false, input: &v1.Node{Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionFalse}}}}}, {want: true, input: &v1.Node{Spec: v1.NodeSpec{Unschedulable: true}, Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}}, </ins> {want: true, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{}}}}, {want: true, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{labelNodeRoleMaster: ""}}}}, {want: true, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{labelNodeRoleExcludeBalancer: ""}}}},
ctx, cancel := getContextWithCancel() defer cancel() <del> glog.V(4).Infof("listing registries") result, err := a.registryClient.List(ctx) if err != nil { glog.Errorf("Failed to list registries: %v", err) return cfg } for ix := range result { loginServer := getLoginServer(result[ix]) var cred *credentialprovider.DockerConfigEntry </del> <ins> if a.config.UseManagedIdentityExtension { glog.V(4).Infof("listing registries") result, err := a.registryClient.List(ctx) if err != nil { glog.Errorf("Failed to list registries: %v", err) return cfg } </ins> <del> if a.config.UseManagedIdentityExtension { cred, err = getACRDockerEntryFromARMToken(a, loginServer) </del> <ins> for ix := range result { loginServer := getLoginServer(result[ix]) glog.V(2).Infof("loginServer: %s", loginServer) cred, err := getACRDockerEntryFromARMToken(a, loginServer) </ins> if err != nil { continue } <del> } else { cred = &credentialprovider.DockerConfigEntry{ </del> <ins> cfg[loginServer] = *cred } } else { // Add our entry for each of the supported container registry URLs for _, url := range containerRegistryUrls { cred := &credentialprovider.DockerConfigEntry{ </ins> Username: a.config.AADClientID, Password: a.config.AADClientSecret, Email:    dummyRegistryEmail, } <ins> cfg[url] = *cred </ins> } <del> cfg[loginServer] = *cred </del> } return cfg }
{ Name: to.StringPtr("foo"), RegistryProperties: &containerregistry.RegistryProperties{ <del> LoginServer: to.StringPtr("foo-microsoft.azurecr.io"), </del> <ins> LoginServer: to.StringPtr("*.azurecr.io"), </ins> }, }, { Name: to.StringPtr("bar"), RegistryProperties: &containerregistry.RegistryProperties{ <del> LoginServer: to.StringPtr("bar-microsoft.azurecr.io"), </del> <ins> LoginServer: to.StringPtr("*.azurecr.cn"), </ins> }, }, { Name: to.StringPtr("baz"), RegistryProperties: &containerregistry.RegistryProperties{ <del> LoginServer: to.StringPtr("baz-microsoft.azurecr.io"), </del> <ins> LoginServer: to.StringPtr("*.azurecr.de"), }, }, { Name: to.StringPtr("bus"), RegistryProperties: &containerregistry.RegistryProperties{ LoginServer: to.StringPtr("*.azurecr.us"), </ins> }, }, }
return "", err } <ins> pc := d.Core().Pods(namespace) mountPods, err := getMountPods(pc, pvc.Name) if err != nil { return "", err } </ins> events, _ := d.Core().Events(namespace).Search(legacyscheme.Scheme, pvc) <del> return describePersistentVolumeClaim(pvc, events) </del> <ins> return describePersistentVolumeClaim(pvc, events, mountPods) } func getMountPods(c coreclient.PodInterface, pvcName string) ([]api.Pod, error) { nsPods, err := c.List(metav1.ListOptions{}) if err != nil { return []api.Pod{}, err } var pods []api.Pod for _, pod := range nsPods.Items { pvcs := getPvcs(pod.Spec.Volumes) for _, pvc := range pvcs { if pvc.PersistentVolumeClaim.ClaimName == pvcName { pods = append(pods, pod) } } } return pods, nil </ins> } <del> func describePersistentVolumeClaim(pvc *api.PersistentVolumeClaim, events *api.EventList) (string, error) { </del> <ins> func getPvcs(volumes []api.Volume) []api.Volume { var pvcs []api.Volume for _, volume := range volumes { if volume.VolumeSource.PersistentVolumeClaim != nil { pvcs = append(pvcs, volume) } } return pvcs } func describePersistentVolumeClaim(pvc *api.PersistentVolumeClaim, events *api.EventList, mountPods []api.Pod) (string, error) { </ins> return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:t%sn", pvc.Name)
} } <ins> // printPodsMultiline prints multiple pods with a proper alignment. func printPodsMultiline(w PrefixWriter, title string, pods []api.Pod) { printPodsMultilineWithIndent(w, "", title, "t", pods) } // printPodsMultilineWithIndent prints multiple pods with a user-defined alignment. func printPodsMultilineWithIndent(w PrefixWriter, initialIndent, title, innerIndent string, pods []api.Pod) { w.Write(LEVEL_0, "%s%s:%s", initialIndent, title, innerIndent) if pods == nil || len(pods) == 0 { w.WriteLine("<none>") return } // to print pods in the sorted order sort.Slice(pods, func(i, j int) bool { cmpKey := func(pod api.Pod) string { return pod.Name } return cmpKey(pods[i]) < cmpKey(pods[j]) }) for i, pod := range pods { if i != 0 { w.Write(LEVEL_0, "%s", initialIndent) w.Write(LEVEL_0, "%s", innerIndent) } w.Write(LEVEL_0, "%sn", pod.Name) } } </ins> // printPodTolerationsMultiline prints multiple tolerations with a proper alignment. func printPodTolerationsMultiline(w PrefixWriter, title string, tolerations []api.Toleration) { printTolerationsMultilineWithIndent(w, "", title, "t", tolerations)
// If ignoreExistErr is set to true, then the -exist option of ipset will be specified, ipset ignores the error // otherwise raised when the same set (setname and create parameters are identical) already exists. func (runner *runner) createSet(set *IPSet, ignoreExistErr bool) error { <del> args := []string{"create", set.Name, string(set.SetType), "comment"} </del> <ins> args := []string{"create", set.Name, string(set.SetType)} </ins> if set.SetType == HashIPPortIP || set.SetType == HashIPPort { args = append(args, "family", set.HashFamily,