Skip to content

Commit

Permalink
Merge pull request #667 from gmfrasca/wc-podspecs
Browse files Browse the repository at this point in the history
Add ResourceRequirments to WorkflowController
  • Loading branch information
openshift-merge-bot[bot] authored Jun 25, 2024
2 parents 6395b5d + fa280ae commit 8280dcd
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 13 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/dspipeline_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ type WorkflowController struct {
Image string `json:"image,omitempty"`
ArgoExecImage string `json:"argoExecImage,omitempty"`
CustomConfig string `json:"customConfig,omitempty"`
// Specify custom Pod resource requirements for this component.
Resources *ResourceRequirements `json:"resources,omitempty"`
}

// ResourceRequirements structures compute resource requirements.
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,41 @@ spec:
type: boolean
image:
type: string
resources:
description: Specify custom Pod resource requirements for this
component.
properties:
limits:
properties:
cpu:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
memory:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
requests:
properties:
cpu:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
memory:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
type: object
type: object
required:
- objectStorage
Expand Down
21 changes: 18 additions & 3 deletions config/internal/workflow-controller/deployment.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,24 @@ spec:
name: metrics
- containerPort: 6060
resources:
requests:
cpu: 100m
memory: 500Mi
{{ if .WorkflowController.Resources.Requests }}
requests:
{{ if .WorkflowController.Resources.Requests.CPU }}
cpu: {{.WorkflowController.Resources.Requests.CPU}}
{{ end }}
{{ if .WorkflowController.Resources.Requests.Memory }}
memory: {{.WorkflowController.Resources.Requests.Memory}}
{{ end }}
{{ end }}
{{ if .WorkflowController.Resources.Limits }}
limits:
{{ if .WorkflowController.Resources.Limits.CPU }}
cpu: {{.WorkflowController.Resources.Limits.CPU}}
{{ end }}
{{ if .WorkflowController.Resources.Limits.Memory }}
memory: {{.WorkflowController.Resources.Limits.Memory}}
{{ end }}
{{ end }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
12 changes: 12 additions & 0 deletions config/samples/v2/dspa-all-fields/dspa_all_fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ spec:
requests:
cpu: 100m
memory: 256Mi
workflowController:
deploy: true
image: quay.io/opendatahub/ds-pipelines-argo-workflowcontroller:3.3.10-upstream
argoExecImage: quay.io/opendatahub/ds-pipelines-argo-argoexec:3.3.10-upstream
customConfig: some-custom-workflowcontroller-configmap # see ../custom-workflow-controller-config for example
resources:
requests:
cpu: 120m
memory: 500Mi
limits:
cpu: 250m
memory: 1Gi
database:
disableHealthCheck: false
# possible values for tls: true, false, skip-verify
Expand Down
19 changes: 10 additions & 9 deletions controllers/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,16 @@ func GetConfigRequiredFields() []string {

// Default ResourceRequirements
var (
APIServerResourceRequirements = createResourceRequirement(resource.MustParse("250m"), resource.MustParse("500Mi"), resource.MustParse("500m"), resource.MustParse("1Gi"))
PersistenceAgentResourceRequirements = createResourceRequirement(resource.MustParse("120m"), resource.MustParse("500Mi"), resource.MustParse("250m"), resource.MustParse("1Gi"))
ScheduledWorkflowResourceRequirements = createResourceRequirement(resource.MustParse("120m"), resource.MustParse("100Mi"), resource.MustParse("250m"), resource.MustParse("250Mi"))
MariaDBResourceRequirements = createResourceRequirement(resource.MustParse("300m"), resource.MustParse("800Mi"), resource.MustParse("1"), resource.MustParse("1Gi"))
MinioResourceRequirements = createResourceRequirement(resource.MustParse("200m"), resource.MustParse("100Mi"), resource.MustParse("250m"), resource.MustParse("1Gi"))
MlPipelineUIResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdEnvoyResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdGRPCResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdWriterResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
APIServerResourceRequirements = createResourceRequirement(resource.MustParse("250m"), resource.MustParse("500Mi"), resource.MustParse("500m"), resource.MustParse("1Gi"))
PersistenceAgentResourceRequirements = createResourceRequirement(resource.MustParse("120m"), resource.MustParse("500Mi"), resource.MustParse("250m"), resource.MustParse("1Gi"))
ScheduledWorkflowResourceRequirements = createResourceRequirement(resource.MustParse("120m"), resource.MustParse("100Mi"), resource.MustParse("250m"), resource.MustParse("250Mi"))
WorkflowControllerResourceRequirements = createResourceRequirement(resource.MustParse("120m"), resource.MustParse("500Mi"), resource.MustParse("250m"), resource.MustParse("1Gi"))
MariaDBResourceRequirements = createResourceRequirement(resource.MustParse("300m"), resource.MustParse("800Mi"), resource.MustParse("1"), resource.MustParse("1Gi"))
MinioResourceRequirements = createResourceRequirement(resource.MustParse("200m"), resource.MustParse("100Mi"), resource.MustParse("250m"), resource.MustParse("1Gi"))
MlPipelineUIResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdEnvoyResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdGRPCResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
MlmdWriterResourceRequirements = createResourceRequirement(resource.MustParse("100m"), resource.MustParse("256Mi"), resource.MustParse("100m"), resource.MustParse("256Mi"))
)

type DBExtraParams map[string]string
Expand Down
1 change: 1 addition & 0 deletions controllers/dspipeline_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ func (p *DSPAParams) ExtractParams(ctx context.Context, dsp *dspa.DataSciencePip
argoExecImageFromConfig := config.GetStringConfigWithDefault(config.ArgoExecImagePath, config.DefaultImageValue)
setStringDefault(argoWorkflowImageFromConfig, &p.WorkflowController.Image)
setStringDefault(argoExecImageFromConfig, &p.WorkflowController.ArgoExecImage)
setResourcesDefault(config.WorkflowControllerResourceRequirements, &p.WorkflowController.Resources)
}

err := p.SetupMLMD(dsp, log)
Expand Down

0 comments on commit 8280dcd

Please sign in to comment.