diff --git a/operator/apis/lifecycle/v1alpha3/common/phases.go b/operator/apis/lifecycle/v1alpha3/common/phases.go index 7a89141a026..a54e31ff744 100644 --- a/operator/apis/lifecycle/v1alpha3/common/phases.go +++ b/operator/apis/lifecycle/v1alpha3/common/phases.go @@ -38,6 +38,7 @@ var phases = []KeptnPhaseType{ PhaseWorkloadCompleted, PhaseDeprecateAppVersion, PhaseDeprecated, + PhaseAppCompleted, } func (p KeptnPhaseType) IsEvaluation() bool { @@ -104,6 +105,7 @@ var ( PhaseDeprecateAppVersion = KeptnPhaseType{LongName: "Deprecate AppVersion", ShortName: "DeprecateAppVersion"} PhaseAppCompleted = KeptnPhaseType{LongName: "App Completed", ShortName: "AppCompleted"} PhaseWorkloadCompleted = KeptnPhaseType{LongName: "Workload Completed", ShortName: "WorkloadCompleted"} + PhaseCompleted = KeptnPhaseType{LongName: "Completed", ShortName: "Completed"} PhaseDeprecated = KeptnPhaseType{LongName: "Deprecated", ShortName: "Deprecated"} ) diff --git a/operator/controllers/common/evaluationhandler_test.go b/operator/controllers/common/evaluationhandler_test.go index bb167d8e4b2..9f2394620a1 100644 --- a/operator/controllers/common/evaluationhandler_test.go +++ b/operator/controllers/common/evaluationhandler_test.go @@ -20,6 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" ) +//nolint:dupl func TestEvaluationHandler(t *testing.T) { tests := []struct { name string diff --git a/operator/controllers/lifecycle/keptnappversion/controller.go b/operator/controllers/lifecycle/keptnappversion/controller.go index cf22a3b9588..aaf5387a84c 100644 --- a/operator/controllers/lifecycle/keptnappversion/controller.go +++ b/operator/controllers/lifecycle/keptnappversion/controller.go @@ -172,7 +172,7 @@ func (r *KeptnAppVersionReconciler) Reconcile(ctx context.Context, req ctrl.Requ func (r *KeptnAppVersionReconciler) finishKeptnAppVersionReconcile(ctx context.Context, appVersion *klcv1alpha3.KeptnAppVersion, spanAppTrace trace.Span) (ctrl.Result, error) { if !appVersion.IsEndTimeSet() { - appVersion.Status.CurrentPhase = apicommon.PhaseAppCompleted.ShortName + appVersion.Status.CurrentPhase = apicommon.PhaseCompleted.ShortName appVersion.SetEndTime() } diff --git a/operator/controllers/lifecycle/keptnappversion/controller_test.go b/operator/controllers/lifecycle/keptnappversion/controller_test.go index 62eec37c8bc..2832100b0ef 100644 --- a/operator/controllers/lifecycle/keptnappversion/controller_test.go +++ b/operator/controllers/lifecycle/keptnappversion/controller_test.go @@ -232,7 +232,7 @@ func TestKeptnAppVersionReconciler_ReconcileReachCompletion(t *testing.T) { func createFinishedAppVersionStatus() lfcv1alpha3.KeptnAppVersionStatus { return lfcv1alpha3.KeptnAppVersionStatus{ - CurrentPhase: apicommon.PhaseAppCompleted.ShortName, + CurrentPhase: apicommon.PhaseCompleted.ShortName, PreDeploymentStatus: apicommon.StateSucceeded, PostDeploymentStatus: apicommon.StateSucceeded, PreDeploymentEvaluationStatus: apicommon.StateSucceeded, diff --git a/operator/controllers/lifecycle/keptntask/job_utils.go b/operator/controllers/lifecycle/keptntask/job_utils.go index 841dd01fa14..a0f4068dbfd 100644 --- a/operator/controllers/lifecycle/keptntask/job_utils.go +++ b/operator/controllers/lifecycle/keptntask/job_utils.go @@ -20,7 +20,7 @@ func (r *KeptnTaskReconciler) createJob(ctx context.Context, req ctrl.Request, t jobName := "" definition, err := controllercommon.GetTaskDefinition(r.Client, r.Log, ctx, task.Spec.TaskDefinition, req.Namespace) if err != nil { - fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition) + r.Log.Error(err, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition)) r.EventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", task.Spec.TaskDefinition), "") return err } diff --git a/operator/controllers/lifecycle/keptntask/runtime_builder.go b/operator/controllers/lifecycle/keptntask/runtime_builder.go index 37bd8a2aa85..82ad532428f 100644 --- a/operator/controllers/lifecycle/keptntask/runtime_builder.go +++ b/operator/controllers/lifecycle/keptntask/runtime_builder.go @@ -212,7 +212,7 @@ func (fb *RuntimeBuilder) handleParent(ctx context.Context, params *RuntimeExecu var parentJobParams RuntimeExecutionParams parentDefinition, err := controllercommon.GetTaskDefinition(fb.options.Client, fb.options.Log, ctx, fb.options.funcSpec.FunctionReference.Name, fb.options.req.Namespace) if err != nil { - fmt.Sprintf("could not finc KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition) + fb.options.Log.Error(err, fmt.Sprintf("could not finc KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition)) fb.options.eventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateNotFound, fmt.Sprintf("could not find KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") return err } @@ -225,7 +225,7 @@ func (fb *RuntimeBuilder) handleParent(ctx context.Context, params *RuntimeExecu // merge parameter to make sure we use child task data for env var and secrets err = mergo.Merge(params, parentJobParams) if err != nil { - fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition) + fb.options.Log.Error(err, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition)) fb.options.eventSender.SendK8sEvent(apicommon.PhaseCreateTask, "Warning", fb.options.task, apicommon.PhaseStateFailed, fmt.Sprintf("could not merge KeptnTaskDefinition: %s ", fb.options.task.Spec.TaskDefinition), "") return err } diff --git a/operator/controllers/lifecycle/keptnworkloadinstance/controller.go b/operator/controllers/lifecycle/keptnworkloadinstance/controller.go index a3ea3336228..23d3571b0df 100644 --- a/operator/controllers/lifecycle/keptnworkloadinstance/controller.go +++ b/operator/controllers/lifecycle/keptnworkloadinstance/controller.go @@ -179,7 +179,7 @@ func (r *KeptnWorkloadInstanceReconciler) Reconcile(ctx context.Context, req ctr func (r *KeptnWorkloadInstanceReconciler) finishKeptnWorkloadInstanceReconcile(ctx context.Context, workloadInstance *klcv1alpha3.KeptnWorkloadInstance, spanWorkloadTrace trace.Span, span trace.Span, phase apicommon.KeptnPhaseType) (ctrl.Result, error) { if !workloadInstance.IsEndTimeSet() { - workloadInstance.Status.CurrentPhase = apicommon.PhaseWorkloadCompleted.ShortName + workloadInstance.Status.CurrentPhase = apicommon.PhaseCompleted.ShortName workloadInstance.Status.Status = apicommon.StateSucceeded workloadInstance.SetEndTime() }