You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	Add nodeSelector using platform for kubernetes (#1737)
				
					
				
			Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
		| @@ -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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user