Skip to content

Commit 4803465

Browse files
author
Mikalai Radchuk
committed
Remove unused pull secret configuration
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
1 parent 1c6a839 commit 4803465

File tree

3 files changed

+3
-41
lines changed

3 files changed

+3
-41
lines changed

cmd/manager/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,7 @@ func main() {
195195
os.Exit(1)
196196
}
197197
unpacker := &source.ImageRegistry{
198-
BaseCachePath: filepath.Join(cachePath, "unpack"),
199-
// TODO: This needs to be derived per extension via ext.Spec.InstallNamespace
200-
AuthNamespace: systemNamespace,
198+
BaseCachePath: filepath.Join(cachePath, "unpack"),
201199
CertPoolWatcher: certPoolWatcher,
202200
}
203201

internal/rukpak/source/image_registry.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
"strings"
1414

1515
"github.com/containerd/containerd/archive"
16-
"github.com/google/go-containerregistry/pkg/authn/k8schain"
17-
gcrkube "github.com/google/go-containerregistry/pkg/authn/kubernetes"
1816
"github.com/google/go-containerregistry/pkg/name"
1917
"github.com/google/go-containerregistry/pkg/v1/remote"
2018
apimacherrors "k8s.io/apimachinery/pkg/util/errors"
@@ -29,8 +27,6 @@ const SourceTypeImage SourceType = "image"
2927
type ImageSource struct {
3028
// Ref contains the reference to a container image containing Bundle contents.
3129
Ref string
32-
// ImagePullSecretName contains the name of the image pull secret in the namespace that the provisioner is deployed.
33-
ImagePullSecretName string
3430
// InsecureSkipTLSVerify indicates that TLS certificate validation should be skipped.
3531
// If this option is specified, the HTTPS protocol will still be used to
3632
// fetch the specified image reference.
@@ -53,7 +49,6 @@ func NewUnrecoverable(err error) *Unrecoverable {
5349

5450
type ImageRegistry struct {
5551
BaseCachePath string
56-
AuthNamespace string
5752
CertPoolWatcher *httputil.CertPoolWatcher
5853
}
5954

@@ -72,24 +67,6 @@ func (i *ImageRegistry) Unpack(ctx context.Context, bundle *BundleSource) (*Resu
7267
return nil, NewUnrecoverable(fmt.Errorf("error parsing image reference: %w", err))
7368
}
7469

75-
remoteOpts := []remote.Option{}
76-
if bundle.Image.ImagePullSecretName != "" {
77-
chainOpts := k8schain.Options{
78-
ImagePullSecrets: []string{bundle.Image.ImagePullSecretName},
79-
Namespace: i.AuthNamespace,
80-
// TODO: Do we want to use any secrets that are included in the rukpak service account?
81-
// If so, we will need to add the permission to get service accounts and specify
82-
// the rukpak service account name here.
83-
ServiceAccountName: gcrkube.NoServiceAccount,
84-
}
85-
authChain, err := k8schain.NewInCluster(ctx, chainOpts)
86-
if err != nil {
87-
return nil, fmt.Errorf("error getting auth keychain: %w", err)
88-
}
89-
90-
remoteOpts = append(remoteOpts, remote.WithAuthFromKeychain(authChain))
91-
}
92-
9370
transport := remote.DefaultTransport.(*http.Transport).Clone()
9471
if transport.TLSClientConfig == nil {
9572
transport.TLSClientConfig = &tls.Config{
@@ -107,6 +84,8 @@ func (i *ImageRegistry) Unpack(ctx context.Context, bundle *BundleSource) (*Resu
10784
}
10885
transport.TLSClientConfig.RootCAs = pool
10986
}
87+
88+
remoteOpts := []remote.Option{}
11089
remoteOpts = append(remoteOpts, remote.WithTransport(transport))
11190

11291
digest, isDigest := imgRef.(name.Digest)
@@ -175,7 +154,6 @@ func unpackedResult(fsys fs.FS, bundle *BundleSource, ref string) *Result {
175154
Type: SourceTypeImage,
176155
Image: &ImageSource{
177156
Ref: ref,
178-
ImagePullSecretName: bundle.Image.ImagePullSecretName,
179157
InsecureSkipTLSVerify: bundle.Image.InsecureSkipTLSVerify,
180158
},
181159
},

internal/rukpak/source/unpacker.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"context"
55
"fmt"
66
"io/fs"
7-
8-
"sigs.k8s.io/controller-runtime/pkg/manager"
97
)
108

119
// Unpacker unpacks bundle content, either synchronously or asynchronously and
@@ -102,15 +100,3 @@ func (s *unpacker) Cleanup(ctx context.Context, bundle *BundleSource) error {
102100
}
103101
return source.Cleanup(ctx, bundle)
104102
}
105-
106-
// NewDefaultUnpacker returns a new composite Source that unpacks bundles using
107-
// a default source mapping with built-in implementations of all of the supported
108-
// source types.
109-
func NewDefaultUnpacker(mgr manager.Manager, namespace, cacheDir string) (Unpacker, error) {
110-
return NewUnpacker(map[SourceType]Unpacker{
111-
SourceTypeImage: &ImageRegistry{
112-
BaseCachePath: cacheDir,
113-
AuthNamespace: namespace,
114-
},
115-
}), nil
116-
}

0 commit comments

Comments
 (0)