@@ -84,6 +84,8 @@ type Reconciler struct {
8484 skipPrimaryGVKSchemeRegistration bool
8585 controllerSetupFuncs []ControllerSetupFunc
8686
87+ stripManifestFromStatus bool
88+
8789 annotSetupOnce sync.Once
8890 annotations map [string ]struct {}
8991 installAnnotations map [string ]annotation.Install
@@ -274,6 +276,17 @@ func SkipDependentWatches(skip bool) Option {
274276 }
275277}
276278
279+ // StripManifestFromStatus is an Option that configures whether the manifest
280+ // should be removed from the automatically populated status.
281+ // This is recommended if the manifest might return sensitive data (i.e.,
282+ // secrets).
283+ func StripManifestFromStatus (strip bool ) Option {
284+ return func (r * Reconciler ) error {
285+ r .stripManifestFromStatus = strip
286+ return nil
287+ }
288+ }
289+
277290// SkipPrimaryGVKSchemeRegistration is an Option that allows to disable the default behaviour of
278291// registering unstructured.Unstructured as underlying type for the GVK scheme.
279292//
@@ -618,7 +631,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
618631 if errors .Is (err , driver .ErrReleaseNotFound ) {
619632 u .UpdateStatus (updater .EnsureCondition (conditions .Deployed (corev1 .ConditionFalse , "" , "" )))
620633 } else if err == nil {
621- ensureDeployedRelease (& u , rel )
634+ r . ensureDeployedRelease (& u , rel )
622635 }
623636 u .UpdateStatus (updater .EnsureCondition (conditions .Initialized (corev1 .ConditionTrue , "" , "" )))
624637
@@ -684,7 +697,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
684697 }
685698 }
686699
687- ensureDeployedRelease (& u , rel )
700+ r . ensureDeployedRelease (& u , rel )
688701 u .UpdateStatus (
689702 updater .EnsureCondition (conditions .ReleaseFailed (corev1 .ConditionFalse , "" , "" )),
690703 updater .EnsureCondition (conditions .Irreconcilable (corev1 .ConditionFalse , "" , "" )),
@@ -1021,7 +1034,7 @@ func (r *Reconciler) setupWatches(mgr ctrl.Manager, c controller.Controller) err
10211034 return nil
10221035}
10231036
1024- func ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
1037+ func ( r * Reconciler ) ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
10251038 reason := conditions .ReasonInstallSuccessful
10261039 message := "release was successfully installed"
10271040 if rel .Version > 1 {
@@ -1031,6 +1044,13 @@ func ensureDeployedRelease(u *updater.Updater, rel *release.Release) {
10311044 if rel .Info != nil && len (rel .Info .Notes ) > 0 {
10321045 message = rel .Info .Notes
10331046 }
1047+
1048+ if r .stripManifestFromStatus {
1049+ relCopy := * rel
1050+ relCopy .Manifest = ""
1051+ rel = & relCopy
1052+ }
1053+
10341054 u .UpdateStatus (
10351055 updater .EnsureCondition (conditions .Deployed (corev1 .ConditionTrue , reason , message )),
10361056 updater .EnsureDeployedRelease (rel ),
0 commit comments