fix: handle case where keda isn't installed properly
If keda is not installed, warn the user that it isn't installed and ignore the rest. Ignoring the error here is fine as it gives the user context but doesn't block a deploy.
This commit is contained in:
1 parent
fd0ac54e7e
commit
f2892208c1
1 file changed
+9
@@ -19,10 +19,12 @@ import (
|
|||||||
"github.com/dokku/dokku/plugins/common"
|
"github.com/dokku/dokku/plugins/common"
|
||||||
nginxvhosts "github.com/dokku/dokku/plugins/nginx-vhosts"
|
nginxvhosts "github.com/dokku/dokku/plugins/nginx-vhosts"
|
||||||
resty "github.com/go-resty/resty/v2"
|
resty "github.com/go-resty/resty/v2"
|
||||||
|
kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
|
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
@@ -686,9 +688,16 @@ func getKedaValues(ctx context.Context, clientset KubernetesClient, appName stri
|
|||||||
|
|
||||||
items, err := clientset.ListClusterTriggerAuthentications(ctx, ListClusterTriggerAuthenticationsInput{})
|
items, err := clientset.ListClusterTriggerAuthentications(ctx, ListClusterTriggerAuthenticationsInput{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if !k8serrors.IsNotFound(err) {
|
||||||
return GlobalKedaValues{}, fmt.Errorf("Error listing cluster trigger authentications: %w", err)
|
return GlobalKedaValues{}, fmt.Errorf("Error listing cluster trigger authentications: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common.LogWarn(fmt.Sprintf("Error listing cluster trigger authentications: %v", err))
|
||||||
|
common.LogWarn("Continuing with no cluster trigger authentications")
|
||||||
|
common.LogWarn("This may be due to the keda helm chart not being installed")
|
||||||
|
items = []kedav1alpha1.ClusterTriggerAuthentication{}
|
||||||
|
}
|
||||||
|
|
||||||
globalAuths := map[string]KedaAuthentication{}
|
globalAuths := map[string]KedaAuthentication{}
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if !strings.HasPrefix(item.Name, "global-auth-") {
|
if !strings.HasPrefix(item.Name, "global-auth-") {
|
||||||
|
|||||||
Reference in new issue
Block a user