Skip to content

Commit

Permalink
Fix pull secret not found error preventing codeModulesImage download (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
luhi-DT authored Jul 4, 2024
1 parent b9f2759 commit 838d0a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/oci/dockerkeychain/docker_keychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ func (keychain *DockerKeychain) loadDockerConfigFromSecret(ctx context.Context,
}

if err := apiReader.Get(ctx, client.ObjectKey{Namespace: pullSecret.Namespace, Name: pullSecret.Name}, &pullSecret); err != nil {
log.Info("failed to load registry pull secret", "name", pullSecret.Name, "namespace", pullSecret.Namespace)
log.Info("No registry pull secret loaded", "name", pullSecret.Name, "namespace", pullSecret.Namespace, "err", err)

return errors.WithStack(err)
return nil
}

dockerAuths, err := extractDockerAuthsFromSecret(&pullSecret)
Expand Down
6 changes: 2 additions & 4 deletions pkg/oci/dockerkeychain/docker_keychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -24,7 +23,7 @@ const (
)

func TestNewDockerKeychain(t *testing.T) {
t.Run("secret not found", func(t *testing.T) {
t.Run("secret not found, try without secret", func(t *testing.T) {
pullSecret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret",
Expand All @@ -34,8 +33,7 @@ func TestNewDockerKeychain(t *testing.T) {
client := fake.NewClient()

_, err := NewDockerKeychain(context.TODO(), client, pullSecret)
require.Error(t, err)
require.True(t, k8sErrors.IsNotFound(err))
require.NoError(t, err)
})

t.Run("invalid format of docker secret dockerconfigjson", func(t *testing.T) {
Expand Down

0 comments on commit 838d0a2

Please sign in to comment.