From 08900dab4ba9e1c6d1e37537b2be415e8ea5a322 Mon Sep 17 00:00:00 2001 From: VijayaSenaReddy Ayyappaneni <48216363+vayyappaneni@users.noreply.github.com> Date: Thu, 9 Jul 2020 11:48:07 -0400 Subject: [PATCH 1/5] adding istion annotation (#3534) --- .../post-install/v0.15.0/storage-version-migration.yaml | 2 ++ config/pre-install/v0.16.0/storage-version-migration.yaml | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/post-install/v0.15.0/storage-version-migration.yaml b/config/post-install/v0.15.0/storage-version-migration.yaml index b39392ace2a..3e6e337bfef 100644 --- a/config/post-install/v0.15.0/storage-version-migration.yaml +++ b/config/post-install/v0.15.0/storage-version-migration.yaml @@ -27,6 +27,8 @@ spec: metadata: labels: app: "storage-version-migration" + annotations: + sidecar.istio.io/inject: "false" spec: serviceAccountName: knative-eventing-post-install-job restartPolicy: OnFailure diff --git a/config/pre-install/v0.16.0/storage-version-migration.yaml b/config/pre-install/v0.16.0/storage-version-migration.yaml index 3b1bd08cc3a..e0af598e837 100644 --- a/config/pre-install/v0.16.0/storage-version-migration.yaml +++ b/config/pre-install/v0.16.0/storage-version-migration.yaml @@ -15,10 +15,10 @@ apiVersion: batch/v1 kind: Job metadata: - name: storage-version-migration-v016 + name: storage-version-migration-eventing namespace: knative-eventing labels: - app: "storage-version-migration" + app: "storage-version-migration-eventing" eventing.knative.dev/release: devel spec: ttlSecondsAfterFinished: 600 @@ -26,7 +26,9 @@ spec: template: metadata: labels: - app: "storage-version-migration" + app: "storage-version-migration-eventing" + annotations: + sidecar.istio.io/inject: "false" spec: serviceAccountName: knative-eventing-pre-install-job restartPolicy: OnFailure From ca3d6a78946e81504656115ddff438e0219d40b0 Mon Sep 17 00:00:00 2001 From: Vijay Ayyappaneni Date: Fri, 10 Jul 2020 11:14:45 -0400 Subject: [PATCH 2/5] backporting #3543 --- test/lib/duck/resource_inspectors.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/lib/duck/resource_inspectors.go b/test/lib/duck/resource_inspectors.go index 6df11cd6d5d..6ad1feed5d5 100644 --- a/test/lib/duck/resource_inspectors.go +++ b/test/lib/duck/resource_inspectors.go @@ -39,6 +39,10 @@ func GetAddressableURI(dynamicClient dynamic.Interface, obj *resources.MetaResou at := untyped.(*duckv1alpha1.AddressableType) + if at.Status.Address == nil { + return url.URL{}, fmt.Errorf("addressable does not have an Address: %+v", at) + } + au := at.Status.Address.GetURL() if au.Host == "" { return url.URL{}, fmt.Errorf("addressable's URL does not have a Host: %+v", at) From 480486ff666fbebf8e3a7d66f87fd186e0568497 Mon Sep 17 00:00:00 2001 From: VijayaSenaReddy Ayyappaneni <48216363+vayyappaneni@users.noreply.github.com> Date: Fri, 10 Jul 2020 11:16:10 -0400 Subject: [PATCH 3/5] Update test/lib/duck/resource_inspectors.go Co-authored-by: Matt Moore --- test/lib/duck/resource_inspectors.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/lib/duck/resource_inspectors.go b/test/lib/duck/resource_inspectors.go index 6ad1feed5d5..392b8a12b0e 100644 --- a/test/lib/duck/resource_inspectors.go +++ b/test/lib/duck/resource_inspectors.go @@ -42,7 +42,6 @@ func GetAddressableURI(dynamicClient dynamic.Interface, obj *resources.MetaResou if at.Status.Address == nil { return url.URL{}, fmt.Errorf("addressable does not have an Address: %+v", at) } - au := at.Status.Address.GetURL() if au.Host == "" { return url.URL{}, fmt.Errorf("addressable's URL does not have a Host: %+v", at) From 2668b90862b33cba89c9f1d8de7a16a55fb76c35 Mon Sep 17 00:00:00 2001 From: vijay ayyappaneni Date: Wed, 8 Jul 2020 13:31:07 -0700 Subject: [PATCH 4/5] Use the standard resource creation libs for upgrade tests. (#3539) * try to dump some state * use client wait or fail * create broker directly --- test/upgrade/prober/configuration.go | 58 +++++----------------------- test/upgrade/prober/prober.go | 5 +-- 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/test/upgrade/prober/configuration.go b/test/upgrade/prober/configuration.go index 7f498a8afab..47d28b2553e 100644 --- a/test/upgrade/prober/configuration.go +++ b/test/upgrade/prober/configuration.go @@ -25,7 +25,6 @@ import ( "text/template" "github.com/wavesoftware/go-ensure" - corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" eventingv1beta1 "knative.dev/eventing/pkg/apis/eventing/v1beta1" testlib "knative.dev/eventing/test/lib" @@ -48,22 +47,13 @@ var ( ) func (p *prober) deployConfiguration() { - p.annotateNamespace() + p.deployBroker() p.deployConfigMap() p.deployTriggers() } -func (p *prober) annotateNamespace() { - ns, err := p.client.Kube.Kube.CoreV1().Namespaces(). - Get(p.client.Namespace, metav1.GetOptions{}) - ensure.NoError(err) - ns.Labels = map[string]string{ - sugar.DeprecatedInjectionLabelKey: sugar.InjectionEnabledLabelValue, - sugar.InjectionLabelKey: sugar.InjectionEnabledLabelValue, - } - _, err = p.client.Kube.Kube.CoreV1().Namespaces(). - Update(ns) - ensure.NoError(err) +func (p *prober) deployBroker() { + p.client.CreateBrokerV1Beta1OrFail(brokerName) } func (p *prober) fetchBrokerUrl() (*apis.URL, error) { @@ -85,28 +75,11 @@ func (p *prober) fetchBrokerUrl() (*apis.URL, error) { func (p *prober) deployConfigMap() { name := configName - testlib.WaitFor(fmt.Sprintf("configmap be deployed: %v", name), func() error { - p.log.Infof("Deploying config map: %v", name) - - brokerUrl, err := p.fetchBrokerUrl() - if err != nil { - return err - } - configData := p.compileTemplate(configFilename, brokerUrl) - watholaConfigMap := &corev1.ConfigMap{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - Data: map[string]string{ - configFilename: configData, - }, - } - _, err = p.client.Kube.Kube.CoreV1().ConfigMaps(p.config.Namespace).Create(watholaConfigMap) - if err != nil { - return err - } - return nil - }) + p.log.Infof("Deploying config map: \"%s/%s\"", p.config.Namespace, name) + brokerUrl, err := p.fetchBrokerUrl() + ensure.NoError(err) + configData := p.compileTemplate(configFilename, brokerUrl) + p.client.CreateConfigMapOrFail(name, p.config.Namespace, map[string]string{configFilename: configData}) } func (p *prober) deployTriggers() { @@ -117,25 +90,14 @@ func (p *prober) deployTriggers() { if p.config.Serving.Use { subscriberOption = resources.WithSubscriberKServiceRefForTrigger(forwarderName) } - trigger := resources.TriggerV1Beta1( - name, + p.client.CreateTriggerOrFailV1Beta1(name, resources.WithBrokerV1Beta1(brokerName), resources.WithAttributesTriggerFilterV1Beta1( eventingv1beta1.TriggerAnyFilter, fullType, map[string]interface{}{}, ), - subscriberOption, - ) - triggers := p.client.Eventing.EventingV1beta1().Triggers(p.config.Namespace) - p.log.Infof("Deploying trigger: %v", name) - // update trigger with the new reference - _, err := triggers.Create(trigger) - ensure.NoError(err) - testlib.WaitFor(fmt.Sprintf("trigger be ready: %v", name), func() error { - meta := resources.NewMetaResource(name, p.config.Namespace, testlib.TriggerTypeMeta) - return duck.WaitForResourceReady(p.client.Dynamic, meta) - }) + subscriberOption) } } diff --git a/test/upgrade/prober/prober.go b/test/upgrade/prober/prober.go index 79c7d6805f3..ea0a9f79b12 100644 --- a/test/upgrade/prober/prober.go +++ b/test/upgrade/prober/prober.go @@ -137,7 +137,7 @@ func (p *prober) deploy() { if p.config.Serving.Use { p.deployForwarder() } - ensure.NoError(testlib.AwaitForAll(p.log)) + p.client.WaitForAllTestResourcesReadyOrFail() p.deploySender() ensure.NoError(testlib.AwaitForAll(p.log)) @@ -151,8 +151,7 @@ func (p *prober) remove() { if p.config.Serving.Use { p.removeForwarder() } - p.removeReceiver() - p.removeConfiguration() + p.client.Tracker.Clean(true) } func newProber(log *zap.SugaredLogger, client *testlib.Client, config *Config) Prober { From 0af2464abccdd1cc75c1974f3aceb885f10812fc Mon Sep 17 00:00:00 2001 From: Vijay Ayyappaneni Date: Fri, 10 Jul 2020 22:12:01 -0400 Subject: [PATCH 5/5] removed the unused import --- test/upgrade/prober/configuration.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/upgrade/prober/configuration.go b/test/upgrade/prober/configuration.go index 47d28b2553e..f98f5f24978 100644 --- a/test/upgrade/prober/configuration.go +++ b/test/upgrade/prober/configuration.go @@ -19,7 +19,6 @@ import ( "bytes" "fmt" "io/ioutil" - "knative.dev/eventing/pkg/reconciler/sugar" "path" "runtime" "text/template"