You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/02/28 15:27:04 UTC
[camel-k] branch master updated: Workaround. Labels are not
supported on ProjectRequest
This is an automated email from the ASF dual-hosted git repository.
nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push:
new 1c55792 Workaround. Labels are not supported on ProjectRequest
1c55792 is described below
commit 1c5579256210922142a520c1787acf2671568ff0
Author: Jan <jb...@redhat.com>
AuthorDate: Fri Feb 28 15:12:45 2020 +0100
Workaround. Labels are not supported on ProjectRequest
---
e2e/test_support.go | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/e2e/test_support.go b/e2e/test_support.go
index 095942d..5b9f1b4 100644
--- a/e2e/test_support.go
+++ b/e2e/test_support.go
@@ -909,6 +909,7 @@ func newTestNamespace(injectKnativeBroker bool) metav1.Object {
var oc bool
var obj runtime.Object
+ brokerLabel := "knative-eventing-injection"
name := "test-" + uuid.New().String()
if oc, err = openshift.IsOpenShift(testClient); err != nil {
@@ -938,12 +939,29 @@ func newTestNamespace(injectKnativeBroker bool) metav1.Object {
if injectKnativeBroker {
mo := obj.(metav1.Object)
mo.SetLabels(map[string]string{
- "knative-eventing-injection": "enabled",
+ brokerLabel: "enabled",
})
}
if err = testClient.Create(testContext, obj); err != nil {
panic(err)
}
+ // workaround https://github.com/openshift/origin/issues/3819
+ if injectKnativeBroker && oc {
+ // use Kubernetes API - https://access.redhat.com/solutions/2677921
+ var namespace *corev1.Namespace
+ if namespace, err = testClient.CoreV1().Namespaces().Get(name, metav1.GetOptions{}); err != nil {
+ panic(err)
+ } else {
+ if _, ok := namespace.GetLabels()[brokerLabel]; !ok {
+ namespace.SetLabels(map[string]string{
+ brokerLabel: "enabled",
+ })
+ if err = testClient.Update(testContext, namespace); err != nil {
+ panic("Unable to label project with knative-eventing-injection. This operation needs update permission on the project.")
+ }
+ }
+ }
+ }
return obj.(metav1.Object)
}