You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/content/en/docs/best-practices/resource-pruning.md
+15-9Lines changed: 15 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ for customization of hooks and strategies.
34
34
Users can configure the pruning library by creating code similar to this example:
35
35
```golang
36
36
cfg = Config{
37
-
log: logf.Log.WithName("prune"),
37
+
Log: logf.Log.WithName("prune"),
38
38
DryRun: false,
39
39
Clientset: client,
40
40
LabelSelector: "app=churro",
@@ -53,7 +53,7 @@ cfg = Config{
53
53
54
54
| Config Field | Description
55
55
| ------------ | -----------
56
-
| log | a logger to handle library log messages
56
+
| Log | a logr.Logger. It is optional if a logger is provided through the context to the Execute method, which is the case with the context of the Reconcile function of operator-sdk and controller-runtime
57
57
| DryRun | a boolean determines whether to actually remove resources; `true` means to execute but not to remove resources
58
58
| Clientset | a client-go Kubernetes ClientSet that will be used for Kube API calls by the library
59
59
| LabelSelector| Kubernetes label selector expression used to find resources to prune
@@ -79,6 +79,9 @@ err := cfg.Execute(ctx)
79
79
Users might want to implement pruning execution by means of a cron package or simply call the prune
80
80
library based on some other triggering event.
81
81
82
+
If a logger has been configured in the Config structure it takes precedence on the one provided through ctx.
83
+
Adding a logger.Logger to the context can be done with [logr.NewContext][logr-newcontext].
0 commit comments