Is there a way to copy an Openshift project?

I want to have an entire copy of my Openshift project (with all builds, pods, secrets, etc.) for testing purposes (second independent testing environment). Is there a way to copy a project?


I'm not sure... but what you want is essentially the first part of creating a Template.

Specifically, the section on writing a template from existing objects would be very relevant.

oc get -o yaml all > <yaml_filename>

I would be very reluctant to apply that however (if you do, be certain to rewrite it; at least change the namespace). ... shudder

Bear particular attention to any cluster-level resources you create (eg. PVs, ClusterRoles etc.) and anything that needs to be different per environment (namespaces, routes/ingresses).

A better way perhaps

I would suggest that a better way of handling this would be to using Kustomize, which is built into recent versions of kubectl and oc.

This allows you an easy way to have a base configuration, and apply overrides for different environments. As a simple example, I'm using it to set a namespace for each environment, and also to set common annotations. You'll see this referred to as 'setting cross-cutting fields' in the Kustomize documentation.

Here's a screenshot of my basic use-case so far (I'm new at this myself).

Screenshot of using kustomize to set namespace and common annotation