@@ -20,18 +20,20 @@ import (
2020 "context"
2121 "fmt"
2222 "strings"
23+ "time"
2324
24- "github.com/fluxcd/pkg/runtime/logger"
2525 corev1 "k8s.io/api/core/v1"
26+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2627 "k8s.io/client-go/tools/record"
2728 ctrl "sigs.k8s.io/controller-runtime"
2829
30+ "github.com/fluxcd/pkg/chartutil"
2931 "github.com/fluxcd/pkg/runtime/conditions"
32+ "github.com/fluxcd/pkg/runtime/logger"
3033
3134 v2 "github.com/fluxcd/helm-controller/api/v2"
3235 "github.com/fluxcd/helm-controller/internal/action"
3336 "github.com/fluxcd/helm-controller/internal/digest"
34- "github.com/fluxcd/pkg/chartutil"
3537)
3638
3739// Install is an ActionReconciler which attempts to install a Helm release
@@ -72,6 +74,7 @@ func (r *Install) Reconcile(ctx context.Context, req *Request) error {
7274 logBuf = action .NewLogBuffer (action .NewDebugLog (ctrl .LoggerFrom (ctx ).V (logger .DebugLevel )), 10 )
7375 obsReleases = make (observedReleases )
7476 cfg = r .configFactory .Build (logBuf .Log , observeRelease (obsReleases ))
77+ startTime = time .Now ()
7578 )
7679
7780 defer summarize (req )
@@ -91,6 +94,9 @@ func (r *Install) Reconcile(ctx context.Context, req *Request) error {
9194 // Run the Helm install action.
9295 _ , err := action .Install (ctx , cfg , req .Object , req .Chart , req .Values )
9396
97+ // Record the action duration in status.
98+ req .Object .Status .LastAttemptedReleaseActionDuration = & metav1.Duration {Duration : time .Since (startTime )}
99+
94100 // Record the history of releases observed during the install.
95101 obsReleases .recordOnObject (req .Object , mutateOCIDigest )
96102
0 commit comments