@spine-event-engine/deployment-gce 2.0.0-snapshot.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +336 -0
  3. package/REFERENCE.md +93 -0
  4. package/dist/discovery/gce-node-discovery.d.ts +56 -0
  5. package/dist/discovery/gce-node-discovery.d.ts.map +1 -0
  6. package/dist/discovery/gce-node-discovery.js +78 -0
  7. package/dist/discovery/gce-node-discovery.js.map +1 -0
  8. package/dist/index.d.ts +7 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +20 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/metadata/gce-metadata-service.d.ts +47 -0
  13. package/dist/metadata/gce-metadata-service.d.ts.map +1 -0
  14. package/dist/metadata/gce-metadata-service.js +65 -0
  15. package/dist/metadata/gce-metadata-service.js.map +1 -0
  16. package/dist/node/application-node.d.ts +35 -0
  17. package/dist/node/application-node.d.ts.map +1 -0
  18. package/dist/node/application-node.js +46 -0
  19. package/dist/node/application-node.js.map +1 -0
  20. package/dist/registrar/gce-registrar-log.d.ts +11 -0
  21. package/dist/registrar/gce-registrar-log.d.ts.map +1 -0
  22. package/dist/registrar/gce-registrar-log.js +44 -0
  23. package/dist/registrar/gce-registrar-log.js.map +1 -0
  24. package/dist/registrar/gce-registrar.d.ts +90 -0
  25. package/dist/registrar/gce-registrar.d.ts.map +1 -0
  26. package/dist/registrar/gce-registrar.js +167 -0
  27. package/dist/registrar/gce-registrar.js.map +1 -0
  28. package/dist/registrar/operations.d.ts +61 -0
  29. package/dist/registrar/operations.d.ts.map +1 -0
  30. package/dist/registrar/operations.js +96 -0
  31. package/dist/registrar/operations.js.map +1 -0
  32. package/dist/registry/gce-registry-reader.d.ts +23 -0
  33. package/dist/registry/gce-registry-reader.d.ts.map +1 -0
  34. package/dist/registry/gce-registry-reader.js +42 -0
  35. package/dist/registry/gce-registry-reader.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -0
  37. package/examples/application.ts +208 -0
  38. package/examples/deployment-settings.ts +119 -0
  39. package/examples/gateway.ts +85 -0
  40. package/package.json +41 -0
  41. package/terraform/.terraform.lock.hcl +22 -0
  42. package/terraform/main.tf +402 -0
  43. package/terraform/terraform.tfvars.example +57 -0
  44. package/terraform/variables.tf +319 -0
  45. package/terraform/versions.tf +15 -0
