@@ -407,6 +407,60 @@ var _ = Describe("HelmChartReconciler", func() {
407
407
Expect (chart .Status .Artifact .Revision ).Should (Equal ("0.1.1" ))
408
408
})
409
409
410
+ It ("Cross namespace" , func () {
411
+ Expect (helmServer .PackageChart (path .Join ("testdata/charts/helmchart" ))).Should (Succeed ())
412
+ Expect (helmServer .GenerateIndex ()).Should (Succeed ())
413
+
414
+ repositoryKey := types.NamespacedName {
415
+ Name : "helmrepository-sample-" + randStringRunes (5 ),
416
+ Namespace : namespace .Name ,
417
+ }
418
+ Expect (k8sClient .Create (context .Background (), & sourcev1.HelmRepository {
419
+ ObjectMeta : metav1.ObjectMeta {
420
+ Name : repositoryKey .Name ,
421
+ Namespace : repositoryKey .Namespace ,
422
+ },
423
+ Spec : sourcev1.HelmRepositorySpec {
424
+ URL : helmServer .URL (),
425
+ Interval : metav1.Duration {Duration : indexInterval },
426
+ },
427
+ })).Should (Succeed ())
428
+
429
+ key := types.NamespacedName {
430
+ Name : "helmchart-sample-" + randStringRunes (5 ),
431
+ Namespace : "default" ,
432
+ }
433
+ created := & sourcev1.HelmChart {
434
+ ObjectMeta : metav1.ObjectMeta {
435
+ Name : key .Name ,
436
+ Namespace : key .Namespace ,
437
+ },
438
+ Spec : sourcev1.HelmChartSpec {
439
+ Chart : "helmchart" ,
440
+ Version : "" ,
441
+ SourceRef : sourcev1.LocalHelmChartSourceReference {
442
+ Kind : sourcev1 .HelmRepositoryKind ,
443
+ Name : repositoryKey .Name ,
444
+ },
445
+ Interval : metav1.Duration {Duration : pullInterval },
446
+ },
447
+ }
448
+ Expect (k8sClient .Create (context .Background (), created )).Should (Succeed ())
449
+
450
+ got := & sourcev1.HelmChart {}
451
+ Eventually (func () bool {
452
+ _ = k8sClient .Get (context .Background (), key , got )
453
+ for _ , c := range got .Status .Conditions {
454
+ if strings .Contains (c .Message , "failed to retrieve source" ) {
455
+ return true
456
+ }
457
+ }
458
+ return false
459
+ }, timeout , interval ).Should (BeTrue ())
460
+
461
+ Expect (k8sClient .Delete (context .Background (), created )).Should (Succeed ())
462
+ })
463
+
410
464
It ("Authenticates when credentials are provided" , func () {
411
465
helmServer .Stop ()
412
466
var username , password = "john" , "doe"
0 commit comments