Skip to content

Commit 75109ea

Browse files
committed
fixes, get e2e test working
1 parent 80069f5 commit 75109ea

File tree

9 files changed

+629
-44
lines changed

9 files changed

+629
-44
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN go mod download
1515
COPY cmd/main.go cmd/main.go
1616
COPY api/ api/
1717
COPY internal/ internal/
18+
COPY pkg/ pkg/
1819

1920
# Build
2021
# the GOARCH has not a default value to allow the binary be built according to the host where the command

api/v1alpha1/mcpserver_types.go

Lines changed: 123 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,106 @@ const (
3131
TransportTypeHTTP TransportType = "http"
3232
)
3333

34+
// MCPServerConditionType represents the condition types for MCPServer status.
35+
type MCPServerConditionType string
36+
37+
const (
38+
// MCPServerConditionAccepted indicates that the MCPServer has been accepted for processing.
39+
// This condition indicates that the MCPServer configuration is syntactically and semantically valid,
40+
// and the controller can generate some configuration for the underlying infrastructure.
41+
//
42+
// Possible reasons for this condition to be True are:
43+
//
44+
// * "Accepted"
45+
//
46+
// Possible reasons for this condition to be False are:
47+
//
48+
// * "InvalidConfig"
49+
// * "UnsupportedTransport"
50+
//
51+
// Controllers may raise this condition with other reasons,
52+
// but should prefer to use the reasons listed above to improve
53+
// interoperability.
54+
MCPServerConditionAccepted MCPServerConditionType = "Accepted"
55+
56+
// MCPServerConditionResolvedRefs indicates whether the controller was able to
57+
// resolve all the object references for the MCPServer.
58+
//
59+
// Possible reasons for this condition to be True are:
60+
//
61+
// * "ResolvedRefs"
62+
//
63+
// Possible reasons for this condition to be False are:
64+
//
65+
// * "ImageNotFound"
66+
//
67+
// Controllers may raise this condition with other reasons,
68+
// but should prefer to use the reasons listed above to improve
69+
// interoperability.
70+
MCPServerConditionResolvedRefs MCPServerConditionType = "ResolvedRefs"
71+
72+
// MCPServerConditionProgrammed indicates that the controller has successfully
73+
// programmed the underlying infrastructure with the MCPServer configuration.
74+
// This means that all required Kubernetes resources (Deployment, Service, ConfigMap)
75+
// have been created and configured.
76+
//
77+
// Possible reasons for this condition to be True are:
78+
//
79+
// * "Programmed"
80+
//
81+
// Possible reasons for this condition to be False are:
82+
//
83+
// * "DeploymentFailed"
84+
// * "ServiceFailed"
85+
// * "ConfigMapFailed"
86+
//
87+
// Controllers may raise this condition with other reasons,
88+
// but should prefer to use the reasons listed above to improve
89+
// interoperability.
90+
MCPServerConditionProgrammed MCPServerConditionType = "Programmed"
91+
92+
// MCPServerConditionReady indicates that the MCPServer is ready to serve traffic.
93+
// This condition indicates that the underlying Deployment has running pods
94+
// that are ready to accept connections.
95+
//
96+
// Possible reasons for this condition to be True are:
97+
//
98+
// * "Ready"
99+
//
100+
// Possible reasons for this condition to be False are:
101+
//
102+
// * "PodsNotReady"
103+
//
104+
// Controllers may raise this condition with other reasons,
105+
// but should prefer to use the reasons listed above to improve
106+
// interoperability.
107+
MCPServerConditionReady MCPServerConditionType = "Ready"
108+
)
109+
110+
// MCPServerConditionReason represents the reasons for MCPServer conditions.
111+
type MCPServerConditionReason string
112+
113+
const (
114+
// Accepted condition reasons
115+
MCPServerReasonAccepted MCPServerConditionReason = "Accepted"
116+
MCPServerReasonInvalidConfig MCPServerConditionReason = "InvalidConfig"
117+
MCPServerReasonUnsupportedTransport MCPServerConditionReason = "UnsupportedTransport"
118+
119+
// ResolvedRefs condition reasons
120+
MCPServerReasonResolvedRefs MCPServerConditionReason = "ResolvedRefs"
121+
MCPServerReasonImageNotFound MCPServerConditionReason = "ImageNotFound"
122+
123+
// Programmed condition reasons
124+
MCPServerReasonProgrammed MCPServerConditionReason = "Programmed"
125+
MCPServerReasonDeploymentFailed MCPServerConditionReason = "DeploymentFailed"
126+
MCPServerReasonServiceFailed MCPServerConditionReason = "ServiceFailed"
127+
MCPServerReasonConfigMapFailed MCPServerConditionReason = "ConfigMapFailed"
128+
129+
// Ready condition reasons
130+
MCPServerReasonReady MCPServerConditionReason = "Ready"
131+
MCPServerReasonPodsNotReady MCPServerConditionReason = "PodsNotReady"
132+
)
133+
34134
// MCPServerSpec defines the desired state of MCPServer.
35135
type MCPServerSpec struct {
36136
// Configuration to Deploy the MCP Server using a docker container
@@ -58,8 +158,29 @@ type HTTPTransport struct {
58158

59159
// MCPServerStatus defines the observed state of MCPServer.
60160
type MCPServerStatus struct {
61-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
62-
// Important: Run "make" to regenerate code after modifying this file
161+
// Conditions describe the current conditions of the MCPServer.
162+
// Implementations should prefer to express MCPServer conditions
163+
// using the `MCPServerConditionType` and `MCPServerConditionReason`
164+
// constants so that operators and tools can converge on a common
165+
// vocabulary to describe MCPServer state.
166+
//
167+
// Known condition types are:
168+
//
169+
// * "Accepted"
170+
// * "ResolvedRefs"
171+
// * "Programmed"
172+
// * "Ready"
173+
//
174+
// +optional
175+
// +listType=map
176+
// +listMapKey=type
177+
// +kubebuilder:validation:MaxItems=8
178+
Conditions []metav1.Condition `json:"conditions,omitempty"`
179+
180+
// ObservedGeneration is the most recent generation observed for this MCPServer.
181+
// It corresponds to the MCPServer's generation, which is updated on mutation by the API Server.
182+
// +optional
183+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
63184
}
64185

65186
// MCPServerDeployment

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/kagent.dev_mcpservers.yaml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ spec:
6767
listen.
6868
type: integer
6969
type: object
70+
httpTransport:
71+
description: HTTPTransport defines the configuration for a Streamable
72+
HTTP transport.
73+
properties:
74+
targetPort:
75+
description: target port is the HTTP port that serves the MCP
76+
server.over HTTP
77+
format: int32
78+
type: integer
79+
type: object
80+
stdioTransport:
81+
description: StdioTransport defines the configuration for a standard
82+
input/output transport.
83+
type: object
7084
transportType:
7185
description: TransportType defines the type of mcp server being run
7286
enum:
@@ -78,6 +92,86 @@ spec:
7892
type: object
7993
status:
8094
description: MCPServerStatus defines the observed state of MCPServer.
95+
properties:
96+
conditions:
97+
description: |-
98+
Conditions describe the current conditions of the MCPServer.
99+
Implementations should prefer to express MCPServer conditions
100+
using the `MCPServerConditionType` and `MCPServerConditionReason`
101+
constants so that operators and tools can converge on a common
102+
vocabulary to describe MCPServer state.
103+
104+
Known condition types are:
105+
106+
* "Accepted"
107+
* "ResolvedRefs"
108+
* "Programmed"
109+
* "Ready"
110+
items:
111+
description: Condition contains details for one aspect of the current
112+
state of this API Resource.
113+
properties:
114+
lastTransitionTime:
115+
description: |-
116+
lastTransitionTime is the last time the condition transitioned from one status to another.
117+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
118+
format: date-time
119+
type: string
120+
message:
121+
description: |-
122+
message is a human readable message indicating details about the transition.
123+
This may be an empty string.
124+
maxLength: 32768
125+
type: string
126+
observedGeneration:
127+
description: |-
128+
observedGeneration represents the .metadata.generation that the condition was set based upon.
129+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
130+
with respect to the current state of the instance.
131+
format: int64
132+
minimum: 0
133+
type: integer
134+
reason:
135+
description: |-
136+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
137+
Producers of specific condition types may define expected values and meanings for this field,
138+
and whether the values are considered a guaranteed API.
139+
The value should be a CamelCase string.
140+
This field may not be empty.
141+
maxLength: 1024
142+
minLength: 1
143+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
144+
type: string
145+
status:
146+
description: status of the condition, one of True, False, Unknown.
147+
enum:
148+
- "True"
149+
- "False"
150+
- Unknown
151+
type: string
152+
type:
153+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
154+
maxLength: 316
155+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
156+
type: string
157+
required:
158+
- lastTransitionTime
159+
- message
160+
- reason
161+
- status
162+
- type
163+
type: object
164+
maxItems: 8
165+
type: array
166+
x-kubernetes-list-map-keys:
167+
- type
168+
x-kubernetes-list-type: map
169+
observedGeneration:
170+
description: |-
171+
ObservedGeneration is the most recent generation observed for this MCPServer.
172+
It corresponds to the MCPServer's generation, which is updated on mutation by the API Server.
173+
format: int64
174+
type: integer
81175
type: object
82176
type: object
83177
served: true

config/rbac/role.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@ kind: ClusterRole
44
metadata:
55
name: manager-role
66
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- configmaps
11+
- services
12+
verbs:
13+
- create
14+
- delete
15+
- get
16+
- list
17+
- patch
18+
- update
19+
- watch
20+
- apiGroups:
21+
- apps
22+
resources:
23+
- deployments
24+
verbs:
25+
- create
26+
- delete
27+
- get
28+
- list
29+
- patch
30+
- update
31+
- watch
732
- apiGroups:
833
- kagent.dev
934
resources:

0 commit comments

Comments
 (0)