Is there an existing issue for this?
Current Behavior
I've set the Helm chart values nodeSelector and tolerations to confine Fleet to a certain set of nodes. The deployments generated by Fleet all have these node selectors and tolerations (e.g., fleet-controller, gitjob) but whenever a new K8s job is created in order to sync a GitRepo, the job is assigned with the tolerations but not the selectors, causing it to get scheduled on untainted nodes.
Digging a little deeper, it appears that the job will inherit tolerations from the Fleet Controller:
// add tolerations from the fleet-controller deployment
jobSpec.Template.Spec.Tolerations = append(
jobSpec.Template.Spec.Tolerations,
fleetControllerDeployment.Spec.Template.Spec.Tolerations...,
)
(source)
but only inherits node selectors when Fleet is sharded:
nodeSelector := map[string]string{"kubernetes.io/os": "linux"}
if shardID != "" && len(strings.TrimSpace(r.JobNodeSelector)) > 0 {
var shardNodeSelector map[string]string
if err := json.Unmarshal([]byte(r.JobNodeSelector), &shardNodeSelector); err != nil {
return nil, fmt.Errorf("could not decode shard node selector: %w", err)
}
maps.Copy(nodeSelector, shardNodeSelector)
}
(source)
I don't want to shard Fleet, so the jobs stay selector-less and aren't scheduled correctly for me.
Expected Behavior
The ability to assign node selectors to generated jobs without having the enable Fleet sharding.
Steps To Reproduce
No response
Environment
Logs
Anything else?
No response
Is there an existing issue for this?
Current Behavior
I've set the Helm chart values
nodeSelectorandtolerationsto confine Fleet to a certain set of nodes. The deployments generated by Fleet all have these node selectors and tolerations (e.g.,fleet-controller,gitjob) but whenever a new K8s job is created in order to sync a GitRepo, the job is assigned with the tolerations but not the selectors, causing it to get scheduled on untainted nodes.Digging a little deeper, it appears that the job will inherit tolerations from the Fleet Controller:
(source)
but only inherits node selectors when Fleet is sharded:
(source)
I don't want to shard Fleet, so the jobs stay selector-less and aren't scheduled correctly for me.
Expected Behavior
The ability to assign node selectors to generated jobs without having the enable Fleet sharding.
Steps To Reproduce
No response
Environment
Logs
Anything else?
No response