I am just getting started with openshift so please forgive me if this is a silly question.
When building an application hosted on openshift that has multiple containers, complex routing, secrets etc. How do you version control this configuration?
Ideally I would like to be able to automatically redeploy my full project on a clean cluster in one fell swoop. How do people do this and can anyone link to an example?
There are many techniques to reach your objective.
In my opinion and experience, one of the most successful (and trendy) approaches is GitOps. GitOps consist on "linking" your development workflow with the deployment workflow, so any changes on a branch of your SVC drives to updates in your application.
Here you have an initial example, but there are many in the wild.
I also recommend this article from Alexis Richardson as very clarifying.
You can use several GitOps tools (ArgoCD, Tekton, Jenkins, Actions...) depending on your situation, but the approach is mostly the same: Infrastructure-as-code plus some complementing processes (Reconciller).
You don't actually need to deep dive into GitOps from the very beginning.
I would recommend making baby steps: first define the state of your application (Resources, Configuration, Secrets...) as files in your SVC. Once you are comfortable with that, go for a process that "deploys" that state automatically. Depending on your situation, you can inject this process directly in your development workflow (i.e. with git hooks), or create a separated process and integrate later.
This approach is not the only one, but I feel it is very helpful and easily understandable for teams getting into DevOps and automation. If you really feel that your process is mature enough, you can go for the next level, and create an Operator for your application (an Operator is basically a reconciler that is deployed into Kubernetes and handles the whole status and lifecycle of your application). Operators require a much deeper understanding of your application status and lifecycle, but also provide a higher degree of manageability.
I hope this gives you some guides to start your own investigation and helps you find the approach better feet your needs.
You see this is no simple question and the answer is not simple. If you want the ability to rebuild and redeploy a project you have to plan and design for that. There are many approaches and tools that help you get there.
For simpler projects, just having a set of YAML files around may be sufficient. These files could be embedded into an OpenShift template, a Helm3 chart, or decorated by Kustomize folders, for parametrization and ease of use.
Just having files provides no automation, then you add CI/CD and GitOps tools such as Jenkins, OpenShift pipelines (Tekton) and ArgoCD that automate workflows for deploying your files into multiple clusters and environments and test the results.
For more complex projects, you may want to build an operator that takes care of the end-user/customer side of deploying and updating your applicaiton, in addition to CI/CD and GitOps on your development side.