@@ -44,6 +44,8 @@ import (
44
44
"github.com/fluxcd/pkg/runtime/logger"
45
45
"github.com/fluxcd/pkg/runtime/pprof"
46
46
"github.com/fluxcd/pkg/runtime/probes"
47
+
48
+ "github.com/fluxcd/source-controller/internal/digest"
47
49
"github.com/fluxcd/source-controller/internal/features"
48
50
"github.com/fluxcd/source-controller/internal/helm/registry"
49
51
@@ -102,6 +104,7 @@ func main() {
102
104
helmCachePurgeInterval string
103
105
artifactRetentionTTL time.Duration
104
106
artifactRetentionRecords int
107
+ artifactDigestAlgo string
105
108
)
106
109
107
110
flag .StringVar (& metricsAddr , "metrics-addr" , envOrDefault ("METRICS_ADDR" , ":8080" ),
@@ -137,9 +140,11 @@ func main() {
137
140
flag .StringSliceVar (& git .HostKeyAlgos , "ssh-hostkey-algos" , []string {},
138
141
"The list of hostkey algorithms to use for ssh connections, arranged from most preferred to the least." )
139
142
flag .DurationVar (& artifactRetentionTTL , "artifact-retention-ttl" , 60 * time .Second ,
140
- "The duration of time that artifacts from previous reconcilations will be kept in storage before being garbage collected." )
143
+ "The duration of time that artifacts from previous reconciliations will be kept in storage before being garbage collected." )
141
144
flag .IntVar (& artifactRetentionRecords , "artifact-retention-records" , 2 ,
142
145
"The maximum number of artifacts to be kept in storage after a garbage collection." )
146
+ flag .StringVar (& artifactDigestAlgo , "artifact-digest-algo" , digest .Canonical .String (),
147
+ "The algorithm to use to calculate the digest of artifacts." )
143
148
144
149
clientOptions .BindFlags (flag .CommandLine )
145
150
logOptions .BindFlags (flag .CommandLine )
@@ -159,7 +164,15 @@ func main() {
159
164
os .Exit (1 )
160
165
}
161
166
162
- // Set upper bound file size limits Helm
167
+ if artifactDigestAlgo != digest .Canonical .String () {
168
+ algo , err := digest .AlgorithmForName (artifactDigestAlgo )
169
+ if err != nil {
170
+ setupLog .Error (err , "unable to configure canonical digest algorithm" )
171
+ os .Exit (1 )
172
+ }
173
+ digest .Canonical = algo
174
+ }
175
+
163
176
helm .MaxIndexSize = helmIndexLimit
164
177
helm .MaxChartSize = helmChartLimit
165
178
helm .MaxChartFileSize = helmChartFileLimit
@@ -169,7 +182,7 @@ func main() {
169
182
watchNamespace = os .Getenv ("RUNTIME_NAMESPACE" )
170
183
}
171
184
172
- disableCacheFor := []ctrlclient.Object {}
185
+ var disableCacheFor []ctrlclient.Object
173
186
shouldCache , err := features .Enabled (features .CacheSecretsAndConfigMaps )
174
187
if err != nil {
175
188
setupLog .Error (err , "unable to check feature gate " + features .CacheSecretsAndConfigMaps )
0 commit comments