Skip to content

Commit 5c6563b

Browse files
committed
fix ci
1 parent 1a24afc commit 5c6563b

File tree

5 files changed

+428
-241
lines changed

5 files changed

+428
-241
lines changed

.github/workflows/test-e2e-lifecycle.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,50 @@ jobs:
116116
export KUBECONFIG=kconfig.yaml
117117
task thv-operator-e2e-test-run
118118
119+
- name: Capture pod logs before cleanup
120+
if: always()
121+
run: |
122+
export KUBECONFIG=kconfig.yaml
123+
echo "========================================="
124+
echo "Capturing logs from all pods in default namespace"
125+
echo "========================================="
126+
127+
# Get all pods in default namespace
128+
kubectl get pods -n default --kubeconfig kconfig.yaml -o wide || true
129+
130+
echo ""
131+
echo "========================================="
132+
echo "Pod logs:"
133+
echo "========================================="
134+
135+
# Get logs from all pods in default namespace
136+
for pod in $(kubectl get pods -n default --kubeconfig kconfig.yaml -o jsonpath='{.items[*].metadata.name}' 2>/dev/null || true); do
137+
echo ""
138+
echo "========== Pod: $pod =========="
139+
140+
# Get pod status
141+
kubectl get pod $pod -n default --kubeconfig kconfig.yaml -o yaml 2>/dev/null | grep -A 20 "^status:" || true
142+
143+
echo ""
144+
echo "--- Container logs for $pod ---"
145+
146+
# Get logs from all containers in the pod
147+
containers=$(kubectl get pod $pod -n default --kubeconfig kconfig.yaml -o jsonpath='{.spec.containers[*].name}' 2>/dev/null || true)
148+
for container in $containers; do
149+
echo ""
150+
echo "Container: $container"
151+
kubectl logs $pod -n default -c $container --tail=200 --kubeconfig kconfig.yaml 2>&1 || echo "Failed to get logs for $container"
152+
done
153+
154+
echo ""
155+
done
156+
157+
echo ""
158+
echo "========================================="
159+
echo "Pod events:"
160+
echo "========================================="
161+
kubectl get events -n default --kubeconfig kconfig.yaml --sort-by='.lastTimestamp' || true
162+
119163
- name: Cleanup cluster
120164
if: always()
121165
run: |

