diff --git a/mmv1/products/compute/BackendService.yaml b/mmv1/products/compute/BackendService.yaml index 0b1597f1ffac..5bb6764e9975 100644 --- a/mmv1/products/compute/BackendService.yaml +++ b/mmv1/products/compute/BackendService.yaml @@ -106,6 +106,12 @@ examples: vars: backend_service_name: 'backend-service' health_check_name: 'health-check' + - name: 'backend_service_stateful_session_affinity' + primary_resource_id: 'default' + min_version: 'beta' + vars: + backend_service_name: 'backend-service' + health_check_name: 'health-check' - name: 'backend_service_network_endpoint' primary_resource_id: 'default' min_version: 'beta' @@ -1295,6 +1301,50 @@ properties: - 'GENERATED_COOKIE' - 'HEADER_FIELD' - 'HTTP_COOKIE' + - 'STRONG_COOKIE_AFFINITY' + - name: 'strongSessionAffinityCookie' + type: NestedObject + description: | + Describes the HTTP cookie used for stateful session affinity. This field is applicable and required if the sessionAffinity is set to STRONG_COOKIE_AFFINITY. + properties: + - name: 'ttl' + type: NestedObject + description: | + Lifetime of the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' + properties: + - name: 'seconds' + type: Integer + description: | + Span of time at a resolution of a second. + Must be from 0 to 315,576,000,000 inclusive. + required: true + - name: 'nanos' + type: Integer + description: | + Span of time that's a fraction of a second at nanosecond + resolution. Durations less than one second are represented + with a 0 seconds field and a positive nanos field. Must + be from 0 to 999,999,999 inclusive. + - name: 'name' + type: String + description: | + Name of the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' + - name: 'path' + type: String + description: | + Path to set for the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' - name: 'timeoutSec' type: Integer description: | diff --git a/mmv1/products/compute/RegionBackendService.yaml b/mmv1/products/compute/RegionBackendService.yaml index 17ce2a0c80ba..76f9dbf223be 100644 --- a/mmv1/products/compute/RegionBackendService.yaml +++ b/mmv1/products/compute/RegionBackendService.yaml @@ -96,6 +96,12 @@ examples: vars: region_backend_service_name: 'region-service' health_check_name: 'rbs-health-check' + - name: 'region_backend_service_ilb_stateful_session_affinity' + primary_resource_id: 'default' + min_version: 'beta' + vars: + region_backend_service_name: 'region-service' + health_check_name: 'rbs-health-check' - name: 'region_backend_service_balancing_mode' primary_resource_id: 'default' vars: @@ -1151,6 +1157,50 @@ properties: - 'HEADER_FIELD' - 'HTTP_COOKIE' - 'CLIENT_IP_NO_DESTINATION' + - 'STRONG_COOKIE_AFFINITY' + - name: 'strongSessionAffinityCookie' + type: NestedObject + description: | + Describes the HTTP cookie used for stateful session affinity. This field is applicable and required if the sessionAffinity is set to STRONG_COOKIE_AFFINITY. + properties: + - name: 'ttl' + type: NestedObject + description: | + Lifetime of the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' + properties: + - name: 'seconds' + type: Integer + description: | + Span of time at a resolution of a second. + Must be from 0 to 315,576,000,000 inclusive. + required: true + - name: 'nanos' + type: Integer + description: | + Span of time that's a fraction of a second at nanosecond + resolution. Durations less than one second are represented + with a 0 seconds field and a positive nanos field. Must + be from 0 to 999,999,999 inclusive. + - name: 'name' + type: String + description: | + Name of the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' + - name: 'path' + type: String + description: | + Path to set for the cookie. + at_least_one_of: + - 'strong_session_affinity_cookie.0.ttl' + - 'strong_session_affinity_cookie.0.name' + - 'strong_session_affinity_cookie.0.path' - name: 'connectionTrackingPolicy' type: NestedObject description: | diff --git a/mmv1/templates/terraform/examples/backend_service_stateful_session_affinity.tf.tmpl b/mmv1/templates/terraform/examples/backend_service_stateful_session_affinity.tf.tmpl new file mode 100644 index 000000000000..18d4856148d5 --- /dev/null +++ b/mmv1/templates/terraform/examples/backend_service_stateful_session_affinity.tf.tmpl @@ -0,0 +1,26 @@ +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + provider = google-beta + + name = "{{index $.Vars "backend_service_name"}}" + health_checks = [google_compute_health_check.health_check.id] + load_balancing_scheme = "EXTERNAL_MANAGED" + locality_lb_policy = "RING_HASH" + session_affinity = "STRONG_COOKIE_AFFINITY" + + strong_session_affinity_cookie { + ttl { + seconds = 11 + nanos = 1111 + } + name = "mycookie" + } +} + +resource "google_compute_health_check" "health_check" { + provider = google-beta + + name = "{{index $.Vars "health_check_name"}}" + http_health_check { + port = 80 + } +} diff --git a/mmv1/templates/terraform/examples/region_backend_service_ilb_stateful_session_affinity.tf.tmpl b/mmv1/templates/terraform/examples/region_backend_service_ilb_stateful_session_affinity.tf.tmpl new file mode 100644 index 000000000000..a3c93ddf65f5 --- /dev/null +++ b/mmv1/templates/terraform/examples/region_backend_service_ilb_stateful_session_affinity.tf.tmpl @@ -0,0 +1,27 @@ +resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" { + provider = google-beta + + region = "us-central1" + name = "{{index $.Vars "region_backend_service_name"}}" + health_checks = [google_compute_health_check.health_check.id] + load_balancing_scheme = "INTERNAL_MANAGED" + locality_lb_policy = "RING_HASH" + session_affinity = "STRONG_COOKIE_AFFINITY" + protocol = "HTTP" + + strong_session_affinity_cookie { + ttl { + seconds = 11 + nanos = 1111 + } + name = "mycookie" + } +} + +resource "google_compute_health_check" "health_check" { + provider = google-beta + name = "{{index $.Vars "health_check_name"}}" + http_health_check { + port = 80 + } +}