There are a few things to note in this description.  First is that we are running the ```kubernetes/cassandra``` image.  This is a standard Cassandra installation on top of Debian.  However it also adds a custom [```SeedProvider```](https://svn.apache.org/repos/asf/cassandra/trunk/src/java/org/apache/cassandra/locator/SeedProvider.java) to Cassandra.  In Cassandra, a ```SeedProvider``` bootstraps the gossip protocol that Cassandra uses to find other nodes.  The ```KubernetesSeedProvider``` discovers the Kubernetes API Server using the built in Kubernetes discovery service, and then uses the Kubernetes API to find new nodes (more on this later) <del> You may also note that we are setting some Cassandra parameters (```MAX_HEAP_SIZE``` and ```HEAP_NEWSIZE```).  We also tell Kubernetes that the container exposes both the ```CQL``` and ```Thrift``` API ports.  Finally, we tell the cluster manager that we need 0.5 cpu (0.5 core). </del> <ins> You may also note that we are setting some Cassandra parameters (```MAX_HEAP_SIZE``` and ```HEAP_NEWSIZE```) and adding information about the [namespace](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/namespaces.md).  We also tell Kubernetes that the container exposes both the ```CQL``` and ```Thrift``` API ports.  Finally, we tell the cluster manager that we need 0.5 cpu (0.5 core). </ins> Given this configuration, we can create the pod from a file specification as follows


manager.podStoreSynced = alwaysReady syncAndValidateDaemonSets(t, manager, ds, podControl, 1, 0) } <ins> func TestDSManagerInit(t *testing.T) { // Insert a stable daemon set and make sure we don't create an extra pod // for the one node which already has a daemon after a simulated restart. ds := newDaemonSet("test") ds.Status = extensions.DaemonSetStatus{ CurrentNumberScheduled: 1, NumberMisscheduled:     0, DesiredNumberScheduled: 1, } nodeName := "only-node" podList := &api.PodList{ Items: []api.Pod{ *newPod("podname", nodeName, simpleDaemonSetLabel), }} response := runtime.EncodeOrDie(testapi.Default.Codec(), podList) fakeHandler := utiltesting.FakeHandler{ StatusCode:   200, ResponseBody: response, } testServer := httptest.NewServer(&fakeHandler) // TODO: Uncomment when fix #19254 // defer testServer.Close() client := client.NewOrDie(&client.Config{Host: testServer.URL, GroupVersion: testapi.Default.GroupVersion()}) manager := NewDaemonSetsController(client, controller.NoResyncPeriodFunc) manager.dsStore.Add(ds) manager.nodeStore.Add(newNode(nodeName, nil)) manager.podStoreSynced = alwaysReady controller.SyncAllPodsWithStore(manager.kubeClient, manager.podStore.Store) fakePodControl := &controller.FakePodControl{} manager.podControl = fakePodControl manager.syncHandler(getKey(ds, t)) validateSyncDaemonSets(t, fakePodControl, 0, 0) } </ins>


return fmt.Errorf("waiting for apiserver timed out") } <del> // WaitForApiserverRestarted waits until apiserver's restart count increased. func WaitForApiserverRestarted(c clientset.Interface, initialRestartCount int32) error { </del> <ins> // waitForApiserverRestarted waits until apiserver's restart count increased. func waitForApiserverRestarted(c clientset.Interface, initialRestartCount int32) error { </ins> for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) { <del> restartCount, err := GetApiserverRestartCount(c) </del> <ins> restartCount, err := getApiserverRestartCount(c) </ins> if err != nil { Logf("Failed to get apiserver's restart count: %v", err) continue


var policy Policy switch topologyPolicyName { <del> case PolicyNone: policy = NewNonePolicy() </del> case PolicyBestEffort: policy = NewBestEffortPolicy(numaInfo, opts)


# Base images - name: "k8s.gcr.io/debian-base: dependents" <del> version: buster-v1.3.0 </del> <ins> version: buster-v1.4.0 </ins> refPaths: - path: build/workspace.bzl match: tag =


- name: ssl-certs mountPath: /etc/ssl/certs readOnly: true <del> - image: gcr.io/google_containers/addon-resizer:1.5 </del> <ins> - image: gcr.io/google_containers/addon-resizer:1.6 </ins> name: heapster-nanny resources: limits:


} // returns the item and true if it is found and not expired, otherwise nil and false. <ins> // If this returns false, it has locked c.inFlightLock and it is caller's responsibility // to unlock that. </ins> func (c *timeCache) get(key string) (T, bool) { c.lock.RLock() defer c.lock.RUnlock() data, ok := c.cache[key] now := c.clock.Now() if !ok || now.Sub(data.lastUpdate) > c.ttl { <ins> // We must lock this while we hold c.lock-- otherwise, a writer could // write to c.cache and remove the channel from c.inFlight before we // manage to read c.inFlight. c.inFlightLock.Lock() </ins> return nil, false } return data.item, true } <ins> // c.inFlightLock MUST be locked before calling this. fillOrWait will unlock it. </ins> func (c *timeCache) fillOrWait(key string) chan T { <del> c.inFlightLock.Lock() </del> defer c.inFlightLock.Unlock() // Already a call in progress?


if err != nil { t.Fatalf(err.Error()) } test.prepare(base) pathToCreate := filepath.Join(base, test.path) fd, err := doSafeOpen(pathToCreate, base)


"type": "boolean" }, "storageCapacity": { <del> "description": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.nnThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.nnAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.nnThis field is immutable.nnThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.", </del> <ins> "description": "If set to true, storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information.nnThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.nnAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.nnThis field was immutable in Kubernetes <= 1.22 and now is mutable.nnThis is a beta field and only available when the CSIStorageCapacity feature is enabled. The default is false.", </ins> "type": "boolean" }, "tokenRequests": {


Metrics:   usage, Available: availableResources[m.Name], }) <ins> delete(availableResources, m.Name) } // print lines for nodes of which the metrics is unreachable. for nodeName := range availableResources { printMissingMetricsNodeLine(w, nodeName) </ins> } return nil }


} } <del> if klog.V(4).Enabled() { logPluginScores(nodes, scoresMap, pod) } </del> if len(g.extenders) != 0 && nodes != nil { var mu sync.Mutex var wg sync.WaitGroup


// Not local instance, get addresses from Azure ARM API. if !isLocalInstance { <del> return addressGetter(name) </del> <ins> if az.vmSet != nil { return addressGetter(name) } // vmSet == nil indicates credentials are not provided. return nil, fmt.Errorf("no credentials provided for Azure cloud provider") </ins> } if len(metadata.Network.Interface) == 0 {


} } <ins> func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithOutQueueingHint(t *testing.T) { c := testingclock.NewFakeClock(time.Now()) logger, ctx := ktesting.NewTestContext(t) ctx, cancel := context.WithCancel(ctx) defer cancel() m := makeEmptyQueueingHintMapPerProfile() defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.SchedulerQueueingHints, false)() m[""][NodeAdd] = []*QueueingHintFunction{ { PluginName:     "fooPlugin", QueueingHintFn: queueHintReturnQueue, }, } q := NewTestQueue(ctx, newDefaultQueueSort(), WithClock(c), WithQueueingHintMapPerProfile(m)) // To simulate the pod is failed in scheduling in the real world, Pop() the pod from activeQ before AddUnschedulableIfNotPresent()s below. if err := q.Add(logger, medPriorityPodInfo.Pod); err != nil { t.Errorf("add failed: %v", err) } err := q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(unschedulablePodInfo.Pod, "fooPlugin"), q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(highPriorityPodInfo.Pod, "fooPlugin"), q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } // Construct a Pod, but don't associate its scheduler failure to any plugin hpp1 := clonePod(highPriorityPodInfo.Pod, "hpp1") // This Pod will go to backoffQ because no failure plugin is associated with it. err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(hpp1), q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } // Construct another Pod, and associate its scheduler failure to plugin "barPlugin". hpp2 := clonePod(highPriorityPodInfo.Pod, "hpp2") // This Pod will go to the unschedulable Pod pool. err = q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(hpp2, "barPlugin"), q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } // This NodeAdd event moves unschedulablePodInfo and highPriorityPodInfo to the backoffQ, // because of the queueing hint function registered for NodeAdd/fooPlugin. q.MoveAllToActiveOrBackoffQueue(logger, NodeAdd, nil, nil, nil) if q.activeQ.Len() != 1 { t.Errorf("Expected 1 item to be in activeQ, but got: %v", q.activeQ.Len()) } // Pop out the medPriorityPodInfo in activeQ. if p, err := q.Pop(logger); err != nil || p.Pod != medPriorityPodInfo.Pod { t.Errorf("Expected: %v after Pop, but got: %v", medPriorityPodInfo.Pod, p.Pod.Name) } // hpp2 won't be moved. if q.podBackoffQ.Len() != 3 { t.Fatalf("Expected 3 items to be in podBackoffQ, but got: %v", q.podBackoffQ.Len()) } // pop out the pods in the backoffQ. // This doesn't make them in-flight pods. for q.podBackoffQ.Len() != 0 { _, err = q.podBackoffQ.Pop() if err != nil { t.Errorf("pop failed: %v", err) } } q.schedulingCycle++ unschedulableQueuedPodInfo := q.newQueuedPodInfo(unschedulablePodInfo.Pod, "fooPlugin") highPriorityQueuedPodInfo := q.newQueuedPodInfo(highPriorityPodInfo.Pod, "fooPlugin") hpp1QueuedPodInfo := q.newQueuedPodInfo(hpp1) err = q.AddUnschedulableIfNotPresent(logger, unschedulableQueuedPodInfo, q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } err = q.AddUnschedulableIfNotPresent(logger, highPriorityQueuedPodInfo, q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } err = q.AddUnschedulableIfNotPresent(logger, hpp1QueuedPodInfo, q.SchedulingCycle()) if err != nil { t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err) } if err = q.Add(logger, medPriorityPodInfo.Pod); err != nil { t.Errorf("add failed: %v", err) } // hpp1 will go to backoffQ because no failure plugin is associated with it. // All plugins other than hpp1 are enqueued to the unschedulable Pod pool. for _, pod := range []*v1.Pod{unschedulablePodInfo.Pod, highPriorityPodInfo.Pod, hpp2} { if q.unschedulablePods.get(pod) == nil { t.Errorf("Expected %v in the unschedulablePods", pod.Name) } } if _, ok, _ := q.podBackoffQ.Get(hpp1QueuedPodInfo); !ok { t.Errorf("Expected %v in the podBackoffQ", hpp1.Name) } // Move clock by podInitialBackoffDuration, so that pods in the unschedulablePods would pass the backing off, // and the pods will be moved into activeQ. c.Step(q.podInitialBackoffDuration) q.flushBackoffQCompleted(logger) // flush the completed backoffQ to move hpp1 to activeQ. q.MoveAllToActiveOrBackoffQueue(logger, NodeAdd, nil, nil, nil) if q.activeQ.Len() != 4 { t.Errorf("Expected 4 items to be in activeQ, but got: %v", q.activeQ.Len()) } if q.podBackoffQ.Len() != 0 { t.Errorf("Expected 0 item to be in podBackoffQ, but got: %v", q.podBackoffQ.Len()) } if len(q.unschedulablePods.podInfoMap) != 1 { // hpp2 won't be moved regardless of its backoff timer. t.Errorf("Expected 1 item to be in unschedulablePods, but got: %v", len(q.unschedulablePods.podInfoMap)) } } </ins> func clonePod(pod *v1.Pod, newName string) *v1.Pod { pod = pod.DeepCopy() pod.Name = newName