pkg/vmcp/types.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,6 @@ type BackendTarget struct {
5858
//
5959
// When a backend MCPServer has OIDCConfig configured, it means clients (including vMCP)
6060
// must present OIDC tokens to access that backend.
61-
//
62-
// Discovery Mode: When vMCP's outgoing auth mode is "discovered", vMCP will use the
63-
// authentication configuration defined in the backend MCPServer. This field stores the
64-
// discovered OIDC config from the backend's OIDCConfig spec, which vMCP uses to
65-
// authenticate when accessing OIDC-protected backends.
66-
//
67-
// See pkg/vmcp/workloads/k8s.go:discoverIncomingOIDCConfig for discovery implementation.
6861
IncomingOIDCConfig map[string]interface{}
6962

7063
// SessionAffinity indicates if requests from the same session
@@ -151,13 +144,6 @@ type Backend struct {
151144
//
152145
// When a backend MCPServer has OIDCConfig configured, it means clients (including vMCP)
153146
// must present OIDC tokens to access that backend.
154-
//
155-
// Discovery Mode: When vMCP's outgoing auth mode is "discovered", vMCP will use the
156-
// authentication configuration defined in the backend MCPServer. This field stores the
157-
// discovered OIDC config from the backend's OIDCConfig spec, which vMCP uses to
158-
// authenticate when accessing OIDC-protected backends.
159-
//
160-
// See pkg/vmcp/workloads/k8s.go:discoverIncomingOIDCConfig for discovery implementation.
161147
IncomingOIDCConfig map[string]interface{}
162148

163149
// Metadata stores additional backend information.

pkg/vmcp/workloads/k8s.go

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ import (
55
"fmt"
66
"strings"
77

8-
corev1 "k8s.io/api/core/v1"
98
"k8s.io/apimachinery/pkg/api/errors"
109
"k8s.io/apimachinery/pkg/runtime"
11-
"k8s.io/apimachinery/pkg/types"
1210
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
1311
"sigs.k8s.io/controller-runtime/pkg/client"
1412

@@ -200,12 +198,6 @@ func (d *k8sDiscoverer) mcpServerToBackend(ctx context.Context, mcpServer *mcpv1
200198
return nil
201199
}
202200

203-
// Discover and populate incoming OIDC configuration from MCPServer
204-
if err := d.discoverIncomingOIDCConfig(ctx, mcpServer, backend); err != nil {
205-
logger.Errorf("Failed to discover incoming OIDC config for MCPServer %s: %v", mcpServer.Name, err)
206-
return nil
207-
}
208-
209201
return backend
210202
}
211203

@@ -242,97 +234,6 @@ func (d *k8sDiscoverer) discoverAuthConfig(ctx context.Context, mcpServer *mcpv1
242234
return nil
243235
}
244236

245-
// discoverIncomingOIDCConfig discovers and stores the backend's OIDC authentication requirements.
246-
//
247-
// When a backend MCPServer has OIDCConfig configured, it means clients (including vMCP) must present
248-
// OIDC tokens to access that backend. This method discovers the backend's OIDC configuration and
249-
// stores it in backend.IncomingOIDCConfig.
250-
//
251-
// Authentication Flow:
252-
// - When vMCP's outgoing auth mode is "discovered", vMCP will use the authentication configuration
253-
// defined in the backend MCPServer (via ExternalAuthConfigRef for token exchange/header injection,
254-
// or via OIDCConfig for OIDC-protected backends)
255-
// - The discovered OIDC config is stored in Backend.IncomingOIDCConfig (see pkg/vmcp/types.go)
256-
// - This config is used by vMCP to authenticate to backends that require OIDC tokens
257-
//
258-
// Return behavior:
259-
// - Returns nil error if OIDCConfig is nil (no OIDC required) - this is expected behavior
260-
// - Returns nil error if OIDC config is discovered and successfully populated into backend
261-
// - Returns error if OIDC config exists but discovery/resolution fails (e.g., secret not found)
262-
func (d *k8sDiscoverer) discoverIncomingOIDCConfig(
263-
ctx context.Context, mcpServer *mcpv1alpha1.MCPServer, backend *vmcp.Backend,
264-
) error {
265-
// If no OIDC config, nothing to discover
266-
if mcpServer.Spec.OIDCConfig == nil {
267-
logger.Debugf("MCPServer %s has no OIDCConfig, no incoming auth required", mcpServer.Name)
268-
return nil
269-
}
270-
271-
oidcConfig := mcpServer.Spec.OIDCConfig
272-
273-
// Convert OIDC config to map for storage in backend
274-
config := make(map[string]interface{})
275-
276-
// Handle inline OIDC configuration
277-
if oidcConfig.Type == "inline" && oidcConfig.Inline != nil {
278-
inline := oidcConfig.Inline
279-
config["issuer"] = inline.Issuer
280-
281-
if inline.Audience != "" {
282-
config["audience"] = inline.Audience
283-
}
284-
285-
if inline.ClientID != "" {
286-
config["client_id"] = inline.ClientID
287-
}
288-
289-
// Resolve client secret from secret reference if present
290-
if inline.ClientSecretRef != nil {
291-
secret := &corev1.Secret{}
292-
secretKey := types.NamespacedName{
293-
Name: inline.ClientSecretRef.Name,
294-
Namespace: mcpServer.Namespace,
295-
}
296-
297-
if err := d.k8sClient.Get(ctx, secretKey, secret); err != nil {
298-
return fmt.Errorf("failed to get secret %s/%s: %w",
299-
mcpServer.Namespace, inline.ClientSecretRef.Name, err)
300-
}
301-
302-
secretValue, ok := secret.Data[inline.ClientSecretRef.Key]
303-
if !ok {
304-
return fmt.Errorf("secret %s/%s does not contain key %s",
305-
mcpServer.Namespace, inline.ClientSecretRef.Name, inline.ClientSecretRef.Key)
306-
}
307-
308-
config["client_secret"] = string(secretValue)
309-
} else if inline.ClientSecret != "" {
310-
// Use direct client secret if provided (not recommended but supported)
311-
config["client_secret"] = inline.ClientSecret
312-
}
313-
314-
if inline.JWKSURL != "" {
315-
config["jwks_url"] = inline.JWKSURL
316-
}
317-
318-
if inline.IntrospectionURL != "" {
319-
config["introspection_url"] = inline.IntrospectionURL
320-
}
321-
322-
// Add security flags
323-
config["insecure_allow_http"] = inline.InsecureAllowHTTP
324-
config["jwks_allow_private_ip"] = inline.JWKSAllowPrivateIP
325-
config["protected_resource_allow_private_ip"] = inline.ProtectedResourceAllowPrivateIP
326-
}
327-
328-
// Store the discovered OIDC config
329-
backend.IncomingOIDCConfig = config
330-
331-
logger.Infof("✓ Discovered incoming OIDC config for MCPServer %s: issuer=%s, client_id=%s",
332-
mcpServer.Name, config["issuer"], config["client_id"])
333-
return nil
334-
}
335-
336237
// mapK8SWorkloadPhaseToHealth converts a MCPServerPhase to a backend health status.
337238
func mapK8SWorkloadPhaseToHealth(phase mcpv1alpha1.MCPServerPhase) vmcp.BackendHealthStatus {
338239
switch phase {

0 commit comments

Comments
 (0)