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 2019/09/23 16:35:19 UTC

[camel-k] branch master updated (dcecad2 -> e3a95a6)

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git.


    from dcecad2  chore(OLM): CSV config field role-path is now role-paths and takes a list of strings
     new 15c20e4  fix(GC): Swallow API group discovery errors
     new e3a95a6  perf(GC): Only enlist resources that support the create verb for garbage collecting

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/util/kubernetes/util.go | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)


[camel-k] 01/02: fix(GC): Swallow API group discovery errors

Posted by nf...@apache.org.
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

commit 15c20e482d567aaf8dd54a2b029ce7e70fd0f248
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Mon Sep 23 14:19:38 2019 +0200

    fix(GC): Swallow API group discovery errors
---
 pkg/util/kubernetes/util.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkg/util/kubernetes/util.go b/pkg/util/kubernetes/util.go
index dcbe2a0..3ba6bf7 100644
--- a/pkg/util/kubernetes/util.go
+++ b/pkg/util/kubernetes/util.go
@@ -29,6 +29,7 @@ import (
 	"k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/util/json"
+	"k8s.io/client-go/discovery"
 
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 
@@ -211,7 +212,10 @@ func GetService(context context.Context, client k8sclient.Reader, name string, n
 // GetDiscoveryTypesWithVerbs --
 func GetDiscoveryTypesWithVerbs(client client.Client, verbs []string) ([]metav1.TypeMeta, error) {
 	resources, err := client.Discovery().ServerPreferredNamespacedResources()
-	if err != nil {
+	// Swallow group discovery errors, e.g., Knative serving exposes
+	// an aggregated API for custom.metrics.k8s.io that requires special
+	// authentication scheme while discovering preferred resources
+	if err != nil && !discovery.IsGroupDiscoveryFailedError(err) {
 		return nil, err
 	}
 


[camel-k] 02/02: perf(GC): Only enlist resources that support the create verb for garbage collecting

Posted by nf...@apache.org.
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

commit e3a95a65277e1d9002cdffddc1c9a3cf62ecc477
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Mon Sep 23 14:22:29 2019 +0200

    perf(GC): Only enlist resources that support the create verb for garbage collecting
---
 pkg/util/kubernetes/util.go | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/pkg/util/kubernetes/util.go b/pkg/util/kubernetes/util.go
index 3ba6bf7..7ac67e0 100644
--- a/pkg/util/kubernetes/util.go
+++ b/pkg/util/kubernetes/util.go
@@ -238,11 +238,13 @@ func GetDiscoveryTypesWithVerbs(client client.Client, verbs []string) ([]metav1.
 
 // LookUpResources --
 func LookUpResources(ctx context.Context, client client.Client, namespace string, selectors []string) ([]unstructured.Unstructured, error) {
-	// We only take types that support the "list" verb as they are going
-	// to be iterated and a list query with labels selector is performed
-	// for each of them. That prevents from performing queries that we know
-	// are going to return "MethodNotAllowed".
-	types, err := GetDiscoveryTypesWithVerbs(client, []string{"list"})
+	// We only take types that support the "create" and "list" verbs as:
+	// - they have to be created to be deleted :) so that excludes read-only
+	//   resources, e.g., aggregated APIs
+	// - they are going to be iterated and a list query with labels selector
+	//   is performed for each of them. That prevents from performing queries
+	//   that we know are going to return "MethodNotAllowed".
+	types, err := GetDiscoveryTypesWithVerbs(client, []string{"create", "list"})
 	if err != nil {
 		return nil, err
 	}
@@ -269,10 +271,7 @@ func LookUpResources(ctx context.Context, client client.Client, namespace string
 			},
 		}
 		if err := client.List(ctx, &options, &list); err != nil {
-			if k8serrors.IsNotFound(err) ||
-				k8serrors.IsForbidden(err) ||
-				k8serrors.IsMethodNotSupported(err) ||
-				k8serrors.IsServiceUnavailable(err) {
+			if k8serrors.IsNotFound(err) || k8serrors.IsForbidden(err) {
 				continue
 			}
 			return nil, err