Repository navigation
Add quickstart subcommand to deploy a local cluster with software packs - #767
marcelovilla wants to merge 22 commits into
Conversation
fb777dd to
3233aca
Compare
9fba00e to
7b69515
Compare
7b69515 to
2fa82bd
Compare
a1dc073 to
313c4c2
Compare
313c4c2 to
12baf60
Compare
a31f96f to
1d025ba
Compare
Testing
|
1d025ba to
0738421
Compare
dcmcand
left a comment
There was a problem hiding this comment.
Verdict: Request changes. The quickstart experience is in good shape after the latest commits, but where the packs live and how they get there need to change before we merge.
🛑 Blocker: internal/quickstart has no tests for RenderConfig, writeQuickstartConfig or InstallPacks.
Add table-driven tests that render each port combination through config.ParseConfig, and cover the existing, identical, different and --force cases for the config write.
Nothing in CI renders config.yaml.tmpl, so a template change that breaks the generated config ships silently.
💡 Suggestion: docs/design-doc/architecture/02-system-overview.md:100 lists the CLI subcommands but not quickstart.
Add quickstart to that list.
Follow-ups from the test report
| Item | Status |
|---|---|
| Extra Argo CD / Keycloak boxes | Fixed in 7ddcfde |
/etc/hosts box on the default domain |
Fixed in 3d1f505 |
| Confusing OutOfSync / Missing state | Fixed in 1ba1a5d |
| Certificate warning | Fixed in c8cd19c |
| Log readability | Deferred to #66 |
nic outputs log line and missing usernames |
No issue opened yet |
| jhub-apps "Authorize access" page | No data-science-pack issue opened yet |
Key: 🛑 Blocker (must fix before merge) · 💡 Suggestion (improvement, not blocking) · ❓ Question (needs author input) · ❤️ Kudos
| return err | ||
| } | ||
|
|
||
| repoDir := config.DefaultLocalRepositoryPath(cfg.ProjectName) |
There was a problem hiding this comment.
🛑 Blocker: The CLI rebuilds the repo path with DefaultLocalRepositoryPath and drives the git client itself, so it ignores repository.local.path and branch.
Move the pack write, commit and refresh into pkg/nic, for example through a DeployOptions field for extra GitOps files.
ADR-0015 says pkg/nic is the only bridge between the repository contract and the git client. Library callers of Deploy also can't get the packs or the refresh today.
There was a problem hiding this comment.
I see your point here, but I don't think DeployOption should be a vehicle to pass arbitrary stuff around Deploy.
That aside, this is making me think deeper into what NIC should and shouldn't own. Initially, when looking at this, I was tempted to tell you we should defer this until we have a nic pack add subcommand or something similar (like an AddApps function in pkg/nic), and then we could reuse that code to add the software packs in the quickstart. But after thinking more about it, I don't think NIC should really handle the addition of software packs to the GitOps repo (with the exception, of course, of the quickstart, which is meant to just work out of the box). That should be the user's responsibility. I'm still not even fully convinced NIC should commit the manifests for other things after the bootstrap but it's probably the most convenient approach.
What do you think about using the Kubernetes API directly to apply the ArgoCD Applications? I faced this same dilemma yesterday on nebari-dev/deploy-nebari-action#49 and ended up using plain kubectl to add the software packs in CI. I know this is different because it's a quickstart that the user interacts too, but it's also ephemeral I guess and I'm not sure if we expect users to interact with the local gitops repo anyways. If we do, you also raised a good point here. I'm leaning towards having the quickstart just install the packs directly for now and avoid relying on the local gitops repo for that. Curious to read your thoughts.
There was a problem hiding this comment.
Agreed, apply them directly. Only the registration of the Applications becomes imperative. Argo still syncs the packs from pinned chart versions under nebari-apps, with self-heal and retry. And on a throwaway cluster, nobody needs Argo to restore a deleted Application. It also settles the rerun-overwrite question and the apps/ placement, since nothing gets written to the repo.
A few conditions to keep it bounded:
- Keep the apply in
internal/quickstart, with no Kubernetes apply path inpkg/nic, so quickstart doesn't grow a second way to install software. - Use server-side apply, so a rerun converges instead of failing or overwriting.
- Keep
project: nebari-apps, so the packs still go through the same project scoping as user packs. - Say in the summary that the packs were applied directly, and point to how to commit them to a GitOps repo. The "This file is yours: edit it" headers need to change to match.
Separately, the tests from my review still stand: RenderConfig, writeQuickstartConfig and whatever replaces InstallPacks need coverage either way.
| project: nebari-apps | ||
| source: | ||
| repoURL: https://github.com/nebari-dev/nebi-pack | ||
| targetRevision: org-ca-bundle-key |
There was a problem hiding this comment.
🛑 Blocker: targetRevision points at the org-ca-bundle-key branch, so a released binary deploys whatever that branch holds.
Pin a released chart version once nebari-dev/nebi-pack#61 ships.
Released nebi-pack charts hardcode the ca-bundle.crt key, and nebari-trust-bundle only has ca-certificates.crt. So this can't simply move to 0.1.4 before #61 merges.
| source: | ||
| repoURL: https://raw.githubusercontent.com/nebari-dev/helm-repository/gh-pages/ | ||
| chart: nebari-data-science-pack | ||
| targetRevision: 0.1.7 |
There was a problem hiding this comment.
❓ Question: Do we want NIC to ship curated pack manifests in the binary?
These templates carry chart versions, hub volumes copied from the chart's values.yaml, and workarounds, so every chart change needs a NIC release. #752 asks for curated sets, so we need to work out whether this is the short-term step and what replaces it.
There was a problem hiding this comment.
This is a good question and one that will need a discussion beyond this thread. In the short term, I think embedding these templates in the binary is the most pragmatic approach. Most of what’s hardcoded in them is workarounds to make things work out of the box. Some need fixing in the corresponding packs, such as the client ID override, which is tracked in data-science-pack#248, and I’ll file the hub trust bundle ones. Others get simpler once the pack contract lands, since a bundle that is guaranteed on every cluster lets packs mount it as required.
Longer term, I think we should rely on curated sets published as versioned artifacts in another repo and pulled at deploy time, with each NIC release pinning a specif version by default.
| ctx, cleanup := nic.StartSlogHandler(ctx, slog.Default()) | ||
| defer cleanup() | ||
|
|
||
| result, err := client.Deploy(ctx, cfg, nic.DeployOptions{}) |
There was a problem hiding this comment.
💡 Suggestion: If Argo CD fails to install, Deploy still returns success, and quickstart writes the packs and exits 0.
Check result.ArgoCDInstalled and return an error before InstallPacks.
pkg/nic/deploy.go only logs a warning when the Argo CD install fails.
| return fmt.Errorf("open GitOps repository: %w", err) | ||
| } | ||
|
|
||
| for name, content := range packs { |
There was a problem hiding this comment.
❓ Question: Should re-running quickstart reset the packs?
Today a rerun overwrites edits to the pack files and re-creates a deleted pack. Commit also stages everything (AddOptions{All: true}), so unrelated changes get committed as "Add quickstart software packs".
There was a problem hiding this comment.
Fair question. This might not make sense depending where we head on #767 (comment), but I added a check to skip writing the files if they exist already. That way we don't overwrite changes made by the user. See cc0bc95
| fmt.Println(" WARNING: YOUR BROWSER CAN'T REACH THE PLATFORM YET") | ||
| fmt.Println("═══════════════════════════════════════════════════════════════════════════════") | ||
| fmt.Println() | ||
| if cfg.Domain == quickstart.DefaultDomain { |
There was a problem hiding this comment.
💡 Suggestion: On the default domain, any lookup failure prints "although it does through public DNS", including an offline machine or the 3s timeout.
Pass the lookup error to printDNSWarning. Use the resolver wording only when the answer came back without a loopback address.
| } | ||
|
|
||
| // printDeployResult prints the post-deploy access instructions. | ||
| func printDeployResult(cfg *config.NebariConfig, result *nic.DeployResult, dryRun bool) { |
There was a problem hiding this comment.
💡 Suggestion: Since 7ddcfde, runDeploy is the only caller of printDeployResult, so the extraction is now a no-op move.
Revert the deploy.go change to keep the PR to quickstart.
a86a686 to
cc0bc95
Compare
|
Thanks for the review @dcmcand. I answered your comments and addressed most of them. There's on in particular where I would like your input: #767 (comment) Regarding the blocker you added in the general review:
Added the tests in 80c5ecb |
80c5ecb to
c0de9da
Compare




Closes
Closes #752
Description
This PR adds an initial version of the
nic quickstartsubcommand. Running it will allow users to deploy a local cluster with a predefined set of software packs (nebi and data science for now) so they can test Nebari on their own machine.The configuration for the subcommand is intentionally kept small for this initial version. It does not need any argument but a few can be passed to override the domain and the http(s) ports. Once run, the subcommand generates a config file and deploys a cluster from it right away. Users that want to delete the cluster can simply run
nic destroypassing that config file as the input.This is a stacked PR as there are two issues blocking both nebi and data science to work properly on a local cluster using self-signed certificates:
I'll open two separate PRs to address them. In the meantime, anyone testing this can refer to the workaround in #641
How to Test
To test this, make sure Docker is running and that ports 80 and 443 are free, (otherwise you need to pass
--http-portand--https-port).The config should use the local provider,
domain: nebari.lvh.me,certificate.type: selfsignedand a local repository. Running the same command again should succeed without changes, and running it with a different--domainshould fail unless you pass--force.It ends with a summary of the URLs and the config file to use with
nic deployandnic destroy.kubectl get applications -n argocd kubectl get nebariapps -A git -C ~/.nic/gitops/nebari-quickstart log --onelineAll applications should be Synced and Healthy, including
nebi-packanddata-science-pack(this takes about 10 minutes on a fresh cluster). Both NebariApps should be Ready, and the repository should have a commit adding the packs.Create a user and log in. Get the Keycloak admin credentials with
./nic outputs, openhttps://keycloak.nebari.lvh.me/admin/, and add a user with a password in thenebarirealm. Then openhttps://nebari.lvh.meand log in. Nebi and JupyterHub should show up on the landing page.Delete the cluster: