Skip to content

Commit

Permalink
respect cluster image pull configurations (#54)
Browse files Browse the repository at this point in the history
* respect cluster image pull configurations

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven committed Apr 25, 2023
1 parent 69a53ad commit 8ec4467
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions pkg/controllers/core/catalogsource_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"fmt"
"io"
"path/filepath"
"time"

"github.com/operator-framework/operator-registry/alpha/declcfg"
Expand Down Expand Up @@ -373,6 +374,8 @@ func (r *CatalogSourceReconciler) parseUnpackLogs(ctx context.Context, job *batc

// unpackJob creates the manifest for an unpack Job given a CatalogSource
func (r *CatalogSourceReconciler) unpackJob(cs *corev1beta1.CatalogSource) *batchv1.Job {
opmVol := "opm"
mountPath := "opmvol/"
return &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Namespace: "catalogd-system",
Expand All @@ -386,14 +389,45 @@ func (r *CatalogSourceReconciler) unpackJob(cs *corev1beta1.CatalogSource) *batc
},
Spec: v1.PodSpec{
RestartPolicy: v1.RestartPolicyOnFailure,
Containers: []v1.Container{
InitContainers: []v1.Container{
{
Image: r.OpmImage,
Name: "initializer",
Command: []string{
"cp",
"/bin/opm",
filepath.Join(mountPath, "opm"),
},
VolumeMounts: []v1.VolumeMount{
{
Name: opmVol,
MountPath: mountPath,
},
},
},
},
Containers: []v1.Container{
{
Image: cs.Spec.Image,
Name: "unpacker",
Command: []string{
"opm",
filepath.Join(mountPath, "opm"),
"render",
cs.Spec.Image,
"/configs/",
},
VolumeMounts: []v1.VolumeMount{
{
Name: opmVol,
MountPath: mountPath,
},
},
},
},
Volumes: []v1.Volume{
{
Name: opmVol,
VolumeSource: v1.VolumeSource{
EmptyDir: &v1.EmptyDirVolumeSource{},
},
},
},
Expand Down

0 comments on commit 8ec4467

Please sign in to comment.