feat: add local zitadel provider bootstrap#49
Conversation
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 41 minutes and 50 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a new ChangesZitadel Local Provider Setup
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant TokenResolver
participant DomainHandler
participant Kubectl
participant Crossplane
User->>CLI: hops local zitadel --access-token=TOKEN --domain=DOMAIN
CLI->>TokenResolver: Resolve token (arg → env → source Secret)
TokenResolver->>Kubectl: Get Secret from source cluster (if needed)
Kubectl-->>TokenResolver: Token from Secret
TokenResolver-->>CLI: Resolved token
CLI->>DomainHandler: Normalize domain (trim, remove scheme, validate host)
DomainHandler-->>CLI: Normalized domain
CLI->>CLI: Build credentials JSON (token + domain + port + insecure)
alt Refresh mode
CLI->>Kubectl: Apply Secret YAML
Kubectl-->>CLI: Secret applied
else Full setup
CLI->>Kubectl: Apply Provider manifest
Kubectl->>Crossplane: Provider resource created
CLI->>Kubectl: Poll for providerconfigs.zitadel CRD
Kubectl-->>CLI: CRD available
CLI->>Kubectl: Apply Secret YAML
Kubectl-->>CLI: Secret applied
CLI->>Kubectl: Apply ProviderConfig YAML
Kubectl->>Crossplane: ProviderConfig references Secret
Kubectl-->>CLI: ProviderConfig applied
end
CLI-->>User: Setup complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/commands/local/zitadel.rs`:
- Around line 76-78: The normalization is dropping an explicit URL port from
args.domain but code still uses args.port (default 443), causing mismatched
credentials for domains like https://auth.example.com:8443; update
normalize_domain to detect and preserve an explicit port (returning either
(host, Option<u16>) or a struct) or provide a new helper that extracts host and
port, then change the call site so build_credentials_json uses the extracted
port when present instead of always using args.port; modify references to
normalize_domain and build_credentials_json to consume the new domain+port
result so explicit ports in args.domain are honored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 46c220e0-0487-4e5c-ba78-6ffb979b1cbc
📒 Files selected for processing (3)
README.mdsrc/commands/local/mod.rssrc/commands/local/zitadel.rs
Summary by CodeRabbit
New Features
Documentation