expectedErrMsg:      fmt.Errorf("failure of getting instance metadata"), }, { <del> name:                "NodeAddresses should report error if VMSS instanceID is invalid", nodeName:            "vm123456", metadataName:        "vmss_$123", vmType:              vmTypeVMSS, useInstanceMetadata: true, expectedErrMsg:      fmt.Errorf("failed to parse VMSS instanceID %q: strconv.ParseInt: parsing %q: invalid syntax", "$123", "$123"), }, { </del> name:                "NodeAddresses should report error if cloud.vmSet is nil", nodeName:            "vm1", vmType:              vmTypeStandard,


OOMScoreAdj:        config.OOMScoreAdj, ConfigSyncPeriod:   config.ConfigSyncPeriod.Duration, HealthzServer:      healthzServer, <ins> UseEndpointSlices:  false, </ins> }, nil }


}) It("should serve a basic image on each replica with a private image", func() { <del> switch testContext.Provider { case "gce", "gke": ServeImageOrFail(c, "private", "gcr.io/_b_k8s_authenticated_test/serve_hostname:1.1") default: </del> <ins> if !providerIs("gce", "gke") { </ins> By(fmt.Sprintf("Skipping private variant, which is only supported for providers gce and gke (not %s)", testContext.Provider)) <ins> return </ins> } <ins> ServeImageOrFail(c, "private", "gcr.io/_b_k8s_authenticated_test/serve_hostname:1.1") </ins> }) })


DeleteLocalData     bool Selector            string PodSelector         string <del> Out                 io.Writer ErrOut              io.Writer </del> <ins> // DisableEviction forces drain to use delete rather than evict DisableEviction bool Out    io.Writer ErrOut io.Writer </ins> // TODO(justinsb): unnecessary? DryRun bool


// RemoveContainer removes the container. func (ds *dockerService) RemoveContainer(_ context.Context, r *runtimeapi.RemoveContainerRequest) (*runtimeapi.RemoveContainerResponse, error) { <del> ds.performPlatformSpecificContainerForContainer(r.ContainerId) </del> // Ideally, log lifecycle should be independent of container lifecycle. // However, docker will remove container log after container is removed, // we can't prevent that now, so we also clean up the symlink here.


t.Fatalf("unexpected proxy user: %v", authUser) } } <ins> // The channel must be closed before any of the connections are closed close(closed) </ins> }) } })


network_mode: openvswitch node_ip: $MINION_IP etcd_servers: $MASTER_IP <ins> api_servers: $MASTER_IP </ins> networkInterfaceName: eth1 apiservers: $MASTER_IP roles:


