Skip to content

Commit 13b42ec

Browse files
committed
Revert "fix: common PVC cleanup job to be assigned to a correct node (#1415)"
This reverts commit 46ecfee.
1 parent 593b2fc commit 13b42ec

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

pkg/constants/constants.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,3 @@ const (
9696
// ProjectCloneDisable specifies that project cloning should be disabled.
9797
ProjectCloneDisable = "disable"
9898
)
99-
100-
const (
101-
// SelectedNodeAnnotation annotation is added to a PVC that is triggered by a scheduler to be dynamically provisioned. Its value is the name of the selected node.
102-
SelectedNodeAnnotation = "volume.kubernetes.io/selected-node"
103-
)

pkg/provision/storage/cleanup.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ func getSpecCommonPVCCleanupJob(workspace *common.DevWorkspaceWithConfig, cluste
120120
pvcName = workspace.Config.Workspace.PVCName
121121
}
122122

123-
targetNode, err := getCommonPVCTargetNode(workspace, clusterAPI)
124-
if err != nil {
125-
clusterAPI.Logger.Info("Error getting target node for PVC", "PVC", fmt.Sprintf("%s/%s", workspace.Namespace, workspace.Config.Workspace.PVCName), "error", err)
126-
} else if targetNode == "" {
127-
clusterAPI.Logger.Info("PVC does not have a target node annotation", "PVC", fmt.Sprintf("%s/%s", workspace.Namespace, workspace.Config.Workspace.PVCName))
128-
}
129-
130123
jobLabels := map[string]string{
131124
constants.DevWorkspaceIDLabel: workspaceId,
132125
constants.DevWorkspaceNameLabel: workspace.Name,
@@ -196,30 +189,11 @@ func getSpecCommonPVCCleanupJob(workspace *common.DevWorkspaceWithConfig, cluste
196189
},
197190
},
198191
},
199-
Affinity: &corev1.Affinity{},
200192
},
201193
},
202194
},
203195
}
204196

205-
if targetNode != "" {
206-
job.Spec.Template.Spec.Affinity.NodeAffinity = &corev1.NodeAffinity{
207-
RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{
208-
NodeSelectorTerms: []corev1.NodeSelectorTerm{
209-
{
210-
MatchExpressions: []corev1.NodeSelectorRequirement{
211-
{
212-
Key: corev1.LabelHostname,
213-
Operator: corev1.NodeSelectorOpIn,
214-
Values: []string{targetNode},
215-
},
216-
},
217-
},
218-
},
219-
},
220-
}
221-
}
222-
223197
podTolerations, nodeSelector, err := nsconfig.GetNamespacePodTolerationsAndNodeSelector(workspace.Namespace, clusterAPI)
224198
if err != nil {
225199
return nil, err
@@ -252,22 +226,3 @@ func commonPVCExists(workspace *common.DevWorkspaceWithConfig, clusterAPI sync.C
252226
}
253227
return true, nil
254228
}
255-
256-
func getCommonPVCTargetNode(workspace *common.DevWorkspaceWithConfig, clusterAPI sync.ClusterAPI) (string, error) {
257-
namespacedName := types.NamespacedName{
258-
Name: workspace.Config.Workspace.PVCName,
259-
Namespace: workspace.Namespace,
260-
}
261-
pvc := &corev1.PersistentVolumeClaim{}
262-
err := clusterAPI.Client.Get(clusterAPI.Ctx, namespacedName, pvc)
263-
if err != nil {
264-
return "", err
265-
}
266-
267-
targetNode := ""
268-
if pvc.Annotations != nil {
269-
targetNode = pvc.Annotations[constants.SelectedNodeAnnotation]
270-
}
271-
272-
return targetNode, nil
273-
}

0 commit comments

Comments
 (0)