Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions internal/controllers/v1beta2/build_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,14 @@ func (r *LagoonBuildReconciler) processBuild(ctx context.Context, opLog logr.Log
Name: lagoonBuild.Name,
Namespace: lagoonBuild.Namespace,
Labels: map[string]string{
"lagoon.sh/jobType": "build",
"lagoon.sh/buildName": lagoonBuild.Name,
"lagoon.sh/controller": r.ControllerNamespace,
"crd.lagoon.sh/version": crdVersion,
"lagoon.sh/buildRemoteID": string(lagoonBuild.UID),
"lagoon.sh/jobType": "build",
"lagoon.sh/buildName": lagoonBuild.Name,
"lagoon.sh/project": lagoonBuild.Spec.Project.Name,
"lagoon.sh/environment": lagoonBuild.Spec.Project.Environment,
"lagoon.sh/environmentType": lagoonBuild.Spec.Project.EnvironmentType,
"lagoon.sh/controller": r.ControllerNamespace,
"crd.lagoon.sh/version": crdVersion,
"lagoon.sh/buildRemoteID": string(lagoonBuild.UID),
},
OwnerReferences: []metav1.OwnerReference{
{
Expand Down Expand Up @@ -688,6 +691,13 @@ func (r *LagoonBuildReconciler) processBuild(ctx context.Context, opLog logr.Log
newPod.Labels["organization.lagoon.sh/name"] = lagoonBuild.Spec.Project.Organization.Name
}

if lagoonBuild.Spec.Project.ID != nil {
newPod.Labels["lagoon.sh/projectId"] = fmt.Sprintf("%d", *lagoonBuild.Spec.Project.ID)
}
if lagoonBuild.Spec.Project.EnvironmentID != nil {
newPod.Labels["lagoon.sh/environmentId"] = fmt.Sprintf("%d", *lagoonBuild.Spec.Project.EnvironmentID)
}

if !r.ClusterAutoscalerEvict {
// try to prevent build pods from being evicted by cluster autoscaler
newPod.Labels["cluster-autoscaler.kubernetes.io/safe-to-evict"] = "false"
Expand Down
5 changes: 5 additions & 0 deletions internal/controllers/v1beta2/task_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ func (r *LagoonTaskReconciler) getTaskPodDeployment(ctx context.Context, lagoonT
Labels: map[string]string{
"lagoon.sh/jobType": "task",
"lagoon.sh/taskName": lagoonTask.Name,
"lagoon.sh/project": lagoonTask.Spec.Project.Name,
"crd.lagoon.sh/version": crdVersion,
"lagoon.sh/controller": r.ControllerNamespace,
},
Expand All @@ -324,6 +325,10 @@ func (r *LagoonTaskReconciler) getTaskPodDeployment(ctx context.Context, lagoonT
taskPod.Labels["organization.lagoon.sh/name"] = lagoonTask.Spec.Project.Organization.Name
}

if lagoonTask.Spec.Project.ID != nil {
taskPod.Labels["lagoon.sh/projectId"] = fmt.Sprintf("%d", *lagoonTask.Spec.Project.ID)
}

if !r.ClusterAutoscalerEvict {
// try to prevent build pods from being evicted by cluster autoscaler
taskPod.Labels["cluster-autoscaler.kubernetes.io/safe-to-evict"] = "false"
Expand Down
Loading