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

Revert common cfgmap func and protect against failure #6791

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nrfox
Copy link
Contributor

@nrfox nrfox commented Oct 27, 2023

This reverts the callers of IstioConfigMapName back to using cfg.external_services.istio.config_map_name directly. It now logs failures in GetMesh to auto-detect the configmap instead of returning an error. Nothing is currently using that configuration so an error shouldn't be returned there. Related to: #6669.

This reverts the callers of IstioConfigMapName back to using `cfg.external_services.istio.config_map_name` directly. It now logs failures in GetMesh to auto-detect the configmap instead of returning an error. Nothing is currently using that configuration so an error shouldn't be returned there. Related to: kiali#6669.
@nrfox
Copy link
Contributor Author

nrfox commented Oct 27, 2023

cc @yohanb if you want to take a look. Basically this change does 2 things:

  1. Removes the use of external_services.istio.config_map_name altogether when trying to guess the configmap name.
  2. Makes any failure to get the "guessed" configmap a debug log that won't cause failures in gateway validations like before.

Another option is to just rip out fetching the guessed configmap entirely. I kept it since it will be used for in progress future work for #6035 but really it doesn't need to be there until it is being used directly.

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.

I say keep a common function unless there is a reason you think ripping it back out is better.

@@ -103,7 +103,7 @@ func (ics *IstioCertsService) getCertificateFromSecret(secretName, certName stri
func (ics *IstioCertsService) getCertsConfigFromIstioConfigMap() ([]certConfig, error) {
cfg := config.Get()

istioConfigMap, err := ics.k8s.GetConfigMap(cfg.IstioNamespace, IstioConfigMapName(*cfg, ""))
istioConfigMap, err := ics.k8s.GetConfigMap(cfg.IstioNamespace, cfg.ExternalServices.Istio.ConfigMapName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why wouldn't we want to keep this common function here and in the common function just return cfg.ExternalServices.Istio.ConfigMapName... in the future, if anything needs to change (like trying to get the name automagically) you only have to change this function and everywhere the name needs to be obtained will just work.

With this revert, if we ever have to change this, we need to go through all these places again and change it back to calling a common function.

I would leave the common function here - and for now just have it simply return config.Get().ExternalServices.Istio.ConfigMapName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why wouldn't we want to keep this common function here and in the common function just return cfg.ExternalServices.Istio.ConfigMapName... in the future, if anything needs to change (like trying to get the name automagically) you only have to change this function and everywhere the name needs to be obtained will just work.

In the future, I would expect callers to call GetMesh to get the config info from there instead of fetching and unmarshaling the configmap every the config is needed.

@jmazzitelli jmazzitelli dismissed their stale review October 27, 2023 18:43

removing the common function - just rely on the config name and hope we don't have to refactor this again :)

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.

i think the ci error is a flake, so approving in case you want this in for the release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants