@@ -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