Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions docs/resources/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ resource "rafay_driver" "driver" {
***Optional***

- `container` (Block List, Max: 1) Specify the container driver config (see [below for nested schema](#nestedblock--spec--config--container))
- `function` (Block List, Max: 1) Configure the function driver configuration (see [below for nested schema](#nestedblock--spec--config--function))
- `http` (Block List, Max: 1) Specify the http driver config (see [below for nested schema](#nestedblock--spec--config--http))
- `max_retry_count` (Number) Specify the max retry count
- `success_condition` (String) Specify the success condition
Expand Down Expand Up @@ -286,6 +287,81 @@ resource "rafay_driver" "driver" {
- `value` (Boolean)


<a id="nestedblock--spec--config--function"></a>
### Nested Schema for `spec.config.function`

***Optional***

- `resources` (Block List, Max: 1) Resource requirements for the function container. When unset=true, no requests/limits are applied (see [below for nested schema](#nestedblock--spec--config--function--resources))
- `hpa` (Block List, Max: 1) Horizontal Pod Autoscaler configuration for the function deployment (see [below for nested schema](#nestedblock--spec--config--function--hpa))

<a id="nestedblock--spec--config--function--resources"></a>
### Nested Schema for `spec.config.function.resources`

***Optional***

- `requests` (Block List, Max: 1) Resource requests for the function container (see [below for nested schema](#nestedblock--spec--config--function--resources--requests))
- `limits` (Block List, Max: 1) Resource limits for the function container (see [below for nested schema](#nestedblock--spec--config--function--resources--limits))
- `unset` (Block List, Max: 1) When true, no CPU/memory requests and limits are applied (see [below for nested schema](#nestedblock--spec--config--function--resources--unset))

<a id="nestedblock--spec--config--function--resources--requests"></a>
### Nested Schema for `spec.config.function.resources.requests`

***Optional***

- `cpu` (String) Kubernetes quantity string for CPU (e.g. "500m", "1")
- `memory` (String) Kubernetes quantity string for memory (e.g. "256Mi", "1Gi")

<a id="nestedblock--spec--config--function--resources--limits"></a>
### Nested Schema for `spec.config.function.resources.limits`

***Optional***

- `cpu` (String) Kubernetes quantity string for CPU (e.g. "500m", "1")
- `memory` (String) Kubernetes quantity string for memory (e.g. "256Mi", "1Gi")

<a id="nestedblock--spec--config--function--resources--unset"></a>
### Nested Schema for `spec.config.function.resources.unset`

***Optional***

- `value` (Boolean)

<a id="nestedblock--spec--config--function--hpa"></a>
### Nested Schema for `spec.config.function.hpa`

***Optional***

- `enabled` (Block List, Max: 1) Enable HPA for the function deployment (see [below for nested schema](#nestedblock--spec--config--function--hpa--enabled))
- `min_replicas` (Number) Minimum number of replicas for HPA
- `max_replicas` (Number) Maximum number of replicas for HPA
- `resource_metrics` (Block List) Resource metric sources (CPU/Memory) for autoscaling; each entry becomes a MetricSpec of type Resource (see [below for nested schema](#nestedblock--spec--config--function--hpa--resource_metrics))

<a id="nestedblock--spec--config--function--hpa--enabled"></a>
### Nested Schema for `spec.config.function.hpa.enabled`

***Optional***

- `value` (Boolean)

<a id="nestedblock--spec--config--function--hpa--resource_metrics"></a>
### Nested Schema for `spec.config.function.hpa.resource_metrics`

***Optional***

- `name` (String) Name of the resource (e.g. "cpu", "memory")
- `target` (Block List, Max: 1) Target value for the metric (see [below for nested schema](#nestedblock--spec--config--function--hpa--resource_metrics--target))

<a id="nestedblock--spec--config--function--hpa--resource_metrics--target"></a>
### Nested Schema for `spec.config.function.hpa.resource_metrics.target`

***Optional***

- `type` (String) Metric target type: "Utilization", "Value", or "AverageValue"
- `value` (String) Target value of the metric (Kubernetes quantity string, e.g. "500m")
- `average_value` (String) Target average value of the metric across pods (Kubernetes quantity string)
- `average_utilization` (Number) Target average utilization as a percentage of the requested resource (e.g. 80 for 80%)

<a id="nestedblock--spec--config--http"></a>
### Nested Schema for `spec.config.http`

Expand Down
77 changes: 77 additions & 0 deletions docs/resources/workflow_handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ resource "rafay_workflow_handler" "workflow_handler" {
- `memory_limit_mb` (String) Configure the Memory Limits as the maximum amount of a resource to be used by a function
- `name` (String) Specify the name of the function
- `num_replicas` (Number) Specify the number of replicas for the function
- `resources` (Block List, Max: 1) Resource requirements for the function container. When unset=true, no requests/limits are applied (see [below for nested schema](#nestedblock--spec--config--function--resources))
- `hpa` (Block List, Max: 1) Horizontal Pod Autoscaler configuration for the function deployment (see [below for nested schema](#nestedblock--spec--config--function--hpa))
- `skip_build` (Block List, Max: 1) Skip the build process for the function (see [below for nested schema](#nestedblock--spec--config--function--skip_build))
- `source` (String) Specify the source of the function
- `system_packages` (List of String) Specify the system packages for the function
Expand Down Expand Up @@ -1059,6 +1061,81 @@ resource "rafay_workflow_handler" "workflow_handler" {
- `toleration_seconds` (Number)
- `value` (String)

<a id="nestedblock--spec--config--function--resources"></a>

### Nested Schema for `spec.config.function.resources`

**_Optional_**

- `requests` (Block List, Max: 1) Resource requests for the function container (see [below for nested schema](#nestedblock--spec--config--function--resources--requests))
- `limits` (Block List, Max: 1) Resource limits for the function container (see [below for nested schema](#nestedblock--spec--config--function--resources--limits))
- `unset` (Block List, Max: 1) When true, no CPU/memory requests and limits are applied (see [below for nested schema](#nestedblock--spec--config--function--resources--unset))

<a id="nestedblock--spec--config--function--resources--requests"></a>

### Nested Schema for `spec.config.function.resources.requests`

**_Optional_**

- `cpu` (String) Kubernetes quantity string for CPU (e.g. "500m", "1")
- `memory` (String) Kubernetes quantity string for memory (e.g. "256Mi", "1Gi")

<a id="nestedblock--spec--config--function--resources--limits"></a>

### Nested Schema for `spec.config.function.resources.limits`

**_Optional_**

- `cpu` (String) Kubernetes quantity string for CPU (e.g. "500m", "1")
- `memory` (String) Kubernetes quantity string for memory (e.g. "256Mi", "1Gi")

<a id="nestedblock--spec--config--function--resources--unset"></a>

### Nested Schema for `spec.config.function.resources.unset`

**_Optional_**

- `value` (Boolean)

<a id="nestedblock--spec--config--function--hpa"></a>

### Nested Schema for `spec.config.function.hpa`

**_Optional_**

- `enabled` (Block List, Max: 1) Enable HPA for the function deployment (see [below for nested schema](#nestedblock--spec--config--function--hpa--enabled))
- `min_replicas` (Number) Minimum number of replicas for HPA
- `max_replicas` (Number) Maximum number of replicas for HPA
- `resource_metrics` (Block List) Resource metric sources (CPU/Memory) for autoscaling; each entry becomes a MetricSpec of type Resource (see [below for nested schema](#nestedblock--spec--config--function--hpa--resource_metrics))

<a id="nestedblock--spec--config--function--hpa--enabled"></a>

### Nested Schema for `spec.config.function.hpa.enabled`

**_Optional_**

- `value` (Boolean)

<a id="nestedblock--spec--config--function--hpa--resource_metrics"></a>

### Nested Schema for `spec.config.function.hpa.resource_metrics`

**_Optional_**

- `name` (String) Name of the resource (e.g. "cpu", "memory")
- `target` (Block List, Max: 1) Target value for the metric (see [below for nested schema](#nestedblock--spec--config--function--hpa--resource_metrics--target))

<a id="nestedblock--spec--config--function--hpa--resource_metrics--target"></a>

### Nested Schema for `spec.config.function.hpa.resource_metrics.target`

**_Optional_**

- `type` (String) Metric target type: "Utilization", "Value", or "AverageValue"
- `value` (String) Target value of the metric (Kubernetes quantity string, e.g. "500m")
- `average_value` (String) Target average value of the metric across pods (Kubernetes quantity string)
- `average_utilization` (Number) Target average utilization as a percentage of the requested resource (e.g. 80 for 80%)

<a id="nestedblock--spec--config--function--skip_build"></a>

### Nested Schema for `spec.config.function.skip_build`
Expand Down
54 changes: 54 additions & 0 deletions examples/resources/rafay_workflow_handler/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,58 @@ resource "rafay_workflow_handler" "workflow_handler" {
}
}
}
}

# Example workflow handler with function driver, resources and HPA
resource "rafay_workflow_handler" "workflow_handler_function" {
metadata {
name = "${var.name}-function"
project = var.project
}
spec {
config {
type = "function"
timeout_seconds = 100
max_retry_count = 3
function {
name = "example-function"
image = "my-registry.io/example-function:latest"
skip_build {
value = true
}
num_replicas = 2
resources {
requests {
cpu = "500m"
memory = "256Mi"
}
limits {
cpu = "1"
memory = "512Mi"
}
}
hpa {
enabled {
value = true
}
min_replicas = 1
max_replicas = 10
resource_metrics {
name = "cpu"
target {
type = "Utilization"
average_utilization = 80
}
}
resource_metrics {
name = "memory"
target {
type = "AverageValue"
average_value = "512Mi"
}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.24.0

require (
github.com/RafaySystems/edge-common v1.24.1-0.20260210092640-f8449fb6a28f
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260212054829-95edf0ffe8c1
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260211050557-17988cb8bba1
github.com/RafaySystems/rctl v1.29.1-0.20251223105806-82bdefd9f2be
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/go-yaml/yaml v2.1.0+incompatible
Expand All @@ -28,7 +28,7 @@ require (
github.com/IBM/sarama v1.43.2 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/RafaySystems/eaas-playground/proto v0.0.0-20251008151511-bf1cf36fe5bd // indirect
github.com/RafaySystems/eaas-playground/proto v0.0.0-20260209100653-efc264d6164b // indirect
github.com/RafaySystems/paas-common v0.0.0-20250519095800-e92646adcd6e // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/RafaySystems/eaas-playground/proto v0.0.0-20251008151511-bf1cf36fe5bd h1:50smMqzYlYN0e7bgVLGBIX7Y1V9fUE+yUhkCoQIVgD4=
github.com/RafaySystems/eaas-playground/proto v0.0.0-20251008151511-bf1cf36fe5bd/go.mod h1:lAle7/tiVlakfiXdJKnsf6qNdLkoWS712T4pAXytSOQ=
github.com/RafaySystems/eaas-playground/proto v0.0.0-20260209100653-efc264d6164b h1:i5ukC9tueAvpXWy8jK+0UQIgd3tGBji3uteaPLA/SgI=
github.com/RafaySystems/eaas-playground/proto v0.0.0-20260209100653-efc264d6164b/go.mod h1:lAle7/tiVlakfiXdJKnsf6qNdLkoWS712T4pAXytSOQ=
github.com/RafaySystems/edge-common v1.24.1-0.20260210092640-f8449fb6a28f h1:Gdp6e7EPmVSFXGW6MUyf9e+avbSKrz+8CJv98CWdS9c=
github.com/RafaySystems/edge-common v1.24.1-0.20260210092640-f8449fb6a28f/go.mod h1:tbd1Z34RfnJ3umcDjf478+dh7hJ66ict3wra7YbQmiA=
github.com/RafaySystems/paas-common v0.0.0-20250519095800-e92646adcd6e h1:SrznY+xkaQ4BkX0HXGa0upur7RAtR6UsTsdMNEgBreY=
github.com/RafaySystems/paas-common v0.0.0-20250519095800-e92646adcd6e/go.mod h1:vDR0S28Q+hwE/5wO0L/Ohn9CZwaI/o2QuPupJ2iLI7k=
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260212054829-95edf0ffe8c1 h1:fNHNkwU6aVzayQ7fi8HudbUQ3+22dVloYkbA53NrNec=
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260212054829-95edf0ffe8c1/go.mod h1:oW9Qjzh48Sq9pBYPYbmzAC73PwehEwEI9PBVpdX9OaI=
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260211050557-17988cb8bba1 h1:u8r3Ljr7hpx4PDAcjpI0PbjL2x9mY+Bx61RlIKPT2t8=
github.com/RafaySystems/rafay-common v1.29.1-rc2.0.20260211050557-17988cb8bba1/go.mod h1:odgdwYI8Syng0UOhwSgAchFp8yE3lZ3h8w3dqEq9AC0=
github.com/RafaySystems/rctl v1.29.1-0.20251223105806-82bdefd9f2be h1:J8aFJgB2guG+pyRmnRGA8yoPM08qBS/8juNGMoltb9U=
github.com/RafaySystems/rctl v1.29.1-0.20251223105806-82bdefd9f2be/go.mod h1:Ja881zvwJU7FeufWgAYQdXhOTYhonzwOy81JBTLVXwQ=
github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ=
Expand Down
12 changes: 12 additions & 0 deletions rafay/resource_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,18 @@ func expandDriverConfig(p []any) *eaaspb.DriverConfig {
driverConfig.Http = expandWorkflowHandlerHttpConfig(v)
}

if v, ok := in["function"].([]any); ok && len(v) > 0 {
driverConfig.Function = expandWorkflowHandlerFunctionConfig(v)
}

if v, ok := in["polling_config"].([]any); ok && len(v) > 0 {
driverConfig.PollingConfig = expandPollingConfig(v)
}

if h, ok := in["timeout_seconds"].(int); ok {
driverConfig.TimeoutSeconds = int64(h)
}

return &driverConfig
}

Expand Down
Loading