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:
Jose Diaz-Gonzalez
2024-03-06 17:50:52 -05:00
parent fd0ac54e7e
commit f2892208c1

View File

@@ -19,10 +19,12 @@ import (
"github.com/dokku/dokku/plugins/common"
nginxvhosts "github.com/dokku/dokku/plugins/nginx-vhosts"
resty "github.com/go-resty/resty/v2"
kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
"golang.org/x/sync/errgroup"
"gopkg.in/yaml.v3"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
@@ -686,7 +688,14 @@ func getKedaValues(ctx context.Context, clientset KubernetesClient, appName stri
items, err := clientset.ListClusterTriggerAuthentications(ctx, ListClusterTriggerAuthenticationsInput{})
if err != nil {
return GlobalKedaValues{}, fmt.Errorf("Error listing cluster trigger authentications: %w", err)
if !k8serrors.IsNotFound(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{}