Skip to content

Conversation

@manusa
Copy link
Member

@manusa manusa commented Oct 10, 2025

Initial phase to unify-merge the Provider interface with the Manager struct.

  • Renamed ManagerProvider to Provider (i.e. kubernets.Provider)
  • Moved Manager related logic to specific files
  • Exposed relevant method through Provider interface (GetDerivedKubernetes, IsOpenShift, VerifyToken)

/cc @Cali0707

@manusa manusa force-pushed the fix/kubernetes-provider branch 2 times, most recently from 51a65fe to e355e10 Compare October 10, 2025 13:23
Comment on lines +83 to +85
func (p *kubeConfigClusterProvider) IsOpenShift(ctx context.Context) bool {
return p.managers[p.defaultContext].IsOpenShift(ctx)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not convinced is the IsOpenShift method makes sense here - what if there are a mix of openshift and non openshift clusters in the kubeconfig?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can either:

  1. check if any of the clusters are openshift
  2. figure out a way to set the "contexts" parameter for the openshift specific tools to only include the contexts which are openshift

Copy link
Member Author

Choose a reason for hiding this comment

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

This is part of the legacy behavior where the Kubernetes MCP server is supposed to adapt to the underlying Kubernetes clusters and provide flavor-specific tools.

In the current state, the toolsets GetTools method receive this interface and can perform some logic to register tools based on the provided information.

With the Multi-Cluster approach and the segregation of toolsets, this might not be applicable any more.

I was going to add a TODO comment in the Provider interface definition beside the OpenShift reference indicating that this was going to be removed.
But since I'm not sure of how we want to move forward, I didn't.

Maybe we can either:

  1. check if any of the clusters are openshift
  2. figure out a way to set the "contexts" parameter for the openshift specific tools to only include the contexts which are openshift

These are valid options, the other alternative is to just remove the interface and provide a base openshift toolset.

Since it's unclear, and there are a few more refactors pending from my side, I think that the // TODO comment would be enough for now.

Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah that makes sense - if we have a comment tracking that we should revisit this logic I'm happy to leave it as is for now

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added the TODO comment so that we eventually deal with this.


// derive the manager based on auth on top of the settings for the cluster
k, err := m.Derived(ctx)
k, err := s.p.GetDerivedKubernetes(ctx, cluster)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this change is great

@manusa manusa force-pushed the fix/kubernetes-provider branch from a7dc685 to 68a2d71 Compare October 13, 2025 10:31
@manusa manusa added this to the 0.1.0 milestone Oct 13, 2025
@manusa manusa force-pushed the fix/kubernetes-provider branch from 68a2d71 to 6a58d29 Compare October 13, 2025 11:12
@manusa manusa requested a review from Cali0707 October 14, 2025 04:39
Copy link
Collaborator

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

LGTM

manusa and others added 2 commits October 14, 2025 15:19
…face

Initial phase to unify-merge the Provider interface with the Manager struct.

- Renamed ManagerProvider to Provider (i.e. kubernets.Provider)
- Moved Manager related logic to specific files
- Exposed relevant method through Provider interface (GetDerivedKubernetes, IsOpenShift, VerifyToken)

Signed-off-by: Marc Nuri <marc@marcnuri.com>
Co-authored-by: Calum Murray <cmurray@redhat.com>
Signed-off-by: Marc Nuri <marc@marcnuri.com>
@manusa manusa force-pushed the fix/kubernetes-provider branch from 6a58d29 to f3f9fd8 Compare October 14, 2025 13:19
@manusa manusa merged commit f3a4466 into containers:main Oct 14, 2025
6 checks passed
@manusa manusa deleted the fix/kubernetes-provider branch October 14, 2025 13:25
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.

2 participants