-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinterfaces.go
More file actions
127 lines (114 loc) · 5.94 KB
/
Copy pathinterfaces.go
File metadata and controls
127 lines (114 loc) · 5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package kai
import (
"context"
"time"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
)
// ServerInterface defines the contract for an mcp server that can register and handle tools.
// Implementations of this interface can register tool handlers and serve MCP Call requests.
type ServerInterface interface {
AddTool(mcp.Tool, server.ToolHandlerFunc)
Serve() error
}
// ClusterManager defines the contract for managing Kubernetes clusters.
type ClusterManager interface {
GetClient(string) (kubernetes.Interface, error)
GetCurrentClient() (kubernetes.Interface, error)
GetCurrentContext() string
GetCurrentDynamicClient() (dynamic.Interface, error)
GetCurrentNamespace() string
GetDynamicClient(string) (dynamic.Interface, error)
ListClusters() []string
LoadKubeConfig(string, string) error
SetCurrentContext(string) error
DeleteContext(string) error
GetContextInfo(string) (*ContextInfo, error)
RenameContext(string, string) error
ListContexts() []*ContextInfo
SetCurrentNamespace(string)
}
// NamespaceOperator defines the operations needed for namespace management
type NamespaceOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
}
// PodOperator defines the operations needed for pod management
type PodOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, limit int64, labelSelector, fieldSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager, force bool) (string, error)
StreamLogs(ctx context.Context, cm ClusterManager, tailLines int64, previous bool, since *time.Duration) (string, error)
}
// DeploymentOperator defines the operations needed for deployment management
type DeploymentOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
Describe(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Scale(ctx context.Context, cm ClusterManager) (string, error)
RolloutStatus(ctx context.Context, cm ClusterManager) (string, error)
RolloutHistory(ctx context.Context, cm ClusterManager) (string, error)
RolloutUndo(ctx context.Context, cm ClusterManager, revision int64) (string, error)
RolloutRestart(ctx context.Context, cm ClusterManager) (string, error)
RolloutPause(ctx context.Context, cm ClusterManager) (string, error)
RolloutResume(ctx context.Context, cm ClusterManager) (string, error)
}
// ServiceOperator defines the operations needed for service management
type ServiceOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
Patch(ctx context.Context, cm ClusterManager, patchData map[string]interface{}) (string, error)
}
// ConfigMapOperator defines the operations needed for ConfigMap management
type ConfigMapOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
}
// SecretOperator defines the operations needed for Secret management
type SecretOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
}
// JobOperator defines the operations needed for Job management
type JobOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
}
// CronJobOperator defines the operations needed for CronJob management
type CronJobOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
SetSuspended(ctx context.Context, cm ClusterManager, suspend bool) (string, error)
}
// IngressOperator defines the operations needed for Ingress management
type IngressOperator interface {
Create(ctx context.Context, cm ClusterManager) (string, error)
Get(ctx context.Context, cm ClusterManager) (string, error)
List(ctx context.Context, cm ClusterManager, allNamespaces bool, labelSelector string) (string, error)
Delete(ctx context.Context, cm ClusterManager) (string, error)
Update(ctx context.Context, cm ClusterManager) (string, error)
}