diff --git a/config/crd.yml b/config/crd.yml index 064b49918..b96cfb289 100644 --- a/config/crd.yml +++ b/config/crd.yml @@ -17,18 +17,10 @@ spec: served: true storage: true additionalPrinterColumns: - - name: Paused - type: boolean - description: Reconcilation is paused - JSONPath: .spec.paused - - name: DeployExitCode - type: integer - description: Exit code from last deploy - JSONPath: .Status.Deploy.exitCode - - name: DeployUpdatedAt - type: date - description: Last deploy finish time - JSONPath: .Status.Deploy.updatedAt + - name: Description + type: string + description: Friendly description + JSONPath: .status.friendlyDescription - name: Age type: date description: |- diff --git a/pkg/apis/kappctrl/v1alpha1/types.go b/pkg/apis/kappctrl/v1alpha1/types.go index 89d11629a..0c5f5f89a 100644 --- a/pkg/apis/kappctrl/v1alpha1/types.go +++ b/pkg/apis/kappctrl/v1alpha1/types.go @@ -52,6 +52,8 @@ type AppStatus struct { ObservedGeneration int64 `json:"observedGeneration"` Conditions []AppCondition `json:"conditions"` + + FriendlyDescription string `json:"friendlyDescription"` } type AppStatusFetch struct { diff --git a/pkg/app/app_reconcile.go b/pkg/app/app_reconcile.go index 036f9da20..07c186512 100644 --- a/pkg/app/app_reconcile.go +++ b/pkg/app/app_reconcile.go @@ -1,6 +1,7 @@ package app import ( + "fmt" "time" "github.com/k14s/kapp-controller/pkg/apis/kappctrl/v1alpha1" @@ -16,6 +17,7 @@ func (a *App) Reconcile() error { case a.app.Spec.Canceled || a.app.Spec.Paused: a.log.Info("App is canceled or paused, not reconciling") a.markObservedLatest() + a.app.Status.FriendlyDescription = "Canceled/paused" return a.updateStatus() case a.app.DeletionTimestamp != nil: @@ -199,6 +201,8 @@ func (a *App) setReconciling() { Type: v1alpha1.Reconciling, Status: corev1.ConditionTrue, }) + + a.app.Status.FriendlyDescription = "Reconciling" } func (a *App) setReconcileCompleted(result exec.CmdRunResult) { @@ -210,12 +214,14 @@ func (a *App) setReconcileCompleted(result exec.CmdRunResult) { Status: corev1.ConditionTrue, Message: result.ErrorStr(), }) + a.app.Status.FriendlyDescription = fmt.Sprintf("Reconcile failed: %s", result.ErrorStr()) } else { a.app.Status.Conditions = append(a.app.Status.Conditions, v1alpha1.AppCondition{ Type: v1alpha1.ReconcileSucceeded, Status: corev1.ConditionTrue, Message: "", }) + a.app.Status.FriendlyDescription = "Reconcile succeeded" } } @@ -226,6 +232,8 @@ func (a *App) setDeleting() { Type: v1alpha1.Deleting, Status: corev1.ConditionTrue, }) + + a.app.Status.FriendlyDescription = "Deleting" } func (a *App) setDeleteCompleted(result exec.CmdRunResult) { @@ -237,6 +245,7 @@ func (a *App) setDeleteCompleted(result exec.CmdRunResult) { Status: corev1.ConditionTrue, Message: result.ErrorStr(), }) + a.app.Status.FriendlyDescription = fmt.Sprintf("Delete failed: %s", result.ErrorStr()) } else { // assume resource will be deleted, hence nothing to update } diff --git a/test/e2e/git_test.go b/test/e2e/git_test.go index 3a735b821..dbc944fab 100644 --- a/test/e2e/git_test.go +++ b/test/e2e/git_test.go @@ -74,6 +74,7 @@ spec: ExitCode: 0, }, ObservedGeneration: 1, + FriendlyDescription: "Reconcile succeeded", } { diff --git a/test/e2e/helm_test.go b/test/e2e/helm_test.go index c451461c0..6e4fef3a5 100644 --- a/test/e2e/helm_test.go +++ b/test/e2e/helm_test.go @@ -84,6 +84,7 @@ stringData: ExitCode: 0, }, ObservedGeneration: 1, + FriendlyDescription: "Reconcile succeeded", } {