@@ -20,18 +20,21 @@ import (
2020 "context"
2121 "fmt"
2222 "strings"
23+ "time"
2324
2425 "github.com/fluxcd/pkg/runtime/logger"
2526 corev1 "k8s.io/api/core/v1"
27+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2628 "k8s.io/client-go/tools/record"
2729 ctrl "sigs.k8s.io/controller-runtime"
2830
2931 "github.com/fluxcd/pkg/runtime/conditions"
3032
33+ "github.com/fluxcd/pkg/chartutil"
34+
3135 v2 "github.com/fluxcd/helm-controller/api/v2"
3236 "github.com/fluxcd/helm-controller/internal/action"
3337 "github.com/fluxcd/helm-controller/internal/digest"
34- "github.com/fluxcd/pkg/chartutil"
3538)
3639
3740// Install is an ActionReconciler which attempts to install a Helm release
@@ -72,6 +75,7 @@ func (r *Install) Reconcile(ctx context.Context, req *Request) error {
7275 logBuf = action .NewLogBuffer (action .NewDebugLog (ctrl .LoggerFrom (ctx ).V (logger .DebugLevel )), 10 )
7376 obsReleases = make (observedReleases )
7477 cfg = r .configFactory .Build (logBuf .Log , observeRelease (obsReleases ))
78+ startTime = time .Now ()
7579 )
7680
7781 defer summarize (req )
@@ -91,6 +95,9 @@ func (r *Install) Reconcile(ctx context.Context, req *Request) error {
9195 // Run the Helm install action.
9296 _ , err := action .Install (ctx , cfg , req .Object , req .Chart , req .Values )
9397
98+ // Record the action duration in status.
99+ req .Object .Status .LastAttemptedReleaseActionDuration = & metav1.Duration {Duration : time .Since (startTime )}
100+
94101 // Record the history of releases observed during the install.
95102 obsReleases .recordOnObject (req .Object , mutateOCIDigest )
96103
0 commit comments