Skip to content

Commit

Permalink
Provide runner labels from kube node annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kiootic committed Jul 4, 2023
1 parent e83174b commit 812b2ce
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/kube/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ func (p *ControllerProvider) RegisterAgent(
group := annotations[annotationRunnerGroup]
labels := strings.Split(annotations[annotationRunnerLabels], ",")

if pod.Spec.NodeName != "" {
node, err := p.kube.CoreV1().Nodes().Get(r.Context(), pod.Spec.NodeName, metav1.GetOptions{})
if err != nil {
p.logger.Error("failed to get node",
zap.String("nodeName", pod.Spec.NodeName),
zap.Error(err))
} else {
nodeRunnerLabels := strings.Split(node.Annotations[annotationRunnerLabels], ",")
labels = append(labels, nodeRunnerLabels...)
}
}

agent, err := p.state.makeAgent(pod, hostName)
if err != nil {
return nil, err
Expand Down

0 comments on commit 812b2ce

Please sign in to comment.