Repository navigation
Conversation
- Remove duplicate rbac.authorization.k8s.io rules block - Move serviceaccounts from rbac API group to core API group - Remove duplicate events rule (already in core API group) - Add deployments/finalizers and statefulsets/finalizers update verb - Fix http-route ClusterRoleBinding referencing wrong ClusterRole name - Guard http-route resources with rbac.enable and add chart labels - Remove broken/unused hasMutatingWebhooks/hasValidatingWebhooks helpers Signed-off-by: Kevin Cogan <[email protected]>
… defaults - Make imagePullPolicy configurable via values with IfNotPresent default - Update SPIRE trust bundle defaults to match ZTWIM standard (spire-bundle/bundle.crt) - Update comment to reflect PEM and SPIFFE JSON format support Signed-off-by: Kevin Cogan <[email protected]>
- Auto-detect and parse PEM-encoded certificates or SPIFFE JSON trust bundles - Add ConfigMapFetcher that reads signed cards from ConfigMap before HTTP fallback - Wire ConfigMap fetcher into the AgentCard controller Signed-off-by: Kevin Cogan <[email protected]>
- After signing, write the signed card to a ConfigMap for the operator to read without needing HTTP access to the agent pod - Log warning on failure (non-fatal, operator falls back to HTTP) Signed-off-by: Kevin Cogan <[email protected]>
…mpatibility Port-only egress rules (DNS port 53, HTTPS port 443 without explicit destinations) are silently dropped by OVN-Kubernetes on OpenShift, breaking DNS resolution and external API access for agent pods. Use allow-all egress for both permissive and restrictive policies since the NetworkPolicy's purpose is to control ingress (who can reach the agent), not egress. Remove unused corev1, intstr, and ptr imports. Signed-off-by: Kevin Cogan <[email protected]>
- Add cooldown check in maybeRestartForResign to prevent infinite restart loops when SVID expiry grace period triggers re-signing - Auto-populate identityBinding spec on auto-created AgentCards when SPIRE trust domain is configured Signed-off-by: Kevin Cogan <[email protected]>
… args - Add Role/RoleBinding for agentcard-signer to create/update ConfigMaps - Add istio.io/dataplane-mode: none label to opt agent pods out of ambient mesh - Proactive restart demo now captures and restores original operator args instead of hardcoding, preventing config drift Signed-off-by: Kevin Cogan <[email protected]>
d9f4b09 to
1cf7755
Compare
Break function signatures and chained method calls exceeding 120 characters across multiple lines. Replace empty branch with verbose-mode logging. Signed-off-by: Kevin Cogan <[email protected]>
cwiklik
left a comment
There was a problem hiding this comment.
Review Summary
Solid production-readiness improvements for AgentCard signing. The ConfigMap fallback for card fetching, PEM trust bundle support, and proactive restart cooldown are well-designed. Helm chart RBAC fixes are thorough. A few observations below.
Areas reviewed: Go (controllers, agentcard, signature), Helm chart, Shell scripts, Demo manifests
Commits: 8 commits, all DCO signed-off
Verdict: COMMENT — suggestions only, author can decide
| }, | ||
| }, | ||
| Ingress: []netv1.NetworkPolicyIngressRule{ingressRule}, | ||
| Egress: []netv1.NetworkPolicyEgressRule{{}}, |
There was a problem hiding this comment.
suggestion: The empty NetworkPolicyEgressRule{{}} means allow-all egress. The commit message explains the rationale (OVN-Kubernetes silently drops port-only rules), which makes sense. Worth a brief inline comment here documenting why allow-all was chosen, so future readers don't try to re-add port restrictions.
There was a problem hiding this comment.
Done. Added inline comment on the permissive policy:
// Allow all egress for verified agents so they can reach external APIs and DNS.
The restrictive policy uses targeted K8s API egress via kubeAPIEgressRules() which is self-documenting.
| "configMap", cmName, "namespace", namespace) | ||
| } | ||
| } else if !apierrors.IsNotFound(err) { | ||
| fetcherLogger.Info("Error reading ConfigMap, falling back to HTTP", |
There was a problem hiding this comment.
nit: Non-404 ConfigMap read errors (e.g., RBAC forbidden, network issues) are logged at Info level here. Consider Error level — a real API failure that forces fallback to HTTP is worth surfacing more prominently.
There was a problem hiding this comment.
Good catch. Changed to fetcherLogger.Error(err, "Failed to read ConfigMap, falling back to HTTP", ...) with the error as a structured first argument per logr convention.
|
|
||
| podAnnotations := getPodTemplateAnnotations(acc) | ||
| if ts, ok := podAnnotations[AnnotationResignTrigger]; ok { | ||
| if lastTrigger, err := time.Parse(time.RFC3339, ts); err == nil && time.Since(lastTrigger) < grace { |
There was a problem hiding this comment.
suggestion: If time.Parse fails on a malformed annotation, the err == nil check silently skips the cooldown — the pod could restart immediately. Consider logging when the timestamp is unparseable so operators can detect annotation corruption.
There was a problem hiding this comment.
Agreed. Restructured the conditional to explicitly handle the parse failure:
lastTrigger, err := time.Parse(time.RFC3339, ts)
if err != nil {
agentCardLogger.Info("Ignoring malformed resign-trigger annotation",
"value", ts, "error", err.Error())
} else if time.Since(lastTrigger) < grace {
return
}Logged at Info since it is recoverable. The reconciler proceeds to evaluate whether a restart is needed.
| @@ -131,3 +136,99 @@ func TestGetServiceURL(t *testing.T) { | |||
| t.Errorf("GetServiceURL: got %q, want %q", got, want) | |||
There was a problem hiding this comment.
praise: Good coverage of ConfigMap found, not-found, and invalid-JSON scenarios. Consider adding a case where the ConfigMap exists but the expected key is missing (empty Data map) to exercise that edge.
There was a problem hiding this comment.
Added TestConfigMapFetcher_MissingKey. Creates a ConfigMap with an empty Data map and verifies fallback to HTTP.
| # Restores the operator grace period to 30m without overwriting other args. | ||
| # | ||
|
|
||
| set -eu |
There was a problem hiding this comment.
nit: set -eu is missing -o pipefail. Without it, failures in piped commands (e.g., kubectl get ... | grep ...) are silently ignored.
There was a problem hiding this comment.
Updated all 8 demo scripts (run + teardown) from set -eu to set -euo pipefail.
Restrictive NetworkPolicies for unverified agents now allow egress only to dynamically discovered K8s API server endpoints on port 6443, instead of deny-all. This permits the agentcard-signer init container to write signed ConfigMaps while fully isolating unverified agents from all other outbound traffic. - Add KubeAPIServerCIDRs discovery from kubernetes Endpoints at startup - Add kubeAPIEgressRules() to construct targeted egress rules - Grant operator RBAC permission to read endpoints - Add inline comment on permissive policy explaining allow-all egress Signed-off-by: Kevin Cogan <[email protected]>
- Upgrade ConfigMap read error log from Info to Error level (fetcher.go) - Log warning when resign-trigger annotation timestamp is malformed - Add TestConfigMapFetcher_MissingKey for empty Data map edge case - Add -o pipefail to all demo scripts for strict pipe error handling Signed-off-by: Kevin Cogan <[email protected]>
|
Note on allow-all egress for verified agents The permissive NetworkPolicy currently uses allow-all egress for verified agents. The original scoped egress rules on main (verified peers + DNS + K8s API only) were silently dropped by OVN-Kubernetes on OpenShift, breaking DNS resolution and external API access. Allow-all is the working baseline for now. I will be opening a follow-up GitHub issue to add per-agent egress scoping possibly via an optional |
| RESTORED_ARGS=$(echo "$CURRENT_ARGS" | python3 -c " | ||
| import sys, json, re | ||
| args = json.loads(sys.stdin.read()) | ||
| patched = [re.sub(r'^--svid-expiry-grace-period=.*', '--svid-expiry-grace-period=30m', a) for a in args] |
There was a problem hiding this comment.
| patched = [re.sub(r'^--svid-expiry-grace-period=.*', '--svid-expiry-grace-period=30m', a) for a in args] | |
| patched = [re.sub(r'^--svid-expiry-grace-period=[^[:space:]]+', '--svid-expiry-grace-period=30m', a) for a in args] |
I haven't actually tested this, but the regex you used looks dangerous ... if there are any other args, won't the .* encompass them?
There was a problem hiding this comment.
Agreed on hardening the regex. The .* was technically safe since each arg is an individual string in the JSON array, so there's no risk of spanning across other args. That said, I've tightened it to \S+ to be more explicit about intent. Worth noting that the POSIX [^[:space:]] syntax in the suggestion isn't supported by Python's re module, so \S+ is the correct Python equivalent.
| fetcher := NewConfigMapFetcher(fakeClient) | ||
|
|
||
| card, err := fetcher.Fetch(context.Background(), A2AProtocol, "", "my-agent", "test-ns") | ||
| if err != nil { |
There was a problem hiding this comment.
Would it make sense to use github.com/onsi/gomega and Expect() the way agentcard_networkpolicy_controller_test.go does? To shorten all these != and err != nil conditions?
There was a problem hiding this comment.
Good idea, I converted the file to use gomega with NewGomegaWithT(t) to match the controller test style. All 11 tests pass.
- Harden regex in teardown-demo.sh from .* to \S+ for defensive coding - Convert fetcher_test.go assertions to gomega for project consistency Signed-off-by: Kevin Cogan <[email protected]> Signed-off-by: Kevin Cogan <[email protected]>
Summary
AgentCard SPIRE signing improvements and Helm chart fixes to make end-to-end signing work reliably in production.
Helm chart fixes
Operator improvements
Demo fixes
Related issue(s)
#783 feature: Integrate AgentCard signing and verification into the Kagenti UI
(Optional) Testing Instructions
All unit tests pass (
make testin kagenti-operator/).Verified end-to-end on OpenShift (OVN-Kubernetes + Istio Ambient Mesh) from a clean environment:
Helm chart validated with
helm lintandhelm templateunder multiple value combinations (rbac.enable=false,signatureVerification.enabled=true).