Redeploy all applications in a space

I created a dedicated space to manage our projects that deploy to our Kubernetes clusters. So far it is working well, but I am seeing a need emerge.

Sometimes our Kubernetes cluster gets temperamental and just needs to be rebuilt. Obviously if I do that I have to worry about downtimes for my users. I am considering a way to be able to have an “active” and “inactive” cluster.

For most of it, I can make it work fairly easily. But when I switch between the active and inactive clusters, I will need to ensure that the latest versions of my applications are deployed on the “to-be-activated” cluster.

Basically, I would take my Octopus Space and point it at the inactive cluster, then tell it to re-deploy all its applications (for the environment(s) that correspond to the cluster). Then I would swap the clusters (so the active cluster is inactive and the inactive cluster is active).

Is there a way to get octopus deploy to re-deploy all the applications in a space to a given environment?

Hi @OctopusSchaff,
Provided you have the inactive cluster set up in that space and targetted the same, then you could use the API to do a redeployment for all the projects in that space. We have an example of an API script for how to do a redeployment for a specific project and environment here: OctopusDeploy-Api/ReDeployLatestReleaseInEnvironment.ps1 at master · OctopusDeploy/OctopusDeploy-Api · GitHub. You would want to get all projects for the space and loop over them doing what that script does. You can see an example of getting all of the projects here: OctopusDeploy-Api/CheckProjectsForManualIntervention.ps1 at master · OctopusDeploy/OctopusDeploy-Api (github.com).

You could set this all up as a runbook to run when you needed it. I hope this helps move you forward, but let me know if you need any additional assistance.

Happy deployments!
Mark

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.