Skip to content

Feat: Support for Project Cloning#359

Open
CGoodwin90 wants to merge 28 commits intomainfrom
project-cloning-setup
Open

Feat: Support for Project Cloning#359
CGoodwin90 wants to merge 28 commits intomainfrom
project-cloning-setup

Conversation

@CGoodwin90
Copy link
Copy Markdown
Contributor

@CGoodwin90 CGoodwin90 commented Mar 18, 2026

Checklist

  • Affected Issues have been mentioned in the Closing issues section
  • Documentation has been written/updated
  • PR title is ready for changelog and subsystem label(s) applied

Various changs to support the project cloning workflow

  • Adds cases for projectclone & projectclonerestore tasks in the consumer + running the clone task in tasks_handler
  • Allows advanced task pods to scan for RWX volumes in the namespace & mount them in a specified location
  • Sets up Tasks to be able to run as rootless

Required for uselagoon/lagoon#4072

@bbenesh
Copy link
Copy Markdown

bbenesh commented Apr 3, 2026

This PR addresses uselagoon/lagoon-product#3

@shreddedbacon shreddedbacon force-pushed the project-cloning-setup branch from 3647698 to 44d04c5 Compare April 14, 2026 21:58
@CGoodwin90 CGoodwin90 changed the title WIP: ProjectClone task setup Feat: Support for Project Cloning Apr 20, 2026
@CGoodwin90 CGoodwin90 requested a review from bomoko April 21, 2026 00:02
@CGoodwin90 CGoodwin90 marked this pull request as ready for review April 21, 2026 03:39
@CGoodwin90 CGoodwin90 force-pushed the project-cloning-setup branch from 44d04c5 to 90bd469 Compare April 21, 2026 23:01
Comment thread internal/messenger/consumer.go Outdated
Comment thread api/lagoon/v1beta2/lagoontask_types.go Outdated
Comment thread internal/controllers/v1beta2/task_controller.go Outdated
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: volume.Name,
ReadOnly: false,
MountPath: "/storage/" + volume.Name,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anywhere where this is actually documented? The fact that this is where things will get mounted? More a question than a request or whatever.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place I've seen it documented is in the issue on the Product board?

lagoonEnvironmentVariables := &[]helpers.LagoonEnvironmentVariable{}
_ = json.Unmarshal(lagoonTask.Spec.Project.Variables.Project, lagoonProjectVariables)
_ = json.Unmarshal(lagoonTask.Spec.Project.Variables.Environment, lagoonEnvironmentVariables)
// checking the various ways rootless could be enabled - not sure if this is overkill?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's pretty intense :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its intense, but it is required in some form to check these variables for the feature flag to ensure the task pod gets the right fsgroup options

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I wasn't sure if this was overkill or not, I just replicated here what we're doing in the build deploy generator to make sure we're covering all the cases. I can take a look and see if there's a nicer way to it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reference, this is the original source

lagoonProjectVariables := &[]helpers.LagoonEnvironmentVariable{}
lagoonEnvironmentVariables := &[]helpers.LagoonEnvironmentVariable{}
_ = json.Unmarshal(lagoonBuild.Spec.Project.Variables.Project, lagoonProjectVariables)
_ = json.Unmarshal(lagoonBuild.Spec.Project.Variables.Environment, lagoonEnvironmentVariables)
// check if INTERNAL_REGISTRY_SOURCE_LAGOON is defined, and if it isn't true
// if this value is true, then we want to use what is provided by Lagoon
// if it is false, or not set, then we use what is provided by this controller
// this allows us to make it so a specific environment or the project entirely
// can still use whats provided by lagoon
if !helpers.VariableExists(lagoonProjectVariables, "INTERNAL_REGISTRY_SOURCE_LAGOON", "true") ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its fine to leave it the way it is, unless you can figure out a better refactor that accomplishes the same result :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants