This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0d61e86d5aabb86fd018a993975ea562d8c6fd08 Author: Nicola Ferraro <ni.ferr...@gmail.com> AuthorDate: Sat Feb 22 10:14:02 2020 +0100 Fix #1233: fix dev mode test and rebase --- deploy/resources.go | 8 ++++---- e2e/dev_mode_test.go | 4 ++-- pkg/cmd/run.go | 2 +- pkg/install/operator.go | 10 +++++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/deploy/resources.go b/deploy/resources.go index 518327e..77c6542 100644 --- a/deploy/resources.go +++ b/deploy/resources.go @@ -189,9 +189,9 @@ var assets = func() http.FileSystem { "/operator-role-kubernetes.yaml": &vfsgen۰CompressedFileInfo{ name: "operator-role-kubernetes.yaml", modTime: time.Time{}, - uncompressedSize: 2260, + uncompressedSize: 2249, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x54\x41\x73\xdb\x36\x13\xbd\xe3\x57\xbc\x11\x2f\xc9\x37\x96\xfc\xa5\xa7\x8e\x7a\x52\x1d\xbb\xd5\x34\x23\xcd\x98\x4a\x33\x39\x2e\xc1\x15\x85\x1a\xc4\xa2\x00\x28\xd9\xfd\xf5\x1d\x40\x54\x22\x47\x49\xa7\x87\x4c\xcd\x8b\x16\xe0\xf2\xed\xdb\xf7\x56\x5b\x61\xfa\xfd\x1e\x55\xe1\x9d\xd1\xec\x22\xb7\x48\x82\xb4\x63\x2c\x3c\xe9\x1d\xa3\x96\x6d\x3a\x50\x60\xdc\xc9\xe0\x5a\x4a\x46\x1c\x5e\x2d\xea\xbb\xd7\x18\x5c\xcb\x01\xe2\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x54\xc1\x6e\x1b\x37\x10\xbd\xf3\x2b\x1e\xb4\x97\xa4\xb0\xe4\xa6\xa7\x42\x3d\xa9\x8e\xdd\x0a\x0d\x24\xc0\xab\x34\xc8\x71\x96\x3b\x5a\xb1\xe6\x72\x58\x92\x2b\xd9\xfd\xfa\x82\xd4\x2a\x91\xa3\x04\xe8\x21\xa8\xf7\xa2\x21\x77\xf6\xcd\x9b\xf7\x46\x53\x61\xfa\xfd\x1e\x55\xe1\x9d\xd1\xec\x22\xb7\x48\x82\xb4\x63\x2c\x3c\xe9\x1d\xa3\x96\x6d\x3a\x50\x60\xdc\xc9\xe0\x5a\x4a\x46\x1c\x5e\x2d\xea\xbb\xd7\x18\x5c\xcb\x01\xe2\x18\x [...] }, "/operator-role-olm.yaml": &vfsgen۰CompressedFileInfo{ name: "operator-role-olm.yaml", @@ -203,9 +203,9 @@ var assets = func() http.FileSystem { "/operator-role-openshift.yaml": &vfsgen۰CompressedFileInfo{ name: "operator-role-openshift.yaml", modTime: time.Time{}, - uncompressedSize: 3039, + uncompressedSize: 3028, - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x54\xc1\x8e\xdb\x46\x0c\xbd\xeb\x2b\x08\xe9\x92\x14\x6b\xbb\xe9\xa9\x70\x4f\xee\x66\xb7\x35\x1a\xd8\xc0\xca\x69\x90\x23\x35\xa2\x25\x76\x47\xc3\xe9\xcc\xc8\x8a\xfb\xf5\x85\x46\x72\x62\xaf\x76\x9b\x06\x08\x60\x5f\x4c\x71\xa8\xc7\xc7\xf7\xa8\xc9\x60\xf6\xfd\x7e\x49\x06\xef\x58\x91\xf1\x54\x42\x10\x08\x35\xc1\xca\xa2\xaa\x09\x72\xd9\x87\x0e\x1d\xc1\xbd\xb4\xa6\xc4\xc0\x62\xe0\xd5\x2a\xbf\x7f\x0d\xad\x29\xc9\x81\x18\x [...] + compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x54\xc1\x8e\xdb\x46\x0c\xbd\xeb\x2b\x08\xe9\x92\x14\x6b\xb9\xe9\xa9\x70\x4f\x6e\xb2\xdb\x1a\x0d\xbc\xc0\xca\x69\x90\x23\x35\xa2\x25\x76\x47\xc3\xe9\xcc\xc8\x8a\xfb\xf5\x85\x46\x72\x62\xaf\x76\x91\x16\x08\x60\x5f\x4c\x71\xa8\xc7\xc7\xf7\xa8\xc9\x60\xf1\xfd\x7e\x49\x06\xef\x59\x91\xf1\x54\x41\x10\x08\x0d\xc1\xda\xa2\x6a\x08\x0a\xd9\x87\x1e\x1d\xc1\x9d\x74\xa6\xc2\xc0\x62\xe0\xd5\xba\xb8\x7b\x0d\x9d\xa9\xc8\x81\x18\x [...] }, "/operator-service-account.yaml": &vfsgen۰CompressedFileInfo{ name: "operator-service-account.yaml", diff --git a/e2e/dev_mode_test.go b/e2e/dev_mode_test.go index a028917..2b42ea7 100644 --- a/e2e/dev_mode_test.go +++ b/e2e/dev_mode_test.go @@ -48,11 +48,11 @@ func TestRunDevMode(t *testing.T) { kamelRun := kamelWithContext(ctx, "run", "-n", ns, file, "--dev") kamelRun.SetOut(pipew) - logScanner := util.NewLogScanner(ctx, piper, "Integration yaml in phase Running", "Magicstring!", "Magicjordan!") + logScanner := util.NewLogScanner(ctx, piper, `integration "yaml" in phase Running`, "Magicstring!", "Magicjordan!") go kamelRun.Execute() - Eventually(logScanner.IsFound("Integration yaml in phase Running"), 5*time.Minute).Should(BeTrue()) + Eventually(logScanner.IsFound(`integration "yaml" in phase Running`), 5*time.Minute).Should(BeTrue()) Eventually(logScanner.IsFound("Magicstring!"), 3*time.Minute).Should(BeTrue()) Expect(logScanner.IsFound("Magicjordan!")()).To(BeFalse()) diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 35e43e0..3755b6c 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -305,7 +305,7 @@ func (o *runCmdOptions) waitForIntegrationReady(cmd *cobra.Command, integration // if i.Status.Phase != "" { // TODO remove this log when we make sure that events are always created - fmt.Printf("progress: integration %q in phase %s\n", integration.Name, string(i.Status.Phase)) + fmt.Fprintf(cmd.OutOrStdout(), "Progress: integration %q in phase %s\n", integration.Name, string(i.Status.Phase)) } if i.Status.Phase == v1.IntegrationPhaseRunning || i.Status.Phase == v1.IntegrationPhaseError { return false diff --git a/pkg/install/operator.go b/pkg/install/operator.go index 28a2a58..9d3d3f4 100644 --- a/pkg/install/operator.go +++ b/pkg/install/operator.go @@ -25,6 +25,7 @@ import ( appsv1 "k8s.io/api/apps/v1" "k8s.io/api/rbac/v1beta1" + k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -126,7 +127,10 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu return installKnative(ctx, c, cfg.Namespace, customizer, collection, force) } - if errevt := installEvents(ctx, c, cfg.Namespace, customizer, collection); errevt != nil { + if errevt := installEvents(ctx, c, cfg.Namespace, customizer, collection, force); errevt != nil { + if k8serrors.IsAlreadyExists(err) { + return err + } fmt.Println("Warning: the operator will not be able to publish Kubernetes events. Try installing as cluster-admin to allow it to generate events.") } @@ -158,8 +162,8 @@ func installKnative(ctx context.Context, c client.Client, namespace string, cust ) } -func installEvents(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection) error { - return ResourcesOrCollect(ctx, c, namespace, collection, customizer, +func installEvents(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error { + return ResourcesOrCollect(ctx, c, namespace, collection, force, customizer, "operator-role-events.yaml", "operator-role-binding-events.yaml", )