// svcFromManifest reads a .json/yaml file and returns the rc in it. func svcFromManifest(fileName string) *api.Service { var svc api.Service framework.Logf("Parsing service from %v", fileName) data := framework.ReadOrDie(fileName) json, err := utilyaml.ToJSON(data) Expect(err).NotTo(HaveOccurred()) Expect(runtime.DecodeInto(api.Codecs.UniversalDecoder(), json, &svc)).NotTo(HaveOccurred()) return &svc }
// rcFromManifest reads a .json/yaml file and returns the rc in it. func rcFromManifest(fileName string) *api.ReplicationController { var controller api.ReplicationController framework.Logf("Parsing rc from %v", fileName) data := framework.ReadOrDie(fileName) json, err := utilyaml.ToJSON(data) Expect(err).NotTo(HaveOccurred()) Expect(runtime.DecodeInto(api.Codecs.UniversalDecoder(), json, &controller)).NotTo(HaveOccurred()) return &controller }
nodeName := pod.Spec.NodeName By("Explicitly delete pod here to free the resource it takes.") err = c.Pods(ns).Delete(podName, api.NewDeleteOptions(0)) framework.ExpectNoError(err) By("Trying to apply a label with fake az info on the found node.") k := "kubernetes.io/e2e-az-name" v := "e2e-az1" framework.AddOrUpdateLabelOnNode(c, nodeName, k, v) framework.ExpectNodeHasLabel(c, nodeName, k, v) defer framework.RemoveLabelOffNode(c, nodeName, k) By("Trying to launch a pod that with NodeAffinity setting as embedded JSON string in the annotation value.") labelPodName := "with-labels" testPodPath := string(framework.ReadOrDie("test/e2e/testing-manifests/node-selection/pod-with-node-affinity.yaml")) framework.RunKubectlOrDie("create", "-f", testPodPath, fmt.Sprintf("--namespace=%v", ns)) // check that pod got scheduled. We intentionally DO NOT check that the // pod is running because this will create a race condition with the // kubelet and the scheduler: the scheduler might have scheduled a pod // already when the kubelet does not know about its new label yet. The // kubelet will then refuse to launch the pod. framework.ExpectNoError(framework.WaitForPodNotPending(c, ns, labelPodName, "")) labelPod, err := c.Pods(ns).Get(labelPodName) framework.ExpectNoError(err) Expect(labelPod.Spec.NodeName).To(Equal(nodeName)) }) // labelSelector Operator is DoesNotExist but values are there in requiredDuringSchedulingIgnoredDuringExecution // part of podAffinity,so validation fails.