Skip to content

Commit 4de8f1f

Browse files
committed
Allow configuration of Helm file limits
This allows custom configuration of the Helm file read limits, allowing a user to overwrite them to their likenings if the defaults are too restrictive for their specific setup using arguments: `--helm-{index,chart,chart-file}-max-size` Signed-off-by: Hidde Beydals <hello@hidde.co>
1 parent a1e9302 commit 4de8f1f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

main.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545

4646
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
4747
"github.com/fluxcd/source-controller/controllers"
48+
"github.com/fluxcd/source-controller/internal/helm"
4849
// +kubebuilder:scaffold:imports
4950
)
5051

@@ -79,6 +80,9 @@ func main() {
7980
concurrent int
8081
requeueDependency time.Duration
8182
watchAllNamespaces bool
83+
helmIndexLimit int64
84+
helmChartLimit int64
85+
helmChartFileLimit int64
8286
clientOptions client.Options
8387
logOptions logger.Options
8488
leaderElectionOptions leaderelection.Options
@@ -98,14 +102,27 @@ func main() {
98102
flag.IntVar(&concurrent, "concurrent", 2, "The number of concurrent reconciles per controller.")
99103
flag.BoolVar(&watchAllNamespaces, "watch-all-namespaces", true,
100104
"Watch for custom resources in all namespaces, if set to false it will only watch the runtime namespace.")
101-
flag.DurationVar(&requeueDependency, "requeue-dependency", 30*time.Second, "The interval at which failing dependencies are reevaluated.")
105+
flag.Int64Var(&helmIndexLimit, "helm-index-max-size", helm.MaxIndexSize,
106+
"The max allowed size in bytes of a Helm repository index file.")
107+
flag.Int64Var(&helmChartLimit, "helm-chart-max-size", helm.MaxChartSize,
108+
"The max allowed size in bytes of a Helm chart file.")
109+
flag.Int64Var(&helmChartFileLimit, "helm-chart-file-max-size", helm.MaxChartFileSize,
110+
"The max allowed size in bytes of a file in a Helm chart.")
111+
flag.DurationVar(&requeueDependency, "requeue-dependency", 30*time.Second,
112+
"The interval at which failing dependencies are reevaluated.")
113+
102114
clientOptions.BindFlags(flag.CommandLine)
103115
logOptions.BindFlags(flag.CommandLine)
104116
leaderElectionOptions.BindFlags(flag.CommandLine)
105117
flag.Parse()
106118

107119
ctrl.SetLogger(logger.NewLogger(logOptions))
108120

121+
// Set upper bound file size limits Helm
122+
helm.MaxIndexSize = helmIndexLimit
123+
helm.MaxChartSize = helmChartLimit
124+
helm.MaxChartFileSize = helmChartFileLimit
125+
109126
var eventRecorder *events.Recorder
110127
if eventsAddr != "" {
111128
if er, err := events.NewRecorder(eventsAddr, controllerName); err != nil {

0 commit comments

Comments
 (0)