func SetDefaults_ServiceSpec(obj *ServiceSpec) { if obj.SessionAffinity == "" { obj.SessionAffinity = ServiceAffinityNone } if obj.Type == "" { obj.Type = ServiceTypeClusterIP } for i := range obj.Ports { sp := &obj.Ports[i] if sp.Protocol == "" { sp.Protocol = ProtocolTCP } if sp.TargetPort == intstr.FromInt(0) || sp.TargetPort == intstr.FromString("") { sp.TargetPort = intstr.FromInt(int(sp.Port)) } } }
var _ = framework.KubeDescribe("DisruptionController", func() { f := framework.NewDefaultFramework("disruption") var ns string var cs *release_1_4.Clientset BeforeEach(func() { // skip on GKE since alpha features are disabled framework.SkipIfProviderIs("gke") cs = f.StagingClient ns = f.Namespace.Name }) It("should create a PodDisruptionBudget", func() { createPodDisruptionBudgetOrDie(cs, ns, intstr.FromString("1%")) }) It("should update PodDisruptionBudget status", func() { createPodDisruptionBudgetOrDie(cs, ns, intstr.FromInt(2)) createPodsOrDie(cs, ns, 2) // Since disruptionAllowed starts out false, if we see it ever become true, // that means the controller is working. err := wait.PollImmediate(framework.Poll, 60*time.Second, func() (bool, error) { pdb, err := cs.Policy().PodDisruptionBudgets(ns).Get("foo") if err != nil { return false, err } return pdb.Status.PodDisruptionAllowed, nil
var _ = framework.KubeDescribe("DisruptionController", func() { f := framework.NewDefaultFramework("disruption") var ns string var cs *release_1_4.Clientset BeforeEach(func() { // skip on GKE since alpha features are disabled framework.SkipIfProviderIs("gke") cs = f.StagingClient ns = f.Namespace.Name }) It("should create a PodDisruptionBudget", func() { createPodDisruptionBudgetOrDie(cs, ns, intstr.FromString("1%")) }) It("should update PodDisruptionBudget status", func() { createPodDisruptionBudgetOrDie(cs, ns, intstr.FromInt(2)) createPodsOrDie(cs, ns, 2) // Since disruptionAllowed starts out false, if we see it ever become true, // that means the controller is working. err := wait.PollImmediate(framework.Poll, timeout, func() (bool, error) { pdb, err := cs.Policy().PodDisruptionBudgets(ns).Get("foo") if err != nil { return false, err } return pdb.Status.PodDisruptionAllowed, nil
var cs *release_1_4.Clientset BeforeEach(func() { cs = f.StagingClient ns = f.Namespace.Name }) It("should create a PodDisruptionBudget", func() { pdb := policy.PodDisruptionBudget{ ObjectMeta: api.ObjectMeta{ Name: "foo", Namespace: ns, }, Spec: policy.PodDisruptionBudgetSpec{ Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, MinAvailable: intstr.FromString("1%"), }, } _, err := cs.Policy().PodDisruptionBudgets(ns).Create(&pdb) Expect(err).NotTo(HaveOccurred()) }) It("should update PodDisruptionBudget status", func() { pdb := policy.PodDisruptionBudget{ ObjectMeta: api.ObjectMeta{ Name: "foo", Namespace: ns, }, Spec: policy.PodDisruptionBudgetSpec{ Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, MinAvailable: intstr.FromInt(2),