Skip to main content
Gå til innhold

The PaaS Console - Migrate to dev and prod namespaces

warning

Before deploying to the new development namespace make sure to delete any conflicting resources in the production namespace. See FAQ below for details.

Console now supports provisioning two namespaces for each project. This is also the default for all new projects going forward.

For existing projects it is possible to migrate to a dual namespace set-up by clicking the yellow button labelled "Migrate to dev and prod namespaces" as seen in the screenshot below.

This will create an additional development namespace while the existing namespace will become the production namespace.

Platon PaaS console project page with migrate cfg button

If you have any manually created secrets or other resources, make sure to create these before deploying to the new namespace. Or even better, deploy secrets from Vault instead of creating them manually.

FAQ

Why doesn't my dev and prod namespace names match up?

  • The project might have been moved in GitLab between the creation of the two namespaces
  • The existing namespace might have been created before we changed the naming scheme from <parent-group-name>-<project-name> to <full-group-path>-<project-name>.

It is not possible to rename a namespace in Kubernetes so to change the name of an existing namespace to match the current scheme it has to be deleted and recreated.

Why does my deploy fail with a nginx admission webhook denied?

If you see an error similar to this you have forgotten to delete the staging ingress resource in prod namespace before deploying to the new dev namespace:

Error from server (BadRequest): error when creating "STDIN": admission webhook "validate.nginx.ingress.kubernetes.io" denied the request: host "hello-staging.paas2.uninett.no" and path "/" is already defined in ingress platon-paas2-examples-hello-world/staging

Why is my pod stuck in init when deploying to dev namespace?

Check the deployment resource events to see if there are any resources it depends on (like ConfigMaps or Secrets) that might be missing in the new namespace.

How can i reliably clean-up my non-prod resources in the prod namespace before deploying to dev?

You can do something similar to the ci-helpers destroy script:

#!/bin/bash
set -e
set -o pipefail

kubectl -n project-namespace delete all -l "app=$CI_ENVIRONMENT_SLUG"
kubectl -n project-namespace delete networkpolicy.v1.networking.k8s.io -l "app=$CI_ENVIRONMENT_SLUG"
kubectl -n project-namespace delete ingress.v1.networking.k8s.io -l "app=$CI_ENVIRONMENT_SLUG"
kubectl -n project-namespace delete persistentvolumeclaim --ignore-not-found=true -l "app=$CI_ENVIRONMENT_SLUG"
kubectl -n project-namespace delete secret,configmap --ignore-not-found=true -l "app=$CI_ENVIRONMENT_SLUG"
kubectl -n project-namespace delete horizontalpodautoscalers --ignore-not-found=true -l "app=$CI_ENVIRONMENT_SLUG"

Export the $CI_ENVIRONMENT_SLUG to be the value of the app label for the deployment you want to remove all resources for, eg something like review-test-dev-p-0vmih1.