Skip to content

Commit 500ab99

Browse files
ChrisJBurnsclaude
andcommitted
Remove stale OIDCConfigRefValidated condition when ref is cleared
When OIDCConfigRef is removed from an MCPRemoteProxy, the condition was left behind in status. Now calls meta.RemoveStatusCondition to match the pattern used by handleToolConfig and handleExternalAuthConfig. Integration test updated to assert the condition is removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 91ce68d commit 500ab99

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

cmd/thv-operator/controllers/mcpremoteproxy_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ func (r *MCPRemoteProxyReconciler) handleOIDCConfig(ctx context.Context, proxy *
719719
ctxLogger := log.FromContext(ctx)
720720

721721
if proxy.Spec.OIDCConfigRef == nil {
722-
// No MCPOIDCConfig referenced, clear any stored hash
722+
// Remove condition if OIDCConfigRef is not set
723+
meta.RemoveStatusCondition(&proxy.Status.Conditions, mcpv1alpha1.ConditionOIDCConfigRefValidated)
723724
if proxy.Status.OIDCConfigHash != "" {
724725
proxy.Status.OIDCConfigHash = ""
725726
if err := r.Status().Update(ctx, proxy); err != nil {

cmd/thv-operator/test-integration/mcp-oidc-config/mcpoidcconfig_mcpremoteproxy_integration_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ var _ = Describe("MCPOIDCConfig and MCPRemoteProxy Cross-Resource Integration Te
716716
return true
717717
}, timeout, interval).Should(BeTrue())
718718

719-
// MCPRemoteProxy OIDCConfigHash should be cleared
719+
// MCPRemoteProxy OIDCConfigHash should be cleared and condition removed
720720
Eventually(func() bool {
721721
proxyUpdated := &mcpv1alpha1.MCPRemoteProxy{}
722722
err := k8sClient.Get(ctx, types.NamespacedName{
@@ -726,7 +726,12 @@ var _ = Describe("MCPOIDCConfig and MCPRemoteProxy Cross-Resource Integration Te
726726
if err != nil {
727727
return false
728728
}
729-
return proxyUpdated.Status.OIDCConfigHash == ""
729+
if proxyUpdated.Status.OIDCConfigHash != "" {
730+
return false
731+
}
732+
// Verify the OIDCConfigRefValidated condition was removed
733+
cond := meta.FindStatusCondition(proxyUpdated.Status.Conditions, mcpv1alpha1.ConditionOIDCConfigRefValidated)
734+
return cond == nil
730735
}, timeout, interval).Should(BeTrue())
731736
})
732737
})

0 commit comments

Comments
 (0)