Skip to content

Commit 71f4eb6

Browse files
ahmed-laiqPhilip Jonany
authored and
Philip Jonany
committed
Add fields to support stateful cookie-based affinity (GoogleCloudPlatform#11845)
1 parent 1bad615 commit 71f4eb6

File tree

4 files changed

+153
-0
lines changed

4 files changed

+153
-0
lines changed

mmv1/products/compute/BackendService.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ examples:
106106
vars:
107107
backend_service_name: 'backend-service'
108108
health_check_name: 'health-check'
109+
- name: 'backend_service_stateful_session_affinity'
110+
primary_resource_id: 'default'
111+
min_version: 'beta'
112+
vars:
113+
backend_service_name: 'backend-service'
114+
health_check_name: 'health-check'
109115
- name: 'backend_service_network_endpoint'
110116
primary_resource_id: 'default'
111117
min_version: 'beta'
@@ -1295,6 +1301,50 @@ properties:
12951301
- 'GENERATED_COOKIE'
12961302
- 'HEADER_FIELD'
12971303
- 'HTTP_COOKIE'
1304+
- 'STRONG_COOKIE_AFFINITY'
1305+
- name: 'strongSessionAffinityCookie'
1306+
type: NestedObject
1307+
description: |
1308+
Describes the HTTP cookie used for stateful session affinity. This field is applicable and required if the sessionAffinity is set to STRONG_COOKIE_AFFINITY.
1309+
properties:
1310+
- name: 'ttl'
1311+
type: NestedObject
1312+
description: |
1313+
Lifetime of the cookie.
1314+
at_least_one_of:
1315+
- 'strong_session_affinity_cookie.0.ttl'
1316+
- 'strong_session_affinity_cookie.0.name'
1317+
- 'strong_session_affinity_cookie.0.path'
1318+
properties:
1319+
- name: 'seconds'
1320+
type: Integer
1321+
description: |
1322+
Span of time at a resolution of a second.
1323+
Must be from 0 to 315,576,000,000 inclusive.
1324+
required: true
1325+
- name: 'nanos'
1326+
type: Integer
1327+
description: |
1328+
Span of time that's a fraction of a second at nanosecond
1329+
resolution. Durations less than one second are represented
1330+
with a 0 seconds field and a positive nanos field. Must
1331+
be from 0 to 999,999,999 inclusive.
1332+
- name: 'name'
1333+
type: String
1334+
description: |
1335+
Name of the cookie.
1336+
at_least_one_of:
1337+
- 'strong_session_affinity_cookie.0.ttl'
1338+
- 'strong_session_affinity_cookie.0.name'
1339+
- 'strong_session_affinity_cookie.0.path'
1340+
- name: 'path'
1341+
type: String
1342+
description: |
1343+
Path to set for the cookie.
1344+
at_least_one_of:
1345+
- 'strong_session_affinity_cookie.0.ttl'
1346+
- 'strong_session_affinity_cookie.0.name'
1347+
- 'strong_session_affinity_cookie.0.path'
12981348
- name: 'timeoutSec'
12991349
type: Integer
13001350
description: |

mmv1/products/compute/RegionBackendService.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ examples:
9696
vars:
9797
region_backend_service_name: 'region-service'
9898
health_check_name: 'rbs-health-check'
99+
- name: 'region_backend_service_ilb_stateful_session_affinity'
100+
primary_resource_id: 'default'
101+
min_version: 'beta'
102+
vars:
103+
region_backend_service_name: 'region-service'
104+
health_check_name: 'rbs-health-check'
99105
- name: 'region_backend_service_balancing_mode'
100106
primary_resource_id: 'default'
101107
vars:
@@ -1151,6 +1157,50 @@ properties:
11511157
- 'HEADER_FIELD'
11521158
- 'HTTP_COOKIE'
11531159
- 'CLIENT_IP_NO_DESTINATION'
1160+
- 'STRONG_COOKIE_AFFINITY'
1161+
- name: 'strongSessionAffinityCookie'
1162+
type: NestedObject
1163+
description: |
1164+
Describes the HTTP cookie used for stateful session affinity. This field is applicable and required if the sessionAffinity is set to STRONG_COOKIE_AFFINITY.
1165+
properties:
1166+
- name: 'ttl'
1167+
type: NestedObject
1168+
description: |
1169+
Lifetime of the cookie.
1170+
at_least_one_of:
1171+
- 'strong_session_affinity_cookie.0.ttl'
1172+
- 'strong_session_affinity_cookie.0.name'
1173+
- 'strong_session_affinity_cookie.0.path'
1174+
properties:
1175+
- name: 'seconds'
1176+
type: Integer
1177+
description: |
1178+
Span of time at a resolution of a second.
1179+
Must be from 0 to 315,576,000,000 inclusive.
1180+
required: true
1181+
- name: 'nanos'
1182+
type: Integer
1183+
description: |
1184+
Span of time that's a fraction of a second at nanosecond
1185+
resolution. Durations less than one second are represented
1186+
with a 0 seconds field and a positive nanos field. Must
1187+
be from 0 to 999,999,999 inclusive.
1188+
- name: 'name'
1189+
type: String
1190+
description: |
1191+
Name of the cookie.
1192+
at_least_one_of:
1193+
- 'strong_session_affinity_cookie.0.ttl'
1194+
- 'strong_session_affinity_cookie.0.name'
1195+
- 'strong_session_affinity_cookie.0.path'
1196+
- name: 'path'
1197+
type: String
1198+
description: |
1199+
Path to set for the cookie.
1200+
at_least_one_of:
1201+
- 'strong_session_affinity_cookie.0.ttl'
1202+
- 'strong_session_affinity_cookie.0.name'
1203+
- 'strong_session_affinity_cookie.0.path'
11541204
- name: 'connectionTrackingPolicy'
11551205
type: NestedObject
11561206
description: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" {
2+
provider = google-beta
3+
4+
name = "{{index $.Vars "backend_service_name"}}"
5+
health_checks = [google_compute_health_check.health_check.id]
6+
load_balancing_scheme = "EXTERNAL_MANAGED"
7+
locality_lb_policy = "RING_HASH"
8+
session_affinity = "STRONG_COOKIE_AFFINITY"
9+
10+
strong_session_affinity_cookie {
11+
ttl {
12+
seconds = 11
13+
nanos = 1111
14+
}
15+
name = "mycookie"
16+
}
17+
}
18+
19+
resource "google_compute_health_check" "health_check" {
20+
provider = google-beta
21+
22+
name = "{{index $.Vars "health_check_name"}}"
23+
http_health_check {
24+
port = 80
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "google_compute_region_backend_service" "{{$.PrimaryResourceId}}" {
2+
provider = google-beta
3+
4+
region = "us-central1"
5+
name = "{{index $.Vars "region_backend_service_name"}}"
6+
health_checks = [google_compute_health_check.health_check.id]
7+
load_balancing_scheme = "INTERNAL_MANAGED"
8+
locality_lb_policy = "RING_HASH"
9+
session_affinity = "STRONG_COOKIE_AFFINITY"
10+
protocol = "HTTP"
11+
12+
strong_session_affinity_cookie {
13+
ttl {
14+
seconds = 11
15+
nanos = 1111
16+
}
17+
name = "mycookie"
18+
}
19+
}
20+
21+
resource "google_compute_health_check" "health_check" {
22+
provider = google-beta
23+
name = "{{index $.Vars "health_check_name"}}"
24+
http_health_check {
25+
port = 80
26+
}
27+
}

0 commit comments

Comments
 (0)