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

Fix double revision in istio configmap name #6675

Merged
merged 3 commits into from Oct 26, 2023
Merged

Conversation

nrfox
Copy link
Contributor

@nrfox nrfox commented Oct 5, 2023

Uses: conf.ExternalServices.Istio.ConfigMapName without adding the rev tag when it is set and not the default istio.

Fixes #6669

@nrfox nrfox requested a review from jmazzitelli October 5, 2023 01:38
@nrfox nrfox self-assigned this Oct 5, 2023
@nrfox
Copy link
Contributor Author

nrfox commented Oct 25, 2023

@jmazzitelli please take a look at this when you get a chance

Copy link
Collaborator

@jmazzitelli jmazzitelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code change makes sense. We need to make the call to this new IstioConfigMap name in all the places where we need the name.

These places: https://github.com/search?q=repo%3Akiali%2Fkiali+%2FGetConfigMap.*ExternalServices.Istio.ConfigMapName%2F&type=code

Here's the files that probably need to be changed in this PR:

$ grep -R 'GetConfig.*ExternalServices.Istio.ConfigMapName'
business/istio_certs.go:	istioConfigMap, err := ics.k8s.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
business/istio_certs.go:	istioConfigMap, err := ics.k8s.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
business/namespaces.go:	if icm, err := in.kialiCache.GetConfigMap(in.conf.IstioNamespace, in.conf.ExternalServices.Istio.ConfigMapName); err == nil {
business/tls.go:	istioConfig, err := kubeCache.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
business/istio_validations.go:		istioConfig, err = kialiCache.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
business/istio_validations.go:		istioConfig, err = userClient.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
business/mesh.go:	istioConfig, err := in.kialiCache.GetConfigMap(in.conf.IstioNamespace, in.conf.ExternalServices.Istio.ConfigMapName)

Note that this PR directly addresses this issue too - so we can close this issue when this PR is merged.

@yohanb
Copy link

yohanb commented Oct 25, 2023

@nrfox thanks for this PR! We just ran into this issue and traced it back to the same faulty code.
When can we expect this to be complete? Only missing a few refactors ;)

@nrfox
Copy link
Contributor Author

nrfox commented Oct 26, 2023

@nrfox thanks for this PR! We just ran into this issue and traced it back to the same faulty code.
When can we expect this to be complete? Only missing a few refactors ;)

@yohanb hoping to have this complete by the end of the week so it can be included with the next release.

@yohanb
Copy link

yohanb commented Oct 26, 2023

@nrfox thanks for this PR! We just ran into this issue and traced it back to the same faulty code.
When can we expect this to be complete? Only missing a few refactors ;)

@yohanb hoping to have this complete by the end of the week so it can be included with the next release.

Awesome, thanks so much 👍

@nrfox
Copy link
Contributor Author

nrfox commented Oct 26, 2023

@jmazzitelli it seemed like the e2e tests were failing because of the tracing flakes. I rebased with main to pickup the latest fix. I also added some additional test coverage to the area that was causing this error to be logged which was in gateway validations.

if revLabel := istiod.Labels[IstioRevisionLabel]; revLabel != "default" && revLabel != "" {
configMapName = configMapName + "-" + revLabel
}
configMapName := IstioConfigMapName(in.conf, controlPlane.Revision)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing I don't see explained anywhere here is why does this pass in the Revision but everywhere else it passes in empty string for revision. How does this work when sometimes you need the revision but other times that is not required to get the configmap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because basically this is the only place that is handling there being multiple controlplanes. Everywhere else just assumes there's one. When set config.external_services.istio.config_map_name, IstioConfigMapName will always return what you've set there regardless of what revision you pass in. It's a bit of a hack to get around the fact that, right now we expect users to set this manually when using control plane revisions.

Copy link
Collaborator

@jmazzitelli jmazzitelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does the refactor so everywhere in the code gets the configmap name using the common function. I have a feeling our support for canary upgrades still isn't seamless but we can worry about that later.

@nrfox
Copy link
Contributor Author

nrfox commented Oct 26, 2023

I have a feeling our support for canary upgrades still isn't seamless but we can worry about that later.

Yes this change doesn't make the support for canary upgrades any better but it at least gets rid of the error log when you've set config.external_services.istio.config_map_name.

@nrfox nrfox merged commit edc574d into kiali:master Oct 26, 2023
6 checks passed
@nrfox nrfox deleted the kiali-6669 branch October 26, 2023 17:11
@amazingandyyy
Copy link

good to see this get merged, what's the ETA for new helm chart release? thanks for the hard work!

@yohanb
Copy link

yohanb commented Oct 26, 2023

probably removing the logic to append the revision all together would be a more cohesive solution. I think we can simply expect users to provide the correct values through external_services.istio

@jmazzitelli
Copy link
Collaborator

probably removing the logic to append the revision all together would be a more cohesive solution. I think we can simply expect users to provide the correct values through external_services.istio

I'm OK doing either suggestion. if Kiali users like @yohanb think it would be simpler and expected of users to set the correct value in the Kiali config, then let's do that.

cc @nrfox

@nrfox
Copy link
Contributor Author

nrfox commented Oct 27, 2023

I'm OK doing either suggestion. if Kiali users like @yohanb think it would be simpler and expected of users to set the correct value in the Kiali config, then let's do that.

That sounds good to me. The only place that is currently using the offending code from GetMesh does not use the config map anyways and I'd rather be sure to not break existing functionality or cause noise for users. I appreciate the feedback here and it's very useful knowing that this is config that users rely on.

@jmazzitelli
Copy link
Collaborator

we need to backport this to the 1.73 branch.

jmazzitelli pushed a commit to jmazzitelli/kiali that referenced this pull request Dec 18, 2023
jmazzitelli added a commit that referenced this pull request Dec 18, 2023
(cherry picked from commit edc574d)

Co-authored-by: Nick Fox <nfox@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Double istio rev in configmap name
4 participants