[go: nahoru, domu]

Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
add CurrentWorkingRevision flag in workload status
Browse files Browse the repository at this point in the history
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
  • Loading branch information
wonderflow committed Sep 2, 2020
1 parent f8b539c commit 2beaae7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apis/core/v1alpha2/core_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ type WorkloadStatus struct {
// if it needs a single place to summarize the entire status of the workload
Status string `json:"status,omitempty"`

// HistoryWorkingRevision is a flag showing if it's history revision but still working
HistoryWorkingRevision bool `json:"currentWorkingRevision,omitempty"`

// ComponentName that produced this workload.
ComponentName string `json:"componentName,omitempty"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ spec:
componentRevisionName:
description: ComponentRevisionName of current component
type: string
currentWorkingRevision:
description: HistoryWorkingRevision is a flag showing if it's
history revision but still working
type: boolean
scopes:
description: Scopes associated with this workload.
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ func (r *OAMApplicationReconciler) updateStatus(ctx context.Context, ac *v1alpha
// These workload exists means the component is under progress of rollout
// Trait will not work for these remaining workload
revisionStatus = append(revisionStatus, v1alpha2.WorkloadStatus{
ComponentName: w.ComponentName,
ComponentRevisionName: v.GetName(),
ComponentName: w.ComponentName,
ComponentRevisionName: v.GetName(),
HistoryWorkingRevision: true,
Reference: v1alpha1.TypedReference{
APIVersion: v.GetAPIVersion(),
Kind: v.GetKind(),
Expand Down
2 changes: 2 additions & 0 deletions test/e2e-test/component_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ var _ = Describe("Versioning mechanism of components", func() {

Expect(len(appconfig.Status.Workloads)).Should(BeEquivalentTo(2))
Expect(appconfig.Status.Workloads[0].ComponentRevisionName).Should(BeEquivalentTo(revisionNameV2))
Expect(appconfig.Status.Workloads[0].HistoryWorkingRevision).Should(BeEquivalentTo(false))
Expect(appconfig.Status.Workloads[1].ComponentRevisionName).Should(BeEquivalentTo(revisionNameV1))
Expect(appconfig.Status.Workloads[1].HistoryWorkingRevision).Should(BeEquivalentTo(true))

//Clean
k8sClient.Delete(ctx, &appconfig)
Expand Down

0 comments on commit 2beaae7

Please sign in to comment.