*out = new(PluginSet) (*in).DeepCopyInto(*out) } <del> if in.NormalizeScore != nil { in, out := &in.NormalizeScore, &out.NormalizeScore *out = new(PluginSet) (*in).DeepCopyInto(*out) } </del> if in.Reserve != nil { in, out := &in.Reserve, &out.Reserve *out = new(PluginSet)


return utilfile.FileExists(kubeletpath) } <ins> func (mounter *NsenterMounter) EvalHostSymlinks(pathname string) (string, error) { return mounter.ne.EvalSymlinks(pathname, true) } </ins> func (mounter *NsenterMounter) CleanSubPaths(podDir string, volumeName string) error { return doCleanSubPaths(mounter, podDir, volumeName) }


// Max amount of time to wait for the container runtime to come up. maxWaitForContainerRuntime = 30 * time.Second <ins> // Max amount of time to wait for node list/watch to initially sync maxWaitForAPIServerSync = 10 * time.Second </ins> // nodeStatusUpdateRetry specifies how many times kubelet retries when posting node status failed. nodeStatusUpdateRetry = 5


return true, nil } <del> // nextRotationDeadline returns a value for the threshold at which the // current certificate should be rotated, 80%+/-10% of the expiration of the // certificate. func (m *manager) nextRotationDeadline() time.Time { // forceRotation is not protected by locks if m.forceRotation { m.forceRotation = false return time.Now() } m.certAccessLock.RLock() defer m.certAccessLock.RUnlock() </del> <ins> // Check that the current certificate on disk satisfies the requests from the // current template. // // Note that extra items in the certificate's SAN or orgs that don't exist in // the template will not trigger a renewal. // // Requires certAccessLock to be locked. func (m *manager) certSatisfiesTemplateLocked() bool { </ins> if m.cert == nil { <del> return time.Now() </del> <ins> return false </ins> } <del> // Ensure the currently held certificate satisfies the requested subject CN and SANs </del> if template := m.getTemplate(); template != nil { if template.Subject.CommonName != m.cert.Leaf.Subject.CommonName { <del> glog.V(2).Infof("Current certificate CN (%s) does not match requested CN (%s), rotating now", m.cert.Leaf.Subject.CommonName, template.Subject.CommonName) return time.Now() </del> <ins> glog.V(2).Infof("Current certificate CN (%s) does not match requested CN (%s)", m.cert.Leaf.Subject.CommonName, template.Subject.CommonName) return false </ins> } currentDNSNames := sets.NewString(m.cert.Leaf.DNSNames...) desiredDNSNames := sets.NewString(template.DNSNames...) missingDNSNames := desiredDNSNames.Difference(currentDNSNames) if len(missingDNSNames) > 0 { <del> glog.V(2).Infof("Current certificate is missing requested DNS names %v, rotating now", missingDNSNames.List()) return time.Now() </del> <ins> glog.V(2).Infof("Current certificate is missing requested DNS names %v", missingDNSNames.List()) return false </ins> } currentIPs := sets.NewString()


Expect(events.Items[1].Message).Should(Equal(fmt.Sprintf("Scaled down rc %s to 0", rcName))) } <ins> func testRecreateDeployment(f *Framework) { ns := f.Namespace.Name c := f.Client // Create nginx pods. deploymentPodLabels := map[string]string{"name": "sample-pod-3"} rcPodLabels := map[string]string{ "name": "sample-pod-3", "pod":  "nginx", } rcName := "nginx-controller" replicas := 3 _, err := c.ReplicationControllers(ns).Create(newRC(rcName, replicas, rcPodLabels, "nginx", "nginx")) Expect(err).NotTo(HaveOccurred()) defer func() { Logf("deleting replication controller %s", rcName) Expect(c.ReplicationControllers(ns).Delete(rcName)).NotTo(HaveOccurred()) }() // Verify that the required pods have come up. err = verifyPods(c, ns, "sample-pod-3", false, 3) if err != nil { Logf("error in waiting for pods to come up: %s", err) Expect(err).NotTo(HaveOccurred()) } // Create a deployment to delete nginx pods and instead bring up redis pods. deploymentName := "redis-deployment-3" Logf("Creating deployment %s", deploymentName) _, err = c.Deployments(ns).Create(newDeployment(deploymentName, replicas, deploymentPodLabels, "redis", "redis", extensions.RecreateDeploymentStrategyType)) Expect(err).NotTo(HaveOccurred()) defer func() { deployment, err := c.Deployments(ns).Get(deploymentName) Expect(err).NotTo(HaveOccurred()) Logf("deleting deployment %s", deploymentName) Expect(c.Deployments(ns).Delete(deploymentName, nil)).NotTo(HaveOccurred()) // TODO: remove this once we can delete rcs with deployment newRC, err := deploymentutil.GetNewRC(*deployment, c) Expect(err).NotTo(HaveOccurred()) Expect(c.ReplicationControllers(ns).Delete(newRC.Name)).NotTo(HaveOccurred()) }() err = waitForDeploymentStatus(c, ns, deploymentName, replicas, 0, replicas, 0) Expect(err).NotTo(HaveOccurred()) // Verify that the pods were scaled up and down as expected. We use events to verify that. deployment, err := c.Deployments(ns).Get(deploymentName) Expect(err).NotTo(HaveOccurred()) waitForEvents(c, ns, deployment, 2) events, err := c.Events(ns).Search(deployment) if err != nil { Logf("error in listing events: %s", err) Expect(err).NotTo(HaveOccurred()) } // There should be 2 events, one to scale up the new RC and then to scale down the old RC. Expect(len(events.Items)).Should(Equal(2)) newRC, err := deploymentutil.GetNewRC(*deployment, c) Expect(err).NotTo(HaveOccurred()) Expect(newRC).NotTo(Equal(nil)) Expect(events.Items[0].Message).Should(Equal(fmt.Sprintf("Scaled down rc %s to 0", rcName))) Expect(events.Items[1].Message).Should(Equal(fmt.Sprintf("Scaled up rc %s to 3", newRC.Name))) } </ins> // testRolloverDeployment tests that deployment supports rollover. // i.e. we can change desired state and kick off rolling update, then change desired state again before it finishes. func testRolloverDeployment(f *Framework) {


Create-Directories Download-HelperScripts <del> Install-LoggingAgent Configure-LoggingAgent Restart-LoggingAgent </del> <ins> # Even if Stackdriver is already installed, the function will still [re]start the service. if (IsLoggingEnabled $kube_env) { Install-LoggingAgent Configure-LoggingAgent Restart-LoggingAgent } </ins> Create-DockerRegistryKey Configure-Dockerd


BeforeEach(func() { podClient = f.PodClient() }) <del> // TODO: Fix Flaky issue #68066 and then re-add this back into Conformance Suite </del> /* <del> Release : v1.9 </del> <ins> Release : v1.15 </ins> Testname: Pods, delete grace period <del> Description: Create a pod, make sure it is running, create a watch to observe Pod creation. Create a 'kubectl local proxy', capture the port the proxy is listening. Using the http client send a ‘delete’ with gracePeriodSeconds=30. Pod SHOULD get deleted within 30 seconds. </del> <ins> Description: Create a pod, make sure it is running. Create a 'kubectl local proxy', capture the port the proxy is listening. Using the http client send a ‘delete’ with gracePeriodSeconds=30. Pod SHOULD get deleted within 30 seconds. </ins> */ <del> It("should be submitted and removed  [Flaky]", func() { </del> <ins> framework.ConformanceIt("should be submitted and removed", func() { </ins> By("creating the pod") name := "pod-submit-remove-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond())


// be made to pass by removing pods, or you change an existing predicate so that // it can never be made to pass by removing pods, you need to add the predicate // failure error in nodesWherePreemptionMightHelp() in scheduler/core/generic_scheduler.go <del> ErrDiskConflict                          = newPredicateFailureError("NoDiskConflict") ErrVolumeZoneConflict                    = newPredicateFailureError("NoVolumeZoneConflict") ErrNodeSelectorNotMatch                  = newPredicateFailureError("MatchNodeSelector") ErrPodAffinityNotMatch                   = newPredicateFailureError("MatchInterPodAffinity") ErrPodAffinityRulesNotMatch              = newPredicateFailureError("PodAffinityRulesNotMatch") ErrPodAntiAffinityRulesNotMatch          = newPredicateFailureError("PodAntiAffinityRulesNotMatch") ErrExistingPodsAntiAffinityRulesNotMatch = newPredicateFailureError("ExistingPodsAntiAffinityRulesNotMatch") ErrTaintsTolerationsNotMatch             = newPredicateFailureError("PodToleratesNodeTaints") ErrPodNotMatchHostName                   = newPredicateFailureError("HostName") ErrPodNotFitsHostPorts                   = newPredicateFailureError("PodFitsHostPorts") ErrNodeLabelPresenceViolated             = newPredicateFailureError("CheckNodeLabelPresence") ErrServiceAffinityViolated               = newPredicateFailureError("CheckServiceAffinity") ErrMaxVolumeCountExceeded                = newPredicateFailureError("MaxVolumeCount") ErrNodeUnderMemoryPressure               = newPredicateFailureError("NodeUnderMemoryPressure") ErrNodeUnderDiskPressure                 = newPredicateFailureError("NodeUnderDiskPressure") ErrNodeOutOfDisk                         = newPredicateFailureError("NodeOutOfDisk") ErrNodeNotReady                          = newPredicateFailureError("NodeNotReady") ErrNodeNetworkUnavailable                = newPredicateFailureError("NodeNetworkUnavailable") ErrNodeUnschedulable                     = newPredicateFailureError("NodeUnschedulable") ErrNodeUnknownCondition                  = newPredicateFailureError("NodeUnknownCondition") ErrVolumeNodeConflict                    = newPredicateFailureError("VolumeNodeAffinityConflict") ErrVolumeBindConflict                    = newPredicateFailureError("VolumeBindingNoMatch") </del> <ins> ErrDiskConflict                          = newPredicateFailureError("NoDiskConflict", "node(s) had no available disk") ErrVolumeZoneConflict                    = newPredicateFailureError("NoVolumeZoneConflict", "node(s) had no available volume zone") ErrNodeSelectorNotMatch                  = newPredicateFailureError("MatchNodeSelector", "node(s) didn't match node selector") ErrPodAffinityNotMatch                   = newPredicateFailureError("MatchInterPodAffinity", "node(s) didn't match pod affinity/anti-affinity") ErrPodAffinityRulesNotMatch              = newPredicateFailureError("PodAffinityRulesNotMatch", "node(s) didn't match pod affinity rules") ErrPodAntiAffinityRulesNotMatch          = newPredicateFailureError("PodAntiAffinityRulesNotMatch", "node(s) didn't match pod anti-affinity rules") ErrExistingPodsAntiAffinityRulesNotMatch = newPredicateFailureError("ExistingPodsAntiAffinityRulesNotMatch", "node(s) didn't satisfy existing pods anti-affinity rules") ErrTaintsTolerationsNotMatch             = newPredicateFailureError("PodToleratesNodeTaints", "node(s) had taints that the pod didn't tolerate") ErrPodNotMatchHostName                   = newPredicateFailureError("HostName", "node(s) didn't match the requested hostname") ErrPodNotFitsHostPorts                   = newPredicateFailureError("PodFitsHostPorts", "node(s) didn't have free ports for the requested pod ports") ErrNodeLabelPresenceViolated             = newPredicateFailureError("CheckNodeLabelPresence", "node(s) didn't have the requested labels") ErrServiceAffinityViolated               = newPredicateFailureError("CheckServiceAffinity", "node(s) didn't match service affinity") ErrMaxVolumeCountExceeded                = newPredicateFailureError("MaxVolumeCount", "node(s) exceed max volume count") ErrNodeUnderMemoryPressure               = newPredicateFailureError("NodeUnderMemoryPressure", "node(s) had memory pressure") ErrNodeUnderDiskPressure                 = newPredicateFailureError("NodeUnderDiskPressure", "node(s) had disk pressure") ErrNodeOutOfDisk                         = newPredicateFailureError("NodeOutOfDisk", "node(s) were out of disk space") ErrNodeNotReady                          = newPredicateFailureError("NodeNotReady", "node(s) were not ready") ErrNodeNetworkUnavailable                = newPredicateFailureError("NodeNetworkUnavailable", "node(s) had unavailable network") ErrNodeUnschedulable                     = newPredicateFailureError("NodeUnschedulable", "node(s) were unschedulable") ErrNodeUnknownCondition                  = newPredicateFailureError("NodeUnknownCondition", "node(s) had unknown conditions") ErrVolumeNodeConflict                    = newPredicateFailureError("VolumeNodeAffinityConflict", "node(s) had volume node affinity conflict") ErrVolumeBindConflict                    = newPredicateFailureError("VolumeBindingNoMatch", "node(s) didn't find available persistent volumes to bind") </ins> // ErrFakePredicate is used for test only. The fake predicates returning false also returns error // as ErrFakePredicate. <del> ErrFakePredicate = newPredicateFailureError("FakePredicateError") </del> <ins> ErrFakePredicate = newPredicateFailureError("FakePredicateError", "Nodes failed the fake predicate") </ins> ) // InsufficientResourceError is an error type that indicates what kind of resource limit is


// ValidateCSINodeDrivers tests that the specified CSINodeDrivers have valid data. func validateCSINodeDrivers(drivers []storage.CSINodeDriver, fldPath *field.Path, validationOpts CSINodeValidationOptions) field.ErrorList { allErrs := field.ErrorList{} <del> driverNamesInSpecs := make(sets.String) </del> <ins> driverNamesInSpecs := sets.New[string]() </ins> for i, driver := range drivers { idxPath := fldPath.Index(i) allErrs = append(allErrs, validateCSINodeDriver(driver, driverNamesInSpecs, idxPath, validationOpts)...)


} func (a genericAccessor) SetAnnotations(annotations map[string]string) { <ins> if a.annotations == nil { emptyAnnotations := make(map[string]string) a.annotations = &emptyAnnotations } </ins> *a.annotations = annotations }