@@ -0,0 +1,319 @@
1
+ variable "project_id" {
2
+ description = "Google Cloud project that owns the Compute Engine resources."
3
+ type = string
4
+
5
+ validation {
6
+ condition = trimspace(var.project_id) != ""
7
+ error_message = "Project ID must not be empty."
8
+ }
9
+ }
10
+
11
+ variable "region" {
12
+ description = "Region that hosts every managed instance group."
13
+ type = string
14
+
15
+ validation {
16
+ condition = trimspace(var.region) != ""
17
+ error_message = "Region must not be empty."
18
+ }
19
+ }
20
+
21
+ variable "application_zones" {
22
+ description = "At least two zones in the region used to distribute application nodes."
23
+ type = list(string)
24
+
25
+ validation {
26
+ condition = length(var.application_zones) >= 2 && alltrue([for zone in var.application_zones : trimspace(zone) != ""])
27
+ error_message = "Application zones must contain at least two non-empty zones."
28
+ }
29
+ }
30
+
31
+ variable "singleton_zone" {
32
+ description = "Zone in the region used by the one-Gateway and one-delivery-server groups."
33
+ type = string
34
+
35
+ validation {
36
+ condition = trimspace(var.singleton_zone) != ""
37
+ error_message = "Singleton zone must not be empty."
38
+ }
39
+ }
40
+
41
+ variable "network" {
42
+ description = "Existing private VPC network self link or name."
43
+ type = string
44
+
45
+ validation {
46
+ condition = trimspace(var.network) != ""
47
+ error_message = "Network must not be empty."
48
+ }
49
+ }
50
+
51
+ variable "subnetwork" {
52
+ description = "Existing regional private subnetwork self link or name."
53
+ type = string
54
+
55
+ validation {
56
+ condition = trimspace(var.subnetwork) != ""
57
+ error_message = "Subnetwork must not be empty."
58
+ }
59
+ }
60
+
61
+ variable "machine_type" {
62
+ description = "Machine type used by the application, Gateway, and delivery server."
63
+ type = string
64
+ default = "e2-standard-2"
65
+
66
+ validation {
67
+ condition = trimspace(var.machine_type) != ""
68
+ error_message = "Machine type must not be empty."
69
+ }
70
+ }
71
+
72
+ variable "service_account_email" {
73
+ description = "Existing least-privilege VM service-account email."
74
+ type = string
75
+
76
+ validation {
77
+ condition = trimspace(var.service_account_email) != ""
78
+ error_message = "Service-account email must not be empty."
79
+ }
80
+ }
81
+
82
+ variable "application_image" {
83
+ description = "Immutable Artifact Registry container image digest for the application-node process."
84
+ type = string
85
+
86
+ validation {
87
+ condition = can(regex("^[a-z0-9-]+-docker\\.pkg\\.dev/.+@sha256:[0-9a-fA-F]{64}$", var.application_image))
88
+ error_message = "Application image must use an Artifact Registry host and end with an immutable SHA-256 digest."
89
+ }
90
+ }
91
+
92
+ variable "gateway_image" {
93
+ description = "Immutable Artifact Registry container image digest for the standalone Gateway process."
94
+ type = string
95
+
96
+ validation {
97
+ condition = can(regex("^[a-z0-9-]+-docker\\.pkg\\.dev/.+@sha256:[0-9a-fA-F]{64}$", var.gateway_image))
98
+ error_message = "Gateway image must use an Artifact Registry host and end with an immutable SHA-256 digest."
99
+ }
100
+ }
101
+
102
+ variable "delivery_image" {
103
+ description = "Immutable Artifact Registry container image digest for the in-memory simple delivery server."
104
+ type = string
105
+
106
+ validation {
107
+ condition = can(regex("^[a-z0-9-]+-docker\\.pkg\\.dev/.+@sha256:[0-9a-fA-F]{64}$", var.delivery_image))
108
+ error_message = "Delivery image must use an Artifact Registry host and end with an immutable SHA-256 digest."
109
+ }
110
+ }
111
+
112
+ variable "application_replicas" {
113
+ description = "Manual application-node capacity when optional autoscaling is disabled."
114
+ type = number
115
+ default = 2
116
+
117
+ validation {
118
+ condition = var.application_replicas >= 0 && floor(var.application_replicas) == var.application_replicas
119
+ error_message = "Application replicas must be a non-negative integer."
120
+ }
121
+ }
122
+
123
+ variable "application_process_count" {
124
+ description = "Number of complete application replicas started in each application VM."
125
+ type = number
126
+
127
+ validation {
128
+ condition = var.application_process_count >= 1 && floor(var.application_process_count) == var.application_process_count
129
+ error_message = "Application process count must be a positive integer."
130
+ }
131
+ }
132
+
133
+ variable "delivery_shard_count" {
134
+ description = "Delivery shard count passed explicitly to each application image's context assembly."
135
+ type = number
136
+
137
+ validation {
138
+ condition = var.delivery_shard_count >= 1 && floor(var.delivery_shard_count) == var.delivery_shard_count
139
+ error_message = "Delivery shard count must be a positive integer."
140
+ }
141
+ }
142
+
143
+ variable "application_port" {
144
+ description = "Private native gRPC listener port of each application node."
145
+ type = number
146
+ default = 8080
147
+
148
+ validation {
149
+ condition = var.application_port >= 1 && var.application_port <= 65535 && floor(var.application_port) == var.application_port
150
+ error_message = "Application port must be an integer from 1 through 65535."
151
+ }
152
+ }
153
+
154
+ variable "gateway_port" {
155
+ description = "Private Gateway listener port for an operator-managed edge."
156
+ type = number
157
+ default = 8081
158
+
159
+ validation {
160
+ condition = var.gateway_port >= 1 && var.gateway_port <= 65535 && floor(var.gateway_port) == var.gateway_port
161
+ error_message = "Gateway port must be an integer from 1 through 65535."
162
+ }
163
+ }
164
+
165
+ variable "delivery_port" {
166
+ description = "Private gRPC listener port of the simple delivery server."
167
+ type = number
168
+ default = 8484
169
+
170
+ validation {
171
+ condition = var.delivery_port >= 1 && var.delivery_port <= 65535 && floor(var.delivery_port) == var.delivery_port
172
+ error_message = "Delivery port must be an integer from 1 through 65535."
173
+ }
174
+ }
175
+
176
+ variable "application_startup_delay_sec" {
177
+ description = "Autohealing delay that gives application startup and registry registration time to finish."
178
+ type = number
179
+ default = 120
180
+
181
+ validation {
182
+ condition = var.application_startup_delay_sec >= 60 && floor(var.application_startup_delay_sec) == var.application_startup_delay_sec
183
+ error_message = "Application startup delay must be an integer of at least 60 seconds."
184
+ }
185
+ }
186
+
187
+ variable "registry_namespace" {
188
+ description = "Operator-chosen durable registry namespace shared by application nodes and the Gateway."
189
+ type = string
190
+ default = "production-application-nodes"
191
+
192
+ validation {
193
+ condition = trimspace(var.registry_namespace) != ""
194
+ error_message = "Registry namespace must not be empty."
195
+ }
196
+ }
197
+
198
+ variable "registry_storage_reference" {
199
+ description = "An application-defined identifier for the durable storage configuration used by the registry."
200
+ type = string
201
+
202
+ validation {
203
+ condition = trimspace(var.registry_storage_reference) != ""
204
+ error_message = "Registry storage reference must not be empty."
205
+ }
206
+ }
207
+
208
+ variable "application_secret_reference" {
209
+ description = "External identifier that the application image resolves for its own secrets; never a secret value."
210
+ type = string
211
+ default = ""
212
+ }
213
+
214
+ variable "gateway_secret_reference" {
215
+ description = "External identifier that the Gateway image resolves for its own secrets; never a secret value."
216
+ type = string
217
+ default = ""
218
+ }
219
+
220
+ variable "private_source_ranges" {
221
+ description = "Private CIDR ranges allowed to reach Spine listeners; configure for the operator's VPC topology."
222
+ type = list(string)
223
+ default = ["10.0.0.0/8"]
224
+
225
+ validation {
226
+ condition = length(var.private_source_ranges) > 0
227
+ error_message = "At least one private source range is required."
228
+ }
229
+ }
230
+
231
+ variable "health_check_source_ranges" {
232
+ description = "Google health-check source ranges allowed to probe private listeners."
233
+ type = list(string)
234
+ default = ["35.191.0.0/16", "130.211.0.0/22"]
235
+ }
236
+
237
+ variable "autoscaling_enabled" {
238
+ description = "Lets Compute Engine, rather than Terraform, control application-node capacity."
239
+ type = bool
240
+ default = false
241
+ }
242
+
243
+ variable "autoscaling_signal" {
244
+ description = "Autoscaling signal: cpu utilization or a custom Monitoring metric."
245
+ type = string
246
+ default = "cpu"
247
+
248
+ validation {
249
+ condition = contains(["cpu", "monitoring"], var.autoscaling_signal)
250
+ error_message = "Autoscaling signal must be cpu or monitoring."
251
+ }
252
+ }
253
+
254
+ variable "autoscaling_metric_scope" {
255
+ description = "Whether a custom Monitoring metric is per_instance or whole_group."
256
+ type = string
257
+ default = "per_instance"
258
+
259
+ validation {
260
+ condition = contains(["per_instance", "whole_group"], var.autoscaling_metric_scope)
261
+ error_message = "Autoscaling metric scope must be per_instance or whole_group."
262
+ }
263
+ }
264
+
265
+ variable "autoscaling_metric" {
266
+ description = "Cloud Monitoring metric name when autoscaling signal is monitoring."
267
+ type = string
268
+ default = ""
269
+ }
270
+
271
+ variable "autoscaling_metric_filter" {
272
+ description = "Cloud Monitoring filter that selects the intended metric resource and series, including resource.type."
273
+ type = string
274
+ default = ""
275
+ }
276
+
277
+ variable "autoscaling_metric_target_type" {
278
+ description = "Monitoring metric target kind, such as GAUGE or DELTA_PER_SECOND."
279
+ type = string
280
+ default = "GAUGE"
281
+
282
+ validation {
283
+ condition = contains(["GAUGE", "DELTA_PER_SECOND", "DELTA_PER_MINUTE"], var.autoscaling_metric_target_type)
284
+ error_message = "Monitoring metric target type must be GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE."
285
+ }
286
+ }
287
+
288
+ variable "autoscaling_target" {
289
+ description = "Target utilization for CPU or target value for the selected Monitoring metric."
290
+ type = number
291
+ default = 0.7
292
+
293
+ validation {
294
+ condition = var.autoscaling_target > 0
295
+ error_message = "Autoscaling target must be greater than zero."
296
+ }
297
+ }
298
+
299
+ variable "autoscaling_min_replicas" {
300
+ description = "Minimum application-node capacity when optional autoscaling is enabled."
301
+ type = number
302
+ default = 1
303
+
304
+ validation {
305
+ condition = var.autoscaling_min_replicas >= 0 && floor(var.autoscaling_min_replicas) == var.autoscaling_min_replicas
306
+ error_message = "Autoscaling minimum replicas must be a non-negative integer."
307
+ }
308
+ }
309
+
310
+ variable "autoscaling_max_replicas" {
311
+ description = "Maximum application-node capacity when optional autoscaling is enabled."
312
+ type = number
313
+ default = 8
314
+
315
+ validation {
316
+ condition = var.autoscaling_max_replicas >= 1 && floor(var.autoscaling_max_replicas) == var.autoscaling_max_replicas
317
+ error_message = "Autoscaling maximum replicas must be a positive integer."
318
+ }
319
+ }
@@ -0,0 +1,15 @@
1
+ terraform {
2
+ required_version = ">= 1.6.0"
3
+
4
+ required_providers {
5
+ google = {
6
+ source = "hashicorp/google"
7
+ version = "~> 6.0"
8
+ }
9
+ }
10
+ }
11
+
12
+ provider "google" {
13
+ project = var.project_id
14
+ region = var.region
15
+ }