From 5fe47770a0260cf40f7116db3c189e4869dd96cb Mon Sep 17 00:00:00 2001 From: Jesse Suen Date: Thu, 7 Nov 2019 21:25:15 -0800 Subject: [PATCH] Show running jobs as part of analysis runs. Fix degraded check to consider experiment/analysis steps (#278) --- pkg/kubectl-argo-rollouts/cmd/get/get.go | 1 + .../cmd/get/get_experiment.go | 5 +- .../cmd/get/get_rollout.go | 13 ++- pkg/kubectl-argo-rollouts/cmd/get/get_test.go | 49 +++++++++ .../info/analysisrun_info.go | 25 +++++ .../testdata/experiment-step/canary-demo.yaml | 81 ++++++++++++++ .../canary-exp-analysis-job-pod.yaml | 104 ++++++++++++++++++ .../canary-exp-analysis-job.yaml | 63 +++++++++++ .../experiment-step/canary-exp-analysis.yaml | 52 +++++++++ .../experiment-step/canary-exp-pod.yaml | 97 ++++++++++++++++ .../experiment-step/canary-exp-rs.yaml | 57 ++++++++++ .../testdata/experiment-step/canary-exp.yaml | 78 +++++++++++++ .../testdata/experiment-step/canary-rs.yaml | 58 ++++++++++ .../testdata/experiment-step/stable-pod1.yaml | 97 ++++++++++++++++ .../testdata/experiment-step/stable-pod2.yaml | 97 ++++++++++++++++ .../testdata/experiment-step/stable-pod3.yaml | 97 ++++++++++++++++ .../testdata/experiment-step/stable-pod4.yaml | 97 ++++++++++++++++ .../testdata/experiment-step/stable-pod5.yaml | 97 ++++++++++++++++ .../testdata/experiment-step/stable-rs.yaml | 61 ++++++++++ .../info/testdata/testdata.go | 9 ++ rollout/sync.go | 11 +- utils/analysis/helpers.go | 1 + utils/replicaset/canary.go | 2 +- 23 files changed, 1244 insertions(+), 8 deletions(-) create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-demo.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job-pod.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-pod.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-rs.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-rs.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod1.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod2.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod3.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod4.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod5.yaml create mode 100644 pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-rs.yaml diff --git a/pkg/kubectl-argo-rollouts/cmd/get/get.go b/pkg/kubectl-argo-rollouts/cmd/get/get.go index e14578770c..6c3e9ab372 100644 --- a/pkg/kubectl-argo-rollouts/cmd/get/get.go +++ b/pkg/kubectl-argo-rollouts/cmd/get/get.go @@ -43,6 +43,7 @@ const ( IconRevision = "#" IconReplicaSet = "⧉" IconPod = "□" + IconJob = "⊞" IconService = "⑃" // other options: ⋲ ⇶ ⋔ ⤨ IconExperiment = "Σ" // other options: ꀀ ⋃ ⨄ IconAnalysis = "α" // other options: ⚯ diff --git a/pkg/kubectl-argo-rollouts/cmd/get/get_experiment.go b/pkg/kubectl-argo-rollouts/cmd/get/get_experiment.go index 10106d492f..b0ada32b0b 100644 --- a/pkg/kubectl-argo-rollouts/cmd/get/get_experiment.go +++ b/pkg/kubectl-argo-rollouts/cmd/get/get_experiment.go @@ -125,9 +125,8 @@ func (o *GetOptions) PrintExperimentInfo(w io.Writer, expInfo info.ExperimentInf curr++ } for _, arInfo := range expInfo.AnalysisRuns { - fmt.Fprintf(w, subpfx) - arPrefix, _ := getPrefixes(curr == total-1, "") - o.PrintAnalysisRunInfo(w, arInfo, arPrefix, "") + arPrefix, arChildPrefix := getPrefixes(curr == total-1, subpfx) + o.PrintAnalysisRunInfo(w, arInfo, arPrefix, arChildPrefix) curr++ } } diff --git a/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go b/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go index 5a6aae56e6..d5ace07061 100644 --- a/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go +++ b/pkg/kubectl-argo-rollouts/cmd/get/get_rollout.go @@ -184,9 +184,8 @@ func (o *GetOptions) PrintReplicaSetInfo(w io.Writer, rsInfo info.ReplicaSetInfo } fmt.Fprintf(w, "%s%s %s\t%s\t%s %s\t%s\t%v\n", prefix, IconReplicaSet, name, "ReplicaSet", o.colorize(rsInfo.Icon), rsInfo.Status, rsInfo.Age(), strings.Join(infoCols, ",")) for i, podInfo := range rsInfo.Pods { - fmt.Fprintf(w, subpfx) isLast := i == len(rsInfo.Pods)-1 - podPrefix, _ := getPrefixes(isLast, "") + podPrefix, _ := getPrefixes(isLast, subpfx) podInfoCol := []string{fmt.Sprintf("ready:%s", podInfo.Ready)} if podInfo.Restarts > 0 { podInfoCol = append(podInfoCol, fmt.Sprintf("restarts:%d", podInfo.Restarts)) @@ -211,4 +210,14 @@ func (o *GetOptions) PrintAnalysisRunInfo(w io.Writer, arInfo info.AnalysisRunIn infoCols = append(infoCols, fmt.Sprintf("%s %d", o.colorize(info.IconWarning), arInfo.Error)) } fmt.Fprintf(w, "%s%s %s\t%s\t%s %s\t%s\t%v\n", prefix, IconAnalysis, name, "AnalysisRun", o.colorize(arInfo.Icon), arInfo.Status, arInfo.Age(), strings.Join(infoCols, ",")) + for i, jobInfo := range arInfo.Jobs { + isLast := i == len(arInfo.Jobs)-1 + jobPrefix, jobChildPrefix := getPrefixes(isLast, subpfx) + o.PrintJob(w, jobInfo, jobPrefix, jobChildPrefix) + } +} + +func (o *GetOptions) PrintJob(w io.Writer, jobInfo info.JobInfo, prefix string, subpfx string) { + name := o.colorizeStatus(jobInfo.Name, jobInfo.Status) + fmt.Fprintf(w, "%s%s %s\t%s\t%s %s\t%s\t%v\n", prefix, IconJob, name, "Job", o.colorize(jobInfo.Icon), jobInfo.Status, jobInfo.Age(), "") } diff --git a/pkg/kubectl-argo-rollouts/cmd/get/get_test.go b/pkg/kubectl-argo-rollouts/cmd/get/get_test.go index af46c25917..0ea54af862 100644 --- a/pkg/kubectl-argo-rollouts/cmd/get/get_test.go +++ b/pkg/kubectl-argo-rollouts/cmd/get/get_test.go @@ -260,3 +260,52 @@ NAME KIND `, "\n") assertStdout(t, expectedOut, o.IOStreams) } + +func TestGetRolloutWithExperimentJob(t *testing.T) { + rolloutObjs := testdata.NewExperimentAnalysisJobRollout() + + tf, o := options.NewFakeArgoRolloutsOptions(rolloutObjs.AllObjects()...) + o.RESTClientGetter = tf.WithNamespace(rolloutObjs.Rollouts[0].Namespace) + defer tf.Cleanup() + cmd := NewCmdGetRollout(o) + cmd.PersistentPreRunE = o.PersistentPreRunE + cmd.SetArgs([]string{rolloutObjs.Rollouts[0].Name, "--no-color"}) + err := cmd.Execute() + assert.NoError(t, err) + + expectedOut := strings.TrimPrefix(` +Name: canary-demo +Namespace: jesse-test +Status: ◌ Progressing +Strategy: Canary + Step: 0/1 + SetWeight: 0 + ActualWeight: 0 +Images: argoproj/rollouts-demo:blue (Σ:canary-preview) + argoproj/rollouts-demo:green (stable) +Replicas: + Desired: 5 + Current: 5 + Updated: 0 + Ready: 5 + Available: 5 + +NAME KIND STATUS AGE INFO +⟳ canary-demo Rollout ◌ Progressing 7d +├──# revision:2 +│ ├──⧉ canary-demo-645d5dbc4c ReplicaSet • ScaledDown 7d canary +│ └──Σ canary-demo-645d5dbc4c-2-0 Experiment ◌ Running 7d +│ ├──⧉ canary-demo-645d5dbc4c-2-0-canary-preview ReplicaSet ✔ Healthy 7d +│ │ └──□ canary-demo-645d5dbc4c-2-0-canary-preview-zmmvz Pod ✔ Running 7d ready:1/1 +│ └──α canary-demo-645d5dbc4c-2-0-stress-test AnalysisRun ◌ Running 7d +│ └──⊞ 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 Job ◌ Running 7d +└──# revision:1 + └──⧉ canary-demo-877894d5b ReplicaSet ✔ Healthy 7d stable + ├──□ canary-demo-877894d5b-n6xqz Pod ✔ Running 7d ready:1/1 + ├──□ canary-demo-877894d5b-nlmj9 Pod ✔ Running 7d ready:1/1 + ├──□ canary-demo-877894d5b-txgs5 Pod ✔ Running 7d ready:1/1 + ├──□ canary-demo-877894d5b-wfqqr Pod ✔ Running 7d ready:1/1 + └──□ canary-demo-877894d5b-zhh6x Pod ✔ Running 7d ready:1/1 +`, "\n") + assertStdout(t, expectedOut, o.IOStreams) +} diff --git a/pkg/kubectl-argo-rollouts/info/analysisrun_info.go b/pkg/kubectl-argo-rollouts/info/analysisrun_info.go index cdbe391135..bea1c72278 100644 --- a/pkg/kubectl-argo-rollouts/info/analysisrun_info.go +++ b/pkg/kubectl-argo-rollouts/info/analysisrun_info.go @@ -5,7 +5,9 @@ import ( "k8s.io/apimachinery/pkg/types" + "github.com/argoproj/argo-rollouts/metricproviders/job" "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1" + analysisutil "github.com/argoproj/argo-rollouts/utils/analysis" ) type AnalysisRunInfo struct { @@ -17,6 +19,13 @@ type AnalysisRunInfo struct { Failed int32 Inconclusive int32 Error int32 + Jobs []JobInfo +} + +type JobInfo struct { + Metadata + Status string + Icon string } func getAnalysisRunInfo(ownerUID types.UID, allAnalysisRuns []*v1alpha1.AnalysisRun) []AnalysisRunInfo { @@ -39,6 +48,22 @@ func getAnalysisRunInfo(ownerUID types.UID, allAnalysisRuns []*v1alpha1.Analysis arInfo.Failed += mr.Failed arInfo.Inconclusive += mr.Inconclusive arInfo.Error += mr.Error + lastMeasurement := analysisutil.LastMeasurement(run, mr.Name) + if lastMeasurement != nil && lastMeasurement.Metadata != nil && lastMeasurement.Phase != v1alpha1.AnalysisPhaseSuccessful { + if jobName, ok := lastMeasurement.Metadata[job.JobNameKey]; ok { + jobInfo := JobInfo{ + Metadata: Metadata{ + Name: jobName, + }, + Icon: analysisIcon(lastMeasurement.Phase), + Status: string(lastMeasurement.Phase), + } + if lastMeasurement.StartedAt != nil { + jobInfo.CreationTimestamp = *lastMeasurement.StartedAt + } + arInfo.Jobs = append(arInfo.Jobs, jobInfo) + } + } } arInfo.Icon = analysisIcon(run.Status.Phase) arInfo.Revision = parseRevision(run.ObjectMeta.Annotations) diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-demo.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-demo.yaml new file mode 100644 index 0000000000..57007defab --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-demo.yaml @@ -0,0 +1,81 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"argoproj.io/v1alpha1","kind":"Rollout","metadata":{"annotations":{},"name":"canary-demo","namespace":"jesse-test"},"spec":{"replicas":5,"revisionHistoryLimit":3,"selector":{"matchLabels":{"app":"canary-demo"}},"strategy":{"canary":{"steps":[{"experiment":{"analyses":[{"name":"stress-test","templateName":"stress-test"}],"templates":[{"metadata":{"labels":{"app":"rollout-canary-preview"}},"name":"canary-preview","selector":{"matchLabels":{"app":"rollout-canary-preview"}},"specRef":"canary"}]}}]}},"template":{"metadata":{"labels":{"app":"canary-demo"}},"spec":{"containers":[{"image":"argoproj/rollouts-demo:blue","imagePullPolicy":"Always","name":"canary-demo","ports":[{"containerPort":8080,"name":"http","protocol":"TCP"}],"resources":{"requests":{"cpu":"5m","memory":"32Mi"}}}]}}}} + rollout.argoproj.io/revision: "2" + creationTimestamp: "2019-11-07T22:38:03Z" + generation: 13 + name: canary-demo + namespace: jesse-test + resourceVersion: "33430711" + selfLink: /apis/argoproj.io/v1alpha1/namespaces/jesse-test/rollouts/canary-demo + uid: 42b19359-01af-11ea-b38c-42010aa80083 +spec: + replicas: 5 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: canary-demo + strategy: + canary: + steps: + - experiment: + analyses: + - name: stress-test + templateName: stress-test + templates: + - metadata: + labels: + app: rollout-canary-preview + name: canary-preview + selector: + matchLabels: + app: rollout-canary-preview + specRef: canary + template: + metadata: + creationTimestamp: null + labels: + app: canary-demo + spec: + containers: + - image: argoproj/rollouts-demo:blue + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi +status: + HPAReplicas: 5 + availableReplicas: 5 + blueGreen: {} + canary: + currentExperiment: canary-demo-645d5dbc4c-2-0 + stableRS: 877894d5b + conditions: + - lastTransitionTime: "2019-11-07T22:38:11Z" + lastUpdateTime: "2019-11-07T22:38:11Z" + message: Rollout has minimum availability + reason: AvailableReason + status: "True" + type: Available + - lastTransitionTime: "2019-11-07T22:38:03Z" + lastUpdateTime: "2019-11-07T22:38:18Z" + message: Created new replica set "canary-demo-645d5dbc4c" + reason: NewReplicaSetCreated + status: "True" + type: Progressing + currentPodHash: 645d5dbc4c + currentStepHash: 7d595679dd + currentStepIndex: 0 + observedGeneration: 7664c98448 + readyReplicas: 5 + replicas: 5 + selector: app=canary-demo diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job-pod.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job-pod.yaml new file mode 100644 index 0000000000..ea19dac3fe --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job-pod.yaml @@ -0,0 +1,104 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:23Z" + generateName: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1- + labels: + controller-uid: 4e309601-01af-11ea-b38c-42010aa80083 + job-name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1-lsrws + namespace: jesse-test + ownerReferences: + - apiVersion: batch/v1 + blockOwnerDeletion: true + controller: true + kind: Job + name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + uid: 4e309601-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430818" + selfLink: /api/v1/namespaces/jesse-test/pods/4e2d824d-01af-11ea-b38c-42010aa80083.stress.1-lsrws + uid: 4e340a3d-01af-11ea-b38c-42010aa80083 +spec: + containers: + - command: + - wrk + - -t12 + - -c100 + - -d30s + - http://canary-demo-preview/color] + image: williamyeh/wrk + imagePullPolicy: Always + name: stress + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-g3kx + priority: 0 + restartPolicy: Never + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:23Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:27Z" + message: 'containers with unready status: [stress]' + reason: ContainersNotReady + status: "False" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:27Z" + message: 'containers with unready status: [stress]' + reason: ContainersNotReady + status: "False" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:23Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://ea0f9d5abffb5a3d608d45702caed64f11a6864828f4dfb173f31a2a5e19c70e + image: williamyeh/wrk:latest + imageID: docker-pullable://williamyeh/wrk@sha256:78adc0d9d51a99e6759e702a08d03eaece81c890ffcc9790ef9e5b199d54f091 + lastState: {} + name: stress + ready: false + restartCount: 0 + state: + terminated: + containerID: docker://ea0f9d5abffb5a3d608d45702caed64f11a6864828f4dfb173f31a2a5e19c70e + exitCode: 1 + finishedAt: "2019-11-07T22:38:26Z" + reason: Error + startedAt: "2019-11-07T22:38:25Z" + hostIP: 10.168.0.26 + phase: Failed + podIP: 10.16.3.136 + qosClass: BestEffort + startTime: "2019-11-07T22:38:23Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job.yaml new file mode 100644 index 0000000000..9fda0d4c50 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis-job.yaml @@ -0,0 +1,63 @@ +apiVersion: batch/v1 +kind: Job +metadata: + annotations: + analysisrun.argoproj.io/metric-name: stress + analysisrun.argoproj.io/name: canary-demo-645d5dbc4c-2-0-stress-test + creationTimestamp: "2019-11-07T22:38:23Z" + labels: + analysisrun.argoproj.io/uid: 4e2d824d-01af-11ea-b38c-42010aa80083 + name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: AnalysisRun + name: canary-demo-645d5dbc4c-2-0-stress-test + uid: 4e2d824d-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430820" + selfLink: /apis/batch/v1/namespaces/jesse-test/jobs/4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + uid: 4e309601-01af-11ea-b38c-42010aa80083 +spec: + backoffLimit: 0 + completions: 1 + parallelism: 1 + selector: + matchLabels: + controller-uid: 4e309601-01af-11ea-b38c-42010aa80083 + template: + metadata: + creationTimestamp: null + labels: + controller-uid: 4e309601-01af-11ea-b38c-42010aa80083 + job-name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + spec: + containers: + - command: + - wrk + - -t12 + - -c100 + - -d30s + - http://canary-demo-preview/color] + image: williamyeh/wrk + imagePullPolicy: Always + name: stress + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + conditions: + - lastProbeTime: "2019-11-07T22:38:27Z" + lastTransitionTime: "2019-11-07T22:38:27Z" + message: Job has reached the specified backoff limit + reason: BackoffLimitExceeded + status: "True" + type: Failed + failed: 1 + startTime: "2019-11-07T22:38:23Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis.yaml new file mode 100644 index 0000000000..c7277ec6ab --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-analysis.yaml @@ -0,0 +1,52 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AnalysisRun +metadata: + creationTimestamp: "2019-11-07T22:38:23Z" + generation: 2 + name: canary-demo-645d5dbc4c-2-0-stress-test + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: Experiment + name: canary-demo-645d5dbc4c-2-0 + uid: 4bef10a5-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430775" + selfLink: /apis/argoproj.io/v1alpha1/namespaces/jesse-test/analysisruns/canary-demo-645d5dbc4c-2-0-stress-test + uid: 4e2d824d-01af-11ea-b38c-42010aa80083 +spec: + analysisSpec: + metrics: + - name: stress + provider: + job: + metadata: + creationTimestamp: null + spec: + backoffLimit: 0 + template: + metadata: + creationTimestamp: null + spec: + containers: + - command: + - wrk + - -t12 + - -c100 + - -d30s + - http://canary-demo-preview/color] + image: williamyeh/wrk + name: stress + resources: {} + restartPolicy: Never +status: + metricResults: + - measurements: + - metadata: + job-name: 4e2d824d-01af-11ea-b38c-42010aa80083.stress.1 + phase: Running + startedAt: "2019-11-07T22:38:22Z" + name: stress + phase: Running + phase: Running diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-pod.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-pod.yaml new file mode 100644 index 0000000000..5e1ff55cb0 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-pod.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:19Z" + generateName: canary-demo-645d5dbc4c-2-0-canary-preview- + labels: + app: rollout-canary-preview + rollouts-pod-template-hash: 645d5dbc4c + name: canary-demo-645d5dbc4c-2-0-canary-preview-zmmvz + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-645d5dbc4c-2-0-canary-preview + uid: 4bf4518c-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430760" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-645d5dbc4c-2-0-canary-preview-zmmvz + uid: 4bfe52c5-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:blue + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-0l5h + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:19Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:22Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:22Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:19Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://56d95a9a9ba9ab750a94a8c50287d6c8690d6585393a9bcbecc0e46e508b15bd + image: argoproj/rollouts-demo:blue + imageID: docker-pullable://argoproj/rollouts-demo@sha256:67759c03ff4a0cf5d693b83f3adcd582394aa3ec39815026769294c33f5f1c53 + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:22Z" + hostIP: 10.168.0.25 + phase: Running + podIP: 10.16.2.193 + qosClass: Burstable + startTime: "2019-11-07T22:38:19Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-rs.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-rs.yaml new file mode 100644 index 0000000000..7d298d68c8 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp-rs.yaml @@ -0,0 +1,57 @@ +apiVersion: extensions/v1beta1 +kind: ReplicaSet +metadata: + annotations: + experiment.argoproj.io/name: canary-demo-645d5dbc4c-2-0 + experiment.argoproj.io/template-name: canary-preview + creationTimestamp: "2019-11-07T22:38:19Z" + generation: 1 + name: canary-demo-645d5dbc4c-2-0-canary-preview + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: Experiment + name: canary-demo-645d5dbc4c-2-0 + uid: 4bef10a5-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430761" + selfLink: /apis/extensions/v1beta1/namespaces/jesse-test/replicasets/canary-demo-645d5dbc4c-2-0-canary-preview + uid: 4bf4518c-01af-11ea-b38c-42010aa80083 +spec: + replicas: 1 + selector: + matchLabels: + app: rollout-canary-preview + template: + metadata: + creationTimestamp: null + labels: + app: rollout-canary-preview + rollouts-pod-template-hash: 645d5dbc4c + spec: + containers: + - image: argoproj/rollouts-demo:blue + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + availableReplicas: 1 + fullyLabeledReplicas: 1 + observedGeneration: 1 + readyReplicas: 1 + replicas: 1 diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp.yaml new file mode 100644 index 0000000000..f6810a1de2 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-exp.yaml @@ -0,0 +1,78 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Experiment +metadata: + annotations: + rollout.argoproj.io/revision: "2" + creationTimestamp: "2019-11-07T22:38:19Z" + generation: 7 + labels: + rollouts-pod-template-hash: 645d5dbc4c + name: canary-demo-645d5dbc4c-2-0 + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: Rollout + name: canary-demo + uid: 42b19359-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430781" + selfLink: /apis/argoproj.io/v1alpha1/namespaces/jesse-test/experiments/canary-demo-645d5dbc4c-2-0 + uid: 4bef10a5-01af-11ea-b38c-42010aa80083 +spec: + analyses: + - name: stress-test + templateName: stress-test + templates: + - name: canary-preview + selector: + matchLabels: + app: rollout-canary-preview + template: + metadata: + creationTimestamp: null + labels: + app: rollout-canary-preview + rollouts-pod-template-hash: 645d5dbc4c + spec: + containers: + - image: argoproj/rollouts-demo:blue + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + analysisRuns: + - analysisRun: canary-demo-645d5dbc4c-2-0-stress-test + name: stress-test + phase: Running + availableAt: "2019-11-07T22:38:22Z" + conditions: + - lastTransitionTime: "2019-11-07T22:38:18Z" + lastUpdateTime: "2019-11-07T22:38:22Z" + message: Experiment "canary-demo-645d5dbc4c-2-0" is running. + reason: NewReplicaSetAvailable + status: "True" + type: Progressing + phase: Running + templateStatuses: + - availableReplicas: 1 + lastTransitionTime: "2019-11-07T22:38:22Z" + name: canary-preview + readyReplicas: 1 + replicas: 1 + status: Running + updatedReplicas: 1 diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-rs.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-rs.yaml new file mode 100644 index 0000000000..b9b9bc9a34 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/canary-rs.yaml @@ -0,0 +1,58 @@ +apiVersion: extensions/v1beta1 +kind: ReplicaSet +metadata: + annotations: + rollout.argoproj.io/desired-replicas: "5" + rollout.argoproj.io/revision: "2" + creationTimestamp: "2019-11-07T22:38:19Z" + generation: 1 + labels: + app: canary-demo + rollouts-pod-template-hash: 645d5dbc4c + name: canary-demo-645d5dbc4c + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: Rollout + name: canary-demo + uid: 42b19359-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430707" + selfLink: /apis/extensions/v1beta1/namespaces/jesse-test/replicasets/canary-demo-645d5dbc4c + uid: 4be647c7-01af-11ea-b38c-42010aa80083 +spec: + replicas: 0 + selector: + matchLabels: + app: canary-demo + rollouts-pod-template-hash: 645d5dbc4c + template: + metadata: + creationTimestamp: null + labels: + app: canary-demo + rollouts-pod-template-hash: 645d5dbc4c + spec: + containers: + - image: argoproj/rollouts-demo:blue + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + observedGeneration: 1 + replicas: 0 diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod1.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod1.yaml new file mode 100644 index 0000000000..444a132b23 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod1.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:03Z" + generateName: canary-demo-877894d5b- + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b-n6xqz + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430581" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-877894d5b-n6xqz + uid: 42b86b15-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-0l5h + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:03Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:08Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:08Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:03Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://458a3dff3ab76d6f7e323e1857c98ab84474b80120bddefabf5dd959e1c504bc + image: argoproj/rollouts-demo:green + imageID: docker-pullable://argoproj/rollouts-demo@sha256:74b276f0cef296aa3f5a76fa09405ca75834567e8ad8cc707412aca716c9d65e + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:07Z" + hostIP: 10.168.0.25 + phase: Running + podIP: 10.16.2.190 + qosClass: Burstable + startTime: "2019-11-07T22:38:03Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod2.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod2.yaml new file mode 100644 index 0000000000..beb1eaf0ce --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod2.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:03Z" + generateName: canary-demo-877894d5b- + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b-nlmj9 + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430624" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-877894d5b-nlmj9 + uid: 42cbe18e-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-0l5h + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:04Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:12Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:12Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:04Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://6d45e723135518321e0af2b3edbc87b6db4d55a88665838726607d52bf14c0a0 + image: argoproj/rollouts-demo:green + imageID: docker-pullable://argoproj/rollouts-demo@sha256:74b276f0cef296aa3f5a76fa09405ca75834567e8ad8cc707412aca716c9d65e + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:10Z" + hostIP: 10.168.0.25 + phase: Running + podIP: 10.16.2.192 + qosClass: Burstable + startTime: "2019-11-07T22:38:04Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod3.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod3.yaml new file mode 100644 index 0000000000..d2ce0fb774 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod3.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:03Z" + generateName: canary-demo-877894d5b- + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b-txgs5 + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430570" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-877894d5b-txgs5 + uid: 42bcc31d-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-dbn2 + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:03Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:08Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:08Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:03Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://3f6b86fa327ac5d3d54f5183dc5e711a69f62cd0682ad9098bca04d2fb67a12f + image: argoproj/rollouts-demo:green + imageID: docker-pullable://argoproj/rollouts-demo@sha256:74b276f0cef296aa3f5a76fa09405ca75834567e8ad8cc707412aca716c9d65e + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:06Z" + hostIP: 10.168.0.28 + phase: Running + podIP: 10.16.4.244 + qosClass: Burstable + startTime: "2019-11-07T22:38:03Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod4.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod4.yaml new file mode 100644 index 0000000000..193d77623f --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod4.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:03Z" + generateName: canary-demo-877894d5b- + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b-wfqqr + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430587" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-877894d5b-wfqqr + uid: 42cbb0aa-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-dbn2 + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:04Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:09Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:09Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:04Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://dacc0448411644e73683925fc05213b94a5cae07bb579dd8db076522f00d1bef + image: argoproj/rollouts-demo:green + imageID: docker-pullable://argoproj/rollouts-demo@sha256:74b276f0cef296aa3f5a76fa09405ca75834567e8ad8cc707412aca716c9d65e + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:08Z" + hostIP: 10.168.0.28 + phase: Running + podIP: 10.16.4.245 + qosClass: Burstable + startTime: "2019-11-07T22:38:04Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod5.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod5.yaml new file mode 100644 index 0000000000..6dbf8a4851 --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-pod5.yaml @@ -0,0 +1,97 @@ +apiVersion: v1 +kind: Pod +metadata: + creationTimestamp: "2019-11-07T22:38:03Z" + generateName: canary-demo-877894d5b- + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b-zhh6x + namespace: jesse-test + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430603" + selfLink: /api/v1/namespaces/jesse-test/pods/canary-demo-877894d5b-zhh6x + uid: 42bd293e-01af-11ea-b38c-42010aa80083 +spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-5wzlj + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: gke-argoproj-demo-01-default-pool-848985e7-0l5h + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-5wzlj + secret: + defaultMode: 420 + secretName: default-token-5wzlj +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:04Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:10Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:10Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2019-11-07T22:38:03Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: docker://365807c5f17d67c2edd98598ecbea06b32aa01535b863bb94c962640edfaa81b + image: argoproj/rollouts-demo:green + imageID: docker-pullable://argoproj/rollouts-demo@sha256:74b276f0cef296aa3f5a76fa09405ca75834567e8ad8cc707412aca716c9d65e + lastState: {} + name: canary-demo + ready: true + restartCount: 0 + state: + running: + startedAt: "2019-11-07T22:38:09Z" + hostIP: 10.168.0.25 + phase: Running + podIP: 10.16.2.191 + qosClass: Burstable + startTime: "2019-11-07T22:38:04Z" diff --git a/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-rs.yaml b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-rs.yaml new file mode 100644 index 0000000000..27bee2796d --- /dev/null +++ b/pkg/kubectl-argo-rollouts/info/testdata/experiment-step/stable-rs.yaml @@ -0,0 +1,61 @@ +apiVersion: extensions/v1beta1 +kind: ReplicaSet +metadata: + annotations: + rollout.argoproj.io/desired-replicas: "5" + rollout.argoproj.io/revision: "1" + creationTimestamp: "2019-11-07T22:38:03Z" + generation: 1 + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + name: canary-demo-877894d5b + namespace: jesse-test + ownerReferences: + - apiVersion: argoproj.io/v1alpha1 + blockOwnerDeletion: true + controller: true + kind: Rollout + name: canary-demo + uid: 42b19359-01af-11ea-b38c-42010aa80083 + resourceVersion: "33430625" + selfLink: /apis/extensions/v1beta1/namespaces/jesse-test/replicasets/canary-demo-877894d5b + uid: 42b5a598-01af-11ea-b38c-42010aa80083 +spec: + replicas: 5 + selector: + matchLabels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + template: + metadata: + creationTimestamp: null + labels: + app: canary-demo + rollouts-pod-template-hash: 877894d5b + spec: + containers: + - image: argoproj/rollouts-demo:green + imagePullPolicy: Always + name: canary-demo + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + requests: + cpu: 5m + memory: 32Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + availableReplicas: 5 + fullyLabeledReplicas: 5 + observedGeneration: 1 + readyReplicas: 5 + replicas: 5 diff --git a/pkg/kubectl-argo-rollouts/info/testdata/testdata.go b/pkg/kubectl-argo-rollouts/info/testdata/testdata.go index 170a1277e4..8082890d7c 100644 --- a/pkg/kubectl-argo-rollouts/info/testdata/testdata.go +++ b/pkg/kubectl-argo-rollouts/info/testdata/testdata.go @@ -63,6 +63,10 @@ func NewExperimentAnalysisRollout() *RolloutObjects { return discoverObjects(testDir + "/experiment-analysis") } +func NewExperimentAnalysisJobRollout() *RolloutObjects { + return discoverObjects(testDir + "/experiment-step") +} + func discoverObjects(path string) *RolloutObjects { files, err := ioutil.ReadDir(path) if err != nil { @@ -118,6 +122,11 @@ func discoverObjects(path string) *RolloutObjects { panic(err) } run.CreationTimestamp = aWeekAgo + for i, m := range run.Status.MetricResults[0].Measurements { + m.StartedAt = &aWeekAgo + m.FinishedAt = &aWeekAgo + run.Status.MetricResults[0].Measurements[i] = m + } objs.AnalysisRuns = append(objs.AnalysisRuns, &run) } } diff --git a/rollout/sync.go b/rollout/sync.go index 8702093797..638d584e11 100644 --- a/rollout/sync.go +++ b/rollout/sync.go @@ -480,6 +480,13 @@ func (c *RolloutController) patchCondition(r *v1alpha1.Rollout, newStatus *v1alp return nil } +// isIndefiniteStep returns whether or not the rollout is at an Experiment or Analysis step which should +// not affect the progressDeadlineSeconds +func isIndefiniteStep(r *v1alpha1.Rollout) bool { + currentStep, _ := replicasetutil.GetCurrentCanaryStep(r) + return currentStep != nil && (currentStep.Experiment != nil || currentStep.Analysis != nil) +} + func (c *RolloutController) calculateRolloutConditions(roCtx rolloutContext, newStatus v1alpha1.RolloutStatus) v1alpha1.RolloutStatus { r := roCtx.Rollout() allRSs := roCtx.AllRSs() @@ -530,7 +537,7 @@ func (c *RolloutController) calculateRolloutConditions(roCtx rolloutContext, new conditions.RemoveRolloutCondition(&newStatus, v1alpha1.RolloutProgressing) } conditions.SetRolloutCondition(&newStatus, *condition) - case conditions.RolloutTimedOut(r, &newStatus): + case !isIndefiniteStep(r) && conditions.RolloutTimedOut(r, &newStatus): // Update the rollout with a timeout condition. If the condition already exists, // we ignore this update. msg := fmt.Sprintf(conditions.RolloutTimeOutMessage, r.Name) @@ -612,7 +619,7 @@ func (c *RolloutController) requeueStuckRollout(r *v1alpha1.Rollout, newStatus v } // No need to estimate progress if the rollout is complete or already timed out. isPaused := len(r.Status.PauseConditions) > 0 || r.Spec.Paused - if conditions.RolloutComplete(r, &newStatus) || currentCond.Reason == conditions.TimedOutReason || isPaused || r.Status.Abort { + if conditions.RolloutComplete(r, &newStatus) || currentCond.Reason == conditions.TimedOutReason || isPaused || r.Status.Abort || isIndefiniteStep(r) { return time.Duration(-1) } // If there is no sign of progress at this point then there is a high chance that the diff --git a/utils/analysis/helpers.go b/utils/analysis/helpers.go index 8a8d0a08d7..b9f02abae2 100644 --- a/utils/analysis/helpers.go +++ b/utils/analysis/helpers.go @@ -141,6 +141,7 @@ func CreateWithCollisionCounter(logCtx *log.Entry, analysisRunIf argoprojclient. if !k8serrors.IsAlreadyExists(err) { return nil, err } + // TODO(jessesuen): switch from Get to List so that there's no guessing about which collision counter to use. existingRun, err := analysisRunIf.Get(run.Name, metav1.GetOptions{}) if err != nil { return nil, err diff --git a/utils/replicaset/canary.go b/utils/replicaset/canary.go index fe2d56c179..1fb7e8f779 100644 --- a/utils/replicaset/canary.go +++ b/utils/replicaset/canary.go @@ -223,7 +223,7 @@ func extraReplicaAdded(replicas int32, setWeight int32) bool { // GetCurrentCanaryStep returns the current canary step. If there are no steps or the rollout // has already executed the last step, the func returns nil func GetCurrentCanaryStep(rollout *v1alpha1.Rollout) (*v1alpha1.CanaryStep, *int32) { - if len(rollout.Spec.Strategy.Canary.Steps) == 0 { + if rollout.Spec.Strategy.Canary == nil || len(rollout.Spec.Strategy.Canary.Steps) == 0 { return nil, nil } currentStepIndex := int32(0)