"Foo": defaultbinder.New, } cases := []struct { <del> name         string opts         []Option wantErr      string wantProfiles []string </del> <ins> name          string opts          []Option wantErr       string wantProfiles  []string wantExtenders []string </ins> }{ { name: "valid out-of-tree registry",


} t.Logf("rc._internal -> rc.v1") <del> data, err = runtime.Encode(defaultGroup.Codec(), rc) </del> <ins> data, err = runtime.Encode(defaultCodec, rc) </ins> if err != nil { t.Fatalf("unexpected encoding error: %v", err) }


addNodes(manager.nodeStore, 0, 1, nil) addPods(manager.podStore, "node-0", simpleDaemonSetLabel, ds, 1) addPods(manager.podStore, "node-1", simpleDaemonSetLabel, ds, 1) <ins> podScheduledUsingAffinity := newPod("pod1-node-3", "", simpleDaemonSetLabel, ds) podScheduledUsingAffinity.Spec.Affinity = &v1.Affinity{ NodeAffinity: &v1.NodeAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{ NodeSelectorTerms: []v1.NodeSelectorTerm{ { MatchFields: []v1.NodeSelectorRequirement{ { Key:      schedulerapi.NodeFieldSelectorKeyNodeName, Operator: v1.NodeSelectorOpIn, Values:   []string{"node-2"}, }, }, }, }, }, }, } manager.podStore.Add(podScheduledUsingAffinity) </ins> if f { syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 1, 0) } else {


ID:               volumeV3.ID, Name:             volumeV3.Name, Status:           volumeV3.Status, <ins> Size:             volumeV3.Size, </ins> } if len(volumeV3.Attachments) > 0 {


// +build !ignore_autogenerated /* <del> Copyright 2016 The Kubernetes Authors. </del> <ins> Copyright 2017 The Kubernetes Authors. </ins> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.


<ins> apiVersion: v1beta3 kind: Namespace metadata: name: quota-example </ins>


func TestPriorityQueue_AddIfNotPresent(t *testing.T) { q := NewPriorityQueue(nil) <del> q.unschedulableQ.addOrUpdate(&highPriNominatedPod) </del> <ins> addOrUpdateUnschedulablePod(q, &highPriNominatedPod) </ins> q.AddIfNotPresent(&highPriNominatedPod) // Must not add anything. q.AddIfNotPresent(&medPriorityPod) q.AddIfNotPresent(&unschedulablePod)


}, }, { <ins> name: "UnschedulableAndUnschedulableFilters", plugins: []*TestPlugin{ { name: "TestPlugin1", inj:  injectedResult{FilterStatus: int(framework.Unschedulable)}, }, { name: "TestPlugin2", inj:  injectedResult{FilterStatus: int(framework.Unschedulable)}, }, }, wantStatus: framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"), wantStatusMap: framework.PluginToStatus{ "TestPlugin1": framework.NewStatus(framework.Unschedulable, injectFilterReason).WithFailedPlugin("TestPlugin1"), }, }, { </ins> name: "SuccessAndSuccessFilters", plugins: []*TestPlugin{ {


} }() err = r.cmd.Wait() <del> stopped <- true </del> <ins> close(stopped) </ins> if exiterr, ok := err.(*exec.ExitError); ok { klog.Infof("etcd server stopped (signal: %s)", exiterr.Error()) // stopped


- mkdir -p /home/kubernetes/containerized_mounter/rootfs - mount --bind /home/kubernetes/containerized_mounter/ /home/kubernetes/containerized_mounter/ - mount -o remount, exec /home/kubernetes/containerized_mounter/ <del> - wget https://storage.googleapis.com/kubernetes-release/gci-mounter/mounter.tar -O /tmp/mounter.tar </del> <ins> - wget https://dl.k8s.io/gci-mounter/mounter.tar -O /tmp/mounter.tar </ins> - tar xvf /tmp/mounter.tar -C /home/kubernetes/containerized_mounter/rootfs - mkdir -p /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet - mount --rbind /var/lib/kubelet /home/kubernetes/containerized_mounter/rootfs/var/lib/kubelet


glog.Infof("managing multiple zones: %v", managedZones) } <del> operationPollRateLimiter := flowcontrol.NewTokenBucketRateLimiter(10, 100) // 10 qps, 100 bucket size. </del> return &GCECloud{ <del> service:                  svc, containerService:         containerSvc, projectID:                projectID, region:                   region, localZone:                zone, managedZones:             managedZones, networkURL:               networkURL, nodeTags:                 nodeTags, useMetadataServer:        useMetadataServer, operationPollRateLimiter: operationPollRateLimiter, </del> <ins> service:           svc, containerService:  containerSvc, projectID:         projectID, region:            region, localZone:         zone, managedZones:      managedZones, networkURL:        networkURL, nodeTags:          nodeTags, useMetadataServer: useMetadataServer, </ins> }, nil }


} servicePrincipalToken, err := auth.GetServicePrincipalToken(&config.AzureAuthConfig, env) <del> if err != nil { </del> <ins> if err == auth.ErrorNoAuth { if !config.UseInstanceMetadata { // No credentials provided, useInstanceMetadata should be enabled. return nil, fmt.Errorf("useInstanceMetadata must be enabled without Azure credentials") } klog.V(2).Infof("Azure cloud provider is starting without credentials") } else if err != nil { </ins> return nil, err }


execAffinityTestForLBService(f, cs, svc) }) <del> // TODO: Get rid of [DisabledForLargeClusters] tag when issue #56138 is fixed. </del> // [LinuxOnly]: Windows does not support session affinity. <del> ginkgo.It("should be able to switch session affinity for LoadBalancer service with ESIPP off [Slow] [DisabledForLargeClusters] [LinuxOnly]", func() { </del> <ins> ginkgo.It("should be able to switch session affinity for LoadBalancer service with ESIPP off [Slow] [LinuxOnly]", func() { </ins> // L4 load balancer affinity `ClientIP` is not supported on AWS ELB. e2eskipper.SkipIfProviderIs("aws")


out.Description = in.Description if in.Type != "" { out.Type = spec.StringOrArray([]string{in.Type}) <del> if in.Nullable { out.Type = append(out.Type, "null") } </del> <ins> } if in.XIntOrString { out.VendorExtensible.AddExtension("x-kubernetes-int-or-string", true) out.Type = spec.StringOrArray{"integer", "string"} } if out.Type != nil && in.Nullable { out.Type = append(out.Type, "null") </ins> } out.Format = in.Format out.Title = in.Title


local -ra docker_cmd=( "${DOCKER[@]}" run "${docker_run_opts[@]}" "${KUBE_BUILD_IMAGE}") <del> # Remove the container if it is left over from some previous aborted run "${DOCKER[@]}" rm -f -v "${KUBE_BUILD_CONTAINER_NAME}" >/dev/null 2>&1 || true </del> <ins> # Clean up container from any previous run kube::build::destroy_container "${KUBE_BUILD_CONTAINER_NAME}" </ins> "${docker_cmd[@]}" "$@" <del> # Remove the container after we run.  '--rm' might be appropriate but it # appears that sometimes it fails. See # https://github.com/docker/docker/issues/3968 "${DOCKER[@]}" rm -f -v "${KUBE_BUILD_CONTAINER_NAME}" >/dev/null 2>&1 || true </del> <ins> kube::build::destroy_container "${KUBE_BUILD_CONTAINER_NAME}" </ins> } # Test if the output directory is remote (and can only be accessed through


if diff := cmp.Diff(tc.wantProfiles, profiles); diff != "" { t.Errorf("unexpected profiles (-want, +got):n%s", diff) } <ins> // Extenders if len(tc.wantExtenders) != 0 { // Scheduler.Extenders extenders := make([]string, 0, len(s.Extenders)) for _, e := range s.Extenders { extenders = append(extenders, e.Name()) } if diff := cmp.Diff(tc.wantExtenders, extenders); diff != "" { t.Errorf("unexpected extenders (-want, +got):n%s", diff) } // framework.Handle.Extenders() for _, p := range s.Profiles { extenders := make([]string, 0, len(p.Extenders())) for _, e := range p.Extenders() { extenders = append(extenders, e.Name()) } if diff := cmp.Diff(tc.wantExtenders, extenders); diff != "" { t.Errorf("unexpected extenders (-want, +got):n%s", diff) } } } </ins> }) } }


if err != nil { return "", err } <del> if isLocalInstance { if metadata.Compute.VMSize != "" { return metadata.Compute.VMSize, nil </del> <ins> if !isLocalInstance { if az.vmSet != nil { return az.vmSet.GetInstanceTypeByNodeName(string(name)) </ins> } <ins> // vmSet == nil indicates credentials are not provided. return "", fmt.Errorf("no credentials provided for Azure cloud provider") } if metadata.Compute.VMSize != "" { return metadata.Compute.VMSize, nil </ins> } }


jig.SanityCheckService(svc, v1.ServiceTypeLoadBalancer) defer func() { framework.StopServeHostnameService(cs, f.InternalClientset, f.ScalesGetter, ns, serviceName) <ins> lb := cloudprovider.GetLoadBalancerName(svc) framework.Logf("cleaning gce resource for %s", lb) framework.CleanupServiceGCEResources(cs, lb, framework.TestContext.CloudConfig.Region, framework.TestContext.CloudConfig.Zone) </ins> }() ingressIP := framework.GetIngressPoint(&svc.Status.LoadBalancer.Ingress[0]) port := int(svc.Spec.Ports[0].Port)


} } <ins> func TestCertSatisfiesTemplate(t *testing.T) { testCases := []struct { name          string cert          *x509.Certificate template      *x509.CertificateRequest shouldSatisfy bool }{ { name:          "No certificate, no template", cert:          nil, template:      nil, shouldSatisfy: false, }, { name:          "No certificate", cert:          nil, template:      &x509.CertificateRequest{}, shouldSatisfy: false, }, { name: "No template", cert: &x509.Certificate{ Subject: pkix.Name{ CommonName: "system:node:fake-node-name", }, }, template:      nil, shouldSatisfy: true, }, { name: "Mismatched common name", cert: &x509.Certificate{ Subject: pkix.Name{ CommonName: "system:node:fake-node-name-2", }, }, template: &x509.CertificateRequest{ Subject: pkix.Name{ CommonName: "system:node:fake-node-name", }, }, shouldSatisfy: false, }, { name: "Missing orgs in certificate", cert: &x509.Certificate{ Subject: pkix.Name{ Organization: []string{"system:nodes"}, }, }, template: &x509.CertificateRequest{ Subject: pkix.Name{ Organization: []string{"system:nodes", "foobar"}, }, }, shouldSatisfy: false, }, { name: "Extra orgs in certificate", cert: &x509.Certificate{ Subject: pkix.Name{ Organization: []string{"system:nodes", "foobar"}, }, }, template: &x509.CertificateRequest{ Subject: pkix.Name{ Organization: []string{"system:nodes"}, }, }, shouldSatisfy: true, }, { name: "Missing DNS names in certificate", cert: &x509.Certificate{ Subject:  pkix.Name{}, DNSNames: []string{"foo.example.com"}, }, template: &x509.CertificateRequest{ Subject:  pkix.Name{}, DNSNames: []string{"foo.example.com", "bar.example.com"}, }, shouldSatisfy: false, }, { name: "Extra DNS names in certificate", cert: &x509.Certificate{ Subject:  pkix.Name{}, DNSNames: []string{"foo.example.com", "bar.example.com"}, }, template: &x509.CertificateRequest{ Subject:  pkix.Name{}, DNSNames: []string{"foo.example.com"}, }, shouldSatisfy: true, }, { name: "Missing IP addresses in certificate", cert: &x509.Certificate{ Subject:     pkix.Name{}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1")}, }, template: &x509.CertificateRequest{ Subject:     pkix.Name{}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1"), net.ParseIP("192.168.1.2")}, }, shouldSatisfy: false, }, { name: "Extra IP addresses in certificate", cert: &x509.Certificate{ Subject:     pkix.Name{}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1"), net.ParseIP("192.168.1.2")}, }, template: &x509.CertificateRequest{ Subject:     pkix.Name{}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1")}, }, shouldSatisfy: true, }, { name: "Matching certificate", cert: &x509.Certificate{ Subject: pkix.Name{ CommonName:   "system:node:fake-node-name", Organization: []string{"system:nodes"}, }, DNSNames:    []string{"foo.example.com"}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1")}, }, template: &x509.CertificateRequest{ Subject: pkix.Name{ CommonName:   "system:node:fake-node-name", Organization: []string{"system:nodes"}, }, DNSNames:    []string{"foo.example.com"}, IPAddresses: []net.IP{net.ParseIP("192.168.1.1")}, }, shouldSatisfy: true, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { var tlsCert *tls.Certificate if tc.cert != nil { tlsCert = &tls.Certificate{ Leaf: tc.cert, } } m := manager{ cert:        tlsCert, getTemplate: func() *x509.CertificateRequest { return tc.template }, } result := m.certSatisfiesTemplate() if result != tc.shouldSatisfy { t.Errorf("cert: %+v, template: %+v, certSatisfiesTemplate returned %v, want %v", m.cert, tc.template, result, tc.shouldSatisfy) } }) } } </ins> func TestRotateCertCreateCSRError(t *testing.T) { now := time.Now() m := manager{


var cpuFractionMap = make(map[string]float64) var memFractionMap = make(map[string]float64) <ins> // For each node, stores its pods info nodeNameToPodList := podListForEachNode(cs) </ins> for _, node := range nodes { <del> cpuFraction, memFraction, _, _ := computeCPUMemFraction(cs, node, requestedResource) </del> <ins> cpuFraction, memFraction, _, _ := computeCPUMemFraction(node, requestedResource, nodeNameToPodList[node.Name]) </ins> cpuFractionMap[node.Name] = cpuFraction memFractionMap[node.Name] = memFraction if cpuFraction > maxCPUFraction {


#     sleep 4 #     i=$[$i+1] #   done <del> apiVersion: v1beta1 </del> <ins> apiVersion: v1beta3 </ins> kind: Pod <del> id: synthetic-logger-0.25lps-pod desiredState: manifest: version: v1beta1 id: synth-logger-0.25lps containers: - name: synth-lgr image: ubuntu:14.04 command: ["bash", "-c", "i="0"; while true; do echo -n "`hostname`: $i: "; date --rfc-3339 ns; sleep 4; i=$[$i+1]; done"] labels: name: synth-logging-source </del> <ins> metadata: labels: name: synth-logging-source name: synthetic-logger-0.25lps-pod spec: containers: - args: - bash - -c - 'i="0"; while true; do echo -n "`hostname`: $i: "; date --rfc-3339 ns; sleep 4; i=$[$i+1]; done' image: ubuntu:14.04 name: synth-lgr </ins> ``` The other YAML file [synthetic_10lps.yaml](synthetic_10lps.yaml) specifies a similar synthetic logger that emits 10 log messages every second. To run both synthetic loggers:


if m == nil { return &Timestamp{} } <ins> // truncate precision to microseconds to match JSON marshaling/unmarshaling truncatedNanoseconds := time.Duration(m.Time.Nanosecond()).Truncate(time.Microsecond) </ins> return &Timestamp{ Seconds: m.Time.Unix(), <del> Nanos:   int32(m.Time.Nanosecond()), </del> <ins> Nanos:   int32(truncatedNanoseconds), </ins> } }


func (plugin *flexVolumePlugin) getExecutable() string { parts := strings.Split(plugin.driverName, "/") execName := parts[len(parts)-1] <del> return path.Join(plugin.execPath, execName) </del> <ins> execPath := path.Join(plugin.execPath, execName) if runtime.GOOS == "windows" { execPath = volume.GetWindowsPath(execPath) } return execPath </ins> } // Name is part of the volume.VolumePlugin interface.


if err := s.validate(); err != nil { return nil, err } <del> dockercfgContent, err := handleDockercfgContent(s.Username, s.Password, s.Email, s.Server) </del> <ins> dockercfgJsonContent, err := handleDockerCfgJsonContent(s.Username, s.Password, s.Email, s.Server) </ins> if err != nil { return nil, err } secret := &v1.Secret{} secret.Name = s.Name <del> secret.Type = v1.SecretTypeDockercfg </del> <ins> secret.Type = v1.SecretTypeDockerConfigJson </ins> secret.Data = map[string][]byte{} <del> secret.Data[v1.DockerConfigKey] = dockercfgContent </del> <ins> secret.Data[v1.DockerConfigJsonKey] = dockercfgJsonContent </ins> if s.AppendHash { h, err := hash.SecretHash(secret) if err != nil {


``` Note that we are still working on making all containerized the master components run smoothly in rkt. Before that we are not able to run the master node with rkt yet. <ins> [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/rkt/README.md?pixel)]() </ins>


}) It("should schedule a pod w/ a RW PD, remove it, then schedule it on another host", func() { <del> if testContext.Provider != "gce" && testContext.Provider != "aws" { </del> <ins> if !providerIs("gce", "aws") { </ins> By(fmt.Sprintf("Skipping PD test, which is only supported for providers gce & aws (not %s)", testContext.Provider)) return


Contexts: map[string]clientcmdapi.Context{ "gothic-context": {AuthInfo: "blue-user", Cluster: "chicken-cluster", Namespace: "plane-ns"}}, } testConfigConflictAlfa = clientcmdapi.Config{ AuthInfos: map[string]clientcmdapi.AuthInfo{ "red-user":    {Token: "a-different-red-token"},


cloud                 *Cloud } <del> // AttachDisk attaches a vhd to vm. The vhd must exist, can be identified by diskName, diskURI, and lun. func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI string, nodeName types.NodeName, lun int32, cachingMode compute.CachingTypes) error { // 1. vmType is standard, attach with availabilitySet.AttachDisk. </del> <ins> // getNodeVMSet gets the VMSet interface based on config.VMType and the real virtual machine type. func (c *controllerCommon) getNodeVMSet(nodeName types.NodeName) (VMSet, error) { // 1. vmType is standard, return cloud.vmSet directly. </ins> if c.cloud.VMType == vmTypeStandard { <del> return c.cloud.vmSet.AttachDisk(isManagedDisk, diskName, diskURI, nodeName, lun, cachingMode) </del> <ins> return c.cloud.vmSet, nil </ins> } // 2. vmType is Virtual Machine Scale Set (vmss), convert vmSet to scaleSet. ss, ok := c.cloud.vmSet.(*scaleSet) if !ok { <del> return fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) </del> <ins> return nil, fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) </ins> } <del> // 3. If the node is managed by availability set, then attach with availabilitySet.AttachDisk. </del> <ins> // 3. If the node is managed by availability set, then return ss.availabilitySet. </ins> managedByAS, err := ss.isNodeManagedByAvailabilitySet(mapNodeNameToVMName(nodeName)) if err != nil { <del> return err </del> <ins> return nil, err </ins> } if managedByAS { // vm is managed by availability set. <del> return ss.availabilitySet.AttachDisk(isManagedDisk, diskName, diskURI, nodeName, lun, cachingMode) </del> <ins> return ss.availabilitySet, nil </ins> } <del> // 4. Node is managed by vmss, attach with scaleSet.AttachDisk. return ss.AttachDisk(isManagedDisk, diskName, diskURI, nodeName, lun, cachingMode) </del> <ins> // 4. Node is managed by vmss return ss, nil </ins> } <del> // DetachDiskByName detaches a vhd from host. The vhd can be identified by diskName or diskURI. func (c *controllerCommon) DetachDiskByName(diskName, diskURI string, nodeName types.NodeName) error { // 1. vmType is standard, detach with availabilitySet.DetachDiskByName. if c.cloud.VMType == vmTypeStandard { return c.cloud.vmSet.DetachDiskByName(diskName, diskURI, nodeName) </del> <ins> // AttachDisk attaches a vhd to vm. The vhd must exist, can be identified by diskName, diskURI, and lun. func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI string, nodeName types.NodeName, lun int32, cachingMode compute.CachingTypes) error { vmset, err := c.getNodeVMSet(nodeName) if err != nil { return err </ins> } <del> // 2. vmType is Virtual Machine Scale Set (vmss), convert vmSet to scaleSet. ss, ok := c.cloud.vmSet.(*scaleSet) if !ok { return fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) } </del> <ins> return vmset.AttachDisk(isManagedDisk, diskName, diskURI, nodeName, lun, cachingMode) } </ins> <del> // 3. If the node is managed by availability set, then detach with availabilitySet.DetachDiskByName. managedByAS, err := ss.isNodeManagedByAvailabilitySet(mapNodeNameToVMName(nodeName)) </del> <ins> // DetachDiskByName detaches a vhd from host. The vhd can be identified by diskName or diskURI. func (c *controllerCommon) DetachDiskByName(diskName, diskURI string, nodeName types.NodeName) error { vmset, err := c.getNodeVMSet(nodeName) </ins> if err != nil { return err } <del> if managedByAS { // vm is managed by availability set. return ss.availabilitySet.DetachDiskByName(diskName, diskURI, nodeName) } // 4. Node is managed by vmss, detach with scaleSet.DetachDiskByName. return ss.DetachDiskByName(diskName, diskURI, nodeName) </del> <ins> return vmset.DetachDiskByName(diskName, diskURI, nodeName) </ins> } <del> // GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI. func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, error) { // 1. vmType is standard, get with availabilitySet.GetDiskLun. if c.cloud.VMType == vmTypeStandard { return c.cloud.vmSet.GetDiskLun(diskName, diskURI, nodeName) </del> <ins> // getNodeDataDisks invokes vmSet interfaces to get data disks for the node. func (c *controllerCommon) getNodeDataDisks(nodeName types.NodeName) ([]compute.DataDisk, error) { vmset, err := c.getNodeVMSet(nodeName) if err != nil { return nil, err </ins> } <del> // 2. vmType is Virtual Machine Scale Set (vmss), convert vmSet to scaleSet. ss, ok := c.cloud.vmSet.(*scaleSet) if !ok { return -1, fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) } </del> <ins> return vmset.GetDataDisks(nodeName) } </ins> <del> // 3. If the node is managed by availability set, then get with availabilitySet.GetDiskLun. managedByAS, err := ss.isNodeManagedByAvailabilitySet(mapNodeNameToVMName(nodeName)) </del> <ins> // GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI. func (c *controllerCommon) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, error) { disks, err := c.getNodeDataDisks(nodeName) </ins> if err != nil { <ins> glog.Errorf("error of getting data disks for node %q: %v", nodeName, err) </ins> return -1, err } <del> if managedByAS { // vm is managed by availability set. return ss.availabilitySet.GetDiskLun(diskName, diskURI, nodeName) } // 4. Node is managed by vmss, get with scaleSet.GetDiskLun. return ss.GetDiskLun(diskName, diskURI, nodeName) </del> <ins> for _, disk := range disks { if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd != nil && disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) || (disk.ManagedDisk != nil && *disk.ManagedDisk.ID == diskURI) { // found the disk glog.V(4).Infof("azureDisk - find disk: lun %d name %q uri %q", *disk.Lun, diskName, diskURI) return *disk.Lun, nil } } return -1, fmt.Errorf("Cannot find Lun for disk %s", diskName) </ins> } // GetNextDiskLun searches all vhd attachment on the host and find unused lun. Return -1 if all luns are used. func (c *controllerCommon) GetNextDiskLun(nodeName types.NodeName) (int32, error) { <del> // 1. vmType is standard, get with availabilitySet.GetNextDiskLun. if c.cloud.VMType == vmTypeStandard { return c.cloud.vmSet.GetNextDiskLun(nodeName) } // 2. vmType is Virtual Machine Scale Set (vmss), convert vmSet to scaleSet. ss, ok := c.cloud.vmSet.(*scaleSet) if !ok { return -1, fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) } // 3. If the node is managed by availability set, then get with availabilitySet.GetNextDiskLun. managedByAS, err := ss.isNodeManagedByAvailabilitySet(mapNodeNameToVMName(nodeName)) </del> <ins> disks, err := c.getNodeDataDisks(nodeName) </ins> if err != nil { <ins> glog.Errorf("error of getting data disks for node %q: %v", nodeName, err) </ins> return -1, err } <del> if managedByAS { // vm is managed by availability set. return ss.availabilitySet.GetNextDiskLun(nodeName) } // 4. Node is managed by vmss, get with scaleSet.GetNextDiskLun. return ss.GetNextDiskLun(nodeName) </del> <ins> used := make([]bool, maxLUN) for _, disk := range disks { if disk.Lun != nil { used[*disk.Lun] = true } } for k, v := range used { if !v { return int32(k), nil } } return -1, fmt.Errorf("all luns are used") </ins> } // DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName. func (c *controllerCommon) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error) { <del> // 1. vmType is standard, check with availabilitySet.DisksAreAttached. if c.cloud.VMType == vmTypeStandard { return c.cloud.vmSet.DisksAreAttached(diskNames, nodeName) } // 2. vmType is Virtual Machine Scale Set (vmss), convert vmSet to scaleSet. ss, ok := c.cloud.vmSet.(*scaleSet) if !ok { return nil, fmt.Errorf("error of converting vmSet (%q) to scaleSet with vmType %q", c.cloud.vmSet, c.cloud.VMType) </del> <ins> attached := make(map[string]bool) for _, diskName := range diskNames { attached[diskName] = false </ins> } <del> // 3. If the node is managed by availability set, then check with availabilitySet.DisksAreAttached. managedByAS, err := ss.isNodeManagedByAvailabilitySet(mapNodeNameToVMName(nodeName)) </del> <ins> disks, err := c.getNodeDataDisks(nodeName) </ins> if err != nil { <del> return nil, err </del> <ins> if err == cloudprovider.InstanceNotFound { // if host doesn't exist, no need to detach glog.Warningf("azureDisk - Cannot find node %q, DisksAreAttached will assume disks %v are not attached to it.", nodeName, diskNames) return attached, nil } return attached, err </ins> } <del> if managedByAS { // vm is managed by availability set. return ss.availabilitySet.DisksAreAttached(diskNames, nodeName) </del> <ins> for _, disk := range disks { for _, diskName := range diskNames { if disk.Name != nil && diskName != "" && *disk.Name == diskName { attached[diskName] = true } } </ins> } <del> // 4. Node is managed by vmss, check with scaleSet.DisksAreAttached. return ss.DisksAreAttached(diskNames, nodeName) </del> <ins> return attached, nil </ins> }


if err != nil { if apierrors.IsNotFound(err) { c.triggerTimeTracker.DeleteService(namespace, name) <ins> // The service has been deleted, return nil so that it won't be retried. return nil </ins> } return err }


"sort" "strconv" "strings" <ins> "sync" </ins> "testing" "github.com/vmware/govmomi/find"


for _, file := range files { fileName := file.Name() // Make a copy It(fmt.Sprintf("tests that %v passes", fileName), func() { <ins> // A number of scripts only work on gce if !providerIs("gce", "gke") { By(fmt.Sprintf("Skipping Shell test %s, which is only supported for provider gce and gke (not %s)", fileName, testContext.Provider)) return } </ins> runCmdTest(filepath.Join(bashE2ERoot, fileName)) }) }


WhenScaled:  apps.DeletePersistentVolumeClaimRetentionPolicyType, WhenDeleted: apps.DeletePersistentVolumeClaimRetentionPolicyType, }, <ins> // tests the case when no policy is set. nil, </ins> } { subtestName := pvcDeletePolicyString(policy) + "/StatefulSetAutoDeletePVCEnabled" if testName != "" {


FindBoundSatsified:   true, }, eventReason: "FailedScheduling", <del> expectError: makePredicateError("1 VolumeBindingNoMatch"), </del> <ins> expectError: makePredicateError("1 node(s) didn't find available persistent volumes to bind"), </ins> }, "bound-and-unbound-unsatisfied": { volumeBinderConfig: &persistentvolume.FakeVolumeBinderConfig{


ginkgo.By("Waiting for container to stop restarting") stableCount := int(0) stableThreshold := int(time.Minute / framework.Poll) <del> err = wait.PollImmediate(framework.Poll, 2*time.Minute, func() (bool, error) { </del> <ins> err = wait.PollImmediate(framework.Poll, framework.PodStartTimeout, func() (bool, error) { </ins> pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(context.TODO(), pod.Name, metav1.GetOptions{}) if err != nil { return false, err


It("should lookup the Schema by its GroupVersionKind", func() { schema = resources.LookupResource(gvk) Expect(schema).ToNot(BeNil()) <del> }) var sarspec *proto.Kind It("should be a Kind and have a spec", func() { </del> sar := schema.(*proto.Kind) Expect(sar).ToNot(BeNil()) Expect(sar.Fields).To(HaveKey("spec")) specRef := sar.Fields["spec"].(proto.Reference) Expect(specRef).ToNot(BeNil()) Expect(specRef.Reference()).To(Equal("io.k8s.api.authorization.v1.SubjectAccessReviewSpec")) <del> sarspec = specRef.SubSchema().(*proto.Kind) Expect(sarspec).ToNot(BeNil()) </del> <ins> Expect(specRef.SubSchema().(*proto.Kind)).ToNot(BeNil()) </ins> }) })


kubetypes.HTTPSource, &api.Pod{ ObjectMeta: api.ObjectMeta{ <del> UID:       "111", Name:      "foo" + "-" + hostname, Namespace: "mynamespace", SelfLink: getSelfLink("foo-"+hostname, "mynamespace"), </del> <ins> UID:         "111", Name:        "foo" + "-" + hostname, Namespace:   "mynamespace", Annotations: map[string]string{kubetypes.ConfigHashAnnotationKey: "111"}, SelfLink:    getSelfLink("foo-"+hostname, "mynamespace"), </ins> }, Spec: api.PodSpec{ NodeName:                      hostname,


{ code: http.StatusBadRequest, expected: &Error{ <del> Retriable:      true, </del> <ins> Retriable:      false, </ins> HTTPStatusCode: http.StatusBadRequest, RawError:       fmt.Errorf("HTTP response: 400"), },


const ( operationDeleteCollection operation = "deleteCollection" operationList             operation = "list" <ins> // assume a default estimate for finalizers to complete when found on items pending deletion. finalizerEstimateSeconds int64 = int64(15) </ins> ) // operationKey is an entry in a cache.


// in https://github.com/kubernetes/kubernetes/issues/120720. // We are already hinting the external cloud provider via the annotation AnnotationAlphaProvidedIPAddr. if !nodeIPSpecified { <ins> node.Status.Addresses = []v1.NodeAddress{ {Type: v1.NodeHostName, Address: hostname}, } </ins> return nil } }


return err } glog.V(4).Info("Successfully created federation controller manager deployment") <del> fmt.Println(cmdOut, " done") </del> <ins> fmt.Fprintln(cmdOut, " done") </ins> fmt.Fprint(cmdOut, "Updating kubeconfig...") glog.V(4).Info("Updating kubeconfig")


"//test/e2e_node/services:go_default_library", "//test/e2e_node/system:go_default_library", "//test/utils:go_default_library", <ins> "//vendor:github.com/coreos/go-systemd/util", </ins> "//vendor:github.com/davecgh/go-spew/spew", "//vendor:github.com/golang/glog", "//vendor:github.com/kardianos/osext",


return } <del> klog.V(4).Infof("Updating customresourcedefinition %s", oldCRD.Name) </del> <ins> klog.V(4).Infof("Updating customresourcedefinition %s", newCRD.Name) r.removeStorage_locked(newCRD.UID) } </ins> <del> if oldInfo, ok := storageMap[types.UID(oldCRD.UID)]; ok { </del> <ins> // removeStorage_locked removes the cached storage with the given uid as key from the storage map. This function // updates r.customStorage with the cleaned-up storageMap and tears down the old storage. // NOTE: Caller MUST hold r.customStorageLock to write r.customStorage thread-safely. func (r *crdHandler) removeStorage_locked(uid types.UID) { storageMap := r.customStorage.Load().(crdStorageMap) if oldInfo, ok := storageMap[uid]; ok { </ins> // Copy because we cannot write to storageMap without a race // as it is used without locking elsewhere. storageMap2 := storageMap.clone() // Remove from the CRD info map and store the map <del> delete(storageMap2, types.UID(oldCRD.UID)) </del> <ins> delete(storageMap2, uid) </ins> r.customStorage.Store(storageMap2) // Tear down the old storage


extensions.Kind("ReplicaSet"):                  &ReplicaSetDescriber{c}, extensions.Kind("NetworkPolicy"):               &ExtensionsNetworkPolicyDescriber{c}, <ins> extensions.Kind("PodSecurityPolicy"):           &PodSecurityPolicyDescriber{c}, </ins> autoscaling.Kind("HorizontalPodAutoscaler"):    &HorizontalPodAutoscalerDescriber{c}, extensions.Kind("DaemonSet"):                   &DaemonSetDescriber{c}, extensions.Kind("Deployment"):                  &DeploymentDescriber{c, versionedClientsetForDeployment(c)},


value: 512M - name: HEAP_NEWSIZE value: 100M <ins> - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace </ins> volumes: - name: data emptyDir: {}


isMigratedOnNode := mpaSet.Has(pluginName) <del> if isMigratedOnNode { installed := false driverName, err := csiMigratedPluginManager.GetCSINameFromInTreeName(pluginName) if err != nil { return isMigratedOnNode, err } for _, driver := range csiNode.Spec.Drivers { if driver.Name == driverName { installed = true break } } if !installed { return true, fmt.Errorf("in-tree plugin %s is migrated on node %s but driver %s is not installed", pluginName, string(nodeName), driverName) } } </del> return isMigratedOnNode, nil }


if err != nil { return err } <ins> if existingRole.AggregationRule != nil { // the old role already moved to an aggregated role, so there are no custom rules to migrate at this point return nil } </ins> glog.V(1).Infof("migrating %v to %v", existingRole.Name, newName) existingRole.Name = newName existingRole.ResourceVersion = "" // clear this so the object can be created.


"net/http" "net/url" "os" <ins> "path/filepath" </ins> "testing" <ins> "github.com/stretchr/testify/assert" </ins> ) // copied from k8s.io/client-go/transport/round_trippers_test.go


return false, nil, nil }, }, <ins> { name:         "API watch error happen", volID:        "vol-005", attachID:     getAttachmentName("vol-005", testDriver, nodeName), shouldFail:   true, watcherError: true, reactor: func(action core.Action) (handled bool, ret runtime.Object, err error) { if action.Matches("get", "volumeattachments") { return true, makeTestAttachment(getAttachmentName("vol-005", testDriver, nodeName), nodeName, "vol-005"), nil } return false, nil, nil }, }, </ins> } for _, tc := range testCases {


"testing" "github.com/imdario/mergo" <ins> "k8s.io/kubernetes/pkg/client/restclient" </ins> clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" )


targetNumNodes := int32(framework.TestContext.CloudConfig.NumNodes - 1) ginkgo.By(fmt.Sprintf("decreasing cluster size to %d", targetNumNodes)) err = framework.ResizeGroup(group, targetNumNodes) <del> framework.ExpectEqual(err, nil) </del> <ins> framework.ExpectNoError(err) </ins> err = framework.WaitForGroupSize(group, targetNumNodes) <del> framework.ExpectEqual(err, nil) </del> <ins> framework.ExpectNoError(err) </ins> err = e2enode.WaitForReadyNodes(c, framework.TestContext.CloudConfig.NumNodes-1, 10*time.Minute) <del> framework.ExpectEqual(err, nil) </del> <ins> framework.ExpectNoError(err) </ins> targetNodes, err := e2enode.GetReadySchedulableNodes(c) framework.ExpectNoError(err) framework.ExpectEqual(len(targetNodes.Items), int(targetNumNodes))


assert.Equal(t, c.expected, real, fmt.Sprintf("TestCase[%d]: %s", i, c.desc)) } } <ins> func TestEnsureLoadBalancerDeleted(t *testing.T) { const vmCount = 8 const availabilitySetCount = 4 const serviceCount = 9 tests := []struct { desc              string service           v1.Service expectCreateError bool }{ { desc:    "external service should be created and deleted successfully", service: getTestService("test1", v1.ProtocolTCP, 80), }, { desc:    "internal service should be created and deleted successfully", service: getInternalTestService("test2", 80), }, { desc:    "annotated service with same resourceGroup should be created and deleted successfully", service: getResourceGroupTestService("test3", "rg", "", 80), }, { desc:              "annotated service with different resourceGroup shouldn't be created but should be deleted successfully", service:           getResourceGroupTestService("test4", "random-rg", "1.2.3.4", 80), expectCreateError: true, }, } az := getTestCloud() for i, c := range tests { clusterResources := getClusterResources(az, vmCount, availabilitySetCount) getTestSecurityGroup(az) if c.service.Annotations[ServiceAnnotationLoadBalancerInternal] == "true" { addTestSubnet(t, az, &c.service) } // create the service first. lbStatus, err := az.EnsureLoadBalancer(context.TODO(), testClusterName, &c.service, clusterResources.nodes) if c.expectCreateError { assert.NotNil(t, err, "TestCase[%d]: %s", i, c.desc) } else { assert.Nil(t, err, "TestCase[%d]: %s", i, c.desc) assert.NotNil(t, lbStatus, "TestCase[%d]: %s", i, c.desc) result, err := az.LoadBalancerClient.List(context.TODO(), az.Config.ResourceGroup) assert.Nil(t, err, "TestCase[%d]: %s", i, c.desc) assert.Equal(t, len(result), 1, "TestCase[%d]: %s", i, c.desc) assert.Equal(t, len(*result[0].LoadBalancingRules), 1, "TestCase[%d]: %s", i, c.desc) } // finally, delete it. err = az.EnsureLoadBalancerDeleted(context.TODO(), testClusterName, &c.service) assert.Nil(t, err, "TestCase[%d]: %s", i, c.desc) result, err := az.LoadBalancerClient.List(context.Background(), az.Config.ResourceGroup) assert.Nil(t, err, "TestCase[%d]: %s", i, c.desc) assert.Equal(t, len(result), 0, "TestCase[%d]: %s", i, c.desc) } } </ins>


"fmt" "io" "net" <ins> "net/http" </ins> "regexp" "time"


SSLContext ctx = SSLContext.getInstance("SSL"); ctx.init(null, trustAll, new SecureRandom()); <del> URL url = new URL(host + path + serviceName); </del> <ins> URL url = new URL(proto + host + ":" + port + path + serviceName); </ins> logger.info("Getting endpoints from " + url); HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();


while true; do if result=$(gcloud compute ${resource} list --project=${PROJECT} ${@:2}); then if [[ ! -z "${GREP_REGEX}" ]]; then <del> result=$(echo "${result}" | grep "${GREP_REGEX}") </del> <ins> result=$(echo "${result}" | grep "${GREP_REGEX}" || true) </ins> fi echo "${result}" return


} // Filter based on extender implemented predicate functions. The filtered list is <del> // expected to be a subset of the supplied list. failedNodesMap optionally contains // the list of failed nodes and failure reasons. </del> <ins> // expected to be a subset of the supplied list; otherwise the function returns an error. // failedNodesMap optionally contains the list of failed nodes and failure reasons. </ins> func (h *HTTPExtender) Filter( pod *v1.Pod, nodes []*v1.Node, nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo,


// IsNotMountPoint determines if a directory is a mountpoint. func (mounter *Mounter) IsNotMountPoint(dir string) (bool, error) { <del> return IsNotMountPoint(mounter, dir) </del> <ins> return isNotMountPoint(mounter, dir) </ins> } // IsLikelyNotMountPoint determines if a directory is not a mountpoint.


kind: Service apiVersion: v1beta1 <del> id: nginxExample </del> <ins> id: nginx-example </ins> # the port that this service should serve on port: 8000 # just like the selector in the replication controller, # but this time it identifies the set of pods to load balance # traffic to. selector: <del> - name: nginx </del> <ins> name: nginx </ins> # the container on each pod to connect to, can be a name # (e.g. 'www') or a number (e.g. 80) containerPort: 80


} } <ins> func createSocketFile(socketDir string) (string, error) { testSocketFile := filepath.Join(socketDir, "mt.sock") // Switch to volume path and create the socket file // socket file can not have length of more than 108 character // and hence we must use relative path oldDir, _ := os.Getwd() err := os.Chdir(socketDir) if err != nil { return "", err } defer func() { os.Chdir(oldDir) }() _, socketCreateError := net.Listen("unix", "mt.sock") return testSocketFile, socketCreateError } </ins> func TestFindExistingPrefix(t *testing.T) { defaultPerm := os.FileMode(0750) tests := []struct {


<del> load("@io_bazel_rules_go//go:def.bzl", "go_library") </del> <ins> load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") </ins> go_library( name = "go_default_library",


(disk.ManagedDisk != nil && diskURI != "" && strings.EqualFold(*disk.ManagedDisk.ID, diskURI)) { // found the disk klog.V(2).Infof("azureDisk - detach disk: name %q uri %q", diskName, diskURI) <del> disks[i].ToBeDetached = to.BoolPtr(true) </del> <ins> if strings.EqualFold(ss.cloud.Environment.Name, "AZURESTACKCLOUD") { disks = append(disks[:i], disks[i+1:]...) } else { disks[i].ToBeDetached = to.BoolPtr(true) } </ins> bFoundDisk = true break }


REGISTRY ?= gcr.io/kubernetes-e2e-test-images GOARM=7 QEMUVERSION=v2.9.1 <del> GOLANG_VERSION=1.8.3 </del> <ins> GOLANG_VERSION=1.9.1 </ins> export ifndef WHAT


// remove all existing c.RemoveStreams(stream0, stream1) <ins> // remove nil stream should not crash c.RemoveStreams(nil) </ins> if len(c.streams) != 0 { t.Fatalf("should not have any streams, has %d", len(c.streams)) }


if _, err := dc.coreClient.CoreV1().Pods(tc.pod.Namespace).Create(ctx, tc.pod, metav1.CreateOptions{}); err != nil { t.Fatalf("Failed to create pod: %v", err) } <ins> dc.clock.Sleep(tc.timePassed) </ins> if err := dc.informerFactory.Core().V1().Pods().Informer().GetIndexer().Add(tc.pod); err != nil { t.Fatalf("Failed adding pod to indexer: %v", err) } <del> dc.clock.Sleep(tc.timePassed) </del> <ins> diff := "" </ins> if err := wait.Poll(100*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) { <del> return dc.stalePodDisruptionQueue.Len() == 0, nil </del> <ins> pod, err := dc.kubeClient.CoreV1().Pods(tc.pod.Namespace).Get(ctx, tc.pod.Name, metav1.GetOptions{}) if err != nil { t.Fatalf("Failed getting updated pod: %v", err) } diff = cmp.Diff(tc.wantConditions, pod.Status.Conditions, cmpopts.IgnoreFields(v1.PodCondition{}, "LastTransitionTime")) return diff == "", nil </ins> }); err != nil { <del> t.Fatalf("Failed waiting for worker to sync: %v", err) } pod, err := dc.kubeClient.CoreV1().Pods(tc.pod.Namespace).Get(ctx, tc.pod.Name, metav1.GetOptions{}) if err != nil { t.Fatalf("Failed getting updated pod: %v", err) } diff := cmp.Diff(tc.wantConditions, pod.Status.Conditions, cmpopts.IgnoreFields(v1.PodCondition{}, "LastTransitionTime")) if diff != "" { t.Errorf("Obtained pod conditions (-want,+got):n%s", diff) </del> <ins> t.Fatalf("Failed waiting for worker to sync: %v, (-want,+got):n%s", err, diff) </ins> } }) }


k8s-app: nvidia-gpu-device-plugin addonmanager.kubernetes.io/mode: Reconcile spec: <ins> selector: matchLabels: k8s-app: nvidia-gpu-device-plugin </ins> template: metadata: labels:


containers: - name: fluentd-elasticsearch image: gcr.io/google_containers/fluentd-elasticsearch:1.5 <ins> resources: limits: cpu: 100m </ins> env: - name: "FLUENTD_ARGS" value: "-qq"


}, { manifest: KubeProxyDaemonSet, <del> data: struct{ ImageRepository, Arch, Version, ImageOverride, ClusterCIDR, MasterTaintKey, CloudTaintKey string }{ </del> <ins> data: struct{ ImageRepository, Arch, Version, ImageOverride, ExtraParams, ClusterCIDR, MasterTaintKey, CloudTaintKey string }{ </ins> ImageRepository: "foo", Arch:            "foo", Version:         "foo", ImageOverride:   "foo", <ins> ExtraParams:     "foo", </ins> ClusterCIDR:     "foo", MasterTaintKey:  "foo", CloudTaintKey:   "foo",


Description string `json:"description,omitempty"` // Versions are versions for this third party object <del> // +optional </del> Versions []APIVersion `json:"versions,omitempty"` }


nodeTime = time.Now() bootTime, err = util.GetBootTime() <del> gomega.Expect(err).To(gomega.BeNil()) </del> <ins> framework.ExpectNoError(err) </ins> // Set lookback duration longer than node up time. // Assume the test won't take more than 1 hour, in fact it usually only takes 90 seconds.


genericConfig.DisabledPostStartHooks.Insert(rbacrest.PostStartHookName) } <del> webhookAuthResolver := func(delegate webhookconfig.AuthenticationInfoResolver) webhookconfig.AuthenticationInfoResolver { return webhookconfig.AuthenticationInfoResolverFunc(func(server string) (*rest.Config, error) { if server == "kubernetes.default.svc" { return genericConfig.LoopbackClientConfig, nil } ret, err := delegate.ClientConfigFor(server) if err != nil { return nil, err } if proxyTransport != nil && proxyTransport.Dial != nil { ret.Dial = proxyTransport.Dial } return ret, err }) </del> <ins> webhookAuthResolverWrapper := func(delegate webhookconfig.AuthenticationInfoResolver) webhookconfig.AuthenticationInfoResolver { return &webhookconfig.AuthenticationInfoResolverDelegator{ ClientConfigForFunc: func(server string) (*rest.Config, error) { if server == "kubernetes.default.svc" { return genericConfig.LoopbackClientConfig, nil } return delegate.ClientConfigFor(server) }, ClientConfigForServiceFunc: func(serviceName, serviceNamespace string) (*rest.Config, error) { if serviceName == "kubernetes" && serviceNamespace == "default" { return genericConfig.LoopbackClientConfig, nil } ret, err := delegate.ClientConfigForService(serviceName, serviceNamespace) if err != nil { return nil, err } if proxyTransport != nil && proxyTransport.Dial != nil { ret.Dial = proxyTransport.Dial } return ret, err }, } </ins> } pluginInitializers, err := BuildAdmissionPluginInitializers( s, client, sharedInformers, serviceResolver, <del> webhookAuthResolver, </del> <ins> webhookAuthResolverWrapper, </ins> ) if err != nil { return nil, nil, nil, nil, nil, fmt.Errorf("failed to create admission plugin initializer: %v", err)


// recent start error or not, State should be Terminated, LastTerminationState should be retrieved from second latest // terminated status. { <del> []api.Container{{Name: "without-reason"}, {Name: "with-reason"}}, []*kubecontainer.ContainerStatus{ </del> <ins> containers: []api.Container{{Name: "without-reason"}, {Name: "with-reason"}}, statuses: []*kubecontainer.ContainerStatus{ </ins> { Name:     "without-reason", State:    kubecontainer.ContainerStateExited,


} } <del> func k8sVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume { </del> <ins> func isPkiVolumeMountNeeded() bool { // On some systems were we host-mount /etc/ssl/certs, it is also required to mount /etc/pki. This is needed // due to symlinks pointing from files in /etc/ssl/certs into /etc/pki/ if _, err := os.Stat("/etc/pki"); err == nil { return true } return false } func pkiVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume { </ins> return api.Volume{ Name: "pki", VolumeSource: api.VolumeSource{ <ins> // TODO(phase1+) make path configurable HostPath: &api.HostPathVolumeSource{Path: "/etc/pki"}, }, } } func pkiVolumeMount() api.VolumeMount { return api.VolumeMount{ Name:      "pki", MountPath: "/etc/pki", } } func k8sVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume { return api.Volume{ Name: "k8s", VolumeSource: api.VolumeSource{ </ins> HostPath: &api.HostPathVolumeSource{Path: kubeadmapi.GlobalEnvParams.KubernetesDir}, }, }


Namespace: pod.Namespace, } tests := []struct { <del> containers                   []api.Container statuses                     []*kubecontainer.ContainerStatus reasons                      map[string]error oldStatuses                  []api.ContainerStatus expectedState                map[string]api.ContainerState </del> <ins> containers    []api.Container statuses      []*kubecontainer.ContainerStatus reasons       map[string]error oldStatuses   []api.ContainerStatus expectedState map[string]api.ContainerState // Only set expectedInitState when it is different from expectedState expectedInitState            map[string]api.ContainerState </ins> expectedLastTerminationState map[string]api.ContainerState }{ // For container with no historical record, State should be Waiting, LastTerminationState should be retrieved from // old status from apiserver. { <del> []api.Container{{Name: "without-old-record"}, {Name: "with-old-record"}}, []*kubecontainer.ContainerStatus{}, map[string]error{}, []api.ContainerStatus{{ </del> <ins> containers: []api.Container{{Name: "without-old-record"}, {Name: "with-old-record"}}, statuses:   []*kubecontainer.ContainerStatus{}, reasons:    map[string]error{}, oldStatuses: []api.ContainerStatus{{ </ins> Name:                 "with-old-record", LastTerminationState: api.ContainerState{Terminated: &api.ContainerStateTerminated{}}, }}, <del> map[string]api.ContainerState{ </del> <ins> expectedState: map[string]api.ContainerState{ </ins> "without-old-record": {Waiting: &api.ContainerStateWaiting{ Reason: startWaitingReason, }},


rs := &apps.ReplicaSet{} rc := &api.ReplicationController{} <ins> extGroup := schema.GroupVersion{Group: "apps", Version: "v1"} extCodec := legacyscheme.Codecs.LegacyCodec(extGroup) </ins> <del> extGroup := testapi.Apps defaultGroup := testapi.Default </del> <ins> defaultGroup := schema.GroupVersion{Group: "", Version: "v1"} defaultCodec := legacyscheme.Codecs.LegacyCodec(defaultGroup) </ins> fuzzInternalObject(t, schema.GroupVersion{Group: "apps", Version: runtime.APIVersionInternal}, rs, rand.Int63())


kubeClient := testKubelet.fakeKubeClient kubeClient.ReactFn = testclient.NewSimpleFake(&api.NodeList{Items: []api.Node{ { <del> ObjectMeta: api.ObjectMeta{Name: "127.0.0.1"}, </del> <ins> ObjectMeta: api.ObjectMeta{Name: testKubeletHostname}, </ins> Spec:       api.NodeSpec{}, Status: api.NodeStatus{ Conditions: []api.NodeCondition{


# # We specify -X to avoid a race condition that can cause minion failure to # install.  See https://github.com/saltstack/salt-bootstrap/issues/270 <del> curl -L http://bootstrap.saltstack.com | sh -s -- -X </del> <ins> curl -L --connect-timeout 20 --retry 6 --retry-delay 10 http://bootstrap.saltstack.com | sh -s -- -X </ins>


if err := os.MkdirAll(dest, 0o755); err != nil { return err } <del> return utils.WithProcfd(c.root, m.Destination, func(procfd string) error { if err := mount(m.Source, m.Destination, procfd, "cgroup2", uintptr(m.Flags), m.Data); err != nil { // when we are in UserNS but CgroupNS is not unshared, we cannot mount cgroup2 (#2158) if errors.Is(err, unix.EPERM) || errors.Is(err, unix.EBUSY) { src := fs2.UnifiedMountpoint if c.cgroupns && c.cgroup2Path != "" { // Emulate cgroupns by bind-mounting // the container cgroup path rather than // the whole /sys/fs/cgroup. src = c.cgroup2Path } err = mount(src, m.Destination, procfd, "", uintptr(m.Flags)|unix.MS_BIND, "") if c.rootlessCgroups && errors.Is(err, unix.ENOENT) { err = nil } } return err } return nil </del> <ins> err = utils.WithProcfd(c.root, m.Destination, func(procfd string) error { return mount(m.Source, m.Destination, procfd, "cgroup2", uintptr(m.Flags), m.Data) </ins> }) <ins> if err == nil || !(errors.Is(err, unix.EPERM) || errors.Is(err, unix.EBUSY)) { return err } // When we are in UserNS but CgroupNS is not unshared, we cannot mount // cgroup2 (#2158), so fall back to bind mount. bindM := &configs.Mount{ Device:           "bind", Source:           fs2.UnifiedMountpoint, Destination:      m.Destination, Flags:            unix.MS_BIND | m.Flags, PropagationFlags: m.PropagationFlags, } if c.cgroupns && c.cgroup2Path != "" { // Emulate cgroupns by bind-mounting the container cgroup path // rather than the whole /sys/fs/cgroup. bindM.Source = c.cgroup2Path } // mountToRootfs() handles remounting for MS_RDONLY. // No need to set c.fd here, because mountToRootfs() calls utils.WithProcfd() by itself in mountPropagate(). err = mountToRootfs(bindM, c) if c.rootlessCgroups && errors.Is(err, unix.ENOENT) { // ENOENT (for `src = c.cgroup2Path`) happens when rootless runc is being executed // outside the userns+mountns. // // Mask `/sys/fs/cgroup` to ensure it is read-only, even when `/sys` is mounted // with `rbind,ro` (`runc spec --rootless` produces `rbind,ro` for `/sys`). err = utils.WithProcfd(c.root, m.Destination, func(procfd string) error { return maskPath(procfd, c.label) }) } return err </ins> } func doTmpfsCopyUp(m *configs.Mount, rootfs, mountLabel string) (Err error) {


import ( "fmt" <del> "k8s.io/kubernetes/pkg/api" </del> "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/runtime" )


framework.ExpectNoError(framework.VerifyServeHostnameServiceUp(cs, ns, host, podNames1, svc1IP, servicePort)) // Restart apiserver <del> initialRestartCount, err := framework.GetApiserverRestartCount(cs) Expect(err).NotTo(HaveOccurred(), "failed to get apiserver's restart count") </del> By("Restarting apiserver") <del> if err := framework.RestartApiserver(cs.Discovery()); err != nil { </del> <ins> if err := framework.RestartApiserver(cs); err != nil { </ins> framework.Failf("error restarting apiserver: %v", err) } <del> By("Waiting for apiserver to be restarted") if err := framework.WaitForApiserverRestarted(cs, initialRestartCount); err != nil { framework.Failf("error while waiting for apiserver to be restarted: %v", err) } </del> By("Waiting for apiserver to come up by polling /healthz") if err := framework.WaitForApiserverUp(cs); err != nil { framework.Failf("error while waiting for apiserver up: %v", err)


serviceHasSynced cache.InformerSynced // nodeLister knows how to list nodes nodeLister corelisters.NodeLister <ins> // nodeHasSynced indicates whether nodes have been sync'd at least once. // Check this before trusting a response from the node lister. nodeHasSynced cache.InformerSynced </ins> // a list of node labels to register nodeLabels map[string]string


echo "Prepare kube-addons manifests and start kube addon manager" local -r src_dir="${KUBE_HOME}/kube-manifests/kubernetes/gci-trusty" local -r dst_dir="/etc/kubernetes/addons" <ins> # prep the additional bindings that are particular to e2e users and groups setup-addon-manifests "addons" "e2e-rbac-bindings" </ins> # Set up manifests of other addons. if [[ "${ENABLE_CLUSTER_MONITORING:-}" == "influxdb" ]] ||  [[ "${ENABLE_CLUSTER_MONITORING:-}" == "google" ]] ||


"context" "encoding/json" "fmt" <ins> "mime" </ins> "net/http" "net/url" "sort"


echo ${short_hash:0:5} } <ins> # Pedantically kill, wait-on and remove a container. The -f -v options # to rm don't actually seem to get the job done, so force kill the # container, wait to ensure it's stopped, then try the remove. This is # a workaround for bug https://github.com/docker/docker/issues/3968. function kube::build::destroy_container() { "${DOCKER[@]}" kill "$1" >/dev/null 2>&1 || true "${DOCKER[@]}" wait "$1" >/dev/null 2>&1 || true "${DOCKER[@]}" rm -f -v "$1" >/dev/null 2>&1 || true } </ins> # --------------------------------------------------------------------------- # Building


"k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" cloudprovider "k8s.io/cloud-provider" <ins> csilibplugins "k8s.io/csi-translation-lib/plugins" </ins> proxyutil "k8s.io/kubernetes/pkg/proxy/util" . "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util/hostutil"


// ResourceConfiguration stores per resource configuration. type ResourceConfiguration struct { <del> // resources is a list of kubernetes resources which have to be encrypted. </del> <ins> // resources is a list of kubernetes resources which have to be encrypted. The resource names are derived from `resource` or `resource.group` of the group/version/resource. // eg: pandas.awesome.bears.example is a custom resource with 'group': awesome.bears.example, 'resource': pandas) </ins> Resources []string // providers is a list of transformers to be used for reading and writing the resources to disk. // eg: aesgcm, aescbc, secretbox, identity.


registry = "k8s.gcr.io/build-image", repository = "debian-base", # Ensure the digests above are updated to match a new tag <del> tag = "buster-v1.3.0",  # ignored, but kept here for documentation </del> <ins> tag = "buster-v1.4.0",  # ignored, but kept here for documentation </ins> ) container_pull(


<ins> /* Copyright 2020 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 network import ( "fmt" "strings" "time" "github.com/onsi/ginkgo" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" e2enode "k8s.io/kubernetes/test/e2e/framework/node" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" e2eservice "k8s.io/kubernetes/test/e2e/framework/service" e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" ) const ( serviceName = "svc-udp" podClient   = "pod-client" podBackend1 = "pod-server-1" podBackend2 = "pod-server-2" srcPort     = 12345 ) // Linux NAT uses conntrack to perform NAT, everytime a new // flow is seen, a connection is created in the conntrack table, and it // is being used by the NAT module. // Each entry in the conntrack table has associated a timeout, that removes // the connection once it expires. // UDP is a connectionless protocol, so the conntrack module tracking functions // are not very advanced. // It uses a short timeout (30 sec by default) that is renewed if there are new flows // matching the connection. Otherwise it expires the entry. // This behaviour can cause issues in Kubernetes when one entry on the conntrack table // is never expired because the sender does not stop sending traffic, but the pods or // endpoints were deleted, blackholing the traffic // In order to mitigate this problem, Kubernetes delete the stale entries: // - when an endpoint is removed // - when a service goes from no endpoints to new endpoint // Ref: https://api.semanticscholar.org/CorpusID:198903401 // Boye, Magnus. “Netfilter Connection Tracking and NAT Implementation.” (2012). var _ = SIGDescribe("Conntrack", func() { fr := framework.NewDefaultFramework("conntrack") type nodeInfo struct { name   string nodeIP string } var ( cs                             clientset.Interface ns                             string clientNodeInfo, serverNodeInfo nodeInfo ) ginkgo.BeforeEach(func() { cs = fr.ClientSet ns = fr.Namespace.Name nodes, err := e2enode.GetBoundedReadySchedulableNodes(cs, 2) framework.ExpectNoError(err) if len(nodes.Items) < 2 { e2eskipper.Skipf( "Test requires >= 2 Ready nodes, but there are only %v nodes", len(nodes.Items)) } ips := e2enode.CollectAddresses(nodes, v1.NodeInternalIP) clientNodeInfo = nodeInfo{ name:   nodes.Items[0].Name, nodeIP: ips[0], } serverNodeInfo = nodeInfo{ name:   nodes.Items[1].Name, nodeIP: ips[1], } }) ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a NodePort service", func() { // Create a NodePort service udpJig := e2eservice.NewTestJig(cs, ns, serviceName) ginkgo.By("creating a UDP service " + serviceName + " with type=NodePort in " + ns) udpService, err := udpJig.CreateUDPService(func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeNodePort svc.Spec.Ports = []v1.ServicePort{ {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, } }) framework.ExpectNoError(err) // Create a pod in one node to create the UDP traffic against the NodePort service every 5 seconds ginkgo.By("creating a client pod for probing the service " + serviceName) clientPod := newAgnhostPod(podClient, "") clientPod.Spec.NodeName = clientNodeInfo.name cmd := fmt.Sprintf(`date; for i in $(seq 1 300); do echo "$(date) Try: ${i}"; echo hostname | nc -u -w 5 -p %d %s %d; echo; done`, srcPort, serverNodeInfo.nodeIP, udpService.Spec.Ports[0].NodePort) clientPod.Spec.Containers[0].Command = []string{"/bin/sh", "-c", cmd} clientPod.Spec.Containers[0].Name = podClient fr.PodClient().CreateSync(clientPod) // Read the client pod logs logs, err := e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) // Add a backend pod to the service in the other node ginkgo.By("creating a backend pod " + podBackend1 + " for the service " + serviceName) serverPod1 := newAgnhostPod(podBackend1, "netexec", fmt.Sprintf("--udp-port=%d", 80)) serverPod1.Labels = udpJig.Labels serverPod1.Spec.NodeName = serverNodeInfo.name fr.PodClient().CreateSync(serverPod1) // Waiting for service to expose endpoint. err = validateEndpointsPorts(cs, ns, serviceName, portsByPodName{podBackend1: {80}}) framework.ExpectNoError(err, "failed to validate endpoints for service %s in namespace: %s", serviceName, ns) // Check that the pod receives the traffic // UDP conntrack entries timeout is 30 sec by default ginkgo.By("checking client pod connected to the backend 1 on Node IP " + serverNodeInfo.nodeIP) time.Sleep(30 * time.Second) logs, err = e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) if !strings.Contains(string(logs), podBackend1) { framework.Failf("Failed to connecto to backend 1") } // Create a second pod ginkgo.By("creating a second backend pod " + podBackend2 + " for the service " + serviceName) serverPod2 := newAgnhostPod(podBackend2, "netexec", fmt.Sprintf("--udp-port=%d", 80)) serverPod2.Labels = udpJig.Labels serverPod2.Spec.NodeName = serverNodeInfo.name fr.PodClient().CreateSync(serverPod2) // and delete the first pod framework.Logf("Cleaning up %s pod", podBackend1) fr.PodClient().DeleteSync(podBackend1, metav1.DeleteOptions{}, framework.DefaultPodDeletionTimeout) // Check that the second pod keeps receiving traffic // UDP conntrack entries timeout is 30 sec by default ginkgo.By("checking client pod connected to the backend 2 on Node IP " + serverNodeInfo.nodeIP) time.Sleep(30 * time.Second) logs, err = e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) if !strings.Contains(string(logs), podBackend2) { framework.Failf("Failed to connecto to backend 2") } }) ginkgo.It("should be able to preserve UDP traffic when server pod cycles for a ClusterIP service", func() { // Create a NodePort service udpJig := e2eservice.NewTestJig(cs, ns, serviceName) ginkgo.By("creating a UDP service " + serviceName + " with type=ClusterIP in " + ns) udpService, err := udpJig.CreateUDPService(func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.Ports = []v1.ServicePort{ {Port: 80, Name: "udp", Protocol: v1.ProtocolUDP, TargetPort: intstr.FromInt(80)}, } }) framework.ExpectNoError(err) // Create a pod in one node to create the UDP traffic against the NodePort service every 5 seconds ginkgo.By("creating a client pod for probing the service " + serviceName) clientPod := newAgnhostPod(podClient, "") clientPod.Spec.NodeName = clientNodeInfo.name cmd := fmt.Sprintf(`date; for i in $(seq 1 300); do echo "$(date) Try: ${i}"; echo hostname | nc -u -w 5 -p %d %s %d; echo; done`, srcPort, udpService.Spec.ClusterIP, udpService.Spec.Ports[0].Port) clientPod.Spec.Containers[0].Command = []string{"/bin/sh", "-c", cmd} clientPod.Spec.Containers[0].Name = podClient fr.PodClient().CreateSync(clientPod) // Read the client pod logs logs, err := e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) // Add a backend pod to the service in the other node ginkgo.By("creating a backend pod " + podBackend1 + " for the service " + serviceName) serverPod1 := newAgnhostPod(podBackend1, "netexec", fmt.Sprintf("--udp-port=%d", 80)) serverPod1.Labels = udpJig.Labels serverPod1.Spec.NodeName = serverNodeInfo.name fr.PodClient().CreateSync(serverPod1) // Waiting for service to expose endpoint. err = validateEndpointsPorts(cs, ns, serviceName, portsByPodName{podBackend1: {80}}) framework.ExpectNoError(err, "failed to validate endpoints for service %s in namespace: %s", serviceName, ns) // Check that the pod receives the traffic // UDP conntrack entries timeout is 30 sec by default ginkgo.By("checking client pod connected to the backend 1 on Node IP " + serverNodeInfo.nodeIP) time.Sleep(30 * time.Second) logs, err = e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) if !strings.Contains(string(logs), podBackend1) { framework.Failf("Failed to connecto to backend 1") } // Create a second pod ginkgo.By("creating a second backend pod " + podBackend2 + " for the service " + serviceName) serverPod2 := newAgnhostPod(podBackend2, "netexec", fmt.Sprintf("--udp-port=%d", 80)) serverPod2.Labels = udpJig.Labels serverPod2.Spec.NodeName = serverNodeInfo.name fr.PodClient().CreateSync(serverPod2) // and delete the first pod framework.Logf("Cleaning up %s pod", podBackend1) fr.PodClient().DeleteSync(podBackend1, metav1.DeleteOptions{}, framework.DefaultPodDeletionTimeout) // Check that the second pod keeps receiving traffic // UDP conntrack entries timeout is 30 sec by default ginkgo.By("checking client pod connected to the backend 2 on Node IP " + serverNodeInfo.nodeIP) time.Sleep(30 * time.Second) logs, err = e2epod.GetPodLogs(cs, ns, podClient, podClient) framework.ExpectNoError(err) framework.Logf("Pod client logs: %s", logs) if !strings.Contains(string(logs), podBackend2) { framework.Failf("Failed to connecto to backend 2") } }) }) </ins>


return "", err } if _, err := os.Stat(filepath.Join(*k8sBinDir, bin)); err != nil { <del> return "", fmt.Errorf("Could not find %s under directory %s.", bin, absPath) </del> <ins> return "", fmt.Errorf("Could not find kube-apiserver under directory %s.", absPath) </ins> } return filepath.Join(absPath, bin), nil }


- Ingress - Egress ``` <ins> ### Negative caching The `denial` cache TTL has been reduced to the minimum of 5 seconds [here](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml#L37). In the unlikely event that this impacts performance, setting this TTL to a higher value make help alleviate issues, but be aware that operations that rely on DNS polling for orchestration may fail (for example operators with StatefulSets). </ins>


if [[ "${master}" == "true" && "${MASTER_OS_DISTRIBUTION}" == "gci" ]] || [[ "${master}" == "false" && "${NODE_OS_DISTRIBUTION}" == "gci" ]]; then cat >>$file <<EOF <del> VOLUME_PLUGIN_DIR: $(yaml-quote ${VOLUME_PLUGIN_DIR:-/home/kubernetes/flexvolume}) </del> <ins> VOLUME_PLUGIN_DIR: $(yaml-quote ${VOLUME_PLUGIN_DIR:-/etc/srv/kubernetes/kubelet-plugins/volume/exec}) </ins> EOF fi


readonly node_logfiles="kube-proxy" readonly aws_logfiles="cloud-init-output" readonly gce_logfiles="startupscript" <del> readonly common_logfiles="kern" </del> <ins> readonly kern_logfile="kern" </ins> readonly initd_logfiles="docker" readonly supervisord_logfiles="kubelet supervisor/supervisord supervisor/kubelet-stdout supervisor/kubelet-stderr supervisor/docker-stdout supervisor/docker-stderr"


} } } <ins> func TestGetRbdImageInfo(t *testing.T) { tmpDir, err := utiltesting.MkTmpdir("rbd_test") if err != nil { t.Fatalf("error creating temp dir: %v", err) } defer os.RemoveAll(tmpDir) for i, c := range []struct { DeviceMountPath    string TargetRbdImageInfo *rbdImageInfo }{ { DeviceMountPath:    fmt.Sprintf("%s/plugins/kubernetes.io/rbd/rbd/pool1-image-image1", tmpDir), TargetRbdImageInfo: &rbdImageInfo{pool: "pool1", name: "image1"}, }, { DeviceMountPath:    fmt.Sprintf("%s/plugins/kubernetes.io/rbd/mounts/pool2-image-image2", tmpDir), TargetRbdImageInfo: &rbdImageInfo{pool: "pool2", name: "image2"}, }, } { rbdImageInfo, err := getRbdImageInfo(c.DeviceMountPath) if err != nil { t.Errorf("Case %d: getRbdImageInfo failed: %v", i, err) continue } if !reflect.DeepEqual(rbdImageInfo, c.TargetRbdImageInfo) { t.Errorf("Case %d: unexpected RbdImageInfo, wanted %v, got %v", i, c.TargetRbdImageInfo, rbdImageInfo) } } } </ins>


"k8s.io/apimachinery/pkg/util/strategicpatch" core "k8s.io/client-go/testing" <ins> "time" </ins> ) func TestRealHistory_ListControllerRevisions(t *testing.T) {


### Hook Handler Implementations Hook handlers are the way that hooks are surfaced to containers.  Containers can select the type of hook handler they would like to implement.  Kubernetes currently supports two different hook handler types: <del> * Exec - Executes a specific command (e.g. pre-stop.sh) inside the cgroup and namespaces of the container.  Resources consumed by the command are counted against the container.  Commands which return non-zero values are treated as container failures (and will cause kubelet to forcibly restart the container).  Parameters are passed to the command as traditional linux command line flags (e.g. pre-stop.sh --reason=HEALTH) </del> <ins> * Exec - Executes a specific command (e.g. pre-stop.sh) inside the cgroup and namespaces of the container.  Resources consumed by the command are counted against the container.  Commands which print "ok" to standard out (stdout) are treated as healthy, any other output is treated as container failures (and will cause kubelet to forcibly restart the container).  Parameters are passed to the command as traditional linux command line flags (e.g. pre-stop.sh --reason=HEALTH) </ins> * HTTP - Executes an HTTP request against a specific endpoint on the container.  HTTP error codes (5xx) and non-response/failure to connect are treated as container failures. Parameters are passed to the http endpoint as query args (e.g. http://some.server.com/some/path?reason=HEALTH)


func rcByNameContainer(name string, replicas int, image string, labels map[string]string, c api.Container) *api.ReplicationController { // Add "name": name to the labels, overwriting if it exists. labels["name"] = name <ins> gracePeriod := int64(0) </ins> return &api.ReplicationController{ TypeMeta: unversioned.TypeMeta{ Kind:       "ReplicationController",


} if kernelVersion.LessThan(version.MustParseGeneric(connReuseMinSupportedKernelVersion)) { klog.ErrorS(nil, fmt.Sprintf("can't set sysctl %s, kernel version must be at least %s", sysctlConnReuse, connReuseMinSupportedKernelVersion)) <ins> } else if kernelVersion.AtLeast(version.MustParseGeneric(connReuseFixedKernelVersion)) { // https://github.com/kubernetes/kubernetes/issues/93297 klog.V(2).InfoS("Left as-is", "sysctl", sysctlConnReuse) </ins> } else { // Set the connection reuse mode if err := utilproxy.EnsureSysctl(sysctl, sysctlConnReuse, 0); err != nil {


mkdir -p "${download_path}" if [[ $(which gsutil) ]] && [[ "$url" =~ ^https://storage.googleapis.com/.* ]]; then <del> gsutil cp "${url//'https://storage.googleapis.com/'/'gs://'}" "${download_path}/${file}" </del> <ins> gsutil cp "${url//'https://storage.googleapis.com/'/gs://}" "${download_path}/${file}" </ins> elif [[ $(which curl) ]]; then # if the url belongs to GCS API we should use oauth2_token in the headers curl_headers=""


Expect(err).ToNot(HaveOccurred()) podZone := node.Labels[apis.LabelZoneFailureDomain] <del> // TODO (verult) Consider using node taints to simulate zonal failure instead. By("deleting instance group belonging to pod's zone") // Asynchronously detect a pod reschedule is triggered during/after instance group deletion. waitStatus := make(chan error) go func() { waitStatus <- waitForStatefulSetReplicasNotReady(statefulSet.Name, ns, c) }() cloud, err := gce.GetGCECloud() if err != nil { Expect(err).NotTo(HaveOccurred()) } instanceGroupName := framework.TestContext.CloudConfig.NodeInstanceGroup instanceGroup, err := cloud.GetInstanceGroup(instanceGroupName, podZone) Expect(err).NotTo(HaveOccurred(), "Error getting instance group %s in zone %s", instanceGroupName, podZone) templateName, err := framework.GetManagedInstanceGroupTemplateName(podZone) Expect(err).NotTo(HaveOccurred(), "Error getting instance group template in zone %s", podZone) err = framework.DeleteManagedInstanceGroup(podZone) Expect(err).NotTo(HaveOccurred(), "Error deleting instance group in zone %s", podZone) </del> <ins> By("tainting nodes in the zone the pod is scheduled in") selector := labels.SelectorFromSet(labels.Set(map[string]string{apis.LabelZoneFailureDomain: podZone})) nodesInZone, err := c.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: selector.String()}) Expect(err).ToNot(HaveOccurred()) removeTaintFunc := addTaint(c, ns, nodesInZone.Items, podZone) </ins> defer func() { <del> framework.Logf("recreating instance group %s", instanceGroup.Name) framework.ExpectNoError(framework.CreateManagedInstanceGroup(instanceGroup.Size, podZone, templateName), "Error recreating instance group %s in zone %s", instanceGroup.Name, podZone) framework.ExpectNoError(framework.WaitForReadyNodes(c, nodeCount, framework.RestartNodeReadyAgainTimeout), "Error waiting for nodes from the new instance group to become ready.") </del> <ins> framework.Logf("removing previously added node taints") removeTaintFunc() </ins> }() <del> err = <-waitStatus Expect(err).ToNot(HaveOccurred(), "Error waiting for replica to be deleted during failover: %v", err) </del> <ins> By("deleting StatefulSet pod") err = c.CoreV1().Pods(ns).Delete(pod.Name, &metav1.DeleteOptions{}) // Verify the pod is scheduled in the other zone. By("verifying the pod is scheduled in a different zone.") var otherZone string if cloudZones[0] == podZone { otherZone = cloudZones[1] } else { otherZone = cloudZones[0] } err = wait.PollImmediate(framework.Poll, statefulSetReadyTimeout, func() (bool, error) { framework.Logf("checking whether new pod is scheduled in zone %q", otherZone) pod = getPod(c, ns, regionalPDLabels) nodeName = pod.Spec.NodeName node, err = c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) if err != nil { return false, nil } newPodZone := node.Labels[apis.LabelZoneFailureDomain] return newPodZone == otherZone, nil }) Expect(err).NotTo(HaveOccurred(), "Error waiting for pod to be scheduled in a different zone (%q): %v", otherZone, err) </ins> err = framework.WaitForStatefulSetReplicasReady(statefulSet.Name, ns, c, 3*time.Second, framework.RestartPodReadyAgainTimeout) if err != nil {


cp "${src_file}" /etc/kubernetes/manifests } <ins> # Starts k8s cluster autoscaler. start_cluster_autoscaler() { if [ "${ENABLE_NODE_AUTOSCALER:-}" = "true" ]; then # Remove salt comments and replace variables with values src_file="${kube_home}/kube-manifests/kubernetes/gci-trusty/cluster-autoscaler.manifest" remove_salt_config_comments "${src_file}" local params=`sed 's/^/"/;s/ /","/g;s/$/",/' <<< "${AUTOSCALER_MIG_CONFIG}"` sed -i -e "s@"{{param}}",@${params}@g" "${src_file}" sed -i -e "s@{%.*%}@@g" "${src_file}" cp "${src_file}" /etc/kubernetes/manifests fi } </ins> # Starts a fluentd static pod for logging. start_fluentd() { if [ "${ENABLE_NODE_LOGGING:-}" = "true" ]; then


// Will operate in the host mount namespace if kubelet is running in a container. // Error is returned on any other error than "file not found". ExistsPath(pathname string) (bool, error) <ins> // EvalHostSymlinks returns the path name after evaluating symlinks. // Will operate in the host mount namespace if kubelet is running in a container. EvalHostSymlinks(pathname string) (string, error) </ins> // CleanSubPaths removes any bind-mounts created by PrepareSafeSubpath in given // pod volume directory. CleanSubPaths(podDir string, volumeName string) error


func GetNodeAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string) { for j := range node.Status.Addresses { nodeAddress := &node.Status.Addresses[j] <del> if nodeAddress.Type == addressType { </del> <ins> if nodeAddress.Type == addressType && nodeAddress.Address != "" { </ins> ips = append(ips, nodeAddress.Address) } }


// SortControllerRevisions sorts revisions by their Revision. func SortControllerRevisions(revisions []*apps.ControllerRevision) { <del> sort.Sort(byRevision(revisions)) </del> <ins> sort.Stable(byRevision(revisions)) </ins> } // EqualRevision returns true if lhs and rhs are either both nil, or both point to non-nil ControllerRevisions that


embed = [":go_default_library"], deps = [ "//pkg/kubelet/cri/remote/fake:go_default_library", <ins> "//pkg/kubelet/cri/remote/util:go_default_library", </ins> "//staging/src/k8s.io/cri-api/pkg/apis:go_default_library", "//staging/src/k8s.io/cri-api/pkg/apis/testing:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library",


cmd.SetUsageFunc(func(cmd *cobra.Command) error { fmt.Fprintf(cmd.OutOrStderr(), usageFmt, cmd.UseLine()) cliflag.PrintSections(cmd.OutOrStderr(), namedFlagSets, cols) <ins> cliflag.PrintSections(cmd.OutOrStderr(), additionalFlags, cols) </ins> return nil }) cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { fmt.Fprintf(cmd.OutOrStdout(), "%snn"+usageFmt, cmd.Long, cmd.UseLine()) cliflag.PrintSections(cmd.OutOrStdout(), namedFlagSets, cols) <ins> cliflag.PrintSections(cmd.OutOrStdout(), additionalFlags, cols) </ins> }) return cmd


return p.Attach.Attach("POST", req.URL(), p.Config, p.In, p.Out, p.Err, t.Raw, sizeQueue) } <ins> if !p.Quiet && stderr != nil { fmt.Fprintln(stderr, "If you don't see a command prompt, try pressing enter.") } </ins> if err := t.Safe(fn); err != nil { return err }


deps = [ "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/container/testing:go_default_library", <ins> "//pkg/kubelet/metrics:go_default_library", </ins> "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library", <ins> "//vendor/github.com/prometheus/client_model/go:go_default_library", </ins> "//vendor/github.com/stretchr/testify/assert:go_default_library", ], )


"k8s.io/klog" ) <ins> var ( // ErrorNoAuth indicates that no credentials are provided. ErrorNoAuth = fmt.Errorf("no credentials provided for Azure cloud provider") ) </ins> // AzureAuthConfig holds auth related part of cloud config type AzureAuthConfig struct { // The cloud environment identifier. Takes values from https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13


Containers: []v1.Container{ { Image: image.GetE2EImage(), <del> Name:  podName, </del> <ins> Name:  "stat-container", </ins> Command: []string{ "powershell.exe", "-Command",


GetProtocol() v1.Protocol // GetHealthCheckNodePort returns service health check node port if present.  If return 0, it means not present. GetHealthCheckNodePort() int <ins> // GetNodePort returns a service Node port if present. If return 0, it means not present. GetNodePort() int </ins> } // Endpoint in an interface which abstracts information about an endpoint.


timedout := make(chan bool) go func() { time.Sleep(gracefulWait) <del> timedout <- true </del> <ins> close(timedout) </ins> }() go func() { select {


import ( "fmt" "os" <ins> "path/filepath" </ins> "strings" "github.com/golang/glog"


}) It("verify monitoring pods and all cluster nodes are available on influxdb using heapster.", func() { <del> if testContext.Provider != "gce" { </del> <ins> if !providerIs("gce") { </ins> By(fmt.Sprintf("Skipping Monitoring test, which is only supported for provider gce (not %s)", testContext.Provider)) return


serviceConfig.RegisterEventHandler(s.Proxier) go serviceConfig.Run(wait.NeverStop) <del> if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) { </del> <ins> if s.UseEndpointSlices { </ins> endpointSliceConfig := config.NewEndpointSliceConfig(informerFactory.Discovery().V1beta1().EndpointSlices(), s.ConfigSyncPeriod) endpointSliceConfig.RegisterEventHandler(s.Proxier) go endpointSliceConfig.Run(wait.NeverStop)


annotations: storageclass.beta.kubernetes.io/is-default-class: "true" labels: <del> addonmanager.kubernetes.io/mode: Reconcile </del> <ins> addonmanager.kubernetes.io/mode: EnsureExists </ins> provisioner: kubernetes.io/host-path


get(t, "valid TLS cert again", false) } <ins> func TestConcurrentUpdateTransportConfig(t *testing.T) { n := time.Now() now := func() time.Time { return n } env := []string{""} environ := func() []string { s := make([]string, len(env)) copy(s, env) return s } c := api.ExecConfig{ Command:    "./testdata/test-plugin.sh", APIVersion: "client.authentication.k8s.io/v1alpha1", } a, err := newAuthenticator(newCache(), &c) if err != nil { t.Fatal(err) } a.environ = environ a.now = now a.stderr = ioutil.Discard stopCh := make(chan struct{}) defer close(stopCh) numConcurrent := 2 for i := 0; i < numConcurrent; i++ { go func() { for { tc := &transport.Config{} a.UpdateTransportConfig(tc) select { case <-stopCh: return default: continue } } }() } time.Sleep(2 * time.Second) } </ins> // genClientCert generates an x509 certificate for testing. Certificate and key // are returned in PEM encoding. func genClientCert(t *testing.T) ([]byte, []byte) {


<del> apiVersion: extensions/v1beta1 </del> <ins> apiVersion: apps/v1 </ins> kind: DaemonSet metadata: name: nvidia-gpu-device-plugin


fmt.Fprint(out, "n") } <ins> func printMissingMetricsNodeLine(out io.Writer, nodeName string) { printValue(out, nodeName) unknownMetricsStatus := "<unknown>" for i := 0; i < len(MeasuredResources); i++ { printValue(out, unknownMetricsStatus) printValue(out, "t") printValue(out, unknownMetricsStatus) printValue(out, "t") } fmt.Fprint(out, "n") } </ins> func printValue(out io.Writer, value interface{}) { fmt.Fprintf(out, "%vt", value) }


import ( "context" <del> "fmt" </del> "math/rand" <del> "strings" </del> "time" v1 "k8s.io/api/core/v1"


// Ensure all of the pods that we found on this node before the reboot are // running / healthy. if !checkPodsRunningReady(c, ns, podNames, rebootPodReadyAgainTimeout) { <ins> newPods := ps.List() printStatusAndLogsForNotReadyPods(c, pods, newPods) </ins> return false }


"reason":                   "FailedScheduling", }.AsSelector()) expectNoError(err) <ins> // If we failed to find event with a capitalized first letter of reason // try looking for one starting with a small one for backward compatibility. // If we don't do it we end up in #15806. // TODO: remove this block when we don't care about supporting v1.0 too much. if len(schedEvents.Items) == 0 { schedEvents, err = c.Events(ns).List( labels.Everything(), fields.Set{ "involvedObject.kind":      "Pod", "involvedObject.name":      podName, "involvedObject.namespace": ns, "source":                   "scheduler", "reason":                   "failedScheduling", }.AsSelector()) expectNoError(err) } </ins> printed := false printOnce := func(msg string) string {


import ( "fmt" "net" <ins> "os" </ins> "strconv" "strings" "testing"


serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder) isIPv6 := ipt.IsIPv6() <ins> var incorrectAddresses []string nodePortAddresses, incorrectAddresses = utilproxy.FilterIncorrectCIDRVersion(nodePortAddresses, isIPv6) if len(incorrectAddresses) > 0 { klog.Warning("NodePortAddresses of wrong family; ", incorrectAddresses) } </ins> proxier := &Proxier{ portsMap:                 make(map[utilproxy.LocalPort]utilproxy.Closeable), serviceMap:               make(proxy.ServiceMap),


go_library( name = "go_default_library", srcs = [ <ins> "bindata.go", </ins> "main.go", <del> ":bindata", ], ) genrule( name = "bindata", srcs = [ "//examples:sources", "//test/images:sources", "//test/fixtures:sources", "//test/e2e/testing-manifests:sources", ], outs = ["bindata.go"], cmd = """ $(location //vendor:github.com/jteeuwen/go-bindata/go-bindata)  -nometadata -o "$(OUTS)" -pkg generated  -prefix $$(pwd)  -ignore .jpg -ignore .png -ignore .md  $(SRCS) """, tools = [ "//vendor:github.com/jteeuwen/go-bindata/go-bindata", </del> ], <ins> tags = ["automanaged"], </ins> )


ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Start to follow the container's log. <ins> fileName := file.Name() </ins> go func(ctx context.Context) { podLogOptions := v1.PodLogOptions{ Follow: true, } opts := NewLogOptions(&podLogOptions, time.Now()) <del> ReadLogs(ctx, file.Name(), containerID, opts, fakeRuntimeService, stdoutBuf, stderrBuf) </del> <ins> _ = ReadLogs(ctx, fileName, containerID, opts, fakeRuntimeService, stdoutBuf, stderrBuf) </ins> }(ctx) // log in stdout


return nc.evictionLimiterQPS } <del> // ReducedQPSFunc returns the QPS for when a the cluster is large make </del> <ins> // ReducedQPSFunc returns the QPS for when the cluster is large make </ins> // evictions slower, if they're small stop evictions altogether. func (nc *Controller) ReducedQPSFunc(nodeNum int) float32 { if int32(nodeNum) > nc.largeClusterThreshold {


name = "go_default_test", srcs = ["healthz_test.go"], embed = [":go_default_library"], <ins> deps = [ "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", ], </ins> ) go_library(


}, } <del> var betaTest *testsuites.StorageClassTest </del> for i, t := range tests { // Beware of closure, use local variables instead of those from // outer scope


t.Errorf("No client request should have been made") } } <ins> // TestAdmissionNamespaceExistsUnknownToHandler func TestAdmissionNamespaceExistsUnknownToHandler(t *testing.T) { namespace := "test" mockClient := &client.Fake{ Err: errors.NewAlreadyExists("namespaces", namespace), } store := cache.NewStore(cache.MetaNamespaceKeyFunc) handler := &provision{ client: mockClient, store:  store, } pod := api.Pod{ ObjectMeta: api.ObjectMeta{Name: "123", Namespace: namespace}, Spec: api.PodSpec{ Volumes:    []api.Volume{{Name: "vol"}}, Containers: []api.Container{{Name: "ctr", Image: "image"}}, }, } err := handler.Admit(admission.NewAttributesRecord(&pod, namespace, "pods", "CREATE")) if err != nil { t.Errorf("Unexpected error returned from admission handler") } } </ins>


// will not need to be updated until new changes are applied (detach is triggered again) time.Sleep(100 * time.Millisecond) verifyVolumeAttachedToNode(t, generatedVolumeName, nodeName1, cache.AttachStateAttached, asw) <del> verifyVolumeReportedAsAttachedToNode(t, logger, generatedVolumeName, nodeName1, true, asw) // After the first detach fails, reconciler will wait for a period of time before retrying to detach. // The wait time is increasing exponentially from initial value of 0.5s (0.5, 1, 2, 4, ...). // The test here waits for 100 Millisecond to make sure it is in exponential backoff period after // the first detach operation. At this point, volumes status should not be updated time.Sleep(100 * time.Millisecond) verifyVolumeAttachedToNode(t, generatedVolumeName, nodeName1, cache.AttachStateAttached, asw) verifyVolumeNoStatusUpdateNeeded(t, logger, generatedVolumeName, nodeName1, asw) // Wait for 600ms to make sure second detach operation triggered. Again, The volume will be // removed from being reported as attached on node status and then added back as attached. // The volume will be in the list of attached volumes that need to be updated to node status. time.Sleep(600 * time.Millisecond) verifyVolumeAttachedToNode(t, generatedVolumeName, nodeName1, cache.AttachStateAttached, asw) verifyVolumeReportedAsAttachedToNode(t, logger, generatedVolumeName, nodeName1, true, asw) </del> <ins> verifyVolumeReportedAsAttachedToNode(t, logger, generatedVolumeName, nodeName1, true, asw, volumeAttachedCheckTimeout) </ins> // Add a second pod which tries to attach the volume to the same node. // After adding pod to the same node, detach will not be triggered any more.


<del> apiVersion: admissionregistration.k8s.io/v1alpha1 kind: ValidatingAdmissionPolicy metadata: annotations: annotationsKey: annotationsValue creationTimestamp: "2008-01-01T01:01:01Z" deletionGracePeriodSeconds: 10 deletionTimestamp: "2009-01-01T01:01:01Z" finalizers: - finalizersValue generateName: generateNameValue generation: 7 labels: labelsKey: labelsValue managedFields: - apiVersion: apiVersionValue fieldsType: fieldsTypeValue fieldsV1: {} manager: managerValue operation: operationValue subresource: subresourceValue time: "2004-01-01T01:01:01Z" name: nameValue namespace: namespaceValue ownerReferences: - apiVersion: apiVersionValue blockOwnerDeletion: true controller: true kind: kindValue name: nameValue uid: uidValue resourceVersion: resourceVersionValue selfLink: selfLinkValue uid: uidValue spec: auditAnnotations: - key: keyValue valueExpression: valueExpressionValue failurePolicy: failurePolicyValue matchConditions: - expression: expressionValue name: nameValue matchConstraints: excludeResourceRules: - apiGroups: - apiGroupsValue apiVersions: - apiVersionsValue operations: - operationsValue resourceNames: - resourceNamesValue resources: - resourcesValue scope: scopeValue matchPolicy: matchPolicyValue namespaceSelector: matchExpressions: - key: keyValue operator: operatorValue values: - valuesValue matchLabels: matchLabelsKey: matchLabelsValue objectSelector: matchExpressions: - key: keyValue operator: operatorValue values: - valuesValue matchLabels: matchLabelsKey: matchLabelsValue resourceRules: - apiGroups: - apiGroupsValue apiVersions: - apiVersionsValue operations: - operationsValue resourceNames: - resourceNamesValue resources: - resourcesValue scope: scopeValue paramKind: apiVersion: apiVersionValue kind: kindValue validations: - expression: expressionValue message: messageValue messageExpression: messageExpressionValue reason: reasonValue variables: null status: conditions: - lastTransitionTime: "2004-01-01T01:01:01Z" message: messageValue observedGeneration: 3 reason: reasonValue status: statusValue type: typeValue observedGeneration: 1 typeChecking: expressionWarnings: - fieldRef: fieldRefValue warning: warningValue </del>


return } <ins> func (az *azPublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) { if !az.rateLimiterReader.TryAccept() { err = createRateLimitErr(false, "VMSSPublicIPGet") return } klog.V(10).Infof("azPublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress(%q,%q): start", resourceGroupName, publicIPAddressName) defer func() { klog.V(10).Infof("azPublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress(%q,%q): end", resourceGroupName, publicIPAddressName) }() mc := newMetricContext("vmss_public_ip_addresses", "get", resourceGroupName, az.client.SubscriptionID, "") result, err = az.client.GetVirtualMachineScaleSetPublicIPAddress(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) mc.Observe(err) return } </ins> func (az *azPublicIPAddressesClient) List(ctx context.Context, resourceGroupName string) ([]network.PublicIPAddress, error) { if !az.rateLimiterReader.TryAccept() { return nil, createRateLimitErr(false, "PublicIPList")


return nil, err } <del> res := metricObj.(*v1beta2.MetricValueList) </del> <ins> var res *v1beta2.MetricValueList var ok bool if res, ok = metricObj.(*v1beta2.MetricValueList); !ok { return nil, fmt.Errorf("the custom metrics API server didn't return MetricValueList, the type is %v", reflect.TypeOf(metricObj)) } </ins> return res, nil }


if protocol == "udp" { // TODO: It would be enough to pass 1s+epsilon to timeout, but unfortunately // busybox timeout doesn't support non-integer values. <del> cmd = fmt.Sprintf("echo 'hostName' | nc -w 1 -u %s %d", targetIP, targetPort) </del> <ins> cmd = fmt.Sprintf("echo hostName | nc -w 1 -u %s %d", targetIP, targetPort) </ins> } else { ipPort := net.JoinHostPort(targetIP, strconv.Itoa(targetPort)) // The current versions of curl included in CentOS and RHEL distros


} func mountPointsEqual(a, b *MountPoint) bool { <del> if a.Device != b.Device || a.Path != b.Path || a.Type != b.Type || !slicesEqual(a.Opts, b.Opts) || a.Pass != b.Pass || a.Freq != b.Freq { </del> <ins> if a.Device != b.Device || a.Path != b.Path || a.Type != b.Type || !reflect.DeepEqual(a.Opts, b.Opts) || a.Pass != b.Pass || a.Freq != b.Freq { </ins> return false } return true } <del> func slicesEqual(a, b []string) bool { if len(a) != len(b) { return false } for i := range a { if a[i] != b[i] { return false } } return true } </del> func TestGetMountRefs(t *testing.T) { fm := &FakeMounter{ MountPoints: []MountPoint{


} // Verify the proxy server logs saw the connection <del> expectedProxyLog := fmt.Sprintf("Accepting CONNECT to %s", strings.TrimRight(strings.TrimLeft(framework.TestContext.Host, "https://"), "/api")) </del> <ins> expectedProxyLog := fmt.Sprintf("Accepting CONNECT to %s", strings.TrimSuffix(strings.TrimPrefix(framework.TestContext.Host, "https://"), "/api")) </ins> proxyLog := proxyLogs.String() if !strings.Contains(proxyLog, expectedProxyLog) {


framework.ExpectNoError(err, "error deleting Service") return svc } <ins> // endpointSlicesEqual compare if the Endpoint and the EndpointSliceList contains the same endpoints values // as in addresses and ports, considering Ready and Unready addresses func endpointSlicesEqual(endpoints *v1.Endpoints, endpointSliceList *discoveryv1.EndpointSliceList) bool { // get the apiserver endpoint addresses epAddresses := sets.NewString() epPorts := sets.NewInt32() for _, subset := range endpoints.Subsets { for _, addr := range subset.Addresses { epAddresses.Insert(addr.IP) } for _, addr := range subset.NotReadyAddresses { epAddresses.Insert(addr.IP) } for _, port := range subset.Ports { epPorts.Insert(port.Port) } } framework.Logf("Endpoints addresses: %v , ports: %v", epAddresses.List(), epPorts.List()) // Endpoints are single stack, and must match the primary IP family of the Service kubernetes.default // However, EndpointSlices can be IPv4 or IPv6, we can only compare the Slices that match the same IP family // framework.TestContext.ClusterIsIPv6() reports the IP family of the kubernetes.default service var addrType discoveryv1.AddressType if framework.TestContext.ClusterIsIPv6() { addrType = discoveryv1.AddressTypeIPv6 } else { addrType = discoveryv1.AddressTypeIPv4 } // get the apiserver addresses from the endpoint slice list sliceAddresses := sets.NewString() slicePorts := sets.NewInt32() for _, slice := range endpointSliceList.Items { if slice.AddressType != addrType { framework.Logf("Skipping slice %s: wanted %s family, got %s", slice.Name, addrType, slice.AddressType) continue } for _, s := range slice.Endpoints { sliceAddresses.Insert(s.Addresses...) } for _, ports := range slice.Ports { if ports.Port != nil { slicePorts.Insert(*ports.Port) } } } framework.Logf("EndpointSlices addresses: %v , ports: %v", sliceAddresses.List(), slicePorts.List()) if sliceAddresses.Equal(epAddresses) && slicePorts.Equal(epPorts) { return true } return false } </ins>


docs/user-guide/kubectl/kubectl_alpha.md docs/user-guide/kubectl/kubectl_alpha_diff.md docs/user-guide/kubectl/kubectl_annotate.md <ins> docs/user-guide/kubectl/kubectl_api-resources.md </ins> docs/user-guide/kubectl/kubectl_api-versions.md docs/user-guide/kubectl/kubectl_apply.md docs/user-guide/kubectl/kubectl_apply_edit-last-applied.md


fs.MarkDeprecated("non-masquerade-cidr", "will be removed in a future version") fs.BoolVar(&f.KeepTerminatedPodVolumes, "keep-terminated-pod-volumes", f.KeepTerminatedPodVolumes, "Keep terminated pod volumes mounted to the node after the pod terminates.  Can be useful for debugging volume related issues.") fs.MarkDeprecated("keep-terminated-pod-volumes", "will be removed in a future version") <del> fs.BoolVar(&f.EnableCAdvisorJSONEndpoints, "enable-cadvisor-json-endpoints", f.EnableCAdvisorJSONEndpoints, "Enable cAdvisor json /spec and /stats/* endpoints.  [default=false]") </del> <ins> fs.BoolVar(&f.EnableCAdvisorJSONEndpoints, "enable-cadvisor-json-endpoints", f.EnableCAdvisorJSONEndpoints, "Enable cAdvisor json /spec and /stats/* endpoints. This flag has no effect on the /stats/summary endpoint.  [default=false]") </ins> // TODO: Remove this flag in 1.20+.  https://github.com/kubernetes/kubernetes/issues/68522 fs.MarkDeprecated("enable-cadvisor-json-endpoints", "will be removed in a future version") fs.BoolVar(&f.ReallyCrashForTesting, "really-crash-for-testing", f.ReallyCrashForTesting, "If true, when panics occur crash. Intended for testing.")