@@ -196,7 +196,7 @@ var _ = Describe("ValidateConfiguration", func() {
196196 {
197197 Name : "my-nginx" ,
198198 Helm : config.HelmConfig {
199- OCIRepository : gardencorev1.OCIRepository {
199+ OCIRepository : & gardencorev1.OCIRepository {
200200 Ref : ptr .To ("registry-1.docker.io/bitnamicharts/nginx:25.0.5" ),
201201 },
202202 },
@@ -212,7 +212,14 @@ var _ = Describe("ValidateConfiguration", func() {
212212 Expect (ValidateConfiguration (conf )).To (BeEmpty ())
213213 })
214214
215- It ("should pass for valid seed managed resources" , func () {
215+ It ("should pass for valid seed managed resources with OCI ref" , func () {
216+ Expect (ValidateConfiguration (conf )).To (BeEmpty ())
217+ })
218+
219+ It ("should pass for valid seed managed resources with inline chart" , func () {
220+ conf .Falco .Additional .SeedManagedResources [0 ].Helm = config.HelmConfig {
221+ Chart : ptr .To ("H4sIAAAAAAAAA+3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAB+BjG/" ),
222+ }
216223 Expect (ValidateConfiguration (conf )).To (BeEmpty ())
217224 })
218225
@@ -249,29 +256,49 @@ var _ = Describe("ValidateConfiguration", func() {
249256 ))
250257 })
251258
252- It ("should reject nil OCI repository ref" , func () {
259+ It ("should reject when neither OCI ref nor chart is set" , func () {
260+ conf .Falco .Additional .SeedManagedResources [0 ].Helm = config.HelmConfig {}
261+ Expect (ValidateConfiguration (conf )).To (ConsistOf (
262+ PointTo (MatchFields (IgnoreExtras , Fields {
263+ "Type" : Equal (field .ErrorTypeRequired ),
264+ "Field" : Equal ("falco.additional.seedManagedResources[0].helm" ),
265+ })),
266+ ))
267+ })
268+
269+ It ("should reject when both OCI ref and chart are set" , func () {
270+ conf .Falco .Additional .SeedManagedResources [0 ].Helm .Chart = ptr .To ("H4sIAAAAAAAAA+3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAB+BjG/" )
271+ Expect (ValidateConfiguration (conf )).To (ConsistOf (
272+ PointTo (MatchFields (IgnoreExtras , Fields {
273+ "Type" : Equal (field .ErrorTypeForbidden ),
274+ "Field" : Equal ("falco.additional.seedManagedResources[0].helm" ),
275+ })),
276+ ))
277+ })
278+
279+ It ("should reject nil OCI repository ref when no chart set" , func () {
253280 conf .Falco .Additional .SeedManagedResources [0 ].Helm .OCIRepository .Ref = nil
254281 Expect (ValidateConfiguration (conf )).To (ConsistOf (
255282 PointTo (MatchFields (IgnoreExtras , Fields {
256283 "Type" : Equal (field .ErrorTypeRequired ),
257- "Field" : Equal ("falco.additional.seedManagedResources[0].helm.ociRepository.ref " ),
284+ "Field" : Equal ("falco.additional.seedManagedResources[0].helm" ),
258285 })),
259286 ))
260287 })
261288
262- It ("should reject empty OCI repository ref" , func () {
289+ It ("should reject empty OCI repository ref when no chart set " , func () {
263290 conf .Falco .Additional .SeedManagedResources [0 ].Helm .OCIRepository .Ref = ptr .To ("" )
264291 Expect (ValidateConfiguration (conf )).To (ConsistOf (
265292 PointTo (MatchFields (IgnoreExtras , Fields {
266293 "Type" : Equal (field .ErrorTypeRequired ),
267- "Field" : Equal ("falco.additional.seedManagedResources[0].helm.ociRepository.ref " ),
294+ "Field" : Equal ("falco.additional.seedManagedResources[0].helm" ),
268295 })),
269296 ))
270297 })
271298
272299 It ("should report multiple errors at once" , func () {
273300 conf .Falco .Additional .SeedManagedResources [0 ].Name = ""
274- conf .Falco .Additional .SeedManagedResources [0 ].Helm . OCIRepository . Ref = nil
301+ conf .Falco .Additional .SeedManagedResources [0 ].Helm = config. HelmConfig {}
275302 Expect (ValidateConfiguration (conf )).To (HaveLen (2 ))
276303 })
277304 })
0 commit comments