PLAN-003: Migrate Scripts to New Secrets Paths
IMPLEMENTATION RULES: Before implementing this plan, read and follow:
- WORKFLOW.md - The implementation process
- PLANS.md - Plan structure and best practices
Status: Complete
Goal: Update all scripts in the repo that reference topsecret/ or secrets/ to use the new .uis.secrets/ paths, while maintaining backwards compatibility.
Last Updated: 2026-01-23
Branch: feature/secrets-migration
Prerequisites: PLAN-001 ✓ and PLAN-002 ✓ complete
Related: INVESTIGATE-secrets-consolidation.md
Note: PLAN-002 created paths.sh with base path detection functions. This plan extends that with backwards-compatible path resolution and deprecation warnings for topsecret/ paths.
Context: Contributor vs User
We are contributors - we update scripts in the repo to use new path conventions.
At runtime, these scripts run inside the container and access:
/mnt/urbalurbadisk/.uis.secrets/(user's secrets, mounted)/mnt/urbalurbadisk/.uis.extend/(user's config, mounted)/mnt/urbalurbadisk/topsecret/(old path, mounted for backwards compat)
The scripts we update need to:
- Prefer new paths when available
- Fall back to old paths for backwards compatibility
- Warn users when old paths are detected
Overview
The investigation identified 24 scripts that reference the old paths:
cloud-init (1):
cloud-init/create-cloud-init.sh
hosts (8):
hosts/azure-aks/02-azure-aks-setup.shhosts/azure-microk8s/01-azure-vm-create-redcross-v2.shhosts/azure-microk8s/02-azure-ansible-inventory-v2.shhosts/raspberry-microk8s/install-raspberry.shhosts/install-azure-aks.shhosts/install-azure-microk8s-v2.shhosts/install-multipass-microk8s.shhosts/install-rancher-kubernetes.sh
topsecret (3) - to be deprecated:
topsecret/update-kubernetes-secrets-rancher.shtopsecret/kubeconf-copy2local.shtopsecret/copy-secrets2host.sh
networking (4):
networking/tailscale/802-tailscale-tunnel-deploy.shnetworking/cloudflare/820-cloudflare-tunnel-setup.shnetworking/cloudflare/821-cloudflare-tunnel-deploy.shnetworking/cloudflare/822-cloudflare-tunnel-delete.sh
provision-host (6):
provision-host/provision-host-02-kubetools.shprovision-host/provision-host-vm-create.shprovision-host/provision-host-sshconf.shprovision-host/uis/lib/secrets-management.shprovision-host/uis/tests/unit/test-phase6-secrets.sh
other (3):
copy2provisionhost.shinstall-rancher.shprovision-host-rancher/provision-host-container-create.sh
Phase 1: Create Path Resolution Library — ✅ DONE
Tasks
-
1.1 Extended
provision-host/uis/lib/paths.shwith backwards-compatible path resolution:# Base paths inside container
NEW_SECRETS_BASE="/mnt/urbalurbadisk/.uis.secrets"
OLD_SECRETS_BASE="/mnt/urbalurbadisk/topsecret"
OLD_SSH_BASE="/mnt/urbalurbadisk/secrets"
# Returns path to use, preferring new location
get_secrets_base_path() {
if [ -d "$NEW_SECRETS_BASE" ]; then
echo "$NEW_SECRETS_BASE"
elif [ -d "$OLD_SECRETS_BASE" ]; then
warn_deprecated_path "$OLD_SECRETS_BASE" "$NEW_SECRETS_BASE"
echo "$OLD_SECRETS_BASE"
else
echo "$NEW_SECRETS_BASE" # Default to new
fi
}
get_ssh_key_path() {
# New: .uis.secrets/ssh/
# Old: secrets/
}
get_kubernetes_secrets_path() {
# New: .uis.secrets/generated/kubernetes/
# Old: topsecret/kubernetes/
}
get_cloud_init_output_path() {
# New: .uis.secrets/generated/ubuntu-cloud-init/
# Old: cloud-init/
}
get_kubeconfig_path() {
# New: .uis.secrets/generated/kubeconfig/
# Old: (various locations)
}
get_tailscale_key() {
# New: .uis.secrets/service-keys/tailscale.env
# Old: topsecret/kubernetes/kubernetes-secrets.yml
}
get_cloudflare_token() {
# New: .uis.secrets/service-keys/cloudflare.env
# Old: topsecret/...
} -
1.2 Add deprecation warning function ✓ (warn_deprecated_path in paths.sh)
-
1.3 Add unit tests for path resolution ✓ (63 tests in test-paths.sh)