@@ -5,15 +5,11 @@ import (
55
66 "k8s.io/apimachinery/pkg/api/meta"
77 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
9- "k8s.io/apimachinery/pkg/runtime"
10- "k8s.io/apimachinery/pkg/runtime/schema"
118 "k8s.io/cli-runtime/pkg/genericclioptions"
129 "k8s.io/client-go/discovery"
1310 "k8s.io/client-go/dynamic"
1411 "k8s.io/client-go/kubernetes"
1512 "k8s.io/client-go/rest"
16- "k8s.io/metrics/pkg/apis/metrics"
1713 metricsv1beta1 "k8s.io/metrics/pkg/client/clientset/versioned/typed/metrics/v1beta1"
1814)
1915
@@ -51,72 +47,14 @@ type KubernetesClient interface {
5147 kubernetes.Interface
5248 // NamespaceOrDefault returns the provided namespace or the default configured namespace if empty
5349 NamespaceOrDefault (namespace string ) string
50+ // RESTConfig returns the REST config used to create clients
5451 RESTConfig () * rest.Config
52+ // RESTMapper returns the REST mapper used to map GVK to GVR
5553 RESTMapper () meta.ResettableRESTMapper
54+ // DiscoveryClient returns the cached discovery client
5655 DiscoveryClient () discovery.CachedDiscoveryInterface
56+ // DynamicClient returns the dynamic client
5757 DynamicClient () dynamic.Interface
58+ // MetricsV1beta1Client returns the metrics v1beta1 client
5859 MetricsV1beta1Client () * metricsv1beta1.MetricsV1beta1Client
59-
60- // TODO: To be removed in next iteration
61- // --- Resource Operations ---
62-
63- // ResourcesList lists resources of the specified GroupVersionKind
64- ResourcesList (ctx context.Context , gvk * schema.GroupVersionKind , namespace string , options ListOptions ) (runtime.Unstructured , error )
65- // ResourcesGet retrieves a single resource by name
66- ResourcesGet (ctx context.Context , gvk * schema.GroupVersionKind , namespace , name string ) (* unstructured.Unstructured , error )
67- // ResourcesCreateOrUpdate creates or updates resources from a YAML/JSON string
68- ResourcesCreateOrUpdate (ctx context.Context , resource string ) ([]* unstructured.Unstructured , error )
69- // ResourcesDelete deletes a resource by name
70- ResourcesDelete (ctx context.Context , gvk * schema.GroupVersionKind , namespace , name string ) error
71- // ResourcesScale gets or sets the scale of a resource
72- ResourcesScale (ctx context.Context , gvk * schema.GroupVersionKind , namespace , name string , desiredScale int64 , shouldScale bool ) (* unstructured.Unstructured , error )
73-
74- // --- Namespace Operations ---
75-
76- // NamespacesList lists all namespaces
77- NamespacesList (ctx context.Context , options ListOptions ) (runtime.Unstructured , error )
78- // ProjectsList lists all OpenShift projects
79- ProjectsList (ctx context.Context , options ListOptions ) (runtime.Unstructured , error )
80-
81- // --- Pod Operations ---
82-
83- // PodsListInAllNamespaces lists pods across all namespaces
84- PodsListInAllNamespaces (ctx context.Context , options ListOptions ) (runtime.Unstructured , error )
85- // PodsListInNamespace lists pods in a specific namespace
86- PodsListInNamespace (ctx context.Context , namespace string , options ListOptions ) (runtime.Unstructured , error )
87- // PodsGet retrieves a single pod by name
88- PodsGet (ctx context.Context , namespace , name string ) (* unstructured.Unstructured , error )
89- // PodsDelete deletes a pod and its managed resources
90- PodsDelete (ctx context.Context , namespace , name string ) (string , error )
91- // PodsLog retrieves logs from a pod container
92- PodsLog (ctx context.Context , namespace , name , container string , previous bool , tail int64 ) (string , error )
93- // PodsRun creates and runs a new pod with optional service and route
94- PodsRun (ctx context.Context , namespace , name , image string , port int32 ) ([]* unstructured.Unstructured , error )
95- // PodsTop retrieves pod metrics
96- PodsTop (ctx context.Context , options PodsTopOptions ) (* metrics.PodMetricsList , error )
97- // PodsExec executes a command in a pod container
98- PodsExec (ctx context.Context , namespace , name , container string , command []string ) (string , error )
99-
100- // --- Node Operations ---
101-
102- // NodesLog retrieves logs from a node
103- NodesLog (ctx context.Context , name string , query string , tailLines int64 ) (string , error )
104- // NodesStatsSummary retrieves stats summary from a node
105- NodesStatsSummary (ctx context.Context , name string ) (string , error )
106- // NodesTop retrieves node metrics
107- NodesTop (ctx context.Context , options NodesTopOptions ) (* metrics.NodeMetricsList , error )
108-
109- // --- Event Operations ---
110-
111- // EventsList lists events in a namespace
112- EventsList (ctx context.Context , namespace string ) ([]map [string ]any , error )
113-
114- // --- Configuration Operations ---
115-
116- // ConfigurationContextsList returns the list of available context names
117- ConfigurationContextsList () (map [string ]string , error )
118- // ConfigurationContextsDefault returns the current context name
119- ConfigurationContextsDefault () (string , error )
120- // ConfigurationView returns the kubeconfig content
121- ConfigurationView (minify bool ) (runtime.Object , error )
12260}
0 commit comments