Skip to content

Commit

Permalink
fix(core): Access configmap from another namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
gansheer committed Oct 24, 2023
1 parent 0422c76 commit a63ebbf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/util/registry/kep_1755.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ import (

"github.com/apache/camel-k/v2/pkg/client"
"gopkg.in/yaml.v2"
corev1 "k8s.io/api/core/v1"
k8errors "k8s.io/apimachinery/pkg/api/errors"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// GetRegistryAddress KEP-1755
// https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
func GetRegistryAddress(ctx context.Context, c client.Client) (*string, error) {
config := corev1.ConfigMap{}
err := c.Get(ctx, ctrl.ObjectKey{Namespace: "kube-public", Name: "local-registry-hosting"}, &config)
config, err := c.CoreV1().ConfigMaps("kube-public").Get(ctx, "local-registry-hosting", metav1.GetOptions{})
if err != nil {
if k8errors.IsNotFound(err) {
if k8serrors.IsNotFound(err) {
return nil, nil
}
return nil, err
Expand Down

0 comments on commit a63ebbf

Please sign in to comment.