-
Notifications
You must be signed in to change notification settings - Fork 145
refactor(kubernetes): keep Provider as only external Kubernetes interface #372
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
base: main
Are you sure you want to change the base?
Conversation
51a65fe
to
e355e10
Compare
func (p *kubeConfigClusterProvider) IsOpenShift(ctx context.Context) bool { | ||
return p.managers[p.defaultContext].IsOpenShift(ctx) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can either:
- check if any of the clusters are openshift
- figure out a way to set the "contexts" parameter for the openshift specific tools to only include the contexts which are openshift
There was a problem hiding this comment.
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:
- check if any of the clusters are openshift
- 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?
|
||
// 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is great
a7dc685
to
68a2d71
Compare
…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 <[email protected]>
Co-authored-by: Calum Murray <[email protected]> Signed-off-by: Marc Nuri <[email protected]>
68a2d71
to
6a58d29
Compare
Initial phase to unify-merge the Provider interface with the Manager struct.
/cc @Cali0707