Skip to content

Conversation

@josunect
Copy link
Contributor

  • Use a CA file path in addition to the inline certificate.
  • Document the standardized pattern for future RH toolsets.

This PR keeps the inline option for back-comp, but I can remove it if it is not required.

How to manually test it:

echo | openssl s_client -showcerts -connect kiali-istio-system.apps-crc.testing:443 2>/dev/null | openssl x509 > /tmp/kiali.crt

Configuration (Using a kiali https route):

url = "https://kiali-istio-system.apps-crc.testing/"
certificate_authority = "/tmp/kiali.crt"
insecure = false

Run the MCP server:

make build
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server

@Cali0707
Copy link
Collaborator

This PR keeps the inline option for back-comp, but I can remove it if it is not required.

@josunect I think it should be safe for you to remove this - we haven't cut a release with kiali toolset yet, so I don't think we need to maintain backwards compatability yet (cc @manusa )

@manusa manusa changed the title feat(kiali): Standardize Certificate Authority Configuration Method for Kiali mCP feat(kiali): Standardize Certificate Authority Configuration Method Nov 26, 2025
@manusa manusa self-requested a review November 26, 2025 16:26
Comment on lines 79 to 93
// Create a config file with absolute path
configFile := filepath.Join(s.tempDir, "config.toml")
// Convert backslashes to forward slashes for TOML compatibility on Windows
caFileForTOML := filepath.ToSlash(s.caFile)
configContent := `
[toolset_configs.kiali]
url = "https://kiali.example/"
certificate_authority = "` + caFileForTOML + `"
`
err := os.WriteFile(configFile, []byte(configContent), 0644)
s.Require().NoError(err, "Failed to write config file")

// Read config - Read() automatically sets the config directory path
cfg, err := config.Read(configFile)
s.Require().NoError(err, "Failed to read config")
Copy link
Member

Choose a reason for hiding this comment

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

Can't this be replaced with the logic we have in place for other tests e.g.

s.Config = test.Must(config.ReadToml([]byte(`
[toolset_configs.kiali]
url = "https://kiali.example/"
insecure = true
`)))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@aljesusg
Copy link
Contributor

This PR keeps the inline option for back-comp, but I can remove it if it is not required.

@josunect I think it should be safe for you to remove this - we haven't cut a release with kiali toolset yet, so I don't think we need to maintain backwards compatability yet (cc @manusa )

Yes please, The idea is to replace the inline CA by path

@josunect josunect requested a review from manusa November 27, 2025 10:21
@manusa
Copy link
Member

manusa commented Nov 27, 2025

@aljesusg @josunect I still se the support for inline PEM certificates.
I'm not sure if this is going to be removed in the scope of this PR or in a follow-up.

@aljesusg
Copy link
Contributor

@aljesusg @josunect I still se the support for inline PEM certificates. I'm not sure if this is going to be removed in the scope of this PR or in a follow-up.

The idea is replace it, so yes we are going to remove it in this PR

Copy link
Contributor

@aljesusg aljesusg left a comment

Choose a reason for hiding this comment

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

Look good only this 2 minor things, I am going to test it locally

docs/KIALI.md Outdated
- Invalid URL → ensure `[toolset_configs.kiali].url` is a valid `http(s)://host` URL.
- TLS certificate validation:
- If `[toolset_configs.kiali].url` uses HTTPS and `[toolset_configs.kiali].insecure` is false, you must set `[toolset_configs.kiali].certificate_authority` with the PEM-encoded certificate(s) used by the Kiali server. This field expects inline PEM content, not a file path. You may concatenate multiple PEM blocks to include an intermediate chain.
- If `[toolset_configs.kiali].url` uses HTTPS and `[toolset_configs.kiali].insecure` is false, you must set `[toolset_configs.kiali].certificate_authority` with the path to the CA certificate file. Relative paths are resolved relative to the directory containing the config file. Only file paths are supported; inline PEM content is not allowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- If `[toolset_configs.kiali].url` uses HTTPS and `[toolset_configs.kiali].insecure` is false, you must set `[toolset_configs.kiali].certificate_authority` with the path to the CA certificate file. Relative paths are resolved relative to the directory containing the config file. Only file paths are supported; inline PEM content is not allowed.
- If `[toolset_configs.kiali].url` uses HTTPS and `[toolset_configs.kiali].insecure` is false, you must set `[toolset_configs.kiali].certificate_authority` with the path to the CA certificate file. Relative paths are resolved relative to the directory containing the config file.

josunect and others added 13 commits November 28, 2025 15:29
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Signed-off-by: josunect <[email protected]>
Co-authored-by: Alberto Gutierrez <[email protected]>
Signed-off-by: josunect <[email protected]>
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.

4 participants