@@ -88,6 +88,8 @@ type Reconciler struct {
88
88
skipPrimaryGVKSchemeRegistration bool
89
89
controllerSetupFuncs []ControllerSetupFunc
90
90
91
+ stripManifestFromStatus bool
92
+
91
93
annotSetupOnce sync.Once
92
94
annotations map [string ]struct {}
93
95
installAnnotations map [string ]annotation.Install
@@ -278,6 +280,17 @@ func SkipDependentWatches(skip bool) Option {
278
280
}
279
281
}
280
282
283
+ // StripManifestFromStatus is an Option that configures whether the manifest
284
+ // should be removed from the automatically populated status.
285
+ // This is recommended if the manifest might return sensitive data (i.e.,
286
+ // secrets).
287
+ func StripManifestFromStatus (strip bool ) Option {
288
+ return func (r * Reconciler ) error {
289
+ r .stripManifestFromStatus = strip
290
+ return nil
291
+ }
292
+ }
293
+
281
294
// SkipPrimaryGVKSchemeRegistration is an Option that allows to disable the default behaviour of
282
295
// registering unstructured.Unstructured as underlying type for the GVK scheme.
283
296
//
@@ -648,7 +661,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
648
661
if errors .Is (err , driver .ErrReleaseNotFound ) {
649
662
u .UpdateStatus (updater .EnsureCondition (conditions .Deployed (corev1 .ConditionFalse , "" , "" )))
650
663
} else if err == nil {
651
- ensureDeployedRelease (& u , rel )
664
+ r . ensureDeployedRelease (& u , rel )
652
665
}
653
666
u .UpdateStatus (updater .EnsureCondition (conditions .Initialized (corev1 .ConditionTrue , "" , "" )))
654
667
@@ -738,7 +751,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.
738
751
}
739
752
}
740
753
741
- ensureDeployedRelease (& u , rel )
754
+ r . ensureDeployedRelease (& u , rel )
742
755
u .UpdateStatus (
743
756
updater .EnsureCondition (conditions .ReleaseFailed (corev1 .ConditionFalse , "" , "" )),
744
757
updater .EnsureCondition (conditions .Irreconcilable (corev1 .ConditionFalse , "" , "" )),
@@ -1097,7 +1110,7 @@ func (r *Reconciler) setupWatches(mgr ctrl.Manager, c controller.Controller) err
1097
1110
return nil
1098
1111
}
1099
1112
1100
- func ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
1113
+ func ( r * Reconciler ) ensureDeployedRelease (u * updater.Updater , rel * release.Release ) {
1101
1114
reason := conditions .ReasonInstallSuccessful
1102
1115
message := "release was successfully installed"
1103
1116
if rel .Version > 1 {
@@ -1107,6 +1120,14 @@ func ensureDeployedRelease(u *updater.Updater, rel *release.Release) {
1107
1120
if rel .Info != nil && len (rel .Info .Notes ) > 0 {
1108
1121
message = rel .Info .Notes
1109
1122
}
1123
+
1124
+ if r .stripManifestFromStatus {
1125
+ relCopy := * rel
1126
+ relCopy .Manifest = ""
1127
+ rel = & relCopy
1128
+ }
1129
+
1130
+ u .Update (updater .EnsureFinalizer (uninstallFinalizer ))
1110
1131
u .UpdateStatus (
1111
1132
updater .EnsureCondition (conditions .Deployed (corev1 .ConditionTrue , reason , message )),
1112
1133
updater .EnsureDeployedRelease (rel ),
0 commit comments