Skip to content

Commit

Permalink
Use correct tag for route controller image as per openshift release
Browse files Browse the repository at this point in the history
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.

- crc-org/snc#660
  • Loading branch information
praveenkumar authored and anjannath committed Mar 7, 2023
1 parent ec2fdfd commit 89b9c35
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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",
Expand All @@ -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,
},
},
Expand All @@ -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 {
Expand Down

0 comments on commit 89b9c35

Please sign in to comment.