Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Bundle logic not working as expected for the OKD preset #3595

Closed
praveenkumar opened this issue Apr 12, 2023 · 5 comments
Closed

[BUG] Bundle logic not working as expected for the OKD preset #3595

praveenkumar opened this issue Apr 12, 2023 · 5 comments
Labels
kind/bug Something isn't working points/1 priority/minor tags/good first issue Good for newcomers tags/help wanted Extra attention is needed

Comments

@praveenkumar
Copy link
Member

praveenkumar commented Apr 12, 2023

As reported in okd-project/okd#1556, we see errors like:

PS C:\Users\USER> crc config set preset okd
PS C:\Users\USER> crc setup
...
INFO Loading bundle: crc_okd_hyperv_4.12.0-0.okd-2023-02-18-033438_amd64...
Preset okd is used but bundle is provided for openshift preset
@praveenkumar praveenkumar added kind/bug Something isn't working status/need triage labels Apr 12, 2023
@gbraad gbraad changed the title [BUG] OKD preset is not working as expected [BUG] Bundle logic not working as expected for the OKD preset Apr 12, 2023
@praveenkumar praveenkumar added the tags/good first issue Good for newcomers label Apr 12, 2023
@praveenkumar
Copy link
Member Author

praveenkumar commented Apr 12, 2023

Issue is around https://github.com/crc-org/crc/blob/main/pkg/crc/machine/bundle/metadata.go#L188-L199 logic which return OpenShift preset for both OKD and Openshift side

func (bundle *CrcBundleInfo) GetBundleType() crcPreset.Preset {
	switch bundle.Type {
	case "snc", "snc_custom":
		return crcPreset.OpenShift
	case "podman", "podman_custom":
		return crcPreset.Podman
	case "microshift", "microshift_custom":
		return crcPreset.Microshift
	default:
		return crcPreset.OpenShift     // <!--- drops here
	}
}

and consuming it https://github.com/crc-org/crc/blob/main/pkg/crc/machine/start.go#L915-L920 here so in start.go logic need to be change something like below.

func bundleMismatchWithPreset(preset crcPreset.Preset, bundleMetadata *bundle.CrcBundleInfo) error {
       bundlePreset := bundleMetadata.GetBundleType()
        if preset == crcPreset.OKD && bundlePreset == crcPreset.OpenShift {
               return nil
        }
	if preset != bundleMetadata.GetBundleType() {
		return errors.Errorf("Preset %s is used but bundle is provided for %s preset", preset, bundleMetadata.GetBundleType())
	}
	return nil
}

A proper fix would be in the metadata the type should be changed to:

  • okd for OKD
  • snc/openshift for openshift preset.

@Maurycy-Krzeminski
Copy link
Contributor

Maurycy-Krzeminski commented Apr 20, 2023

On windows to make OKD work i created my fork with proposed fix:
Maurycy-Krzeminski@609507f
I built it and this was enough for crc to work with OKD bundl
There was no need to change bundleMismatchWithPreset function, i only changed GetBundleType function
After that i had to set kubeadmin-password because there appeared some other problems:
crc config set kubeadmin-password ChangeMe
and to access i had to copy kubeconfig from
C:\Users\USERNAME\.crc\machines\crc\kubeconfig to
C:\Users\USERNAME\.kube\config
And as far as i see everything works

@praveenkumar
Copy link
Member Author

@Maurycy-Krzeminski yes this is correct fix, can you put a PR for same?

@Maurycy-Krzeminski
Copy link
Contributor

Sure: #3610

@praveenkumar
Copy link
Member Author

Since PR is merged, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working points/1 priority/minor tags/good first issue Good for newcomers tags/help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants