Skip to content

Commit

Permalink
RUN-20790 Don't run device plugin DaemonSet on fake nodes (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
gshaibi authored Nov 28, 2024
1 parent eddc6cf commit ce655c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions internal/status-updater/handlers/node/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package node

import (
"github.com/run-ai/fake-gpu-operator/internal/common/constants"
v1 "k8s.io/api/core/v1"
)

func isFakeNode(node *v1.Node) bool {
return node != nil && node.Annotations[constants.AnnotationKwokNode] == "fake"
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,3 @@ func generateFakeNodeDeploymentFromTemplate(template *appsv1.Deployment, node *v

return deployment
}

func isFakeNode(node *v1.Node) bool {
return node != nil && node.Annotations[constants.AnnotationKwokNode] == "fake"
}
10 changes: 7 additions & 3 deletions internal/status-updater/handlers/node/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ const (

// labelNode labels the node with required labels for the fake-gpu-operator to function.
func (p *NodeHandler) labelNode(node *v1.Node) error {
err := p.patchNodeLabels(node, map[string]interface{}{
labels := map[string]interface{}{
dcgmExporterLabelKey: "true",
devicePluginLabelKey: "true",
})
}
if !isFakeNode(node) {
labels[devicePluginLabelKey] = "true"
}

err := p.patchNodeLabels(node, labels)
if err != nil {
return fmt.Errorf("failed to label node %s: %w", node.Name, err)
}
Expand Down

0 comments on commit ce655c0

Please sign in to comment.