Skip to content

Remove obsolete node labels for ws-daemon and registry-facade readiness #20904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
53 changes: 0 additions & 53 deletions components/node-labeler/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ import (
)

const (
registryFacadeLabel = "gitpod.io/registry-facade_ready_ns_%v"
wsdaemonLabel = "gitpod.io/ws-daemon_ready_ns_%v"

registryFacade = "registry-facade"
wsDaemon = "ws-daemon"

Expand Down Expand Up @@ -351,10 +348,6 @@ func (r *NodeReconciler) reconcileAll(ctx context.Context) error {
continue
}

err := updateNodeLabel(node.Name, r.Client)
if err != nil {
log.WithError(err).WithField("node", node.Name).Error("failed to initialize labels on node")
}
r.Reconcile(ctx, reconcile.Request{NamespacedName: types.NamespacedName{Name: node.Name}})
}

Expand All @@ -378,10 +371,6 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req reconcile.Request) (
if err != nil {
return reconcile.Result{}, fmt.Errorf("cannot list pods: %w", err)
}
err = updateNodeLabel(node.Name, r.Client)
if err != nil {
log.WithError(err).WithField("node", node.Name).Error("failed to initialize labels on node")
}
isWsdaemonTaintExists := isNodeTaintExists(wsDaemonTaintKey, node)
isRegistryFacadeTaintExists := isNodeTaintExists(registryFacadeTaintKey, node)
isWsDaemonReady, isRegistryFacadeReady := false, false
Expand Down Expand Up @@ -735,45 +724,3 @@ func isWorkspaceNode(node corev1.Node) bool {
_, isHeadlessWorkspaceNode := node.Labels[workspacesHeadlessLabel]
return isRegularWorkspaceNode || isHeadlessWorkspaceNode
}

func updateNodeLabel(nodeName string, client client.Client) error {
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

var node corev1.Node
err := client.Get(ctx, types.NamespacedName{Name: nodeName}, &node)
if err != nil {
return err
}

registryFacadeLabelForNamespace := fmt.Sprintf(registryFacadeLabel, namespace)
wsDaemonLabelForNamespace := fmt.Sprintf(wsdaemonLabel, namespace)

needUpdate := false

if node.Labels == nil {
node.Labels = make(map[string]string)
}

if v := node.Labels[registryFacadeLabelForNamespace]; v != "true" {
needUpdate = true
}
if v := node.Labels[wsDaemonLabelForNamespace]; v != "true" {
needUpdate = true
}

if !needUpdate {
return nil
}
node.Labels[registryFacadeLabelForNamespace] = "true"
node.Labels[wsDaemonLabelForNamespace] = "true"

err = client.Update(ctx, &node)
if err != nil {
return err
}

return nil
})
}
8 changes: 0 additions & 8 deletions components/ws-manager-mk2/controllers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,6 @@ func createDefiniteWorkspacePod(sctx *startWorkspaceContext) (*corev1.Pod, error
Key: "gitpod.io/workload_workspace_" + workloadType,
Operator: corev1.NodeSelectorOpExists,
},
{
Key: "gitpod.io/ws-daemon_ready_ns_" + sctx.Config.Namespace,
Operator: corev1.NodeSelectorOpExists,
},
{
Key: "gitpod.io/registry-facade_ready_ns_" + sctx.Config.Namespace,
Operator: corev1.NodeSelectorOpExists,
},
}

affinity := &corev1.Affinity{
Expand Down
10 changes: 5 additions & 5 deletions memory-bank/components/node-labeler.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ The Node-Labeler component integrates with:

## Usage Patterns

### Node Label Management
The component adds the following labels to nodes:
- `gitpod.io/registry-facade_ready_ns_<namespace>`: Indicates registry-facade is ready
- `gitpod.io/ws-daemon_ready_ns_<namespace>`: Indicates ws-daemon is ready
### Node Taint Management
The component manages node taints to control workspace scheduling:
- `gitpod.io/registry-facade-not-ready`: Added when registry-facade is not ready
- `gitpod.io/ws-daemon-not-ready`: Added when ws-daemon is not ready

These labels are used by the workspace scheduler to ensure workspaces are only scheduled on nodes with the required services.
These taints prevent workspace pods from being scheduled on nodes where required services are not available.

### Cluster-Autoscaler Annotation Management
The component adds or removes the following annotation:
Expand Down
Loading