Skip to content

Commit 06a0c7e

Browse files
author
Jeff Peeler
committedNov 14, 2019
fix(e2e): update ginkgo configmap test
Since this test isn't running in the gate (yet), there were a few things that needed updating.
1 parent 237e0d7 commit 06a0c7e

File tree

2 files changed

+55
-10
lines changed

2 files changed

+55
-10
lines changed
 

‎test/e2e/bundle_image_test.go

+54-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/sirupsen/logrus"
1414
batchv1 "k8s.io/api/batch/v1"
1515
corev1 "k8s.io/api/core/v1"
16+
rbacv1 "k8s.io/api/rbac/v1"
1617
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1718
"k8s.io/apimachinery/pkg/watch"
1819

@@ -684,33 +685,77 @@ func buildContainer(tag, dockerfilePath, context string) {
684685

685686
var _ = ginkgo.Describe("Launch bundle", func() {
686687
namespace := "default"
688+
initImage := "init-operator-manifest:test"
689+
bundleImage := "bundle-image:test"
690+
687691
correctConfigMap := corev1.ConfigMap{
688692
ObjectMeta: metav1.ObjectMeta{
689693
Namespace: namespace,
690694
Annotations: map[string]string{
691-
bundle.MediatypeLabel: "registry+v1",
695+
bundle.MediatypeLabel: "registry+v1",
692696
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,
698702
},
699703
},
700704
Data: getConfigMapDataSection(),
701705
}
702706

703707
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+
704749
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)
707752
})
708753

709754
ginkgo.It("should populate specified configmap", func() {
710755
kubeclient, err := client.NewKubeClient("", logrus.StandardLogger())
711756
gomega.Expect(err).NotTo(gomega.HaveOccurred())
712757

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)
714759
gomega.Expect(err).NotTo(gomega.HaveOccurred())
715760

716761
// wait for job to complete
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# docker build -t init-operator-manifest .
22
FROM busybox
33

4-
COPY opm /
4+
COPY opm /bin

0 commit comments

Comments
 (0)