Add profiles::puppet::migrate: repoint VM agents onto puppet-on-k8s #493
Reference in New Issue
Block a user
Delete Branch "benvin/puppet-k8s-migrate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Migrate the VM puppet agents off the legacy VM puppetmasters onto the new puppet-on-kubernetes servers, one wave at a time and reversible without re-enrolment.
Changing
server/ca_serveralone is insufficient: each agent's ssldir holds a client certificate signed by the old CA, which the new k8s CA neither trusts nor recognises. Migrated nodes switch to a fresh ssldir, so the agent generates a new key + CSR on its next run (autosigned immediately by the k8s CA, which runsautosign = true), pulls its catalog from the new compilers, and leaves the old CA-signed creds intact on disk for rollback.The reconfiguration catalog is compiled by the old server (the node still points there when it applies the change).
profiles::puppet::clientrewritespuppet.confwith the new endpoints + ssldir and notifiesService['puppet'], so the very next agent run lands on k8s.Single-boolean design (reworked): cutover is now driven by one hiera key.
profiles::puppet::migrateships wired intoprofiles::basewithenabled => false, so every node evaluates it but nothing changes until the boolean is flipped.profiles::puppet::clientincludes migrate and folds the migrate endpoints into the effective values it renders. Flipprofiles::puppet::migrate::enabled: trueat any hiera layer (node/role/common) to migrate a target -- no other keys required.Changes
profiles::base(site/profiles/manifests/base.pp):include profiles::puppet::migratealongside the other puppet profiles (ships disabled).profiles::puppet::migrate(site/profiles/manifests/puppet/migrate.pp): unchanged params (enabled=false,new_server,new_ca_server,new_ssldir); when enabled and the node is not a puppetmaster it owns the fresh ssldir directory. Class-header runbook rewritten for the single-boolean flow. No longer opt-in viahiera_include.profiles::puppet::client(site/profiles/manifests/puppet/client.pp):include profiles::puppet::migrateand compute$effective_server/$effective_ca_server/$effective_report_server/$effective_ssldir, feeding those to the template. Keeps the existing optional$ssldir/$report_serverparams as manual overrides.puppet.conf.erb: render from the@effective_*vars.Precedence
Optional, defaultundef): explicitprofiles::puppet::client::ssldir/::report_serverin hiera wins; else the migrate-derived value whenenabled; else the legacy default (ssldir omitted -> puppet default; report_server -> effective server).String, no undef sentinel): the migrate endpoint wins whileenabled => true; otherwise the client param (legacy default unless set explicitly). To pin a bespoke server, leaveenabled => falsefor that target and setprofiles::puppet::client::serverdirectly.$facts['enc_role'].Runbook
hieradata/nodes/<certname>.yaml:profiles::puppet::migrate::enabled: truehieradata/roles/<t1>/<t2>[/<t3>].yaml:profiles::puppet::migrate::enabled: truehieradata/common.yaml:profiles::puppet::migrate::enabled: truefalse) at that layer; next run rewrites puppet.conf back to the legacy server + legacy ssldir (original CA-signed cert intact).new_server/new_ca_server/new_ssldir) areprofiles::puppet::migrateparam defaults; override them in hiera if the k8s names change.Verification
puppet.conftodevelop(diff empty). Migrated render (onlyenabled: true) emitsserver/ca_server/report_server= k8s endpoints andssldir = /etc/puppetlabs/puppet/ssl-k8s.puppet-lint(repo args--no-80chars-check --no-documentation-check --no-puppet_url_without_modules-check --fail-on-warnings): clean on all 3 manifests.puppet parser validate: OK. ERB syntax: OK. Repo pre-commit hooks (erb-validate, puppet-lint, puppet-validate): all Passed.