Skip to content

Commit

Permalink
fix(core): Manage forbidden access configmap for KEP-1755
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Oct 25, 2023
1 parent 461c548 commit 2f23084
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/util/registry/kep_1755.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"

"github.com/apache/camel-k/v2/pkg/client"
"github.com/apache/camel-k/v2/pkg/util/log"
"gopkg.in/yaml.v2"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -31,7 +32,11 @@ import (
func GetRegistryAddress(ctx context.Context, c client.Client) (*string, error) {
config, err := c.CoreV1().ConfigMaps("kube-public").Get(ctx, "local-registry-hosting", metav1.GetOptions{})
if err != nil {
if k8serrors.IsNotFound(err) {
if k8serrors.IsForbidden(err) {
log.Debug("Cannot access registry configuration local-registry-hosting ConfigMap", "error", err)
return nil, nil
} else if k8serrors.IsNotFound(err) {
log.Error(err, "Cannot find registry configuration local-registry-hosting ConfigMap", "error", err)
return nil, nil
}
return nil, err
Expand Down

0 comments on commit 2f23084

Please sign in to comment.