Skip to content
Draft
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
1 change: 1 addition & 0 deletions RELEASE_NOTES.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the docs need updating too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated container-apps.md to document all four fields of ServiceBusScaleRule (QueueName, Namespace, MessageCount, SecretRef) (commit 47bfd399).

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Release Notes

## 1.9.28
* Container Apps: Add `resources` operation to the `container` builder to set both CPU and memory together using a `ConsumptionPlanResources` discriminated union. This ensures only valid consumption plan resource combinations can be selected at compile time. The individual `cpu_cores` and `memory` operations remain available for use with dedicated plans.
* Container Apps: Add required `Namespace` field to `ServiceBusScaleRule` to associate the scale rule with the correct Service Bus namespace.

## 1.9.27
* Storage Accounts: Add `AccountKey` member to return just the storage account key and `ConnectionString` member to return the connection string. The existing `Key` member is now obsolete (it incorrectly returned a connection string instead of just the key).
Expand Down
9 changes: 9 additions & 0 deletions docs/content/api-overview/resources/container-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ The Container App Builder supports a number of KEDA scale rules out of the box:
| add_queue_scale_rule | Adds a scale rule for Azure Storage Queue length. |
| add_custom_scale_rule | Adds a custom scale rule. Provide an object that matches the KEDA specification. |

The `add_servicebus_scale_rule` keyword takes a name and a `ServiceBusScaleRule` record with the following fields:

| Field | Purpose |
|-|-|
| QueueName | The name of the Service Bus queue to monitor. |
| Namespace | The Service Bus namespace to associate with the scale rule. |
| MessageCount | The number of messages in the queue that triggers scaling. |
| SecretRef | The name of the secret containing the Service Bus connection string. |

> The Azure Storage Queue Scale Rule integration is "smart" - provide a reference to the storage account, queue name and length threshold; all appropriate settings and secrets will be automatically configured for you.

#### Container Builder
Expand Down
1 change: 1 addition & 0 deletions src/Farmer/Arm/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ type ContainerApp = {
metadata = {|
queueName = settings.QueueName
messageCount = string settings.MessageCount
``namespace`` = settings.Namespace
|}
auth = [|
{|
Expand Down
1 change: 1 addition & 0 deletions src/Farmer/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4081,6 +4081,7 @@ module ContainerApp =

type ServiceBusScaleRule = {
QueueName: string
Namespace: string
MessageCount: int
SecretRef: string
}
Expand Down
11 changes: 11 additions & 0 deletions src/Tests/ContainerApps.fs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should one of the tests check that the value is set correctly?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added assertions to check that queueName, messageCount, and namespace are all correctly serialized in the JSON output (commit 47bfd399).

Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ let fullContainerAppDeployment =
QueueName = "wishrequests"
MessageCount = 5
SecretRef = "servicebusconnectionkey"
Namespace = "servicebus"
}
}
containerApp {
Expand Down Expand Up @@ -361,6 +362,16 @@ let tests =
"/certs"
"Incorrect container volume mount"

let sbScaleRuleMetadata =
serviceBusContainerApp.SelectToken(
"properties.template.scale.rules[0].custom.metadata"
)

Expect.isNotNull sbScaleRuleMetadata "service bus scale rule metadata was null"
Expect.equal (sbScaleRuleMetadata["queueName"] |> string) "wishrequests" "Incorrect service bus scale rule queueName"
Expect.equal (sbScaleRuleMetadata["messageCount"] |> string) "5" "Incorrect service bus scale rule messageCount"
Expect.equal (sbScaleRuleMetadata["namespace"] |> string) "servicebus" "Incorrect service bus scale rule namespace"

let azureQueueContainerApp = jobj.SelectToken("resources[?(@.name=='azurequeue')]")
Expect.isNotNull azureQueueContainerApp "resources[?(@.name=='azurequeue')] was null"

Expand Down
Loading