Skip to content

refactor: expose cluster provider strategy to toolsets#836

Closed
Cali0707 wants to merge 1 commit intocontainers:mainfrom
Cali0707:expose-cluster-strategy
Closed

refactor: expose cluster provider strategy to toolsets#836
Cali0707 wants to merge 1 commit intocontainers:mainfrom
Cali0707:expose-cluster-strategy

Conversation

@Cali0707
Copy link
Copy Markdown
Collaborator

When we initially made the cluster provider strategy, the thinking was that everything could be handled transparently from the toolsets. While this has been true for the most part, as some toolsets are now adding functionality that calls to non kube API server APIs (e.g. a prometheus instance in the cluster), this somewhat breaks down.

In these scenarios, there is sometimes a need for the toolset to know what the strategy was so that it can determine if it needs/should use extra config (e.g. TLS config if not in the cluster).

This attempts to expose that config to toolsets where they can optionally consume it as needed

Signed-off-by: Calum Murray <cmurray@redhat.com>
@Cali0707 Cali0707 requested a review from manusa February 27, 2026 15:51
@manusa
Copy link
Copy Markdown
Member

manusa commented Feb 27, 2026

Can we hold on this one until I send a proposed alternative via Middleware, that OpenShift struct was something I wanted to get rid of, so making it bigger won't help 😅

@Cali0707
Copy link
Copy Markdown
Collaborator Author

@manusa for sure, happy to look into different ways of approaching this

@Cali0707 Cali0707 marked this pull request as draft February 27, 2026 18:29
@Cali0707
Copy link
Copy Markdown
Collaborator Author

Marking as draft so it doesn't get accidentally merged early

@iNecas
Copy link
Copy Markdown

iNecas commented Mar 11, 2026

What's the status of this PR? If I understand it correctly, this blocks openshift#124

manusa added a commit to marcnuri-forks/kubernetes-mcp-server that referenced this pull request Mar 12, 2026
Expose GetClusterProviderStrategy() to tool and prompt handlers at
execution time via the new ConfigProvider interface. This allows
toolsets to access the cluster provider strategy when invoked,
rather than only at initialization through GetTools().

The approach is compatible with dynamic config reload — subsequent
tool calls always see the current strategy value.

Refs containers#836

Signed-off-by: Marc Nuri <marc@marcnuri.com>
manusa added a commit to marcnuri-forks/kubernetes-mcp-server that referenced this pull request Mar 12, 2026
Expose GetClusterProviderStrategy() to tool and prompt handlers at
execution time via the new ConfigProvider interface. This allows
toolsets to access the cluster provider strategy when invoked,
rather than only at initialization through GetTools().

The approach is compatible with dynamic config reload — subsequent
tool calls always see the current strategy value.

Refs containers#836

Signed-off-by: Marc Nuri <marc@marcnuri.com>
manusa added a commit to marcnuri-forks/kubernetes-mcp-server that referenced this pull request Mar 13, 2026
Replace the ConfigProvider interface with the existing BaseConfig
interface in ToolHandlerParams and PromptHandlerParams. This avoids
duplicating GetClusterProviderStrategy() across two interfaces and
reuses the already composed BaseConfig which includes ClusterProvider
and ExtendedConfigProvider.

Reverts changes to pkg/api/config.go and pkg/kiali/kiali.go since
no new interface is needed.

Refs containers#836

Signed-off-by: Marc Nuri <marc@marcnuri.com>
matzew pushed a commit that referenced this pull request Mar 13, 2026
* refactor(api): rename ExtendedConfigProvider to ConfigProvider

Expose GetClusterProviderStrategy() to tool and prompt handlers at
execution time via the new ConfigProvider interface. This allows
toolsets to access the cluster provider strategy when invoked,
rather than only at initialization through GetTools().

The approach is compatible with dynamic config reload — subsequent
tool calls always see the current strategy value.

Refs #836

Signed-off-by: Marc Nuri <marc@marcnuri.com>

* refactor(api): expose BaseConfig to tool and prompt handlers

Replace the ConfigProvider interface with the existing BaseConfig
interface in ToolHandlerParams and PromptHandlerParams. This avoids
duplicating GetClusterProviderStrategy() across two interfaces and
reuses the already composed BaseConfig which includes ClusterProvider
and ExtendedConfigProvider.

Reverts changes to pkg/api/config.go and pkg/kiali/kiali.go since
no new interface is needed.

Refs #836

Signed-off-by: Marc Nuri <marc@marcnuri.com>

---------

Signed-off-by: Marc Nuri <marc@marcnuri.com>
matzew pushed a commit to matzew/kubernetes-mcp-server that referenced this pull request Mar 13, 2026
…ers#916)

* refactor(api): rename ExtendedConfigProvider to ConfigProvider

Expose GetClusterProviderStrategy() to tool and prompt handlers at
execution time via the new ConfigProvider interface. This allows
toolsets to access the cluster provider strategy when invoked,
rather than only at initialization through GetTools().

The approach is compatible with dynamic config reload — subsequent
tool calls always see the current strategy value.

Refs containers#836

Signed-off-by: Marc Nuri <marc@marcnuri.com>

* refactor(api): expose BaseConfig to tool and prompt handlers

Replace the ConfigProvider interface with the existing BaseConfig
interface in ToolHandlerParams and PromptHandlerParams. This avoids
duplicating GetClusterProviderStrategy() across two interfaces and
reuses the already composed BaseConfig which includes ClusterProvider
and ExtendedConfigProvider.

Reverts changes to pkg/api/config.go and pkg/kiali/kiali.go since
no new interface is needed.

Refs containers#836

Signed-off-by: Marc Nuri <marc@marcnuri.com>

---------

Signed-off-by: Marc Nuri <marc@marcnuri.com>
@manusa
Copy link
Copy Markdown
Member

manusa commented Mar 18, 2026

I believe this was superseded by #916. Should we close it?

@manusa
Copy link
Copy Markdown
Member

manusa commented Mar 30, 2026

Closing as I think this one is no longer necessary #916

@manusa manusa closed this Mar 30, 2026
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.

3 participants