WIP: working document about decoupling vars backends from clan #3196
Closed
lopter
wants to merge 6759 commits from
lopter/clan-core:lo-vars-brainstorm into main
pull from: lopter/clan-core:lo-vars-brainstorm
merge into: :main
:main
:update-devFlake-nixpkgs-dev-26.05
:update-nixpkgs
:update-nixpkgs-26.05
:26.05
:gui-revival-wt
:gui-revival
:external-age-store
:inventory-nixpkgs
:ke-diagnose-full-disk-on-activation
:remove-dead-components
:push-rpmpkpwntkpx
:rl-iroh
:templates-fix-2
:networking-guides
:docs-release-fixup
:template-copy-replace
:bump-templates
:zerotier-migration-message
:deprecate-clanpkgs
:service-deprecation
:release-diff
:hsjobeki-patch-2
:gather-breakage-26-05
:push-xzmskvotpuqo
:push-kkkourwouovl
:mock-rng
:doc-pages
:25.11
:hgl-docs
:lib-cycle
:zerotier-broken
:hgl-cli-var
:push-yoktrnrsxunp
:ke-container-upstream
:no-pkgs
:push-oqxutzzokmrn
:ke-flake-vars-cli-vars
:hgl-cli
:remove-select
:governance
:fix-vars-script
:dm-wg-star-namespaces
:push-rxxsoluyyynr
:push-qmntxolnuzuo
:push-okmytrqowyqy
:pr-7172
:planemaniac/main
:fix-deploy-vars
:documentation-for-machine
:push-svvlvonvykyz
:push-svvlvonv
:ke-cli-docs-inline-with-validation
:ke-remove-superfluous-gitignore
:slop-lint
:push-nkotmrkxouut
:push-vxoqznoxsmxn
:hsjobeki-patch-1
:iso_pr_v2
:flake-vars
:btrfs-disk-templates
:push-rsukkkymktxq
:lints
:pr-6858
:docs-condense
:ke-track-files-no-commit
:ke-docs-delete-machine
:docupdates012026
:ke-test-sizelint
:wireguard-exports
:simplify-select
:test-big-pr
:push-wsnpnwyzuqqu
:push-tklsrvotlysz
:push-lyuynpksppnm
:headline-levels
:push-yywpqvmpuklr
:push-mxosyunptxsm
:push-ytnkqzvqkvzs
:push-ovrvponxzmoq
:ke-docs-abbrev
:add-vale-linting
:25-11-installer
:ke-test-pr
:ke-create-fill-in-values-template
:push-qynqwmxyvwkq
:graph-class
:ke-deprecate-clan-flakes-create
:fix-update-decrypt-only-target-machines
:fix-flash-installer
:deployment-opt
:password-store-activation
:activation-test
:backport-passage
:hgl-ui2
:test-download
:WIP-store
:push-kvxsnswmtyxn
:ke-bump-nixpkgs-to-branchoff
:yggdrasil-fix-exports
:MoritzBoehme-coredns-ipv6
:friedow-feat/extend-meta-tld
:push-sotuxokuxntv
:ke-checkpoint-for-checks
:ke-install-hardware-config
:clan-25.05
:ke-fix-cr
:lopter-lo-fix-error-msg
:hgl-ui-textfield
:revers-update-vars-break
:pr-5024
:serve-json-telegraf
:clean-dead-code
:monitoring-service-prometheus
:flake-compat
:fix/combobox-form-binding
:migration-docs
:remove-modules-2
:nim65s-multi-wifi
:ke-facts-cli-warning
:update-devFlake-private-nixpkgs-dev
:ke-disko-shell-completions
:templates-2
:prep-ui-version2
:pr-4283-generate_test_vars-fix-it
:pr-3785
:vars-new
:speed-up-vars-check
:agit-4042
:generate-test-vars-precache
:kenji/ke-fix-ssh-deploy
:ssh-fix
:fix-flake-cache-chroot
:nix_transform_host_options
:push-trllkluxupnn
:feat/terminal-ui-component
:feat/clan-uri-in-route
:admin-migrate-service
:pinned-clan-core
:improve-container
:Qubasa-replace_machine_name_with_machine_obj
:control-master
:check-the-checks
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Type/Regression
Good first issue
Help wanted
Breaking change in behavior
Architecture
Change
Fundamental change spanning across components
Component
API
Issues regarding the clan api
Component
App
Issues regarding the clan app
Component
Backup
Component
CICD
Component
CLI
Component
Clan Services
Component
Clan module system
Issues regarding the clan module system including inventory.
Component
Docs
Component
Flake
Component
Install & Update
Component
Networking
Component
Select
Issues regarding select - the caching layer
Component
Templates
Issues regarding templates.
Component
Testing
Issues regarding testing
Component
VARS
Issues regarding vars.
Component
Virtualisation
Issues regarding virtual machines.
OS
Darwin
OS
Linux
Priority
Critical
1
Priority
High
2
Priority
Medium
3
Priority
Low
4
Status
Blocked
1
Status
On Hold
2
Status
Needs More Info
3
Status
Needs Review
4
Status
In Progress
5
Status
Won't Fix
6
Status
Available
Status
Duplicate
Type
Community Contribution
1
contributed by members of the Clan community
Type
Discussion
1
Type
Bug
2
Type
Question
3
Type
Epic
4
Type
Feature Request
5
Type
User Experience
5
Type
Enhancement
6
Type
Maintenance
7
Type
Documentation
Type
Question
Question to be resolved
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: clan/clan-core#3196
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Opening a PR so that everyone can comment.
Rendered version in my branch.
Reposting from what i said in matrix, and maybe could structure this document
Into these headings:
@@ -0,0 +10,4 @@I[^1], have been thinking about how we could decouple the sops vars implementation from `clan-cli`, and the goal of this longer form post, is to help me / us converge towards some kind of spec of what that means. A few things are spinning in my head, points are numbered for easy referencing:1. The sops-nix backend stores the secrets in the same repository as the clan which is problematic because it leaks metadata, e.g. the name of all the users in your directory as soon as you need to create per-users secrets;We could actually support storing secrets in a different repository/location.
At the moment we require uploading secrets through flakes/sops, but sops-nix actually doesn't requires secrets in the nix store. It also supports a mode where secrets can be on the filesystem.
I looked into nixops4 a little bit, and will look further to see how, vars and their backends, can be implemented as, resources and providers.
Top of mind there for me, is being able to use multiple vars backend on a single host.
Otherwise, in my mind, the API is basically the exchange we already have:
activationScripts).I am using the work declaration here to refer to the data used to know how to generate the vars; as opposed to vars definitions which is the part that comes after the vars are generated. ↩︎
@@ -0,0 +11,4 @@I[^1], have been thinking about how we could decouple the sops vars implementation from `clan-cli`, and the goal of this longer form post, is to help me / us converge towards some kind of spec of what that means. A few things are spinning in my head, points are numbered for easy referencing:1. The sops-nix backend stores the secrets in the same repository as the clan which is problematic because it leaks metadata, e.g. the name of all the users in your directory as soon as you need to create per-users secrets;1. I understand the [pass]\([-age]) backends are not subject to this issue, but otoh you can't specify recipients on a per-secret basis, the entire store is encrypted with the same set of PGP or AGE keys;you can override recipients (with pass at least) with a per folder .gpg-id file
I had no idea, good to know!
About the secrets CLI. I had the rough idea to deprecate the secrets CLI (or move to another repo) and instead have a lower level cars CLI that is backend agnostic and can do most of the things we need. Like setting up users/groups. The CLI would get the configured back end from nix and use the python classes afterwards (the the vars upload code)
I agree with the sentiment that the secrets CLI does not belong in the clan CLI. I agree the users/group abstraction is nice to have inside clan, and could help have a more consistent/DRY interface across backends; we can leave it to clan users to setups multiple users and/or use groups only with backends that support it.
b41e7cda9dto421512bc82421512bc82tobf36b08596bf36b08596to2558328fb0I have attached my architecture vision of vars.
Right now generate directly depends on the store and on the machine class, we should use dependency injection and a narrow contract for the interface between a generator and the vars generate.
Should i make my own adr ?
2558328fb0toa28e0144fba28e0144fbto1acd917c6eI read through this. I don't know clan's codebase at all, so some of the juiciest parts in the "Decision" section sort of went in one ear and out the other.
I left a lot of readability nits. Sorry for the noise!
The talk about clan being coupled with sops is confusing to me, as Clan already provides multiple vars backends: both sops-nix and pass. I feel like this needs more words:
sops/sops-nixif it also supportspass?clan_cli. Where would it go instead? Somewhere else inclan-core?passbackend? Does it need similar treatment?As a nit, I found the last sentence to be very confusing, perhaps it's missing a word?
nit: "is" -> "may be", right? Some generators just roll dice without human input.
nit: Could use rephrasing, as this assumes there is user input (see my previous comment).
nit: "declaration" -> "declarations"
nit: For consistency with the previous entry ("Exporting ...", either changing this to "Prompting", or change the previous one to "Export ". I think the "*ing" reads a little nicer with the intro to this list.
I have some familiarity with vars, but basically none with clan. I'm having trouble understanding this, especially the "(vars backend)" parenthetical. Perhaps this needs more words, or just needs the parenthetical removed?
Getting secrets on the target machine is a key part of implementing a vars-based "system", and it's left out of the vars nix code because (as you call out above), it cannot be implemented in Nix. Calling this
StoreBaseCRUD interface the "vars backend" doesn't sound right to me, though.I commented on this above: I'm confused by calling
StoreBase(a python class) equivalent to a "vars backend". Vars backends require some nix code, right?nit: I haven't written a lot of ADRs, but the phrasing here seems odd. You're proposing this ADR. The ADR has a decision, and to me, shouldn't use language like "propose".
I'd rephrase this from:
to:
(I see at least one more use of the word "propose" below, I won't comment on all of them)
1acd917c6eto53c5d33b5353c5d33b53toab65b6f6e0ab65b6f6e0to3225f6ed5f@lopter Closing for now, as commit history is broken. Please reopen if it is still relevant.
Pull request closed