maxBackOffTolerance  = time.Duration(1.3 * float64(kubelet.MaxContainerBackOff)) podRetryPeriod       = 1 * time.Second podRetryTimeout      = 1 * time.Minute <ins> podReadyTimeout      = 1 * time.Minute </ins> ) // testHostIP tests that a pod gets a host IP


scheme := runtime.NewScheme() scheme.AddKnownTypes(cmResource.GroupVersion(), &v1.ConfigMap{}) codecs := serializer.NewCodecFactory(scheme) <del> o := NewFieldManagedObjectTracker(scheme, codecs.UniversalDecoder(), fakeTypeConverter) </del> <ins> o := NewFieldManagedObjectTracker(scheme, codecs.UniversalDecoder(), configMapTypeConverter(scheme)) </ins> reaction := ObjectReaction(o) patch := []byte(`{"apiVersion": "v1", "kind": "ConfigMap", "metadata": {"name": "cm-1"}, "data": {"k": "v"}}`)


newDevicePath := "" <del> err = wait.Poll(1*time.Second, timeout, func() (bool, error) { </del> <ins> err = wait.PollImmediate(1*time.Second, timeout, func() (bool, error) { </ins> if newDevicePath, err = findDiskByLun(int(lun), io, exec); err != nil { return false, fmt.Errorf("azureDisk - WaitForAttach ticker failed node (%s) disk (%s) lun(%v) err(%s)", nodeName, diskName, lun, err) }


} } <del> // OpenAPIv3 type/maxLength/maxItems/MaxProperties/required/wrong type field validation failures are viewed as blocking err for CEL validation </del> <ins> // OpenAPIv3 type/maxLength/maxItems/MaxProperties/required/enum violation/wrong type field validation failures are viewed as blocking err for CEL validation </ins> func hasBlockingErr(errs field.ErrorList) (bool, *field.Error) { for _, err := range errs { <del> if err.Type == field.ErrorTypeRequired || err.Type == field.ErrorTypeTooLong || err.Type == field.ErrorTypeTooMany || err.Type == field.ErrorTypeTypeInvalid { </del> <ins> if err.Type == field.ErrorTypeNotSupported || err.Type == field.ErrorTypeRequired || err.Type == field.ErrorTypeTooLong || err.Type == field.ErrorTypeTooMany || err.Type == field.ErrorTypeTypeInvalid { </ins> return true, field.Invalid(nil, nil, "some validation rules were not checked because the object was invalid; correct the existing errors to complete validation") } }


// Removes SCSI controller which is latest attached to VM. func cleanUpController(newSCSIController types.BaseVirtualDevice, vmDevices object.VirtualDeviceList, vm *object.VirtualMachine, ctx context.Context) error { <ins> if newSCSIController == nil || vmDevices == nil || vm == nil { return nil } </ins> ctls := vmDevices.SelectByType(newSCSIController) if len(ctls) < 1 { return ErrNoDevicesFound


// rest.Config generated by the resolver. type AuthenticationInfoResolverWrapper func(AuthenticationInfoResolver) AuthenticationInfoResolver <del> // AuthenticationInfoResolver builds rest.Config base on the server name. </del> <ins> // AuthenticationInfoResolver builds rest.Config base on the server or service // name and service namespace. </ins> type AuthenticationInfoResolver interface { <ins> // ClientConfigFor builds rest.Config based on the server. </ins> ClientConfigFor(server string) (*rest.Config, error) <ins> // ClientConfigForService builds rest.Config based on the serviceName and // serviceNamespace. ClientConfigForService(serviceName, serviceNamespace string) (*rest.Config, error) </ins> } <del> // AuthenticationInfoResolverFunc implements AuthenticationInfoResolver. type AuthenticationInfoResolverFunc func(server string) (*rest.Config, error) </del> <ins> // AuthenticationInfoResolverDelegator implements AuthenticationInfoResolver. type AuthenticationInfoResolverDelegator struct { ClientConfigForFunc        func(server string) (*rest.Config, error) ClientConfigForServiceFunc func(serviceName, serviceNamespace string) (*rest.Config, error) } func (a *AuthenticationInfoResolverDelegator) ClientConfigFor(server string) (*rest.Config, error) { return a.ClientConfigForFunc(server) } </ins> <del> //ClientConfigFor implements AuthenticationInfoResolver. func (a AuthenticationInfoResolverFunc) ClientConfigFor(server string) (*rest.Config, error) { return a(server) </del> <ins> func (a *AuthenticationInfoResolverDelegator) ClientConfigForService(serviceName, serviceNamespace string) (*rest.Config, error) { return a.ClientConfigForServiceFunc(serviceName, serviceNamespace) </ins> } type defaultAuthenticationInfoResolver struct {


v1 "k8s.io/api/core/v1" policy "k8s.io/api/policy/v1beta1" <del> apierrors "k8s.io/apimachinery/pkg/api/errors" </del> "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime"


"type": "string" }, "ports": { <del> "description": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.", </del> <ins> "description": "List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.", </ins> "items": { "$ref": "#/definitions/io.k8s.api.core.v1.ContainerPort" },


AUTOSCALER_MIN_NODES="${KUBE_AUTOSCALER_MIN_NODES:-1}" AUTOSCALER_MAX_NODES="${KUBE_AUTOSCALER_MAX_NODES:-${NUM_MINIONS}}" TARGET_NODE_UTILIZATION="${KUBE_TARGET_NODE_UTILIZATION:-0.7}" <ins> ENABLE_CLUSTER_MONITORING=googleinfluxdb </ins> fi # Optional: Enable deployment experimental feature, not ready for production use.


ETCD_HOST=${ETCD_HOST:-127.0.0.1} ETCD_PORT=${ETCD_PORT:-4001} <ins> ETCD_PREFIX=${ETCD_PREFIX:-randomPrefix} </ins> API_PORT=${API_PORT:-8080} API_HOST=${API_HOST:-127.0.0.1} KUBE_API_VERSIONS=""


} // performPlatformSpecificContainerCleanup is responsible for doing any platform-specific cleanup <del> // after either: //   * the container creation has failed //   * the container has been successfully started //   * the container has been removed // whichever happens first. // Any errors it returns are simply logged, but do not prevent the container from being started or // removed. </del> <ins> // after either the container creation has failed or the container has been removed. </ins> func (ds *dockerService) performPlatformSpecificContainerCleanup(cleanupInfo *containerCleanupInfo) (errors []error) { if err := removeGMSARegistryValue(cleanupInfo); err != nil { errors = append(errors, err)


DefaultDummyDevice = "kube-ipvs0" connReuseMinSupportedKernelVersion = "4.1" <ins> // https://github.com/torvalds/linux/commit/35dfb013149f74c2be1ff9c78f14e6a3cd1539d1 connReuseFixedKernelVersion = "5.9" </ins> ) // iptablesJumpChain is tables of iptables chains that ipvs proxier used to install iptables or cleanup iptables.


VolumeSubpath:                  {Default: true, PreRelease: featuregate.GA}, ConfigurableFSGroupPolicy:      {Default: false, PreRelease: featuregate.Alpha}, BalanceAttachedNodeVolumes:     {Default: false, PreRelease: featuregate.Alpha}, <del> VolumeSubpathEnvExpansion:      {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.19, </del> CSIBlockVolume:                 {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.20 CSIInlineVolume:                {Default: true, PreRelease: featuregate.Beta}, RuntimeClass:                   {Default: true, PreRelease: featuregate.Beta},


tc.opts..., ) <ins> // Errors </ins> if len(tc.wantErr) != 0 { if err == nil || !strings.Contains(err.Error(), tc.wantErr) { t.Errorf("got error %q, want %q", err, tc.wantErr)


<ins> /* Copyright 2017 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 scheme import ( "testing" "k8s.io/apimachinery/pkg/api/testing/roundtrip" "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/fuzzer" ) func TestRoundTripTypes(t *testing.T) { scheme, _, err := NewSchemeAndCodecs() if err != nil { t.Fatalf("unexpected error: %v", err) } roundtrip.RoundTripTestForScheme(t, scheme, fuzzer.Funcs) } </ins>


type NodeServer interface { // NodePrepareResources prepares several ResourceClaims // for use on the node. If an error is returned, the <del> // response is ignored. Failures for individidual claims </del> <ins> // response is ignored. Failures for individual claims </ins> // can be reported inside NodePrepareResourcesResponse. NodePrepareResources(context.Context, *NodePrepareResourcesRequest) (*NodePrepareResourcesResponse, error) // NodeUnprepareResources is the opposite of NodePrepareResources.


Interval_Sec 2 # Channels Setup,Windows PowerShell Channels     application,system,security <del> Tag          winevent.raw </del> <ins> Tag          winevt.raw </ins> DB           /var/run/google-fluentbit/pos-files/winlog.db # Json Log Example:


pod := config.endpointPods[0] config.getPodClient().Delete(pod.Name, nil) config.endpointPods = config.endpointPods[1:] <del> time.Sleep(5 * time.Second) // wait for kube-proxy to catch up with the pod being deleted. </del> <ins> // wait for pod being deleted. err := waitForPodToDisappear(config.f.Client, config.f.Namespace.Name, pod.Name, labels.Everything(), time.Second, util.ForeverTestTimeout) if err != nil { Failf("Failed to delete %s pod: %v", pod.Name, err) } // wait for endpoint being removed. err = waitForServiceEndpointsNum(config.f.Client, config.f.Namespace.Name, nodePortServiceName, len(config.endpointPods), time.Second, util.ForeverTestTimeout) if err != nil { Failf("Failed to remove endpoint from service: %s", nodePortServiceName) } // wait for kube-proxy to catch up with the pod being deleted. time.Sleep(5 * time.Second) </ins> } func (config *KubeProxyTestConfig) createPod(pod *api.Pod) *api.Pod {


package e2e_node import ( <del> "fmt" </del> "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" <del> "k8s.io/apimachinery/pkg/util/uuid" </del> "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/test/e2e/framework"


"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/apis/extensions" <ins> "k8s.io/kubernetes/pkg/util/codeinspector" </ins> "k8s.io/kubernetes/plugin/pkg/scheduler" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" priorityutil "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities/util"


psps, err := kubeClient.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), metav1.ListOptions{}) if err != nil { Logf("Error listing PodSecurityPolicies; assuming PodSecurityPolicy is disabled: %v", err) <del> isPSPEnabled = false } else if psps == nil || len(psps.Items) == 0 { </del> <ins> return } if psps == nil || len(psps.Items) == 0 { </ins> Logf("No PodSecurityPolicies found; assuming PodSecurityPolicy is disabled.") <del> isPSPEnabled = false } else { Logf("Found PodSecurityPolicies; assuming PodSecurityPolicy is enabled.") isPSPEnabled = true </del> <ins> return } Logf("Found PodSecurityPolicies; testing pod creation to see if PodSecurityPolicy is enabled") testPod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{GenerateName: "psp-test-pod-"}, Spec:       v1.PodSpec{Containers: []v1.Container{{Name: "test", Image: imageutils.GetPauseImageName()}}}, } dryRunPod, err := kubeClient.CoreV1().Pods("kube-system").Create(context.TODO(), testPod, metav1.CreateOptions{DryRun: []string{metav1.DryRunAll}}) if err != nil { if strings.Contains(err.Error(), "PodSecurityPolicy") { Logf("PodSecurityPolicy error creating dryrun pod; assuming PodSecurityPolicy is enabled: %v", err) isPSPEnabled = true } else { Logf("Error creating dryrun pod; assuming PodSecurityPolicy is disabled: %v", err) } return } pspAnnotation, pspAnnotationExists := dryRunPod.Annotations["kubernetes.io/psp"] if !pspAnnotationExists { Logf("No PSP annotation exists on dry run pod; assuming PodSecurityPolicy is disabled") return </ins> } <ins> Logf("PSP annotation exists on dry run pod: %q; assuming PodSecurityPolicy is enabled", pspAnnotation) isPSPEnabled = true </ins> }) return isPSPEnabled }


} } <ins> func TestDiscoveryContentTypeVersion(t *testing.T) { tests := []struct { contentType string isV2Beta1   bool }{ { contentType: "application/json; g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList", isV2Beta1:   true, }, { // content-type parameters are not in correct order, but comparison ignores order. contentType: "application/json; v=v2beta1;as=APIGroupDiscoveryList;g=apidiscovery.k8s.io", isV2Beta1:   true, }, { // content-type parameters are not in correct order, but comparison ignores order. contentType: "application/json; as=APIGroupDiscoveryList;g=apidiscovery.k8s.io;v=v2beta1", isV2Beta1:   true, }, { // Ignores extra parameter "charset=utf-8" contentType: "application/json; g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList;charset=utf-8", isV2Beta1:   true, }, { contentType: "application/json", isV2Beta1:   false, }, { contentType: "application/json; charset=UTF-8", isV2Beta1:   false, }, { contentType: "text/json", isV2Beta1:   false, }, { contentType: "text/html", isV2Beta1:   false, }, { contentType: "", isV2Beta1:   false, }, } for _, test := range tests { isV2Beta1 := isV2Beta1ContentType(test.contentType) assert.Equal(t, test.isV2Beta1, isV2Beta1) } } </ins> func TestUseLegacyDiscovery(t *testing.T) { // Default client sends aggregated discovery accept format (first) as well as legacy format. server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {


package main import ( <del> "fmt" </del> "math/rand" "os" "time"


// our target metric should be updated by now if err := wait.PollUntilContextTimeout(ctx, 10*time.Second, 2*time.Minute, true, func(_ context.Context) (bool, error) { metrics, err := metricsGrabber.GrabFromKubeProxy(ctx, nodeName) <del> framework.ExpectNoError(err) </del> <ins> if err != nil { return false, fmt.Errorf("failed to fetch metrics: %w", err) } </ins> targetMetricAfter, err := metrics.GetCounterMetricValue(metricName) <del> framework.ExpectNoError(err) </del> <ins> if err != nil { return false, fmt.Errorf("failed to fetch metric: %w", err) } </ins> return targetMetricAfter > targetMetricBefore, nil }); err != nil { <del> framework.Failf("expected %s metric to be updated after accessing endpoints via localhost nodeports", metricName) </del> <ins> if wait.Interrupted(err) { framework.Failf("expected %s metric to be updated after accessing endpoints via localhost nodeports", metricName) } framework.ExpectNoError(err) </ins> } }) })


NodeDiskPressure NodeConditionType = "DiskPressure" // NodeNetworkUnavailable means that network for the node is not correctly configured. NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable" <del> // NodeInodePressure means the kubelet is under pressure due to insufficient available inodes. NodeInodePressure NodeConditionType = "InodePressure" </del> ) // NodeCondition contains condition information for a node.


go_test( name = "go_default_test", srcs = [ <ins> "codec_test.go", </ins> "conversion_test.go", "converter_test.go", "embedded_test.go",


fi proxy_mem_per_node=50 proxy_mem=$((100 * 1024 + proxy_mem_per_node*NUM_NODES)) <ins> hollow_kubelet_params=$(eval "for param in ${HOLLOW_KUBELET_TEST_ARGS:-}; do echo -n "$param",; done") hollow_kubelet_params=${hollow_kubelet_params%?} hollow_proxy_params=$(eval "for param in ${HOLLOW_PROXY_TEST_ARGS:-}; do echo -n "$param",; done") hollow_proxy_params=${hollow_proxy_params%?} </ins> sed -i'' -e "s/{{HOLLOW_PROXY_CPU}}/${proxy_cpu}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s/{{HOLLOW_PROXY_MEM}}/${proxy_mem}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s'{{kubemark_image_registry}}'${KUBEMARK_IMAGE_REGISTRY}${KUBE_NAMESPACE}'g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s/{{kubemark_image_tag}}/${KUBEMARK_IMAGE_TAG}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s/{{master_ip}}/${MASTER_IP}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" <del> sed -i'' -e "s/{{hollow_kubelet_params}}/${HOLLOW_KUBELET_TEST_ARGS:-}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s/{{hollow_proxy_params}}/${HOLLOW_PROXY_TEST_ARGS:-}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" </del> <ins> sed -i'' -e "s/{{hollow_kubelet_params}}/${hollow_kubelet_params}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" sed -i'' -e "s/{{hollow_proxy_params}}/${hollow_proxy_params}/g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" </ins> sed -i'' -e "s'{{kubemark_mig_config}}'${KUBEMARK_MIG_CONFIG:-}'g" "${RESOURCE_DIRECTORY}/hollow-node.yaml" "${KUBECTL}" create -f "${RESOURCE_DIRECTORY}/hollow-node.yaml" --namespace="kubemark"


var resourcesByGV map[schema.GroupVersion]*metav1.APIResourceList // Switch on content-type server responded with: aggregated or unaggregated. <del> switch responseContentType { case AcceptV1: </del> <ins> switch { case isV2Beta1ContentType(responseContentType): var aggregatedDiscovery apidiscovery.APIGroupDiscoveryList err = json.Unmarshal(body, &aggregatedDiscovery) if err != nil { return nil, nil, nil, err } apiGroupList, resourcesByGV, failedGVs = SplitGroupsAndResources(aggregatedDiscovery) default: // Default is unaggregated discovery v1. </ins> var v metav1.APIVersions err = json.Unmarshal(body, &v) if err != nil {


} } <ins> func TestInClusterClientConfigPrecedence(t *testing.T) { tt := []struct { overrides *ConfigOverrides }{ { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ CertificateAuthority: "/path/to/ca-from-overrides.crt", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server:               "https://host-from-overrides.com", CertificateAuthority: "/path/to/ca-from-overrides.crt", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ CertificateAuthority: "/path/to/ca-from-overrides.crt", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server:               "https://host-from-overrides.com", CertificateAuthority: "/path/to/ca-from-overrides.crt", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{}, }, } for _, tc := range tt { expectedServer := "https://host-from-cluster.com" expectedToken := "token-from-cluster" expectedCAFile := "/path/to/ca-from-cluster.crt" icc := &inClusterClientConfig{ inClusterConfigProvider: func() (*restclient.Config, error) { return &restclient.Config{ Host:        expectedServer, BearerToken: expectedToken, TLSClientConfig: restclient.TLSClientConfig{ CAFile: expectedCAFile, }, }, nil }, overrides: tc.overrides, } clientConfig, err := icc.ClientConfig() if err != nil { t.Fatalf("Unxpected error: %v", err) } if overridenServer := tc.overrides.ClusterInfo.Server; len(overridenServer) > 0 { expectedServer = overridenServer } if overridenToken := tc.overrides.AuthInfo.Token; len(overridenToken) > 0 { expectedToken = overridenToken } if overridenCAFile := tc.overrides.ClusterInfo.CertificateAuthority; len(overridenCAFile) > 0 { expectedCAFile = overridenCAFile } if clientConfig.Host != expectedServer { t.Errorf("Expected server %v, got %v", expectedServer, clientConfig.Host) } if clientConfig.BearerToken != expectedToken { t.Errorf("Expected token %v, got %v", expectedToken, clientConfig.BearerToken) } if clientConfig.TLSClientConfig.CAFile != expectedCAFile { t.Errorf("Expected Certificate Authority %v, got %v", expectedCAFile, clientConfig.TLSClientConfig.CAFile) } } } </ins> func matchBoolArg(expected, got bool, t *testing.T) { if expected != got { t.Errorf("Expected %v, got %v", expected, got)


// The name of this port. All ports in an EndpointSlice must have a unique // name. If the EndpointSlice is dervied from a Kubernetes service, this // corresponds to the Service.ports[].name. <del> // Name must either be an empty string or pass IANA_SVC_NAME validation: // * must be no more than 15 characters long // * may contain only [-a-z0-9] // * must contain at least one letter [a-z] // * it must not start or end with a hyphen, nor contain adjacent hyphens </del> <ins> // Name must either be an empty string or pass DNS_LABEL validation: // * must be no more than 63 characters long. // * must consist of lower case alphanumeric characters or '-'. // * must start and end with an alphanumeric character. </ins> Name *string // The IP protocol for this port. // Must be UDP, TCP, or SCTP.


docs/man/man1/kubectl-alpha-diff.1 docs/man/man1/kubectl-alpha.1 docs/man/man1/kubectl-annotate.1 <ins> docs/man/man1/kubectl-api-resources.1 </ins> docs/man/man1/kubectl-api-versions.1 docs/man/man1/kubectl-apply-edit-last-applied.1 docs/man/man1/kubectl-apply-set-last-applied.1


maxStorageAccounts                     = 100 // max # is 200 (250 with special request). this allows 100 for everything else including stand alone disks maxDisksPerStorageAccounts             = 60 storageAccountUtilizationBeforeGrowing = 0.5 <ins> // Disk Caching is not supported for disks 4 TiB and larger // https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching diskCachingLimit = 4096 // GiB </ins> maxLUN               = 64 // max number of LUNs per VM errLeaseFailed       = "AcquireDiskLeaseFailed"


// list all pods to include the pods that don't match the rs`s selector // anymore but has the stale controller ref. // TODO: Do the List and Filter in a single pass, or use an index. <del> pods, err := rsc.podLister.Pods(rs.Namespace).List(labels.Everything()) </del> <ins> allPods, err := rsc.podLister.Pods(rs.Namespace).List(labels.Everything()) </ins> if err != nil { return err } // Ignore inactive pods. var filteredPods []*v1.Pod <del> for _, pod := range pods { </del> <ins> for _, pod := range allPods { </ins> if controller.IsPodActive(pod) { filteredPods = append(filteredPods, pod) }


statuses[container.Name] = status } <ins> // Copy the slice before sorting it containerStatusesCopy := make([]*kubecontainer.Status, len(podStatus.ContainerStatuses)) copy(containerStatusesCopy, podStatus.ContainerStatuses) </ins> // Make the latest container status comes first. <del> sort.Sort(sort.Reverse(kubecontainer.SortContainerStatusesByCreationTime(podStatus.ContainerStatuses))) </del> <ins> sort.Sort(sort.Reverse(kubecontainer.SortContainerStatusesByCreationTime(containerStatusesCopy))) </ins> // Set container statuses according to the statuses seen in pod status containerSeen := map[string]int{} <del> for _, cStatus := range podStatus.ContainerStatuses { </del> <ins> for _, cStatus := range containerStatusesCopy { </ins> cName := cStatus.Name if _, ok := statuses[cName]; !ok { // This would also ignore the infra container.


"k8s.io/apimachinery/pkg/util/diff" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" <ins> "k8s.io/kubernetes/federation/apis/federation" </ins> "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/apis/apps"


}, } if strings.Contains(err.Error(), "0/3 nodes are available") { <del> if strings.Contains(err.Error(), "2 NodeUnderDiskPressure") && strings.Contains(err.Error(), "1 NodeUnderMemoryPressure") { </del> <ins> if strings.Contains(err.Error(), "2 node(s) had disk pressure") && strings.Contains(err.Error(), "1 node(s) had memory pressure") { </ins> return } }


} } <ins> if utilfeature.DefaultFeatureGate.Enabled(features.HonorPVReclaimPolicy) { if metav1.HasAnnotation(volume.ObjectMeta, storagehelpers.AnnMigratedTo) { // CSI migration scenario - do not depend on in-tree plugin return nil, nil } if volume.Spec.CSI != nil { // CSI volume source scenario - external provisioner is requested return nil, nil } } </ins> // The plugin that provisioned the volume was not found or the volume // was not dynamically provisioned. Try to find a plugin by spec. spec := vol.NewSpecFromPersistentVolume(volume, false)


} func (s *containerScope) Admit(pod *v1.Pod) lifecycle.PodAdmitResult { <del> // Exception - Policy : none if s.policy.Name() == PolicyNone { return s.admitPolicyNone(pod) } </del> for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) { bestHint, admit := s.calculateAffinity(pod, &container) klog.InfoS("Best TopologyHint", "bestHint", bestHint, "pod", klog.KObj(pod), "containerName", container.Name)


Name: "foo"}}, api.Namespace{ ObjectMeta: api.ObjectMeta{ <ins> Name: "foo"}, Status: api.NamespaceStatus{ Phase: api.NamespaceTerminating, }, }, false}, {api.Namespace{ ObjectMeta: api.ObjectMeta{ Name: "foo"}}, api.Namespace{ ObjectMeta: api.ObjectMeta{ </ins> Name: "bar"}, Status: api.NamespaceStatus{ Phase: api.NamespaceTerminating,


Rule:       admissionv1beta1.Rule{APIGroups: []string{""}, APIVersions: []string{"v1"}, Resources: []string{"pods"}}, }}, ObjectSelector:          webhook.objectSelector, <ins> NamespaceSelector:       &metav1.LabelSelector{MatchLabels: nsLabels}, </ins> FailurePolicy:           &fail, ReinvocationPolicy:      webhook.policy, AdmissionReviewVersions: []string{"v1beta1"}, }) } <ins> // Register a marker checking webhook with each set of webhook configurations markerEndpoint := webhookServer.URL + "/marker" webhooks = append(webhooks, admissionv1beta1.MutatingWebhook{ Name: "admission.integration.test.marker", ClientConfig: admissionv1beta1.WebhookClientConfig{ URL:      &markerEndpoint, CABundle: localhostCert, }, Rules: []admissionv1beta1.RuleWithOperations{{ Operations: []admissionv1beta1.OperationType{admissionv1beta1.OperationAll}, Rule:       admissionv1beta1.Rule{APIGroups: []string{""}, APIVersions: []string{"v1"}, Resources: []string{"pods"}}, }}, NamespaceSelector:       &metav1.LabelSelector{MatchLabels: markerNsLabels}, ObjectSelector:          &metav1.LabelSelector{MatchLabels: map[string]string{"marker": "true"}}, AdmissionReviewVersions: []string{"v1beta1"}, }) </ins> cfg, err := client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Create(&admissionv1beta1.MutatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("admission.integration.test-%d", i)},


} func (az *Cloud) isCurrentInstance(name types.NodeName, metadataVMName string) (bool, error) { <ins> var err error </ins> nodeName := mapNodeNameToVMName(name) <ins> // VMSS vmName is not same with hostname, use hostname instead. </ins> if az.VMType == vmTypeVMSS { <del> // VMSS vmName is not same with hostname, construct the node name "{computer-name-prefix}{base-36-instance-id}". // Refer https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-instance-ids#scale-set-vm-computer-name. if ssName, instanceID, err := extractVmssVMName(metadataVMName); err == nil { instance, err := strconv.ParseInt(instanceID, 10, 64) if err != nil { return false, fmt.Errorf("failed to parse VMSS instanceID %q: %v", instanceID, err) } metadataVMName = fmt.Sprintf("%s%06s", ssName, strconv.FormatInt(instance, 36)) </del> <ins> metadataVMName, err = os.Hostname() if err != nil { return false, err } // Use name from env variable "NODE_NAME" if it is set. nodeNameEnv := os.Getenv(nodeNameEnvironmentName) if nodeNameEnv != "" { metadataVMName = nodeNameEnv </ins> } }


Expect(lineCount).To(Equal(expectedLineCount), "Line count of the written file should be %d.", expectedLineCount) <del> // 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] </del> <ins> } func addTaint(c clientset.Interface, ns string, nodes []v1.Node, podZone string) (removeTaint func()) { reversePatches := make(map[string][]byte) for _, node := range nodes { oldData, err := json.Marshal(node) Expect(err).NotTo(HaveOccurred()) node.Spec.Taints = append(node.Spec.Taints, v1.Taint{ Key:    taintKeyPrefix + ns, Value:  podZone, Effect: v1.TaintEffectNoSchedule, }) newData, err := json.Marshal(node) Expect(err).NotTo(HaveOccurred()) patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, v1.Node{}) Expect(err).NotTo(HaveOccurred()) reversePatchBytes, err := strategicpatch.CreateTwoWayMergePatch(newData, oldData, v1.Node{}) Expect(err).NotTo(HaveOccurred()) reversePatches[node.Name] = reversePatchBytes _, err = c.CoreV1().Nodes().Patch(node.Name, types.StrategicMergePatchType, patchBytes) Expect(err).ToNot(HaveOccurred()) </ins> } <del> nodeName = pod.Spec.NodeName node, err = c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) newPodZone := node.Labels[apis.LabelZoneFailureDomain] Expect(newPodZone).To(Equal(otherZone), "The pod should be scheduled in zone %s after all nodes in zone %s have been deleted", otherZone, podZone) </del> <ins> return func() { for nodeName, reversePatch := range reversePatches { _, err := c.CoreV1().Nodes().Patch(nodeName, types.StrategicMergePatchType, reversePatch) Expect(err).ToNot(HaveOccurred()) } } </ins> } func testRegionalDelayedBinding(c clientset.Interface, ns string) {


ginkgo.BeforeEach(func() { c = f.ClientSet ns = f.Namespace.Name <ins> dc = f.DynamicClient </ins> }) ginkgo.It("deployment reaping should cascade to its replica sets and pods", func() {


func (i *Instances) NodeAddresses(name string) ([]api.NodeAddress, error) { glog.V(4).Infof("NodeAddresses(%v) called", name) <del> srv, err := getServerByName(i.compute, name) </del> <ins> addrs, err := getAddressesByName(i.compute, name) </ins> if err != nil { return nil, err } <del> addrs := []api.NodeAddress{} for _, addr := range findAddrs(srv.Addresses["private"]) { addrs = append(addrs, api.NodeAddress{ Type:    api.NodeInternalIP, Address: addr, }) } for _, addr := range findAddrs(srv.Addresses["public"]) { addrs = append(addrs, api.NodeAddress{ Type:    api.NodeExternalIP, Address: addr, }) } // AccessIPs are usually duplicates of "public" addresses. api.AddToNodeAddresses(&addrs, api.NodeAddress{ Type:    api.NodeExternalIP, Address: srv.AccessIPv6, }, api.NodeAddress{ Type:    api.NodeExternalIP, Address: srv.AccessIPv4, }, ) </del> glog.V(4).Infof("NodeAddresses(%v) => %v", name, addrs) return addrs, nil }


"fmt" "net/http" "net/http/httptest" <ins> "net/url" </ins> "reflect" "testing" <ins> "k8s.io/apimachinery/pkg/util/sets" </ins> ) func TestInstallHandler(t *testing.T) {


# Get the compute zone zone=${ZONE:-"$(gcloud info --format='value(config.properties.compute.zone.value)')"} <ins> zone=${zone// /} </ins> if [[ ${zone} == "" ]]; then echo "Could not find gcloud compute/zone when running: `gcloud info --format='value(config.properties.compute.zone.value)'`" exit 1


Searches: []string{testHostDomain}, }, nil } <del> // getResolvConf returns the hostResolvConf string, which will be used to get the Host's DNS configuration. func getResolvConf(t *testing.T) (string, func()) { return hostResolvConf, func() {} } </del>


} if h.nodeCacheCapable && result.NodeNames != nil { <del> nodeResult = make([]*v1.Node, 0, len(*result.NodeNames)) for i := range *result.NodeNames { nodeResult = append(nodeResult, nodeNameToInfo[(*result.NodeNames)[i]].Node()) </del> <ins> nodeResult = make([]*v1.Node, len(*result.NodeNames)) for i, nodeName := range *result.NodeNames { if node, ok := nodeNameToInfo[nodeName]; ok { nodeResult[i] = node.Node() } else { return nil, nil, fmt.Errorf( "extender %q claims a filtered node %q which is not found in nodeNameToInfo map", h.extenderURL, nodeName) } </ins> } } else if result.Nodes != nil { <del> nodeResult = make([]*v1.Node, 0, len(result.Nodes.Items)) </del> <ins> nodeResult = make([]*v1.Node, len(result.Nodes.Items)) </ins> for i := range result.Nodes.Items { <del> nodeResult = append(nodeResult, &result.Nodes.Items[i]) </del> <ins> nodeResult[i] = &result.Nodes.Items[i] </ins> } }


return nil } <del> policyGroupVersion, err := CheckEvictionSupport(d.Client) if err != nil { return err } </del> // TODO(justinsb): unnecessary? getPodFn := func(namespace, name string) (*corev1.Pod, error) { return d.Client.CoreV1().Pods(namespace).Get(name, metav1.GetOptions{}) } <del> if len(policyGroupVersion) > 0 { return d.evictPods(pods, policyGroupVersion, getPodFn) </del> <ins> if !d.DisableEviction { policyGroupVersion, err := CheckEvictionSupport(d.Client) if err != nil { return err } if len(policyGroupVersion) > 0 { return d.evictPods(pods, policyGroupVersion, getPodFn) } </ins> } return d.deletePods(pods, getPodFn)


// shouldRetryHTTPRequest determines if the request is retriable. func shouldRetryHTTPRequest(resp *http.Response, err error) bool { if resp != nil { <del> // HTTP 412 (StatusPreconditionFailed) means etag mismatch, hence we shouldn't retry. if resp.StatusCode == http.StatusPreconditionFailed { </del> <ins> // HTTP 412 (StatusPreconditionFailed) means etag mismatch // HTTP 400 (BadRequest) means the request cannot be accepted, hence we shouldn't retry. if resp.StatusCode == http.StatusPreconditionFailed || resp.StatusCode == http.StatusBadRequest { </ins> return false }


return expected.ret } <del> func (testcase *testcase) DiskIsAttached(diskName string, nodeName types.NodeName) (bool, error) { </del> <ins> func (testcase *testcase) DiskIsAttached(diskName string, nodeName types.NodeName) (bool, string, error) { </ins> expected := &testcase.diskIsAttached if expected.diskName == "" && expected.nodeName == "" { // testcase.diskIsAttached looks uninitialized, test did not expect to // call DiskIsAttached testcase.t.Errorf("Unexpected DiskIsAttached call!") <del> return false, errors.New("Unexpected DiskIsAttached call!") </del> <ins> return false, diskName, errors.New("Unexpected DiskIsAttached call!") </ins> } if expected.diskName != diskName { testcase.t.Errorf("Unexpected DiskIsAttached call: expected diskName %s, got %s", expected.diskName, diskName) <del> return false, errors.New("Unexpected DiskIsAttached call: wrong diskName") </del> <ins> return false, diskName, errors.New("Unexpected DiskIsAttached call: wrong diskName") </ins> } if expected.nodeName != nodeName { testcase.t.Errorf("Unexpected DiskIsAttached call: expected nodeName %s, got %s", expected.nodeName, nodeName) <del> return false, errors.New("Unexpected DiskIsAttached call: wrong nodeName") </del> <ins> return false, diskName, errors.New("Unexpected DiskIsAttached call: wrong nodeName") </ins> } klog.V(4).Infof("DiskIsAttached call: %s, %s, returning %v, %v", diskName, nodeName, expected.isAttached, expected.ret) <del> return expected.isAttached, expected.ret </del> <ins> return expected.isAttached, diskName, expected.ret </ins> } func (testcase *testcase) DisksAreAttached(nodeVolumes map[types.NodeName][]string) (map[types.NodeName]map[string]bool, error) {


package dns <del> import ( "fmt" "os" runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1" "k8s.io/klog/v2" ) func getHostDNSConfig(resolverConfig string) (*runtimeapi.DNSConfig, error) { var hostDNS, hostSearch, hostOptions []string // Get host DNS settings if resolverConfig != "" { f, err := os.Open(resolverConfig) if err != nil { klog.ErrorS(err, "Could not open resolv conf file.") return nil, err } defer f.Close() hostDNS, hostSearch, hostOptions, err = parseResolvConf(f) if err != nil { err := fmt.Errorf("Encountered error while parsing resolv conf file. Error: %w", err) klog.ErrorS(err, "Could not parse resolv conf file.") return nil, err } } return &runtimeapi.DNSConfig{ Servers:  hostDNS, Searches: hostSearch, Options:  hostOptions, }, nil } </del> <ins> // Read the DNS configuration from a resolv.conf file. var getHostDNSConfig = getDNSConfig </ins>


return nil } <del> // Ensures that the load balancer associated with the given service is deleted, // doing the deletion if necessary. Should always be retried upon failure. func (s *ServiceController) ensureLBDeleted(service *api.Service) error { // This is only needed because not all delete load balancer implementations // are currently idempotent to the LB not existing. if _, exists, err := s.balancer.GetTCPLoadBalancer(s.loadBalancerName(service), s.zone.Region); err != nil { return err } else if !exists { return nil } if err := s.balancer.DeleteTCPLoadBalancer(s.loadBalancerName(service), s.zone.Region); err != nil { return err } return nil } </del> // ListKeys implements the interface required by DeltaFIFO to list the keys we // already know about. func (s *serviceCache) ListKeys() []string {


start_kube_controller_manager start_kube_scheduler start_kube_addons <ins> start_cluster_autoscaler </ins> } 2>&1 | logger --priority daemon.info -t ${UPSTART_JOB} end script


// to the node. This list can be used to determine volumes that are either in-use // or have a mount/unmount operation pending. GetAttachedVolumes() []AttachedVolume <ins> // SyncReconstructedVolume check the volume.outerVolumeSpecName in asw and // the one populated from dsw , if they do not match, update this field from the value from dsw. SyncReconstructedVolume(volumeName v1.UniqueVolumeName, podName volumetypes.UniquePodName, outerVolumeSpecName string) </ins> } // MountedVolume represents a volume that has successfully been mounted to a pod.


} }) <ins> It("should provision storage with non-default reclaim policy Retain", func() { framework.SkipUnlessProviderIs("gce", "gke") test := testsuites.StorageClassTest{ Name:           "HDD PD on GCE/GKE", CloudProviders: []string{"gce", "gke"}, Provisioner:    "kubernetes.io/gce-pd", Parameters: map[string]string{ "type": "pd-standard", }, ClaimSize:    "1Gi", ExpectedSize: "1Gi", PvCheck: func(volume *v1.PersistentVolume) error { return checkGCEPD(volume, "pd-standard") }, } class := newStorageClass(test, ns, "reclaimpolicy") retain := v1.PersistentVolumeReclaimRetain class.ReclaimPolicy = &retain claim := newClaim(test, ns, "reclaimpolicy") claim.Spec.StorageClassName = &class.Name pv := testsuites.TestDynamicProvisioning(test, c, claim, class) By(fmt.Sprintf("waiting for the provisioned PV %q to enter phase %s", pv.Name, v1.VolumeReleased)) framework.ExpectNoError(framework.WaitForPersistentVolumePhase(v1.VolumeReleased, c, pv.Name, 1*time.Second, 30*time.Second)) By(fmt.Sprintf("deleting the storage asset backing the PV %q", pv.Name)) framework.ExpectNoError(framework.DeletePDWithRetry(pv.Spec.GCEPersistentDisk.PDName)) By(fmt.Sprintf("deleting the PV %q", pv.Name)) framework.ExpectNoError(framework.DeletePersistentVolume(c, pv.Name), "Failed to delete PV ", pv.Name) framework.ExpectNoError(framework.WaitForPersistentVolumeDeleted(c, pv.Name, 1*time.Second, 30*time.Second)) }) </ins> It("should not provision a volume in an unmanaged GCE zone.", func() { framework.SkipUnlessProviderIs("gce", "gke") var suffix string = "unmananged"


"description": "EndpointPort is a tuple that describes a single port.", "properties": { "appProtocol": { <del> "description": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol.", </del> <ins> "description": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol.", </ins> "type": "string" }, "name": {


return i.doCmd(s, nil, ipvsCmdDelService) } <ins> // Flush deletes all existing services in the passed // handle. func (i *Handle) Flush() error { _, err := i.doCmdWithoutAttr(ipvsCmdFlush) return err } </ins> // NewDestination creates a new real server in the passed ipvs // service which should already be existing in the passed handle. func (i *Handle) NewDestination(s *Service, d *Destination) error {


<del> apiVersion: v1 kind: Service metadata: name: elasticsearch-discovery labels: component: elasticsearch role: master spec: selector: component: elasticsearch role: master ports: - name: transport port: 9300 protocol: TCP </del>


}{ "backoffLimit 0 should have 1 pod active": { 1, 1, 0, <del> true, []int32{0}, </del> <ins> true, []int32{0}, v1.PodRunning, </ins> 1, 0, 0, nil, "", }, "backoffLimit 1 with restartCount 0 should have 1 pod active": { 1, 1, 1, <del> true, []int32{0}, </del> <ins> true, []int32{0}, v1.PodRunning, </ins> 1, 0, 0, nil, "", }, <del> "backoffLimit 1 with restartCount 1 should have 0 pod active": { </del> <ins> "backoffLimit 1 with restartCount 1 and podRunning should have 0 pod active": { </ins> 1, 1, 1, <del> true, []int32{1}, </del> <ins> true, []int32{1}, v1.PodRunning, </ins> 0, 0, 1, &jobConditionFailed, "BackoffLimitExceeded", }, <del> "too many job failures - single pod": { </del> <ins> "backoffLimit 1 with restartCount 1 and podPending should have 0 pod active": { 1, 1, 1, true, []int32{1}, v1.PodPending, 0, 0, 1, &jobConditionFailed, "BackoffLimitExceeded", }, "too many job failures with podRunning - single pod": { </ins> 1, 5, 2, <del> true, []int32{2}, </del> <ins> true, []int32{2}, v1.PodRunning, </ins> 0, 0, 1, &jobConditionFailed, "BackoffLimitExceeded", }, <del> "too many job failures - multiple pods": { </del> <ins> "too many job failures with podPending - single pod": { 1, 5, 2, true, []int32{2}, v1.PodPending, 0, 0, 1, &jobConditionFailed, "BackoffLimitExceeded", }, "too many job failures with podRunning - multiple pods": { 2, 5, 2, true, []int32{1, 1}, v1.PodRunning, 0, 0, 2, &jobConditionFailed, "BackoffLimitExceeded", }, "too many job failures with podPending - multiple pods": { </ins> 2, 5, 2, <del> true, []int32{1, 1}, </del> <ins> true, []int32{1, 1}, v1.PodPending, </ins> 0, 0, 2, &jobConditionFailed, "BackoffLimitExceeded", }, "not enough failures": { 2, 5, 3, <del> true, []int32{1, 1}, </del> <ins> true, []int32{1, 1}, v1.PodRunning, </ins> 2, 0, 0, nil, "", }, }


import ( "fmt" <ins> "os/exec" </ins> "reflect" "testing" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/resource" <ins> "k8s.io/kubernetes/pkg/util/codeinspector" </ins> "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" )


"fmt" "net" "path/filepath" <ins> "strings" </ins> "sync" "testing" "time" authenticationv1 "k8s.io/api/authentication/v1" v1 "k8s.io/api/core/v1" <ins> storagev1 "k8s.io/api/storage/v1" </ins> metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" <ins> "k8s.io/apimachinery/pkg/labels" </ins> "k8s.io/apimachinery/pkg/types" <ins> "k8s.io/apimachinery/pkg/util/sets" </ins> "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/informers" clientset "k8s.io/client-go/kubernetes"


// It must return ("", cloudprovider.InstanceNotFound) if the instance does // not exist or is no longer running. func (ss *scaleSet) GetInstanceIDByNodeName(name string) (string, error) { <del> _, _, vm, err := ss.getVmssVM(name) </del> <ins> managedByAS, err := ss.isNodeManagedByAvailabilitySet(name) </ins> if err != nil { <del> if err == ErrorNotVmssInstance { glog.V(4).Infof("GetInstanceIDByNodeName: node %q is managed by availability set", name) // Retry with standard type because nodes are not managed by vmss. return ss.availabilitySet.GetInstanceIDByNodeName(name) } </del> <ins> glog.Errorf("Failed to check isNodeManagedByAvailabilitySet: %v", err) return "", err } if managedByAS { // vm is managed by availability set. return ss.availabilitySet.GetInstanceIDByNodeName(name) } _, _, vm, err := ss.getVmssVM(name) if err != nil { </ins> return "", err }


t.Errorf("Expect node port type service, got none") } } <ins> func TestLoadBalanceSourceRanges(t *testing.T) { ipt := iptablestest.NewFake() ipvs := ipvstest.NewFake() ipset := ipsettest.NewFake(testIPSetVersion) fp := NewFakeProxier(ipt, ipvs, ipset, nil) svcIP := "10.20.30.41" svcPort := 80 svcLBIP := "1.2.3.4" svcLBSource := "10.0.0.0/8" svcPortName := proxy.ServicePortName{ NamespacedName: makeNSN("ns1", "svc1"), Port:           "p80", } epIP := "10.180.0.1" makeServiceMap(fp, makeTestService(svcPortName.Namespace, svcPortName.Name, func(svc *api.Service) { svc.Spec.Type = "LoadBalancer" svc.Spec.ClusterIP = svcIP svc.Spec.Ports = []api.ServicePort{{ Name:     svcPortName.Port, Port:     int32(svcPort), Protocol: api.ProtocolTCP, }} svc.Status.LoadBalancer.Ingress = []api.LoadBalancerIngress{{ IP: svcLBIP, }} svc.Spec.LoadBalancerSourceRanges = []string{ svcLBSource, } }), ) makeEndpointsMap(fp, makeTestEndpoints(svcPortName.Namespace, svcPortName.Name, func(ept *api.Endpoints) { ept.Subsets = []api.EndpointSubset{{ Addresses: []api.EndpointAddress{{ IP:       epIP, NodeName: strPtr(testHostname), }}, Ports: []api.EndpointPort{{ Name: svcPortName.Port, Port: int32(svcPort), }}, }} }), ) fp.syncProxyRules() // Check ipvs service and destinations services, err := ipvs.GetVirtualServers() if err != nil { t.Errorf("Failed to get ipvs services, err: %v", err) } found := false for _, svc := range services { fmt.Printf("address: %s:%d, %s", svc.Address.String(), svc.Port, svc.Protocol) if svc.Address.Equal(net.ParseIP(svcLBIP)) && svc.Port == uint16(svcPort) && svc.Protocol == string(api.ProtocolTCP) { destinations, _ := ipvs.GetRealServers(svc) if len(destinations) != 1 { t.Errorf("Unexpected %d destinations, expect 0 destinations", len(destinations)) } for _, ep := range destinations { if ep.Address.String() == epIP && ep.Port == uint16(svcPort) { found = true } } } } if !found { t.Errorf("Did not got expected loadbalance service") } // Check ipset entry expectIPSet := map[string]*utilipset.Entry{ KubeLoadBalancerSet: { IP:       svcLBIP, Port:     svcPort, Protocol: strings.ToLower(string(api.ProtocolTCP)), SetType:  utilipset.HashIPPort, }, KubeLoadBalancerMasqSet: { IP:       svcLBIP, Port:     svcPort, Protocol: strings.ToLower(string(api.ProtocolTCP)), SetType:  utilipset.HashIPPort, }, KubeLoadBalancerSourceCIDRSet: { IP:       svcLBIP, Port:     svcPort, Protocol: strings.ToLower(string(api.ProtocolTCP)), Net:      svcLBSource, SetType:  utilipset.HashIPPortNet, }, } for set, entry := range expectIPSet { ents, err := ipset.ListEntries(set) if err != nil || len(ents) != 1 { t.Errorf("Check ipset entries failed for ipset: %q", set) continue } if ents[0] != entry.String() { t.Errorf("Check ipset entries failed for ipset: %q", set) } } // Check iptables chain and rules kubeSvcRules := ipt.GetRules(string(kubeServicesChain)) kubeFWRules := ipt.GetRules(string(KubeFireWallChain)) if !hasJump(kubeSvcRules, string(KubeMarkMasqChain), KubeLoadBalancerMasqSet) { t.Errorf("Didn't find jump from chain %v match set %v to MASQUERADE", kubeServicesChain, KubeLoadBalancerMasqSet) } if !hasJump(kubeSvcRules, string(KubeFireWallChain), KubeLoadBalancerSet) { t.Errorf("Didn't find jump from chain %v match set %v to %v", kubeServicesChain, KubeLoadBalancerSet, KubeFireWallChain) } if !hasJump(kubeFWRules, "ACCEPT", KubeLoadBalancerSourceCIDRSet) { t.Errorf("Didn't find jump from chain %v match set %v to ACCEPT", kubeServicesChain, KubeLoadBalancerSourceCIDRSet) } } </ins> func TestOnlyLocalLoadBalancing(t *testing.T) { ipt := iptablestest.NewFake()


// Sleep 1s to verify no detach are triggered after second pod is added in the future. time.Sleep(1000 * time.Millisecond) verifyVolumeAttachedToNode(t, generatedVolumeName, nodeName1, cache.AttachStateAttached, asw) <ins> verifyVolumeReportedAsAttachedToNode(t, logger, generatedVolumeName, nodeName1, true, asw, volumeAttachedCheckTimeout) </ins> // verifyVolumeNoStatusUpdateNeeded(t, logger, generatedVolumeName, nodeName1, asw) // Add a third pod which tries to attach the volume to a different node.


return nil } _, err = p.client.Namespaces().Create(namespace) <del> if err != nil { </del> <ins> if err != nil && !errors.IsAlreadyExists(err) { </ins> return err } return nil


OOMScoreAdj:            config.OOMScoreAdj, ConfigSyncPeriod:       config.ConfigSyncPeriod.Duration, HealthzServer:          healthzServer, <ins> UseEndpointSlices:      utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice), </ins> }, nil }


allErrs = append(allErrs, field.Invalid(fldPath.Child("deletionTimestamp"), newMeta.DeletionTimestamp, "field is immutable; may only be changed via deletion")) } <ins> // Finalizers cannot be added if the object is already being deleted. if oldMeta.DeletionTimestamp != nil { allErrs = append(allErrs, ValidateNoNewFinalizers(newMeta.Finalizers, oldMeta.Finalizers, fldPath.Child("finalizers"))...) } </ins> // Reject updates that don't specify a resource version if len(newMeta.ResourceVersion) == 0 { allErrs = append(allErrs, field.Invalid(fldPath.Child("resourceVersion"), newMeta.ResourceVersion, "must be specified for an update"))


"time" "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" <ins> "github.com/golang/glog" </ins> "k8s.io/apimachinery/pkg/types" kwait "k8s.io/apimachinery/pkg/util/wait" <ins> "k8s.io/kubernetes/pkg/cloudprovider" </ins> ) const (


"k8s.io/kubernetes/pkg/client/record" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/controller/framework" <ins> "k8s.io/kubernetes/pkg/fields" </ins> "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/runtime" )


// Synced returns true if the view is synced (for the first time) func (f *federatedInformerImpl) ClustersSynced() bool { <del> f.Lock() defer f.Unlock() </del> return f.clusterInformer.controller.HasSynced() }


framework.Failf("failed dialing endpoint, %v", err) } <ins> ginkgo.By("pod-Service(hostNetwork): udp") ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort)) err = config.DialFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames()) if err != nil { framework.Failf("failed dialing endpoint, %v", err) } ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort)) err = config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames()) if err != nil { framework.Failf("failed dialing endpoint, %v", err) } </ins> ginkgo.By("node-Service(hostNetwork): http") ginkgo.By(fmt.Sprintf("dialing(http) %v (node) --> %v:%v (config.clusterIP)", config.NodeIP, config.ClusterIP, e2enetwork.ClusterHTTPPort))


framework.ExpectNoError(err) }) <del> // TODO: Get rid of [DisabledForLargeClusters] tag when issue #56138 is fixed. ginkgo.It("should be able to change the type and ports of a service [Slow] [DisabledForLargeClusters]", func() { </del> <ins> ginkgo.It("should be able to change the type and ports of a service [Slow]", func() { </ins> // requires cloud load-balancer support e2eskipper.SkipUnlessProviderIs("gce", "gke", "aws")


w := newLogWriter(stdoutBuf, stderrBuf, &LogOptions{timestamp: test.timestamp, bytes: int64(test.bytes)}) for i := 0; i < test.stdoutLines; i++ { msg.stream = runtimeapi.Stdout <del> if err := w.write(msg); err != nil { </del> <ins> if err := w.write(msg, true); err != nil { </ins> assert.EqualError(t, err, errMaximumWrite.Error()) } } for i := 0; i < test.stderrLines; i++ { msg.stream = runtimeapi.Stderr <del> if err := w.write(msg); err != nil { </del> <ins> if err := w.write(msg, true); err != nil { </ins> assert.EqualError(t, err, errMaximumWrite.Error()) } }


"../examples/walkthrough": { "pod1": &api.Pod{}, "pod2": &api.Pod{}, <ins> "pod-with-http-healthcheck": &api.Pod{}, "service":                   &api.Service{}, "replication-controller":    &api.ReplicationController{}, </ins> }, }


var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ CrossNamespaceVolumeDataSource: {Default: false, PreRelease: featuregate.Alpha}, <ins> AllowServiceLBStatusOnNonLB: {Default: false, PreRelease: featuregate.Deprecated}, // remove after 1.29 </ins> AnyVolumeDataSource: {Default: true, PreRelease: featuregate.Beta}, // on by default in 1.24 APISelfSubjectReview: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.28; remove in 1.30


v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" storagev1 "k8s.io/api/storage/v1" <del> storagev1beta1 "k8s.io/api/storage/v1beta1" </del> apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema"


{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + service_cluster_ip_range + " " + terminated_pod_gc + " " + enable_garbage_collector + " " + cloud_provider  + " " + cloud_config + " " + service_account_key + " " + log_level + " " + root_ca_file -%} {% set params = params + " " + feature_gates -%} <ins> {% if pillar.get('enable_hostpath_provisioner', '').lower() == 'true' -%} {% set params = params + " --enable-hostpath-provisioner" %} {% endif -%} </ins> # test_args has to be kept at the end, so they'll overwrite any prior configuration {% if pillar['controller_manager_test_args'] is defined -%}


{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "Status", Type: "string", Description: "Status of the cluster"}, {Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]}, <ins> {Name: "Labels", Type: "string", Description: "The labels of the cluster"}, </ins> } h.TableHandler(clusterColumnDefinitions, printCluster) h.TableHandler(clusterColumnDefinitions, printClusterList)


"redis-sentinel-service":    &api.Service{}, }, "../examples/resourcequota": { <del> "resource-quota": &api.ResourceQuota{}, </del> <ins> "namespace": &api.Namespace{}, "limits":    &api.LimitRange{}, "quota":     &api.ResourceQuota{}, </ins> }, "../examples/rethinkdb": { "admin-pod":      &api.Pod{},


kube::test::get_object_assert deployment "{{range.items}}{{(index .spec.template.spec.containers 1).resources.limits.cpu}}:{{end}}" "300m:" kube::test::get_object_assert deployment "{{range.items}}{{(index .spec.template.spec.containers 1).resources.requests.cpu}}:{{end}}" "300m:" # Set limits on a local file without talking to the server <del> kubectl set resources -f hack/testdata/deployment-multicontainer.yaml -c=perl --limits=cpu=500m --requests=cpu=500m --dry-run -o yaml "${kube_flags[@]}" kubectl set resources deployment nginx-deployment -c=perl --limits=cpu=500m --requests=cpu=500m --dry-run -o yaml "${kube_flags[@]}" ! kubectl set resources deployment nginx-deployment -c=perl --limits=cpu=500m --requests=cpu=500m --local -o yaml "${kube_flags[@]}" </del> <ins> kubectl set resources deployment -f hack/testdata/deployment-multicontainer.yaml -c=perl --limits=cpu=300m --requests=cpu=300m --dry-run -o yaml "${kube_flags[@]}" </ins> kube::test::get_object_assert deployment "{{range.items}}{{(index .spec.template.spec.containers 0).resources.limits.cpu}}:{{end}}" "200m:" kube::test::get_object_assert deployment "{{range.items}}{{(index .spec.template.spec.containers 1).resources.limits.cpu}}:{{end}}" "300m:" kube::test::get_object_assert deployment "{{range.items}}{{(index .spec.template.spec.containers 1).resources.requests.cpu}}:{{end}}" "300m:"


// define volume limit to be 2 for this test var err error <del> init(testParameters{nodeSelectorKey: "node-attach-limit-csi", attachLimit: 2}) </del> <ins> nodeSelectorKey := fmt.Sprintf("attach-limit-csi-%s", f.Namespace.Name) init(testParameters{nodeSelectorKey: nodeSelectorKey, attachLimit: 2}) </ins> defer cleanup() nodeName := m.config.ClientNodeName attachKey := v1.ResourceName(volumeutil.GetCSIAttachLimitKey(m.provisioner))


// buildELBSecurityGroupList returns list of SecurityGroups which should be // attached to ELB created by a service. List always consist of at least <del> // 1 member which is an SG created for this service or a SG from the Global config. Extra groups can be // specified via annotation func (c *Cloud) buildELBSecurityGroupList(serviceName types.NamespacedName, loadBalancerName, annotation string) ([]string, error) { </del> <ins> // 1 member which is an SG created for this service or a SG from the Global config. // Extra groups can be specified via annotation, as can extra tags for any // new groups. func (c *Cloud) buildELBSecurityGroupList(serviceName types.NamespacedName, loadBalancerName string, annotations map[string]string) ([]string, error) { </ins> var err error var securityGroupID string


var _ = SIGDescribe("PriorityPidEvictionOrdering [Slow] [Serial] [Disruptive][NodeFeature:Eviction]", func() { f := framework.NewDefaultFramework("pidpressure-eviction-test") f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged <del> pressureTimeout := 2 * time.Minute </del> <ins> pressureTimeout := 3 * time.Minute </ins> expectedNodeCondition := v1.NodePIDPressure expectedStarvedResource := noStarvedResource


command: - /usr/local/bin/kube-proxy - --kubeconfig=/var/lib/kube-proxy/kubeconfig.conf <ins> {{ .ExtraParams }} </ins> {{ .ClusterCIDR }} securityContext: privileged: true


allErrs = append(allErrs, field.Forbidden(fldPath.Child("x-kubernetes-int-or-string"), "must be false to be structural")) } <ins> // forbid reasoning about metadata because it can lead to metadata restriction we don't want if _, found := v.Properties["metadata"]; found { allErrs = append(allErrs, field.Forbidden(fldPath.Child("properties").Key("metadata"), "must not be specified in a nested context")) } </ins> return allErrs }


} return false, nil, nil } <del> mockMetadataClient := metadatafake.NewSimpleMetadataClient(scheme.Scheme) </del> <ins> mockMetadataClient := metadatafake.NewSimpleMetadataClient(metadatafake.NewTestScheme()) </ins> mockMetadataClient.PrependReactor("delete-collection", "flakes", ns1FlakesNotFound) mockMetadataClient.PrependReactor("list", "flakes", ns1FlakesNotFound)


// This call is idempotent, and must not return an error if the sandbox has // already been removed. func (f *RemoteRuntime) RemovePodSandbox(ctx context.Context, req *kubeapi.RemovePodSandboxRequest) (*kubeapi.RemovePodSandboxResponse, error) { <del> err := f.RuntimeService.RemovePodSandbox(req.PodSandboxId) </del> <ins> err := f.RuntimeService.StopPodSandbox(req.PodSandboxId) </ins> if err != nil { return nil, err }


function config-ip-firewall { echo "Configuring IP firewall rules" # The GCI image has host firewall which drop most inbound/forwarded packets. <del> # We need to add rules to accept all TCP/UDP packets. </del> <ins> # We need to add rules to accept all TCP/UDP/ICMP packets. </ins> if iptables -L INPUT | grep "Chain INPUT (policy DROP)" > /dev/null; then <del> echo "Add rules to accept all inbound TCP/UDP packets" </del> <ins> echo "Add rules to accept all inbound TCP/UDP/ICMP packets" </ins> iptables -A INPUT -w -p TCP -j ACCEPT iptables -A INPUT -w -p UDP -j ACCEPT <ins> iptables -A INPUT -w -p ICMP -j ACCEPT </ins> fi if iptables -L FORWARD | grep "Chain FORWARD (policy DROP)" > /dev/null; then <del> echo "Add rules to accept all forwarded TCP/UDP packets" </del> <ins> echo "Add rules to accept all forwarded TCP/UDP/ICMP packets" </ins> iptables -A FORWARD -w -p TCP -j ACCEPT iptables -A FORWARD -w -p UDP -j ACCEPT <ins> iptables -A FORWARD -w -p ICMP -j ACCEPT </ins> fi }


return result, nil } <del> // logPluginScores adds summarized plugin score logging. The goal of this block is to show the highest scoring plugins on // each node, and the average score for those plugins across all nodes. func logPluginScores(nodes []*v1.Node, scoresMap framework.PluginToNodeScores, pod *v1.Pod) { totalPluginScores := make(map[string]int64) for j := range scoresMap { for i := range nodes { totalPluginScores[j] += scoresMap[j][i].Score } } // Build a map of Nodes->PluginScores on that node nodeToPluginScores := make(framework.PluginToNodeScores, len(nodes)) for _, node := range nodes { nodeToPluginScores[node.Name] = make(framework.NodeScoreList, len(scoresMap)) } // Convert the scoresMap (which contains Plugins->NodeScores) to the Nodes->PluginScores map for plugin, nodeScoreList := range scoresMap { for _, nodeScore := range nodeScoreList { klog.V(10).InfoS("Plugin scored node for pod", "pod", klog.KObj(pod), "plugin", plugin, "node", nodeScore.Name, "score", nodeScore.Score) nodeToPluginScores[nodeScore.Name] = append(nodeToPluginScores[nodeScore.Name], framework.NodeScore{Name: plugin, Score: nodeScore.Score}) } } for node, scores := range nodeToPluginScores { // Get the top 3 scoring plugins for each node sort.Slice(scores, func(i, j int) bool { return scores[i].Score > scores[j].Score }) var topScores []pluginScores for _, score := range scores { pluginScore := pluginScores{ Plugin:           score.Name, Score:            score.Score, AverageNodeScore: float64(totalPluginScores[score.Name]) / float64(len(nodes)), } topScores = append(topScores, pluginScore) if len(topScores) == 3 { break } } klog.InfoS("Top 3 plugins for pod on node", "pod", klog.KObj(pod), "node", node, "scores", topScores, ) } } </del> // NewGenericScheduler creates a genericScheduler object. func NewGenericScheduler( cache internalcache.Cache,


// Returns true if and only if changes were made // If the security group no longer exists, will return (false, nil) func (c *Cloud) removeSecurityGroupIngress(securityGroupID string, removePermissions []*ec2.IpPermission) (bool, error) { <ins> // We do not want to make changes to the Global defined SG if securityGroupID == c.cfg.Global.ElbSecurityGroup { return false, nil } </ins> group, err := c.findSecurityGroup(securityGroupID) if err != nil { glog.Warningf("Error retrieving security group: %q", err)


// pod stats api summarizes ephemeral storage usage (container, emptyDir, host[etc-hosts, logs]) podEphemeralStorageTotalUsage := &resource.Quantity{} <del> if podStats.EphemeralStorage != nil { </del> <ins> if podStats.EphemeralStorage != nil && podStats.EphemeralStorage.UsedBytes != nil { </ins> podEphemeralStorageTotalUsage = resource.NewQuantity(int64(*podStats.EphemeralStorage.UsedBytes), resource.BinarySI) } podEphemeralStorageLimit := podLimits[v1.ResourceEphemeralStorage]


if err != nil { klog.Warningf("error looking for nvme volume %q: %v", volumeID, err) } else if nvmePath != "" { <ins> if partition != "" { nvmePath = nvmePath + nvmeDiskPartitionSuffix + partition } </ins> devicePaths = append(devicePaths, nvmePath) } }


// back to the caller. in.Spec.InitContainers = values // Call defaulters explicitly until annotations are removed <del> for i := range in.Spec.InitContainers { c := &in.Spec.InitContainers[i] SetDefaults_Container(c) </del> <ins> tmpPod := &Pod{ Spec: PodSpec{ HostNetwork:    in.Spec.HostNetwork, InitContainers: values, }, </ins> } <ins> SetObjectDefaults_Pod(tmpPod) in.Spec.InitContainers = tmpPod.Spec.InitContainers </ins> } // If there is a beta annotation, copy to alpha key. // See commit log for PR #31026 for why we do this.


t.Errorf("%s: expect no error when applying json patch, but got %v", test.name, err) continue } <del> if err.Error() != test.expectedError { </del> <ins> if !strings.Contains(err.Error(), test.expectedError) { </ins> t.Errorf("%s: expected error %v, but got %v", test.name, test.expectedError, err) } if test.expectedErrorType != apierrors.ReasonForError(err) {


discoveryv1beta1 "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" <ins> "k8s.io/apimachinery/pkg/runtime/schema" </ins> "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets"


return nil, "", "", err } <del> testSocketFile := filepath.Join(volpath, "mount_test.sock") _, err := net.Listen("unix", testSocketFile) return mounts, volpath, testSocketFile, err </del> <ins> socketFile, socketCreateError := createSocketFile(volpath) return mounts, volpath, socketFile, socketCreateError </ins> }, expectError: false, },


const ( gcePDDetachTimeout  = 10 * time.Minute gcePDDetachPollTime = 10 * time.Second <del> nodeStatusTimeout   = 5 * time.Minute </del> <ins> nodeStatusTimeout   = 10 * time.Minute </ins> nodeStatusPollTime  = 1 * time.Second maxReadRetry        = 3 )


Description: The discovery.k8s.io API group MUST exist in the /apis discovery document. The discovery.k8s.io/v1 API group/version MUST exist in the /apis/discovery.k8s.io discovery document. The endpointslices resource MUST exist in the /apis/discovery.k8s.io/v1 discovery document. <del> API Server should create self referential Endpoints and EndpointSlices named "kubernetes" in the default namespace. </del> <ins> The cluster MUST have a service named "kubernetes" on the default namespace referencing the API servers. The "kubernetes.default" service MUST have Endpoints and EndpointSlices pointing to each API server instance. </ins> */ framework.ConformanceIt("should have Endpoints and EndpointSlices pointing to API Server", func() { namespace := "default" name := "kubernetes" <ins> // verify "kubernetes.default" service exist _, err := cs.CoreV1().Services(namespace).Get(context.TODO(), name, metav1.GetOptions{}) framework.ExpectNoError(err, "error obtaining API server "kubernetes" Service resource on "default" namespace") // verify Endpoints for the API servers exist </ins> endpoints, err := cs.CoreV1().Endpoints(namespace).Get(context.TODO(), name, metav1.GetOptions{}) <del> framework.ExpectNoError(err, "error creating Endpoints resource") if len(endpoints.Subsets) != 1 { framework.Failf("Expected 1 subset in endpoints, got %d: %#v", len(endpoints.Subsets), endpoints.Subsets) </del> <ins> framework.ExpectNoError(err, "error obtaining API server "kubernetes" Endpoint resource on "default" namespace") if len(endpoints.Subsets) == 0 { framework.Failf("Expected at least 1 subset in endpoints, got %d: %#v", len(endpoints.Subsets), endpoints.Subsets) </ins> } <del> endpointSubset := endpoints.Subsets[0] endpointSlice, err := cs.DiscoveryV1().EndpointSlices(namespace).Get(context.TODO(), name, metav1.GetOptions{}) framework.ExpectNoError(err, "error creating EndpointSlice resource") if len(endpointSlice.Ports) != len(endpointSubset.Ports) { framework.Failf("Expected EndpointSlice to have %d ports, got %d: %#v", len(endpointSubset.Ports), len(endpointSlice.Ports), endpointSlice.Ports) </del> <ins> // verify EndpointSlices for the API servers exist endpointSliceList, err := cs.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), metav1.ListOptions{ LabelSelector: "kubernetes.io/service-name=" + name, }) framework.ExpectNoError(err, "error obtaining API server "kubernetes" EndpointSlice resource on "default" namespace") if len(endpointSliceList.Items) == 0 { framework.Failf("Expected at least 1 EndpointSlice, got %d: %#v", len(endpoints.Subsets), endpoints.Subsets) </ins> } <del> numExpectedEndpoints := len(endpointSubset.Addresses) + len(endpointSubset.NotReadyAddresses) if len(endpointSlice.Endpoints) != numExpectedEndpoints { framework.Failf("Expected EndpointSlice to have %d endpoints, got %d: %#v", numExpectedEndpoints, len(endpointSlice.Endpoints), endpointSlice.Endpoints) </del> <ins> if !endpointSlicesEqual(endpoints, endpointSliceList) { framework.Failf("Expected EndpointSlice to have same addresses and port as Endpoints, got %#v: %#v", endpoints, endpointSliceList) </ins> } })