-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Session Affinity in Azure Container Apps #24757
Comments
I also ran into this issue.
Where affinity can only be "sticky" or "none" at the moment. This is compatible with the REST API and the go-azure-sdk. This way we can handle further sticky session settings in the future. For instance it is reasonable to assume that there will be more options for sticky_sessions in the future like duration specifications once containerapps evolve further. I would love to implement this change and create a PR if this sounds reasonable. Regards |
I added the support in my commit here: However some post-test destorys are flaky for me (They work sometimes). For instance
Runs inconsistently
I can't consistently run the acceptance tests for containerapps for that reason (Even apart from my changes). Also I am running into total number of container_app_environment limits on my Azure account when I run the whole containerapp acceptance test suite. |
Is there any news on this? |
Workaround using azapi: resource "azurerm_container_app" "example" {
name = "ca-exemple"
...
template {
http_scale_rule {
concurrent_requests = "10"
name = "http-scaler"
}
max_replicas = 1
min_replicas = 10
}
ingress {
allow_insecure_connections = false
external_enabled = true
target_port = "8080"
transport = "auto"
traffic_weight {
percentage = 100
latest_revision = true
}
}
}
# Patch Sticky sessions
resource "azapi_resource_action" "sticky_session" {
type = "Microsoft.App/containerApps@2023-11-02-preview"
resource_id = azurerm_container_app.example.id
method = "PATCH"
body = jsonencode({
properties = {
configuration = {
ingress = {
stickySessions = {
affinity = "sticky"
}
}
}
}
})
depends_on = [
azurerm_container_app.example,
]
} |
about this workaround what would be the else side of it? Let say you have a module with variable "sticky_sessions_affinity" {
description = "The sticky session affinity boolean to enable or disable sticky session."
type = bool
default = false
} resource "azapi_resource_action" "sticky_session" {
count = var.sticky_sessions_affinity ? [1] : [0]
type = "Microsoft.App/containerApps@2023-11-02-preview"
resource_id = azurerm_container_app.example.id
method = "PATCH"
body = jsonencode({
properties = {
configuration = {
ingress = {
stickySessions = {
affinity = "sticky"
}
}
}
}
})
depends_on = [
azurerm_container_app.container_app,
]
} what value should affinity have if the var.sticky_sessions_affinity is false? |
@ffroliva Based on documentation; True is |
Is there an existing issue for this?
Community Note
Description
Session Affinity is GA since August 16, 2023.
I'd like to enable or disable Session Affinity in the
ingress
block of anazurerm_container_app
with terraform, but I can't find anything in the docs.New or Affected Resource(s)/Data Source(s)
azurerm_container_app
Potential Terraform Configuration
References
https://learn.microsoft.com/en-us/azure/container-apps/sticky-sessions
https://azure.microsoft.com/en-us/updates/generally-available-session-affinity-for-azure-container-apps/
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/container_app
The text was updated successfully, but these errors were encountered: