uselagoon / remote-controller

A group of controllers for handling Lagoon builds and tasks in Kubernetes or Openshift
5 stars 1 forks source link

allow to define default image for TaskImages #26

Closed Schnitzel closed 2 years ago

shreddedbacon commented 3 years ago

Looking into this, I think this will not be super easy to do.

The advanced tasks system doesn't have any concept of different tasks, it just has a set of requirements that need to be met to run a pod, and the image that pod would use. See https://github.com/amazeeio/lagoon-kbd/blob/main/TASKS.md#advanced-tasks

Currently, the the only advanced task is active/standby, and this is entirely handled by Lagoon. The payload that gets delivered into the task and the image required to handle that payload are created by Lagoon itself.

I designed the advanced task system this way so that in the future, if there was a need to do specific things that would be able to leverage talking to k8s/openshift, we can define the task and the payload in Lagoon, and the advanced task system would just do what it needs to do to run the defined task.

This logic could also be removed from Lagoon, and built into the controller instead. Then the only information that the controller would need is what it would normally send to the controllers, just omitting the image.

shreddedbacon commented 3 years ago

I would like to still have it so that Lagoon could still overwrite what the controller has defined though, so we could leverage environment variable overrides in the project/environment level without having to change the controller. Similar to how we do now for other features.

This would mean we could add LAGOON_AS_TASKIMAGE or something to the API for a specific project, and then any active/standby tasks that are created would use the image defined here, instead of what the controller has defined. Could be nice for testing hot-fix images on specific projects/environments then.

Schnitzel commented 3 years ago

@shreddedbacon ok, makes sense, we should then fix https://github.com/amazeeio/lagoon/issues/2287 so that we don't rely on manual environment variables inside lagoon :) but I can handle that one.