Skip to content

Commit

Permalink
respect cluster image pull configurations
Browse files Browse the repository at this point in the history
when creating an unpack job by using init containers to pull the catalog image
, populate a volume with fbc configs, and use the opm image to render the configs
from the volume

fixes operator-framework#21

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven committed Apr 21, 2023
1 parent 69a53ad commit 97997f0
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion pkg/controllers/core/catalogsource_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,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 {
volName := "volumizer"
mountPath := "catalog-configs/"
return &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Namespace: "catalogd-system",
Expand All @@ -386,14 +388,46 @@ func (r *CatalogSourceReconciler) unpackJob(cs *corev1beta1.CatalogSource) *batc
},
Spec: v1.PodSpec{
RestartPolicy: v1.RestartPolicyOnFailure,
InitContainers: []v1.Container{
{
Image: cs.Spec.Image,
Name: "initializer",
Command: []string{
"cp",
"-r",
"configs/", // Do all FBC catalog images stuff everything under the configs/ directory?
mountPath,
},
VolumeMounts: []v1.VolumeMount{
{
Name: volName,
MountPath: mountPath,
},
},
},
},
Containers: []v1.Container{
{
Image: r.OpmImage,
Name: "unpacker",
Command: []string{
"opm",
"render",
cs.Spec.Image,
mountPath,
},
VolumeMounts: []v1.VolumeMount{
{
Name: volName,
MountPath: mountPath,
},
},
},
},
Volumes: []v1.Volume{
{
Name: volName,
VolumeSource: v1.VolumeSource{
EmptyDir: &v1.EmptyDirVolumeSource{},
},
},
},
Expand Down

0 comments on commit 97997f0

Please sign in to comment.