mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-09 09:05:26 +00:00
Add nodeSelector
using platform for kubernetes (#1737)
Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
parent
820cec9466
commit
d13a8744ce
1 changed files with 11 additions and 0 deletions
|
@ -100,6 +100,16 @@ func Pod(namespace string, step *types.Step, labels, annotations map[string]stri
|
|||
|
||||
labels["step"] = podName
|
||||
|
||||
var platform string
|
||||
for _, e := range mapToEnvVars(step.Environment) {
|
||||
if e.Name == "CI_SYSTEM_ARCH" {
|
||||
platform = e.Value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
NodeSelector := map[string]string{"kubernetes.io/arch": strings.Split(platform, "/")[1]}
|
||||
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: podName,
|
||||
|
@ -110,6 +120,7 @@ func Pod(namespace string, step *types.Step, labels, annotations map[string]stri
|
|||
Spec: v1.PodSpec{
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
HostAliases: hostAliases,
|
||||
NodeSelector: NodeSelector,
|
||||
Containers: []v1.Container{{
|
||||
Name: podName,
|
||||
Image: step.Image,
|
||||
|
|
Loading…
Reference in a new issue