@@ -81,6 +81,8 @@ type Reconciler struct {
8181 markFailedAfter time.Duration
8282 maxHistory int
8383
84+ stripManifestFromStatus bool
85+
8486 annotSetupOnce sync.Once
8587 annotations map [string ]struct {}
8688 installAnnotations map [string ]annotation.Install
@@ -265,6 +267,17 @@ func SkipDependentWatches(skip bool) Option {
265267 }
266268}
267269
270+ // StripManifestFromStatus is an Option that configures whether the manifest
271+ // should be removed from the automatically populated status.
272+ // This is recommended if the manifest might return sensitive data (i.e.,
273+ // secrets).
274+ func StripManifestFromStatus (strip bool ) Option {
275+ return func (r * Reconciler ) error {
276+ r .stripManifestFromStatus = strip
277+ return nil
278+ }
279+ }
280+
268281// WithMaxConcurrentReconciles is an Option that configures the number of
269282// concurrent reconciles that the controller will run.
270283//
@@ -528,7 +541,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
528541 if errors .Is (err , driver .ErrReleaseNotFound ) {
529542 u .UpdateStatus (updater .EnsureCondition (conditions .Deployed (corev1 .ConditionFalse , "" , "" )))
530543 } else if err == nil {
531- ensureDeployedRelease (& u , rel )
544+ r . ensureDeployedRelease (& u , rel )
532545 }
533546 u .UpdateStatus (updater .EnsureCondition (conditions .Initialized (corev1 .ConditionTrue , "" , "" )))
534547
@@ -615,7 +628,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
615628 }
616629 }
617630
618- ensureDeployedRelease (& u , rel )
631+ r . ensureDeployedRelease (& u , rel )
619632 u .UpdateStatus (
620633 updater .EnsureCondition (conditions .ReleaseFailed (corev1 .ConditionFalse , "" , "" )),
621634 updater .EnsureCondition (conditions .Irreconcilable (corev1 .ConditionFalse , "" , "" )),
@@ -943,7 +956,7 @@ func (r *Reconciler) setupWatches(mgr ctrl.Manager, c controller.Controller) err
943956 return nil
944957}
945958
946- func ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
959+ func ( r * Reconciler ) ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
947960 reason := conditions .ReasonInstallSuccessful
948961 message := "release was successfully installed"
949962 if rel .Version > 1 {
@@ -953,6 +966,13 @@ func ensureDeployedRelease(u *updater.Updater, rel *release.Release) {
953966 if rel .Info != nil && len (rel .Info .Notes ) > 0 {
954967 message = rel .Info .Notes
955968 }
969+
970+ if r .stripManifestFromStatus {
971+ relCopy := * rel
972+ relCopy .Manifest = ""
973+ rel = & relCopy
974+ }
975+
956976 u .Update (updater .EnsureFinalizer (uninstallFinalizer ))
957977 u .UpdateStatus (
958978 updater .EnsureCondition (conditions .Deployed (corev1 .ConditionTrue , reason , message )),
0 commit comments