How to rename a project in OpenShift

Solution Verified - Updated -

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 3.X
    • 4.X

Issue

After a project creation, it is needed to change its name.

Resolution

[RHOCP 3.X]

  • There is a workaround to get the same effect of renaming:

    1. Backup up the content of the project.
    2. Restore it into a new project as outlined in the following section of the Day Two operations guide
  • One can also modify a project's display name and description, editing the following annotations:

$ oc edit project myproject
[...]
metadata:
  annotations:
    openshift.io/description: "rename-me"
    openshift.io/display-name: "rename-me"
[...]

[RHOCP 4.X]

  • There is no verified way for renaming the projects in RHOCP 4.X.
  • Also there will be data loss if pods are using any persistent storage.

Root Cause

It is not possible to rename projects as the Name field is primarily intended for creating idempotence and configuration definition and therefore cannot be updated.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments