mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #22210 from janetkuo/deployment-e2e
Auto commit by PR queue bot
This commit is contained in:
commit
5b415a7aed
@ -743,7 +743,7 @@ func setNewReplicaSetAnnotations(deployment *extensions.Deployment, rs *extensio
|
|||||||
if rs.Annotations[deploymentutil.RevisionAnnotation] != newRevision {
|
if rs.Annotations[deploymentutil.RevisionAnnotation] != newRevision {
|
||||||
rs.Annotations[deploymentutil.RevisionAnnotation] = newRevision
|
rs.Annotations[deploymentutil.RevisionAnnotation] = newRevision
|
||||||
annotationChanged = true
|
annotationChanged = true
|
||||||
glog.V(4).Infof("updating replica set %q's revision to %s - %+v\n", rs.Name, newRevision)
|
glog.V(4).Infof("updating replica set %q's revision to %s - %+v\n", rs.Name, newRevision, rs)
|
||||||
}
|
}
|
||||||
return annotationChanged
|
return annotationChanged
|
||||||
}
|
}
|
||||||
|
@ -239,65 +239,6 @@ func resizeRC(c *client.Client, ns, name string, replicas int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func podsCreated(c *client.Client, ns, name string, replicas int) (*api.PodList, error) {
|
|
||||||
timeout := 2 * time.Minute
|
|
||||||
// List the pods, making sure we observe all the replicas.
|
|
||||||
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
|
|
||||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(5 * time.Second) {
|
|
||||||
options := api.ListOptions{LabelSelector: label}
|
|
||||||
pods, err := c.Pods(ns).List(options)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
created := []api.Pod{}
|
|
||||||
for _, pod := range pods.Items {
|
|
||||||
if pod.DeletionTimestamp != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
created = append(created, pod)
|
|
||||||
}
|
|
||||||
Logf("Pod name %s: Found %d pods out of %d", name, len(created), replicas)
|
|
||||||
|
|
||||||
if len(created) == replicas {
|
|
||||||
pods.Items = created
|
|
||||||
return pods, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("Pod name %s: Gave up waiting %v for %d pods to come up", name, timeout, replicas)
|
|
||||||
}
|
|
||||||
|
|
||||||
func podsRunning(c *client.Client, pods *api.PodList) []error {
|
|
||||||
// Wait for the pods to enter the running state. Waiting loops until the pods
|
|
||||||
// are running so non-running pods cause a timeout for this test.
|
|
||||||
By("ensuring each pod is running")
|
|
||||||
e := []error{}
|
|
||||||
for _, pod := range pods.Items {
|
|
||||||
// TODO: make waiting parallel.
|
|
||||||
err := waitForPodRunningInNamespace(c, pod.Name, pod.Namespace)
|
|
||||||
if err != nil {
|
|
||||||
e = append(e, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
func verifyPods(c *client.Client, ns, name string, wantName bool, replicas int) error {
|
|
||||||
pods, err := podsCreated(c, ns, name, replicas)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
e := podsRunning(c, pods)
|
|
||||||
if len(e) > 0 {
|
|
||||||
return fmt.Errorf("failed to wait for pods running: %v", e)
|
|
||||||
}
|
|
||||||
err = podsResponding(c, ns, name, wantName, pods)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to wait for pods responding: %v", err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMaster(c *client.Client) string {
|
func getMaster(c *client.Client) string {
|
||||||
master := ""
|
master := ""
|
||||||
switch testContext.Provider {
|
switch testContext.Provider {
|
||||||
|
@ -1159,6 +1159,65 @@ func podsResponding(c *client.Client, ns, name string, wantName bool, pods *api.
|
|||||||
return wait.PollImmediate(poll, podRespondingTimeout, podProxyResponseChecker{c, ns, label, name, wantName, pods}.checkAllResponses)
|
return wait.PollImmediate(poll, podRespondingTimeout, podProxyResponseChecker{c, ns, label, name, wantName, pods}.checkAllResponses)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func podsCreated(c *client.Client, ns, name string, replicas int) (*api.PodList, error) {
|
||||||
|
timeout := 2 * time.Minute
|
||||||
|
// List the pods, making sure we observe all the replicas.
|
||||||
|
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
|
||||||
|
for start := time.Now(); time.Since(start) < timeout; time.Sleep(5 * time.Second) {
|
||||||
|
options := api.ListOptions{LabelSelector: label}
|
||||||
|
pods, err := c.Pods(ns).List(options)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
created := []api.Pod{}
|
||||||
|
for _, pod := range pods.Items {
|
||||||
|
if pod.DeletionTimestamp != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
created = append(created, pod)
|
||||||
|
}
|
||||||
|
Logf("Pod name %s: Found %d pods out of %d", name, len(created), replicas)
|
||||||
|
|
||||||
|
if len(created) == replicas {
|
||||||
|
pods.Items = created
|
||||||
|
return pods, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("Pod name %s: Gave up waiting %v for %d pods to come up", name, timeout, replicas)
|
||||||
|
}
|
||||||
|
|
||||||
|
func podsRunning(c *client.Client, pods *api.PodList) []error {
|
||||||
|
// Wait for the pods to enter the running state. Waiting loops until the pods
|
||||||
|
// are running so non-running pods cause a timeout for this test.
|
||||||
|
By("ensuring each pod is running")
|
||||||
|
e := []error{}
|
||||||
|
for _, pod := range pods.Items {
|
||||||
|
// TODO: make waiting parallel.
|
||||||
|
err := waitForPodRunningInNamespace(c, pod.Name, pod.Namespace)
|
||||||
|
if err != nil {
|
||||||
|
e = append(e, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
func verifyPods(c *client.Client, ns, name string, wantName bool, replicas int) error {
|
||||||
|
pods, err := podsCreated(c, ns, name, replicas)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
e := podsRunning(c, pods)
|
||||||
|
if len(e) > 0 {
|
||||||
|
return fmt.Errorf("failed to wait for pods running: %v", e)
|
||||||
|
}
|
||||||
|
err = podsResponding(c, ns, name, wantName, pods)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to wait for pods responding: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func serviceResponding(c *client.Client, ns, name string) error {
|
func serviceResponding(c *client.Client, ns, name string) error {
|
||||||
By(fmt.Sprintf("trying to dial the service %s.%s via the proxy", ns, name))
|
By(fmt.Sprintf("trying to dial the service %s.%s via the proxy", ns, name))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user