mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-02 23:23:45 +00:00
Add Agent-level Tolerations setting (#5266)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -67,6 +67,8 @@ type config struct {
|
||||
PodAnnotations map[string]string
|
||||
PodAnnotationsAllowFromStep bool
|
||||
PodNodeSelector map[string]string
|
||||
PodTolerationsAllowFromStep bool
|
||||
PodTolerations []Toleration
|
||||
ImagePullSecretNames []string
|
||||
SecurityContext SecurityContextConfig
|
||||
NativeSecretsAllowFromStep bool
|
||||
@@ -109,6 +111,7 @@ func configFromCliContext(ctx context.Context) (*config, error) {
|
||||
PodLabelsAllowFromStep: c.Bool("backend-k8s-pod-labels-allow-from-step"),
|
||||
PodAnnotations: make(map[string]string), // just init empty map to prevent nil panic
|
||||
PodAnnotationsAllowFromStep: c.Bool("backend-k8s-pod-annotations-allow-from-step"),
|
||||
PodTolerationsAllowFromStep: c.Bool("backend-k8s-pod-tolerations-allow-from-step"),
|
||||
PodNodeSelector: make(map[string]string), // just init empty map to prevent nil panic
|
||||
ImagePullSecretNames: c.StringSlice("backend-k8s-pod-image-pull-secret-names"),
|
||||
SecurityContext: SecurityContextConfig{
|
||||
@@ -136,6 +139,13 @@ func configFromCliContext(ctx context.Context) (*config, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if podTolerations := c.String("backend-k8s-pod-tolerations"); podTolerations != "" {
|
||||
if err := yaml.Unmarshal([]byte(podTolerations), &config.PodTolerations); err != nil {
|
||||
log.Error().Err(err).Msgf("could not unmarshal pod tolerations '%s'", podTolerations)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &config, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user