From 89b9c35860e88e9f62ebb32d8e28d899c0502da6 Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Tue, 7 Mar 2023 14:34:15 +0530 Subject: [PATCH] Use correct tag for route controller image as per openshift release We started building router image for each openshift release (OCP side) and till now it is divert from what is present in the bundle and what we are consuming from crc side. This PR make sure use the right tag of the image for OCP and use `latest` for OKD. In future we are going to update the bundle with this pod resource so that it can be happen as part of snc. - https://github.com/crc-org/snc/issues/660 --- pkg/crc/machine/start.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/crc/machine/start.go b/pkg/crc/machine/start.go index 3796b4cbb7..d3f7138f16 100644 --- a/pkg/crc/machine/start.go +++ b/pkg/crc/machine/start.go @@ -529,7 +529,7 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig) } if client.useVSock() { - if err := ensureRoutesControllerIsRunning(sshRunner, ocConfig); err != nil { + if err := ensureRoutesControllerIsRunning(sshRunner, ocConfig, startConfig.Preset, vm.bundle); err != nil { return nil, err } } @@ -822,7 +822,7 @@ func logBundleDate(crcBundleMetadata *bundle.CrcBundleInfo) { } } -func ensureRoutesControllerIsRunning(sshRunner *crcssh.Runner, ocConfig oc.Config) error { +func ensureRoutesControllerIsRunning(sshRunner *crcssh.Runner, ocConfig oc.Config, preset crcPreset.Preset, bundleInfo *bundle.CrcBundleInfo) error { bin, err := json.Marshal(v1.Pod{ TypeMeta: metav1.TypeMeta{ Kind: "Pod", @@ -837,7 +837,7 @@ func ensureRoutesControllerIsRunning(sshRunner *crcssh.Runner, ocConfig oc.Confi Containers: []v1.Container{ { Name: "routes-controller", - Image: "quay.io/crcont/routes-controller:latest", + Image: getRouterControllerImage(preset, bundleInfo), ImagePullPolicy: v1.PullIfNotPresent, }, }, @@ -856,6 +856,13 @@ func ensureRoutesControllerIsRunning(sshRunner *crcssh.Runner, ocConfig oc.Confi return nil } +func getRouterControllerImage(preset crcPreset.Preset, bundleInfo *bundle.CrcBundleInfo) string { + if preset == crcPreset.OpenShift { + return fmt.Sprintf("quay.io/crcont/routes-controller:%s", bundleInfo.GetOpenshiftVersion()) + } + return "quay.io/crcont/routes-controller:latest" +} + func updateKubeconfig(ctx context.Context, ocConfig oc.Config, sshRunner *crcssh.Runner, kubeconfigFilePath string) error { selfSignedCAKey, selfSignedCACert, err := crctls.GetSelfSignedCA() if err != nil {