Migration from the v1beta1 GitLab resource
Status: Implemented Issue: https://gitlab.com/gitlab-org/cloud-native/gitlab-operator/-/work_items/2332 Parent: none
Goal
An administrator moves an instance that a v1beta1 GitLab manages to a GitLabCore, keeping its
repositories, Secrets, and external data, and accepting a short downtime. Both reconcilers stay in
the Operator. For the design, see ADR 42.
Requirements
kubectl bridge migrate <name> [--namespace <namespace>]migrates theGitLabof that name to aGitLabCoreof the same name and namespace.- The command refuses, with the reason, and changes nothing when:
- the
GitLabruns a chart older than 10.5.0; - the
GitLabis notRunningwithAvailabletrue, or is upgrading; - its effective values turn on the bundled
nginx-ingressornginx-ingress-geo, which theGitLabCoreforces off; - its effective values request cert-manager certificates for its Ingresses
(
global.ingress.configureCertmanager); - the cluster does not serve
gitlabcores.apps.gitlab.com, or no ready Operator withENABLE_BRIDGE=truewatches the namespace; - the Operator is rolling out, because a manager of the previous version may still apply objects;
- the version of the plugin and the version of the Operator are both known and differ;
- a
GitLabCoreof that name exists, unless a migration that resumes created it; - the ConfigMap of a migration records another
GitLabof the same name.
- the
- The command warns, and continues only after confirmation, when:
- the
GitLabcarries the labels or annotations of Argo CD, Flux, or Helm; - the plugin or the Operator version is unknown, or the administrator may not list the Operator;
- the
GitLabruns the bundled Prometheus, which aGitLabCoreforces off. The one warning names the volume claims of its history, which the delete removes; - the delete removes other volume claims the
GitLabowns, such as the Toolbox scratch volumes; - the draft drops the
app.kubernetes.iolabels the v1beta1 controller adds.
- the
- Every warning and difference starts with its topic, such as
Monitoring:,Persistence:,Secrets:, orLabels:. - The draft
GitLabCorepinsspec.versionto theStaticchart version theGitLabruns. - The draft renders with the same effective values as the
GitLab, except for the differences the command lists: the shared secrets provider, the Operator overrides ofGitLabCore, and the dropped values of the subcharts it forces off. - The draft drops the
app.kubernetes.iolabels the v1beta1 controller adds to every object, and keeps the labels theGitLabsets itself. - The draft leaves the settings of the shared secrets Job to the
GitLabCore, whoseGitLabSecretscontroller generates the Secrets, and keeps the ones theGitLabsets itself. - The draft keeps OpenBao and the AI Gateway off, because the v1beta1 controller never deploys
them, and lists it when the
GitLabturns them on. - The draft keeps the components and the Gateway API setup the
GitLabran on chart defaults: the container registry, the Toolbox, the Gateway API with its Envoy configuration, and the cert-manager Issuer of the Gateway. - A setting moves into its structured field only when the effective values stay the same. Every
other setting stays in
spec.chart.values.spec.networkingstays unset. - The draft moves
global.certificates.customCAsintospec.certificates.customCAswhen every entry is a map of exactly one non-emptysecretorconfigMapname and an optional list of validkeys, with no other field, and the list holds at most 64 entries. It removes the list fromspec.chart.values, and the maps that leaves empty. Otherwise, or for an empty list, the whole list stays inspec.chart.values, and the command lists the reason as a difference, except for an empty list. See trusted certificate authorities. - The command prints the draft and the differences, and changes nothing until the administrator
confirms.
--dry-runstops there.--yesconfirms every prompt. - Before it changes the
GitLab, the command stores theGitLab, its UID, and the draft in a ConfigMap named<name>-v1beta1-migration, which nothing owns. - The command marks the
GitLabwith the annotationapps.gitlab.com/migrate-to: GitLabCore, and changes nothing more until theGitLabreports the conditionMigrating. - The v1beta1 controller applies nothing for a marked
GitLab, and reportsMigratingwith the generation it observed. Removing the annotation hands theGitLabback, and removes the condition. - The v1beta1 controller applies nothing for a
GitLabthat is being deleted. - A run that stops while the
GitLabstays marked says so, and prints how to hand it back. - The command keeps the Gateways, EnvoyProxies,
LoadBalancerServices, and cert-manager Issuers of theGitLab, so their addresses and certificates survive. TheGitLabCoretakes over those it renders. - The command deletes the
GitLabin the foreground. It creates theGitLabCoreonly after theGitLaband every pod of its release are gone. - The Gitaly repositories, the generated Secrets, and the external PostgreSQL, Redis, and object storage are unchanged after the migration.
- The command waits for the
GitLabCoreto reportAvailable, and reports a timeout without undoing anything. - Run again after an interruption, the command continues from the ConfigMap and completes the
migration. While the
GitLabstill exists, it asks for confirmation again.
Out of scope
- Handing an instance back to v1beta1. The user documentation of the migration describes the manual way.
- Charts older than 10.5.0, the bundled NGINX, and cert-manager certificates for Ingresses.
- Moving the Gateway API setup into
spec.networking. - Migration through the Bridge API or the Bridge UI.
FAQ
- Why delete the
GitLabrather than orphan its objects? A short downtime is acceptable, and every stateful object survives the delete: the Gitaly volumes come from volume claim templates, which theGitLabdoes not own, and the shared secrets Job creates Secrets without an owner. A fresh install by theGitLabCoreleaves no fields of the v1beta1 controller behind. - Why keep the Gateways, EnvoyProxies, and
LoadBalancerServices? Deleting them releases the cloud load balancer, and a new one usually gets a new address, which turns a short downtime into a DNS change. - Why does the v1beta1 controller have to stop? It applies the objects of a
GitLabon every pass, with the owner reference of theGitLab. A pass during the handover would put the reference back on an object the command keeps, and garbage collection would delete it. The controller never reconciles oneGitLabtwice at once, so once it reportsMigrating, no such pass runs. - Do the shared Secrets need a migration of their own? No. A
GitLabCoreon chart 10.5 or later declares them in aGitLabSecrets, and its controller keeps every Secret that exists under the same name and adds only missing keys. The Job and its settings have nothing left to do. - Why keep the cert-manager Issuers? The v1beta1 controller creates them itself, and the
GitLabCorecreates none. Without them, no certificate is issued or renewed. - Why the same name? The release name is the name of the resource. It names the Gitaly StatefulSet, and with it the volume claims the new StatefulSet binds again.
- Why pin the version? A new
GitLabCorehas no deployed version, so its first pass is an install, without the ordered upgrade steps. At the version theGitLabruns, the migrations have nothing to do. - Why is
spec.networkingleft unset? ItsenvoyGatewayControllermode names the GatewayClass after the namespace and the resource, which changes the Gateway the instance runs on. - Why does the plugin run the migration, and not the Operator? It is a one-time step an administrator approves, with the permissions of that administrator. The translation lives in a package the Bridge API can serve later.
- Why are HAProxy and Traefik no blockers? The v1beta1 controller never deploys them, so a
GitLabthat turns them on runs without them, as theGitLabCoredoes. - Why refuse cert-manager certificates for Ingresses? The chart then renders a Job that creates
the Issuer with RBAC of its own, which a
GitLabCoredoes not apply. The Gateway API, the chart default, keeps working through the Issuer the command keeps. - Why only warn for Argo CD and Flux? The administrator may have removed the
GitLabfrom the repository already. The warning says that otherwise the tool recreates it and the two reconcilers compete for the instance.
Was this page helpful?