mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-24 08:08:38 +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
|
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{
|
pod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: podName,
|
Name: podName,
|
||||||
|
@ -110,6 +120,7 @@ func Pod(namespace string, step *types.Step, labels, annotations map[string]stri
|
||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
RestartPolicy: v1.RestartPolicyNever,
|
RestartPolicy: v1.RestartPolicyNever,
|
||||||
HostAliases: hostAliases,
|
HostAliases: hostAliases,
|
||||||
|
NodeSelector: NodeSelector,
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
Name: podName,
|
Name: podName,
|
||||||
Image: step.Image,
|
Image: step.Image,
|
||||||
|
|
Loading…
Reference in a new issue