Add support for defining kubernetes tolerations

Signed-off-by: Zsolt <zsolt.szeberenyi@figured.com>
This commit is contained in:
Zsolt
2022-04-05 17:02:16 +12:00
parent adafbe0e65
commit 3f6517747e
3 changed files with 50 additions and 0 deletions

View File

@ -32,6 +32,7 @@ type DeploymentOpt struct {
Rootless bool
NodeSelector map[string]string
Tolerations []corev1.Toleration
RequestsCPU string
RequestsMemory string
LimitsCPU string
@ -159,6 +160,10 @@ func NewDeployment(opt *DeploymentOpt) (d *appsv1.Deployment, c []*corev1.Config
d.Spec.Template.Spec.NodeSelector = opt.NodeSelector
}
if len(opt.Tolerations) > 0 {
d.Spec.Template.Spec.Tolerations = opt.Tolerations
}
if opt.RequestsCPU != "" {
reqCPU, err := resource.ParseQuantity(opt.RequestsCPU)
if err != nil {