@@ -13,6 +13,7 @@ import (
13
13
"github.com/sirupsen/logrus"
14
14
batchv1 "k8s.io/api/batch/v1"
15
15
corev1 "k8s.io/api/core/v1"
16
+ rbacv1 "k8s.io/api/rbac/v1"
16
17
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17
18
"k8s.io/apimachinery/pkg/watch"
18
19
@@ -684,33 +685,77 @@ func buildContainer(tag, dockerfilePath, context string) {
684
685
685
686
var _ = ginkgo .Describe ("Launch bundle" , func () {
686
687
namespace := "default"
688
+ initImage := "init-operator-manifest:test"
689
+ bundleImage := "bundle-image:test"
690
+
687
691
correctConfigMap := corev1.ConfigMap {
688
692
ObjectMeta : metav1.ObjectMeta {
689
693
Namespace : namespace ,
690
694
Annotations : map [string ]string {
691
- bundle .MediatypeLabel : "registry+v1" ,
695
+ bundle .MediatypeLabel : "registry+v1" ,
692
696
bundle .ManifestsLabel : "/manifests/" ,
693
- bundle .MetadataLabel : "/metadata/" ,
694
- bundle .PackageLabel : "kiali-operator.v1.4.2" ,
695
- bundle .ChannelsLabel : "alpha,stable" ,
696
- bundle .ChannelDefaultLabel : "stable" ,
697
- configmap .ConfigMapImageAnnotationKey : "bundle-image:latest" ,
697
+ bundle .MetadataLabel : "/metadata/" ,
698
+ bundle .PackageLabel : "kiali-operator.v1.4.2" ,
699
+ bundle .ChannelsLabel : "alpha,stable" ,
700
+ bundle .ChannelDefaultLabel : "stable" ,
701
+ configmap .ConfigMapImageAnnotationKey : bundleImage ,
698
702
},
699
703
},
700
704
Data : getConfigMapDataSection (),
701
705
}
702
706
703
707
ginkgo .Context ("Deploy bundle job" , func () {
708
+ // these permissions are only necessary for the e2e (and not OLM using the feature)
709
+ ginkgo .It ("should apply necessary RBAC" , func () {
710
+ kubeclient , err := client .NewKubeClient ("" , logrus .StandardLogger ())
711
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
712
+
713
+ _ , err = kubeclient .RbacV1 ().Roles (namespace ).Create (& rbacv1.Role {
714
+ ObjectMeta : metav1.ObjectMeta {
715
+ Name : "olm-dev-configmap-access" ,
716
+ Namespace : namespace ,
717
+ },
718
+ Rules : []rbacv1.PolicyRule {
719
+ {
720
+ APIGroups : []string {"" },
721
+ Resources : []string {"configmaps" },
722
+ Verbs : []string {"create" , "get" , "update" },
723
+ },
724
+ },
725
+ })
726
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
727
+
728
+ _ , err = kubeclient .RbacV1 ().RoleBindings (namespace ).Create (& rbacv1.RoleBinding {
729
+ ObjectMeta : metav1.ObjectMeta {
730
+ Name : "olm-dev-configmap-access-binding" ,
731
+ Namespace : namespace ,
732
+ },
733
+ Subjects : []rbacv1.Subject {
734
+ {
735
+ APIGroup : "" ,
736
+ Kind : "ServiceAccount" ,
737
+ Name : "default" ,
738
+ Namespace : namespace ,
739
+ },
740
+ },
741
+ RoleRef : rbacv1.RoleRef {
742
+ APIGroup : "rbac.authorization.k8s.io" ,
743
+ Kind : "Role" ,
744
+ Name : "olm-dev-configmap-access" ,
745
+ },
746
+ })
747
+ })
748
+
704
749
ginkgo .It ("should build required images" , func () {
705
- buildContainer ("init-operator-manifest" , imageDirectory + "Dockerfile.serve" , "../../bin" )
706
- buildContainer ("bundle-image" , imageDirectory + "Dockerfile.bundle" , imageDirectory )
750
+ buildContainer (initImage , imageDirectory + "Dockerfile.serve" , "../../bin" )
751
+ buildContainer (bundleImage , imageDirectory + "Dockerfile.bundle" , imageDirectory )
707
752
})
708
753
709
754
ginkgo .It ("should populate specified configmap" , func () {
710
755
kubeclient , err := client .NewKubeClient ("" , logrus .StandardLogger ())
711
756
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
712
757
713
- bundleDataConfigMap , job , err := configmap .LaunchBundleImage (kubeclient , "bundle-image:latest" , "init-operator-manifest:latest" , namespace )
758
+ bundleDataConfigMap , job , err := configmap .LaunchBundleImage (kubeclient , bundleImage , initImage , namespace )
714
759
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
715
760
716
761
// wait for job to complete
0 commit comments