mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-04 00:36:33 +00:00
feat: initial impl of integration
Signed-off-by: AlexsJones <alexsimonjones@gmail.com> Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
@@ -2,17 +2,23 @@ package kubernetes
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
Client kubernetes.Interface
|
||||
Client kubernetes.Interface
|
||||
RestClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *Client) GetClient() kubernetes.Interface {
|
||||
return c.Client
|
||||
}
|
||||
|
||||
func (c *Client) GetRestClient() rest.Interface {
|
||||
return c.RestClient
|
||||
}
|
||||
|
||||
func NewClient(kubecontext string, kubeconfig string) (*Client, error) {
|
||||
|
||||
config := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
|
||||
@@ -30,7 +36,13 @@ func NewClient(kubecontext string, kubeconfig string) (*Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
restClient, err := rest.RESTClientFor(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Client{
|
||||
Client: clientSet,
|
||||
Client: clientSet,
|
||||
RestClient: restClient,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user