dtrack-migration

by KvalitetsIT

Helm chartv0.12.1App 0.12.1Verified publisher

One-shot Dependency-Track v4-to-v5 database migration Job

About this chart

dtrack-migration Helm Chart

This chart runs a one-shot Dependency-Track v4-to-v5 database migration as a Kubernetes Job, using the v4-migrator image. It is a standalone, separately installed chart: migration is a one-time, out-of-band operation, not a steady-state part of the dtrack chart. Installing dtrack-migration IS the intent to migrate; the Job always renders, there is no enabled gate.

Prerequisites

  • The existing v4 PostgreSQL database (source), reachable from the Job.
  • A freshly provisioned v5 PostgreSQL database (target), reachable from the Job. Install it separately, for example with the KvalitetsIT cnpg-cluster chart.
  • The v4 Dependency-Track backend must be stopped before the migration runs. This chart's offline guard verifies that from the outside; it does not stop the backend for you.

Runbook

  1. Scale the v4 dtrack release's backend (and frontend) down to zero replicas. If a v5 backend already exists pointed at the target database, scale it down too. Nothing should write to either database while the migration Job runs.

  2. Install this chart with source pointing at the v4 database and target pointing at the v5 database:

    source:
      jdbcUrl: "jdbc:postgresql://v4-postgresql:5432/dtrack"
      usernameSecret:
        name: dtrack-v4-postgres-credentials
        key: username
      passwordSecret:
        name: dtrack-v4-postgres-credentials
        key: password
    
    target:
      jdbcUrl: "jdbc:postgresql://v5-postgresql:5432/dtrack"
      usernameSecret:
        name: dtrack-v5-postgres-credentials
        key: username
      passwordSecret:
        name: dtrack-v5-postgres-credentials
        key: password
    
    offlineGuard:
      url: "http://dtrack-v4-backend.dtrack.svc.cluster.local:8080/api"
    
    helm install dtrack-migration ./charts/dtrack-migration -f my-migration-values.yaml
    
  3. The wait-for-backend-offline init container polls offlineGuard.url and only allows the migration to proceed once it observes offlineGuard.failureThreshold consecutive failed probes within offlineGuard.timeoutSeconds. This is the real safety interlock: since the v5 backend is not installed until after this chart finishes, nothing else writes to the target database while the Job runs. Set offlineGuard.enabled: false only if you have another way to guarantee the v4 backend is stopped.

  4. Watch the Job:

    kubectl logs job/dtrack-migration -c migration-bootstrap
    kubectl logs job/dtrack-migration -c migration
    
  5. Once the Job completes successfully, upgrade the dtrack release to Dependency-Track v5 with backend.database pointing at the target database used above, then remove this chart:

    helm uninstall dtrack-migration
    
  6. Re-run the dtrack bootstrap job. The v4-migrator nulls out DB-encrypted secret values (repository passwords, integration tokens) as part of the migration, so those credentials do not exist in the v5 database until bootstrap re-seeds them through the API, where v5 KEK-encrypts them under the fresh key.

Values

Global Configuration

KeyTypeDefaultDescription
nameOverridestring""Override the release/name base used for resource naming and labels.
fullnameOverridestring""Override the fully qualified name used for resource naming and labels.
commonAnnotationsobject{}Common annotations added to the Job.
globalobjectSee values.yamlGlobal configuration options, kept namespace-compatible with the dtrack chart's global block.
global.imagePullSecretslist[]Image pull secrets applied to the Job. Merged with image.pullSecrets.
global.image.registrystring""Registry prefix applied to the migrator image. Takes precedence over image.registry.
global.waitForBackendobjectSee values.yamlImage used by the offline-guard init container that probes the v4 backend.
global.waitForBackend.image.registrystring"docker.io"Fallback registry prefix for the wait-for-backend image. Overridden by global.image.registry when set.
global.waitForBackend.image.repositorystring"library/busybox"Image repository path (without registry prefix)
global.waitForBackend.image.digeststring""Optional image digest (e.g., sha256:...)
global.waitForBackend.image.pullPolicystring"IfNotPresent"Image pull policy
global.waitForBackend.image.tagstring"1.37"Image tag

Migration Configuration

KeyTypeDefaultDescription
imageobjectSee values.yamlv4-migrator image used for both the bootstrap and run steps.
image.registrystring""Fallback registry prefix for the migrator image. Overridden by global.image.registry when set.
image.repositorystring"dependencytrack/v4-migrator"Migrator image repository
image.tagstring"5.2.2"Migrator image tag
image.digeststring""Optional image digest (e.g., sha256:...)
image.pullPolicystring"IfNotPresent"Image pull policy
image.pullSecretslist[]Image pull secrets for the Job. Merged with global.imagePullSecrets.
sourceobjectSee values.yamlConnection details for the existing v4 source PostgreSQL database.
source.jdbcUrlstring""JDBC URL for the v4 source database (e.g. jdbc:postgresql://v4-postgres:5432/dtrack). Required.
source.usernameSecretobject{"key":"","name":""}Secret containing the v4 database username
source.passwordSecretobject{"key":"","name":""}Secret containing the v4 database password
targetobjectSee values.yamlConnection details for the v5 target PostgreSQL database.
target.jdbcUrlstring""JDBC URL for the v5 target database (e.g. jdbc:postgresql://v5-postgres:5432/dtrack). Required, and must differ from source.jdbcUrl.
target.usernameSecretobject{"key":"","name":""}Secret containing the v5 database username
target.passwordSecretobject{"key":"","name":""}Secret containing the v5 database password
offlineGuardobjectSee values.yamlBounded probe that requires consecutive backend API failures before database work starts.
offlineGuard.enabledbooltrueRun the wait-for-backend-offline init container before the migration starts.
offlineGuard.urlstring""Backend API base URL the guard probes for offline confirmation, pointing at the v4 backend being drained. Required when offlineGuard.enabled is true.
offlineGuard.timeoutSecondsint300Maximum seconds to wait for the backend API to become unavailable
offlineGuard.periodSecondsint5Seconds between backend API probes
offlineGuard.failureThresholdint3Consecutive failed probes required to prove the backend is offline
metricsRetentionDaysint90Number of days of metrics history to migrate. 0 for none, large number for all.
resourcesobject{}Resource requests and limits for the migration Job containers.

Deploy dtrack-migration with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dtrack-migration on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdtrack-migration is pinned at v0.12.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply