Terraform updates for Fleet k8s deployment (#123)
* Adds region support for `carving` bucket configuration * Adds support for `software installers` bucket configuration
This commit is contained in:
1 parent
f0ce62bf29
commit
569b155b6e
9 files changed
+2197
-2078
No files matched your search
+17
-17
@@ -292,7 +292,7 @@ No requirements.
|
|||||||
|
|
||||||
| Name | Version |
|
| Name | Version |
|
||||||
|------|---------|
|
|------|---------|
|
||||||
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.37.1 |
|
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.38.0 |
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
@@ -316,31 +316,31 @@ No modules.
|
|||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|------|---------|:--------:|
|
|------|-------------|------|---------|:--------:|
|
||||||
| <a name="input_affinity_rules"></a> [affinity\_rules](#input\_affinity\_rules) | Used to configure affinity rules for the fleet deployment, migration job, and vuln-processing cron job. | <pre>object({ <br/> required_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> preferred_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> })</pre> | n/a | yes |
|
| <a name="input_affinity_rules"></a> [affinity\_rules](#input\_affinity\_rules) | Used to configure affinity rules for the fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> required_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> preferred_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_anti_affinity_rules"></a> [anti\_affinity\_rules](#input\_anti\_affinity\_rules) | Used to configure anti-affinity rules for the fleet deployment, migration job, and vuln-processing cron job. | <pre>object({ <br/> required_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> preferred_during_scheduling_ignored_during_execution = optional(list(any),<br/> [<br/> {<br/> weight = 100<br/> label_selector = {<br/> match_expressions = [<br/> {<br/> key = "app"<br/> operator = "In"<br/> values = ["fleet"]<br/> }<br/> ]<br/> }<br/> topology_key = "kubernetes.io/hostname"<br/> }<br/> ])<br/> })</pre> | n/a | yes |
|
| <a name="input_anti_affinity_rules"></a> [anti\_affinity\_rules](#input\_anti\_affinity\_rules) | Used to configure anti-affinity rules for the fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> required_during_scheduling_ignored_during_execution = optional(list(any), [])<br/> preferred_during_scheduling_ignored_during_execution = optional(list(any),<br/> [<br/> {<br/> weight = 100<br/> label_selector = {<br/> match_expressions = [<br/> {<br/> key = "app"<br/> operator = "In"<br/> values = ["fleet"]<br/> }<br/> ]<br/> }<br/> topology_key = "kubernetes.io/hostname"<br/> }<br/> ])<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_cache"></a> [cache](#input\_cache) | Used to configure redis specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> address = optional(string, "redis:6379")<br/> database = optional(number, 0)<br/> use_password = optional(bool, false)<br/> secret_name = optional(string, "redis")<br/> password_key = optional(string, "password")<br/> })</pre> | n/a | yes |
|
| <a name="input_cache"></a> [cache](#input\_cache) | Used to configure redis specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> address = optional(string, "redis:6379")<br/> database = optional(number, 0)<br/> use_password = optional(bool, false)<br/> secret_name = optional(string, "redis")<br/> password_key = optional(string, "password")<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_database"></a> [database](#input\_database) | Used to configure database specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> secret_name = optional(string, "mysql")<br/> address = optional(string, "mysql:3306")<br/> database = optional(string, "fleet")<br/> username = optional(string, "fleet")<br/> password_key = optional(string, "password")<br/> max_open_conns = optional(number, 50)<br/> max_idle_conns = optional(number, 50)<br/> conn_max_lifetime = optional(number, 0)<br/><br/> tls = object({<br/> enabled = optional(bool, false)<br/> config = optional(string, "")<br/> server_name = optional(string, "")<br/> ca_cert_key = optional(string, "")<br/> cert_key = optional(string, "")<br/> key_key = optional(string, "")<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_database"></a> [database](#input\_database) | Used to configure database specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> secret_name = optional(string, "mysql")<br/> address = optional(string, "mysql:3306")<br/> database = optional(string, "fleet")<br/> username = optional(string, "fleet")<br/> password_key = optional(string, "password")<br/> max_open_conns = optional(number, 50)<br/> max_idle_conns = optional(number, 50)<br/> conn_max_lifetime = optional(number, 0)<br/><br/> tls = object({<br/> enabled = optional(bool, false)<br/> config = optional(string, "")<br/> server_name = optional(string, "")<br/> ca_cert_key = optional(string, "")<br/> cert_key = optional(string, "")<br/> key_key = optional(string, "")<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_database_read_replica"></a> [database\_read\_replica](#input\_database\_read\_replica) | Used to configure database\_read\_replica specific values for use in the Fleet deployment and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> secret_name = optional(string, "mysql")<br/> address = optional(string, "mysql-ro:3306")<br/> database = optional(string, "fleet")<br/> username = optional(string, "fleet-ro")<br/> password_key = optional(string, "ro-password")<br/> password_path = optional(string,"")<br/> max_open_conns = optional(number, 50)<br/> max_idle_conns = optional(number, 50)<br/> conn_max_lifetime = optional(number, 0)<br/><br/> tls = object({<br/> enabled = optional(bool, false)<br/> config = optional(string, "")<br/> server_name = optional(string, "")<br/> ca_cert_key = optional(string, "")<br/> cert_key = optional(string, "")<br/> key_key = optional(string, "")<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_database_read_replica"></a> [database\_read\_replica](#input\_database\_read\_replica) | Used to configure database\_read\_replica specific values for use in the Fleet deployment and vuln-processing cron job. | <pre>object({<br/> enabled = optional(bool, false)<br/> secret_name = optional(string, "mysql")<br/> address = optional(string, "mysql-ro:3306")<br/> database = optional(string, "fleet")<br/> username = optional(string, "fleet-ro")<br/> password_key = optional(string, "ro-password")<br/> password_path = optional(string, "")<br/> max_open_conns = optional(number, 50)<br/> max_idle_conns = optional(number, 50)<br/> conn_max_lifetime = optional(number, 0)<br/><br/> tls = optional(object({<br/> enabled = optional(bool, false)<br/> config = optional(string, "")<br/> server_name = optional(string, "")<br/> ca_cert_key = optional(string, "")<br/> cert_key = optional(string, "")<br/> key_key = optional(string, "")<br/> }))<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_environment_from_config_maps"></a> [environment\_from\_config\_maps](#input\_environment\_from\_config\_maps) | Used to configure additional environment variables from a config map for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
| <a name="input_environment_from_config_maps"></a> [environment\_from\_config\_maps](#input\_environment\_from\_config\_maps) | Used to configure additional environment variables from a config map for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
||||||
| <a name="input_environment_from_secrets"></a> [environment\_from\_secrets](#input\_environment\_from\_secrets) | Used to configure additional environment variables from a secret for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
| <a name="input_environment_from_secrets"></a> [environment\_from\_secrets](#input\_environment\_from\_secrets) | Used to configure additional environment variables from a secret for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
||||||
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | Used to configure additional environment variables for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
| <a name="input_environment_variables"></a> [environment\_variables](#input\_environment\_variables) | Used to configure additional environment variables for the fleet deployment and vuln-processing cron job. | `list(map(string))` | `[]` | no |
|
||||||
| <a name="input_fleet"></a> [fleet](#input\_fleet) | Used to configure Fleet specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> listen_port = optional(number, 8080)<br/> secret_name = optional(string, "fleet")<br/> migrations = object({<br/> auto_apply_sql_migrations = optional(bool, true)<br/> migration_job_annotations = optional(map(string), {})<br/> parallelism = optional(number, 1)<br/> completions = optional(number, 1)<br/> active_deadline_seconds = optional(number, 900)<br/> backoff_limit = optional(number, 6)<br/> manual_selector = optional(bool, false)<br/> restart_policy = optional(string, "Never")<br/> })<br/> tls = object({<br/> enabled = optional(bool, false)<br/> unique_tls_secret = optional(bool, false)<br/> secret_name = optional(string, "fleet-tls")<br/> compatibility = optional(string, "modern")<br/> cert_secret_key = optional(string, "server.cert")<br/> key_secret_key = optional(string, "server.key")<br/> })<br/> auth = object({<br/> b_crypto_cost = optional(number, 12)<br/> salt_key_size = optional(number, 24)<br/> })<br/> app = object({<br/> token_key_size = optional(number, 24)<br/> invite_token_validity_period = optional(string, "120h")<br/> })<br/> session = object({<br/> key_size = optional(number, 64)<br/> duration = optional(string, "2160h")<br/> })<br/> logging = object({<br/> debug = optional(bool, false)<br/> json = optional(bool, false)<br/> disable_banner = optional(bool, false)<br/> })<br/> carving = object({<br/> s3 = object({<br/> bucket_name = optional(string, "")<br/> prefix = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "s3-bucket")<br/> sts_assume_role_arn = optional(string, "")<br/> })<br/> })<br/> license = object({<br/> secret_name = optional(string, "")<br/> license_key = optional(string, "license-key")<br/> })<br/> extra_volumes = optional(list(any), [])<br/> extra_volume_mounts = optional(list(any), [])<br/> security_context = object({<br/> run_as_user = optional(number, null)<br/> run_as_group = optional(number, null)<br/> run_as_non_root = optional(bool, true)<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_fleet"></a> [fleet](#input\_fleet) | Used to configure Fleet specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> listen_port = optional(number, 8080)<br/> secret_name = optional(string, "fleet")<br/> migrations = object({<br/> auto_apply_sql_migrations = optional(bool, true)<br/> migration_job_annotations = optional(map(string), {})<br/> parallelism = optional(number, 1)<br/> completions = optional(number, 1)<br/> active_deadline_seconds = optional(number, 900)<br/> backoff_limit = optional(number, 6)<br/> manual_selector = optional(bool, false)<br/> restart_policy = optional(string, "Never")<br/> })<br/> tls = object({<br/> enabled = optional(bool, false)<br/> unique_tls_secret = optional(bool, false)<br/> secret_name = optional(string, "fleet-tls")<br/> compatibility = optional(string, "modern")<br/> cert_secret_key = optional(string, "server.cert")<br/> key_secret_key = optional(string, "server.key")<br/> })<br/> auth = object({<br/> b_crypto_cost = optional(number, 12)<br/> salt_key_size = optional(number, 24)<br/> })<br/> app = object({<br/> token_key_size = optional(number, 24)<br/> invite_token_validity_period = optional(string, "120h")<br/> })<br/> session = object({<br/> key_size = optional(number, 64)<br/> duration = optional(string, "2160h")<br/> })<br/> logging = object({<br/> debug = optional(bool, false)<br/> json = optional(bool, false)<br/> disable_banner = optional(bool, false)<br/> })<br/> software_installers = object({<br/> s3 = object({<br/> bucket_name = optional(string, "")<br/> prefix = optional(string, "")<br/> endpoint_url = optional(string, "")<br/> force_s3_path_style = optional(bool, false)<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "s3-software-installers")<br/> sts_assume_role_arn = optional(string, "")<br/> })<br/> })<br/> carving = object({<br/> s3 = object({<br/> bucket_name = optional(string, "")<br/> prefix = optional(string, "")<br/> endpoint_url = optional(string, "")<br/> force_s3_path_style = optional(bool, false)<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "s3-bucket")<br/> sts_assume_role_arn = optional(string, "")<br/> })<br/> })<br/> license = object({<br/> secret_name = optional(string, "")<br/> license_key = optional(string, "license-key")<br/> })<br/> extra_volumes = optional(list(any), [])<br/> extra_volume_mounts = optional(list(any), [])<br/> security_context = object({<br/> run_as_user = optional(number, null)<br/> run_as_group = optional(number, null)<br/> run_as_non_root = optional(bool, true)<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_gke"></a> [gke](#input\_gke) | Used to configure gke specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> workload_identity_email = optional(string, "")<br/> cloud_sql = object({<br/> enable_proxy = optional(bool, false)<br/> image_repository = optional(string, "gcr.io/cloudsql-docker/gce-proxy")<br/> image_tag = optional(string, "1.17-alpine")<br/> verbose = optional(bool, true)<br/> instance_name = optional(string, "")<br/> })<br/> ingress = object({<br/> use_managed_certificate = optional(bool, false)<br/> use_gke_ingress = optional(bool, false)<br/> node_port = optional(number, 0)<br/> hostnames = optional(list(string), [""])<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_gke"></a> [gke](#input\_gke) | Used to configure gke specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> workload_identity_email = optional(string, "")<br/> cloud_sql = object({<br/> enable_proxy = optional(bool, false)<br/> image_repository = optional(string, "gcr.io/cloudsql-docker/gce-proxy")<br/> image_tag = optional(string, "1.17-alpine")<br/> verbose = optional(bool, true)<br/> instance_name = optional(string, "")<br/> })<br/> ingress = object({<br/> use_managed_certificate = optional(bool, false)<br/> use_gke_ingress = optional(bool, false)<br/> node_port = optional(number, 0)<br/> hostnames = optional(list(string), [""])<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_hostname"></a> [hostname](#input\_hostname) | Used as the hostname that you will access fleet on. | `string` | `"fleet.localhost"` | no |
|
| <a name="input_hostname"></a> [hostname](#input\_hostname) | Used as the hostname that you will access fleet on. | `string` | `"fleet.localhost"` | no |
|
||||||
| <a name="input_image_pull_secrets"></a> [image\_pull\_secrets](#input\_image\_pull\_secrets) | Used to inject image pull secrets for access to a private container registry. | <pre>list(object({<br/> name = string<br/> }))</pre> | `[]` | no |
|
| <a name="input_image_pull_secrets"></a> [image\_pull\_secrets](#input\_image\_pull\_secrets) | Used to inject image pull secrets for access to a private container registry. | <pre>list(object({<br/> name = string<br/> }))</pre> | `[]` | no |
|
||||||
| <a name="input_image_repository"></a> [image\_repository](#input\_image\_repository) | Used to populate the image repository for fleet. | `string` | `"fleetdm/fleet"` | no |
|
| <a name="input_image_repository"></a> [image\_repository](#input\_image\_repository) | Used to populate the image repository for fleet. | `string` | `"fleetdm/fleet"` | no |
|
||||||
| <a name="input_image_tag"></a> [image\_tag](#input\_image\_tag) | Used to populate the fleet version that will be deployed. | `string` | `"v4.66.0"` | no |
|
| <a name="input_image_tag"></a> [image\_tag](#input\_image\_tag) | Used to populate the fleet version that will be deployed. | `string` | `"v4.66.0"` | no |
|
||||||
| <a name="input_ingress"></a> [ingress](#input\_ingress) | Used to configure values for ingress. | <pre>object({<br/> enabled = optional(bool, false)<br/> class_name = optional(string, "nginx")<br/> labels = optional(map(string), {})<br/> annotations = optional(map(string), {})<br/> hosts = optional(list(any), [])<br/> tls = object({<br/> secret_name = optional(string, "")<br/> hosts = optional(list(string),[])<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_ingress"></a> [ingress](#input\_ingress) | Used to configure values for ingress. | <pre>object({<br/> enabled = optional(bool, false)<br/> class_name = optional(string, "nginx")<br/> labels = optional(map(string), {})<br/> annotations = optional(map(string), {})<br/> hosts = optional(list(any), [])<br/> tls = object({<br/> secret_name = optional(string, "")<br/> hosts = optional(list(string), [])<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_namespace"></a> [namespace](#input\_namespace) | The value for this variable will be used as the name of the namespace that fleet will be deployed to. | `string` | `"fleet"` | no |
|
| <a name="input_namespace"></a> [namespace](#input\_namespace) | The value for this variable will be used as the name of the namespace that fleet will be deployed to. | `string` | `"fleet"` | no |
|
||||||
| <a name="input_node_selector"></a> [node\_selector](#input\_node\_selector) | Used to populate node selector values. | `map` | `{}` | no |
|
| <a name="input_node_selector"></a> [node\_selector](#input\_node\_selector) | Used to populate node selector values. | `map(any)` | `{}` | no |
|
||||||
| <a name="input_osquery"></a> [osquery](#input\_osquery) | Used to configure osquery specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> secret_name = optional(string, "osquery")<br/> node_key_size = optional(number, 24)<br/> label_update_interval = optional(string, "30m")<br/> detail_update_interval = optional(string, "30m")<br/> logging = object({<br/> status_plugin = optional(string, "filesystem")<br/> result_plugin = optional(string, "filesystem")<br/> filesystem = object({<br/> status_log_file = optional(string, "osquery_status")<br/> result_log_file = optional(string, "osquery_result")<br/> enable_rotation = optional(bool, false)<br/> enable_compression = optional(bool, false)<br/> volume_size = optional(string, "20Gi")<br/> })<br/> firehose = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "firehose")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> kinesis = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "kinesis")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> lambda = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "lambda")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> pubsub = object({<br/> project = optional(string, "")<br/> status_topic = optional(string, "")<br/> result_topic = optional(string, "")<br/> })<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_osquery"></a> [osquery](#input\_osquery) | Used to configure osquery specific values for use in the Fleet deployment, migration job, and vuln-processing cron job. | <pre>object({<br/> secret_name = optional(string, "osquery")<br/> node_key_size = optional(number, 24)<br/> label_update_interval = optional(string, "30m")<br/> detail_update_interval = optional(string, "30m")<br/> logging = object({<br/> status_plugin = optional(string, "filesystem")<br/> result_plugin = optional(string, "filesystem")<br/> filesystem = object({<br/> status_log_file = optional(string, "osquery_status")<br/> result_log_file = optional(string, "osquery_result")<br/> enable_rotation = optional(bool, false)<br/> enable_compression = optional(bool, false)<br/> volume_size = optional(string, "20Gi")<br/> })<br/> firehose = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "firehose")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> kinesis = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "kinesis")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> lambda = object({<br/> region = optional(string, "")<br/> access_key_id = optional(string, "")<br/> secret_key = optional(string, "lambda")<br/> sts_assume_role_arn = optional(string, "")<br/> status_stream = optional(string, "")<br/> result_stream = optional(string, "")<br/> })<br/> pubsub = object({<br/> project = optional(string, "")<br/> status_topic = optional(string, "")<br/> result_topic = optional(string, "")<br/> })<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_pod_annotations"></a> [pod\_annotations](#input\_pod\_annotations) | Used to populate the annotations for pods. | `map` | `{}` | no |
|
| <a name="input_pod_annotations"></a> [pod\_annotations](#input\_pod\_annotations) | Used to populate the annotations for pods. | `map(any)` | `{}` | no |
|
||||||
| <a name="input_replicas"></a> [replicas](#input\_replicas) | Used to drive the number of fleet deployment replicas. | `number` | `3` | no |
|
| <a name="input_replicas"></a> [replicas](#input\_replicas) | Used to drive the number of fleet deployment replicas. | `number` | `3` | no |
|
||||||
| <a name="input_resources"></a> [resources](#input\_resources) | Used to populate resource values for the fleet deployment and migration job. | <pre>object({<br/> limits = optional(object({<br/> cpu = optional(string, "1")<br/> memory = optional(string, "4Gi")<br/> }),{<br/> cpu = "1"<br/> memory = "4Gi"<br/> })<br/> requests = optional(object({<br/> cpu = optional(string, "0.1")<br/> memory = optional(string, "50Mi")<br/> }),{<br/> cpu = "0.1"<br/> memory = "50Mi"<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_resources"></a> [resources](#input\_resources) | Used to populate resource values for the fleet deployment and migration job. | <pre>object({<br/> limits = optional(object({<br/> cpu = optional(string, "1")<br/> memory = optional(string, "4Gi")<br/> }), {<br/> cpu = "1"<br/> memory = "4Gi"<br/> })<br/> requests = optional(object({<br/> cpu = optional(string, "0.1")<br/> memory = optional(string, "50Mi")<br/> }), {<br/> cpu = "0.1"<br/> memory = "50Mi"<br/> })<br/> })</pre> | n/a | yes |
|
||||||
| <a name="input_service_account_annotations"></a> [service\_account\_annotations](#input\_service\_account\_annotations) | Used to populate the annotations for the fleet service account. | `map` | `{}` | no |
|
| <a name="input_service_account_annotations"></a> [service\_account\_annotations](#input\_service\_account\_annotations) | Used to populate the annotations for the fleet service account. | `map(any)` | `{}` | no |
|
||||||
| <a name="input_service_annotations"></a> [service\_annotations](#input\_service\_annotations) | Used to populate the annotations for the fleet service. | `map` | `{}` | no |
|
| <a name="input_service_annotations"></a> [service\_annotations](#input\_service\_annotations) | Used to populate the annotations for the fleet service. | `map(any)` | `{}` | no |
|
||||||
| <a name="input_tolerations"></a> [tolerations](#input\_tolerations) | Used to configure tolerations. | `list(any)` | `[]` | no |
|
| <a name="input_tolerations"></a> [tolerations](#input\_tolerations) | Used to configure tolerations. | `list(any)` | `[]` | no |
|
||||||
| <a name="input_vuln_processing"></a> [vuln\_processing](#input\_vuln\_processing) | Used to configure the values for the vuln-processing cron job. | <pre>object({<br/> ttl_seconds_after_finished = optional(number, 100)<br/> restart_policy = optional(string, "Never")<br/> dedicated = optional(bool, false)<br/> schedule = optional(string, "0 * * * *")<br/> resources = object({<br/> limits = optional(object({<br/> cpu = optional(string, "1")<br/> memory = optional(string, "4Gi")<br/> }),{<br/> cpu = "1"<br/> memory = "4Gi"<br/> })<br/> requests = optional(object({<br/> cpu = optional(string, "0.1")<br/> memory = optional(string, "50Mi")<br/> }),{<br/> cpu = "0.1"<br/> memory = "50Mi"<br/> })<br/> })<br/> })</pre> | n/a | yes |
|
| <a name="input_vuln_processing"></a> [vuln\_processing](#input\_vuln\_processing) | Used to configure the values for the vuln-processing cron job. | <pre>object({<br/> ttl_seconds_after_finished = optional(number, 100)<br/> restart_policy = optional(string, "Never")<br/> dedicated = optional(bool, false)<br/> schedule = optional(string, "0 * * * *")<br/> resources = object({<br/> limits = optional(object({<br/> cpu = optional(string, "1")<br/> memory = optional(string, "4Gi")<br/> }), {<br/> cpu = "1"<br/> memory = "4Gi"<br/> })<br/> requests = optional(object({<br/> cpu = optional(string, "0.1")<br/> memory = optional(string, "50Mi")<br/> }), {<br/> cpu = "0.1"<br/> memory = "50Mi"<br/> })<br/> })<br/> })</pre> | n/a | yes |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
|
|||||||
+456
-441
@@ -1,446 +1,461 @@
|
|||||||
resource "kubernetes_cron_job_v1" "fleet_vuln_processing_cron_job" {
|
resource "kubernetes_cron_job_v1" "fleet_vuln_processing_cron_job" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet-vulnprocessing"
|
name = "fleet-vulnprocessing"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
schedule = local.vuln_processing.schedule
|
schedule = local.vuln_processing.schedule
|
||||||
concurrency_policy = "Forbid"
|
concurrency_policy = "Forbid"
|
||||||
|
|
||||||
job_template {
|
job_template {
|
||||||
metadata {
|
metadata {
|
||||||
labels = {
|
labels = {
|
||||||
app = "fleet"
|
app = "fleet"
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spec {
|
|
||||||
ttl_seconds_after_finished = local.vuln_processing.ttl_seconds_after_finished
|
|
||||||
template {
|
|
||||||
metadata {
|
|
||||||
labels = {
|
|
||||||
app = "fleet"
|
|
||||||
}
|
|
||||||
annotations = local.pod_annotations
|
|
||||||
}
|
|
||||||
spec {
|
|
||||||
share_process_namespace = "true"
|
|
||||||
restart_policy = local.vuln_processing.restart_policy
|
|
||||||
service_account_name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
|
||||||
|
|
||||||
container {
|
|
||||||
name = "fleet-vulnprocessing"
|
|
||||||
image = "${local.image_repository}:${local.image_tag}"
|
|
||||||
|
|
||||||
command = ["/bin/sh", "-c"]
|
|
||||||
args = local.gke.cloud_sql.enable_proxy ? [
|
|
||||||
"/usr/bin/fleet vuln_processing; sql_proxy_pid=$(pgrep cloud_sql_proxy) && kill -INT $sql_proxy_pid;"
|
|
||||||
] : [
|
|
||||||
"/usr/bin/fleet vuln_processing;"
|
|
||||||
]
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_VULNERABILITIES_DATABASES_PATH", value = "/tmp/vuln" },
|
|
||||||
{ name = "FLEET_LOGGING_DEBUG", value = local.fleet.logging.debug },
|
|
||||||
{ name = "FLEET_LOGGING_JSON", value = local.fleet.logging.json },
|
|
||||||
{ name = "FLEET_LOGGING_DISABLE_BANNER", value = local.fleet.logging.disable_banner }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.fleet.license.secret_name != "" ? [
|
|
||||||
{
|
|
||||||
name = "FLEET_LICENSE_KEY",
|
|
||||||
value_from = {
|
|
||||||
secret_key_ref = {
|
|
||||||
name = local.fleet.license.secret_name
|
|
||||||
key = local.fleet.license.license_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value_from {
|
|
||||||
secret_key_ref {
|
|
||||||
name = env.value.value_from.secret_key_ref.name
|
|
||||||
key = env.value.value_from.secret_key_ref.key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_MYSQL_ADDRESS", value = local.database.address },
|
|
||||||
{ name = "FLEET_MYSQL_DATABASE", value = local.database.database },
|
|
||||||
{ name = "FLEET_MYSQL_USERNAME", value = local.database.username },
|
|
||||||
{ name = "FLEET_MYSQL_MAX_OPEN_CONNS", value = local.database.max_open_conns },
|
|
||||||
{ name = "FLEET_MYSQL_MAX_IDLE_CONNS", value = local.database.max_idle_conns },
|
|
||||||
{ name = "FLEET_MYSQL_CONN_MAX_LIFETIME", value = local.database.conn_max_lifetime }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "FLEET_MYSQL_PASSWORD"
|
|
||||||
value_from {
|
|
||||||
secret_key_ref {
|
|
||||||
name = local.database.secret_name
|
|
||||||
key = local.database.password_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CA", value = "/secrets/mysql/${local.database.tls.ca_cert_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CERT", value = "/secrets/mysql/${local.database.tls.cert_secret_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_KEY", value = "/secrets/mysql/${local.database.tls.key_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CONFIG", value = local.database.tls.config },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_SERVER_NAME", value = local.database.tls.server_name }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_ADDRESS", value = local.database_read_replica.address },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_DATABASE", value = local.database_read_replica.database },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_USERNAME", value = local.database_read_replica.username },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_PASSWORD_PATH", value = local.database_read_replica.password_path },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_MAX_OPEN_CONNS", value = local.database_read_replica.max_open_conns },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_MAX_IDLE_CONNS", value = local.database_read_replica.max_idle_conns },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_CONN_MAX_LIFETIME", value = local.database_read_replica.conn_max_lifetime }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "FLEET_MYSQL_READ_REPLICA_PASSWORD"
|
|
||||||
value_from {
|
|
||||||
secret_key_ref {
|
|
||||||
name = local.database_read_replica.secret_name
|
|
||||||
key = local.database_read_replica.password_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CA", value = "/secrets/mysql/${local.database_read_replica.tls.ca_cert_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CERT", value = "/secrets/mysql/${local.database_read_replica.tls.cert_secret_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_KEY", value = "/secrets/mysql/${local.database_read_replica.tls.key_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CONFIG", value = local.database_read_replica.tls.config },
|
|
||||||
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_SERVER_NAME", value = local.database_read_replica.tls.server_name }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_REDIS_ADDRESS", value = local.cache.address },
|
|
||||||
{ name = "FLEET_REDIS_DATABASE", value = local.cache.database }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.cache.use_password ? [
|
|
||||||
{
|
|
||||||
name = "FLEET_REDIS_PASSWORD",
|
|
||||||
value_from = {
|
|
||||||
secret_key_ref = {
|
|
||||||
name = local.cache.secret_name
|
|
||||||
key = local.cache.password_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value_from {
|
|
||||||
secret_key_ref {
|
|
||||||
name = env.value.value_from.secret_key_ref.name
|
|
||||||
key = env.value.value_from.secret_key_ref.key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env"{
|
|
||||||
for_each = local.environment_variables
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env_from" {
|
|
||||||
for_each = local.environment_from_config_maps
|
|
||||||
|
|
||||||
content {
|
|
||||||
config_map_ref {
|
|
||||||
name = env_from.value.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env_from" {
|
|
||||||
for_each = local.environment_from_secrets
|
|
||||||
|
|
||||||
content {
|
|
||||||
secret_ref {
|
|
||||||
name = env_from.value.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
security_context {
|
|
||||||
run_as_user = local.fleet.security_context.run_as_user
|
|
||||||
run_as_group = local.fleet.security_context.run_as_group
|
|
||||||
run_as_non_root = local.fleet.security_context.run_as_non_root
|
|
||||||
read_only_root_filesystem = "true"
|
|
||||||
privileged = "false"
|
|
||||||
allow_privilege_escalation = "false"
|
|
||||||
capabilities {
|
|
||||||
drop = ["ALL"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resources {
|
|
||||||
limits = {
|
|
||||||
cpu = local.vuln_processing.resources.limits.cpu
|
|
||||||
memory = local.vuln_processing.resources.limits.memory
|
|
||||||
}
|
|
||||||
requests = {
|
|
||||||
cpu = local.vuln_processing.resources.requests.cpu
|
|
||||||
memory = local.vuln_processing.resources.requests.memory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
volume_mount {
|
|
||||||
name = "tmp"
|
|
||||||
mount_path = "/tmp"
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "volume_mount" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{ name = "mysql-tls", read_only = true, mount_path = "/secrets/mysql" }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = volume_mount.value.name
|
|
||||||
read_only = volume_mount.value.read_only
|
|
||||||
mount_path = volume_mount.value.mount_path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "container" {
|
|
||||||
for_each = local.gke.cloud_sql.enable_proxy ? [
|
|
||||||
{
|
|
||||||
name = "cloudql-proxy",
|
|
||||||
image = "${local.gke.cloud_sql.image_repository}:${local.gke.cloud_sql.image_tag}",
|
|
||||||
command = ["/cloud_sql_proxy", "-verbose=${local.gke.cloud_sql.verbose}", "-instances=${local.gke.cloud_sql.instance_name}=tcp:3306"]
|
|
||||||
resources = {
|
|
||||||
limits = {
|
|
||||||
cpu = "0.5",
|
|
||||||
memory = "150Mi"
|
|
||||||
},
|
|
||||||
requests = {
|
|
||||||
cpu = "0.1",
|
|
||||||
memory = "50Mi"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
security_context = {
|
|
||||||
allow_privilege_escalation = false,
|
|
||||||
capabilities = {
|
|
||||||
drop = ["ALL"]
|
|
||||||
},
|
|
||||||
privileged = false,
|
|
||||||
read_only_root_filesystem = true,
|
|
||||||
run_as_user = local.fleet.security_context.run_as_user,
|
|
||||||
run_as_group = local.fleet.security_context.run_as_group,
|
|
||||||
run_as_non_root = local.fleet.security_context.run_as_non_root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = container.value.name
|
|
||||||
image = container.value.image
|
|
||||||
command = container.value.command
|
|
||||||
resources {
|
|
||||||
limits = {
|
|
||||||
cpu = container.value.resources.limits.cpu
|
|
||||||
memory = container.value.resources.limits.memory
|
|
||||||
}
|
|
||||||
requests = {
|
|
||||||
cpu = container.value.resources.requests.cpu
|
|
||||||
memory = container.value.resources.requests.memory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
security_context {
|
|
||||||
allow_privilege_escalation = container.value.security_context.allow_privilege_escalation
|
|
||||||
capabilities {
|
|
||||||
drop = container.value.security_context.capabilities.drop
|
|
||||||
}
|
|
||||||
privileged = container.value.security_context.privileged
|
|
||||||
read_only_root_filesystem = container.value.security_context.read_only_root_filesystem
|
|
||||||
run_as_user = container.value.security_context.run_as_user
|
|
||||||
run_as_group = container.value.security_context.run_as_group
|
|
||||||
run_as_non_root = container.value.security_context.run_as_non_root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
volume {
|
|
||||||
name = "tmp"
|
|
||||||
empty_dir {}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "volume" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{
|
|
||||||
name = "mysql-tls",
|
|
||||||
secret_name = local.database.tls.secret_name
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = volume.value.name
|
|
||||||
secret {
|
|
||||||
secret_name = volume.value.secret_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_affinity {
|
|
||||||
required_during_scheduling_ignored_during_execution {
|
|
||||||
label_selector {
|
|
||||||
match_expressions {
|
|
||||||
key = affinity.value.label_selector.match_expressions[*].key
|
|
||||||
operator = affinity.value.label_selector.match_expressions[*].operator
|
|
||||||
values = affinity.value.label_selector.match_expressions[*].values
|
|
||||||
}
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_affinity {
|
|
||||||
preferred_during_scheduling_ignored_during_execution {
|
|
||||||
pod_affinity_term {
|
|
||||||
preference = affinity.value.preference
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.anti_affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_anti_affinity {
|
|
||||||
required_during_scheduling_ignored_during_execution {
|
|
||||||
label_selector {
|
|
||||||
match_expressions {
|
|
||||||
key = affinity.value.label_selector.match_expressions[*].key
|
|
||||||
operator = affinity.value.label_selector.match_expressions[*].operator
|
|
||||||
values = affinity.value.label_selector.match_expressions[*].values
|
|
||||||
}
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.anti_affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_anti_affinity {
|
|
||||||
preferred_during_scheduling_ignored_during_execution {
|
|
||||||
pod_affinity_term {
|
|
||||||
label_selector = affinity.value.label_selector.label_selector
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "toleration" {
|
|
||||||
for_each = local.tolerations
|
|
||||||
|
|
||||||
content {
|
|
||||||
key = toleration.env.key
|
|
||||||
operator = toleration.env.operator
|
|
||||||
value = toleration.env.value
|
|
||||||
effect = toleration.env.effect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node_selector = local.node_selector
|
|
||||||
|
|
||||||
dynamic "image_pull_secrets" {
|
|
||||||
for_each = var.image_pull_secrets
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = image_pull_secrets.value["name"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spec {
|
||||||
|
ttl_seconds_after_finished = local.vuln_processing.ttl_seconds_after_finished
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
|
labels = {
|
||||||
|
app = "fleet"
|
||||||
|
}
|
||||||
|
annotations = local.pod_annotations
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
share_process_namespace = "true"
|
||||||
|
restart_policy = local.vuln_processing.restart_policy
|
||||||
|
service_account_name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
||||||
|
|
||||||
|
container {
|
||||||
|
name = "fleet-vulnprocessing"
|
||||||
|
image = "${local.image_repository}:${local.image_tag}"
|
||||||
|
|
||||||
|
command = ["/bin/sh", "-c"]
|
||||||
|
args = local.gke.cloud_sql.enable_proxy ? [
|
||||||
|
"/usr/bin/fleet vuln_processing; sql_proxy_pid=$(pgrep cloud_sql_proxy) && kill -INT $sql_proxy_pid;"
|
||||||
|
] : [
|
||||||
|
"/usr/bin/fleet vuln_processing;"
|
||||||
|
]
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = [
|
||||||
|
{ name = "FLEET_VULNERABILITIES_DATABASES_PATH", value = "/tmp/vuln" },
|
||||||
|
{ name = "FLEET_LOGGING_DEBUG", value = local.fleet.logging.debug },
|
||||||
|
{ name = "FLEET_LOGGING_JSON", value = local.fleet.logging.json },
|
||||||
|
{ name = "FLEET_LOGGING_DISABLE_BANNER", value = local.fleet.logging.disable_banner }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.fleet.license.secret_name != "" ? [
|
||||||
|
{
|
||||||
|
name = "FLEET_LICENSE_KEY",
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = local.fleet.license.secret_name
|
||||||
|
key = local.fleet.license.license_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value_from {
|
||||||
|
secret_key_ref {
|
||||||
|
name = env.value.value_from.secret_key_ref.name
|
||||||
|
key = env.value.value_from.secret_key_ref.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = [
|
||||||
|
{ name = "FLEET_MYSQL_ADDRESS", value = local.database.address },
|
||||||
|
{ name = "FLEET_MYSQL_DATABASE", value = local.database.database },
|
||||||
|
{ name = "FLEET_MYSQL_USERNAME", value = local.database.username },
|
||||||
|
{ name = "FLEET_MYSQL_MAX_OPEN_CONNS", value = local.database.max_open_conns },
|
||||||
|
{ name = "FLEET_MYSQL_MAX_IDLE_CONNS", value = local.database.max_idle_conns },
|
||||||
|
{ name = "FLEET_MYSQL_CONN_MAX_LIFETIME", value = local.database.conn_max_lifetime }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
name = "FLEET_MYSQL_PASSWORD"
|
||||||
|
|
||||||
|
value_from {
|
||||||
|
secret_key_ref {
|
||||||
|
name = local.database.secret_name
|
||||||
|
key = local.database.password_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CA", value = "/secrets/mysql/${local.database.tls.ca_cert_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CERT", value = "/secrets/mysql/${local.database.tls.cert_secret_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_KEY", value = "/secrets/mysql/${local.database.tls.key_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CONFIG", value = local.database.tls.config },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_SERVER_NAME", value = local.database.tls.server_name }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.database_read_replica.enabled ? [
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_ADDRESS", value = local.database_read_replica.address },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_DATABASE", value = local.database_read_replica.database },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_USERNAME", value = local.database_read_replica.username },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_PASSWORD_PATH", value = local.database_read_replica.password_path },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_MAX_OPEN_CONNS", value = local.database_read_replica.max_open_conns },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_MAX_IDLE_CONNS", value = local.database_read_replica.max_idle_conns },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_CONN_MAX_LIFETIME", value = local.database_read_replica.conn_max_lifetime }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.database_read_replica.enabled ? [
|
||||||
|
{
|
||||||
|
name = "FLEET_MYSQL_READ_REPLICA_PASSWORD",
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = local.database_read_replica.secret_name
|
||||||
|
key = local.database_read_replica.password_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value_from {
|
||||||
|
secret_key_ref {
|
||||||
|
name = env.value.value_from.secret_key_ref.name
|
||||||
|
key = env.value.value_from.secret_key_ref.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.database_read_replica.enabled && local.database.tls.enabled ? [
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CA", value = "/secrets/mysql/${local.database_read_replica.tls.ca_cert_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CERT", value = "/secrets/mysql/${local.database_read_replica.tls.cert_secret_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_KEY", value = "/secrets/mysql/${local.database_read_replica.tls.key_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_CONFIG", value = local.database_read_replica.tls.config },
|
||||||
|
{ name = "FLEET_MYSQL_READ_REPLICA_TLS_SERVER_NAME", value = local.database_read_replica.tls.server_name }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = [
|
||||||
|
{ name = "FLEET_REDIS_ADDRESS", value = local.cache.address },
|
||||||
|
{ name = "FLEET_REDIS_DATABASE", value = local.cache.database }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.cache.use_password ? [
|
||||||
|
{
|
||||||
|
name = "FLEET_REDIS_PASSWORD",
|
||||||
|
value_from = {
|
||||||
|
secret_key_ref = {
|
||||||
|
name = local.cache.secret_name
|
||||||
|
key = local.cache.password_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value_from {
|
||||||
|
secret_key_ref {
|
||||||
|
name = env.value.value_from.secret_key_ref.name
|
||||||
|
key = env.value.value_from.secret_key_ref.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.environment_variables
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env_from" {
|
||||||
|
for_each = local.environment_from_config_maps
|
||||||
|
|
||||||
|
content {
|
||||||
|
config_map_ref {
|
||||||
|
name = env_from.value.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env_from" {
|
||||||
|
for_each = local.environment_from_secrets
|
||||||
|
|
||||||
|
content {
|
||||||
|
secret_ref {
|
||||||
|
name = env_from.value.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
security_context {
|
||||||
|
run_as_user = local.fleet.security_context.run_as_user
|
||||||
|
run_as_group = local.fleet.security_context.run_as_group
|
||||||
|
run_as_non_root = local.fleet.security_context.run_as_non_root
|
||||||
|
read_only_root_filesystem = "true"
|
||||||
|
privileged = "false"
|
||||||
|
allow_privilege_escalation = "false"
|
||||||
|
capabilities {
|
||||||
|
drop = ["ALL"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
limits = {
|
||||||
|
cpu = local.vuln_processing.resources.limits.cpu
|
||||||
|
memory = local.vuln_processing.resources.limits.memory
|
||||||
|
}
|
||||||
|
requests = {
|
||||||
|
cpu = local.vuln_processing.resources.requests.cpu
|
||||||
|
memory = local.vuln_processing.resources.requests.memory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
name = "tmp"
|
||||||
|
mount_path = "/tmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "volume_mount" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{ name = "mysql-tls", read_only = true, mount_path = "/secrets/mysql" }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = volume_mount.value.name
|
||||||
|
read_only = volume_mount.value.read_only
|
||||||
|
mount_path = volume_mount.value.mount_path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "container" {
|
||||||
|
for_each = local.gke.cloud_sql.enable_proxy ? [
|
||||||
|
{
|
||||||
|
name = "cloudql-proxy",
|
||||||
|
image = "${local.gke.cloud_sql.image_repository}:${local.gke.cloud_sql.image_tag}",
|
||||||
|
command = ["/cloud_sql_proxy", "-verbose=${local.gke.cloud_sql.verbose}", "-instances=${local.gke.cloud_sql.instance_name}=tcp:3306"]
|
||||||
|
resources = {
|
||||||
|
limits = {
|
||||||
|
cpu = "0.5",
|
||||||
|
memory = "150Mi"
|
||||||
|
},
|
||||||
|
requests = {
|
||||||
|
cpu = "0.1",
|
||||||
|
memory = "50Mi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
security_context = {
|
||||||
|
allow_privilege_escalation = false,
|
||||||
|
capabilities = {
|
||||||
|
drop = ["ALL"]
|
||||||
|
},
|
||||||
|
privileged = false,
|
||||||
|
read_only_root_filesystem = true,
|
||||||
|
run_as_user = local.fleet.security_context.run_as_user,
|
||||||
|
run_as_group = local.fleet.security_context.run_as_group,
|
||||||
|
run_as_non_root = local.fleet.security_context.run_as_non_root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = container.value.name
|
||||||
|
image = container.value.image
|
||||||
|
command = container.value.command
|
||||||
|
resources {
|
||||||
|
limits = {
|
||||||
|
cpu = container.value.resources.limits.cpu
|
||||||
|
memory = container.value.resources.limits.memory
|
||||||
|
}
|
||||||
|
requests = {
|
||||||
|
cpu = container.value.resources.requests.cpu
|
||||||
|
memory = container.value.resources.requests.memory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
security_context {
|
||||||
|
allow_privilege_escalation = container.value.security_context.allow_privilege_escalation
|
||||||
|
capabilities {
|
||||||
|
drop = container.value.security_context.capabilities.drop
|
||||||
|
}
|
||||||
|
privileged = container.value.security_context.privileged
|
||||||
|
read_only_root_filesystem = container.value.security_context.read_only_root_filesystem
|
||||||
|
run_as_user = container.value.security_context.run_as_user
|
||||||
|
run_as_group = container.value.security_context.run_as_group
|
||||||
|
run_as_non_root = container.value.security_context.run_as_non_root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume {
|
||||||
|
name = "tmp"
|
||||||
|
empty_dir {}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "volume" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{
|
||||||
|
name = "mysql-tls",
|
||||||
|
secret_name = local.database.tls.secret_name
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = volume.value.name
|
||||||
|
secret {
|
||||||
|
secret_name = volume.value.secret_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_affinity {
|
||||||
|
required_during_scheduling_ignored_during_execution {
|
||||||
|
label_selector {
|
||||||
|
match_expressions {
|
||||||
|
key = affinity.value.label_selector.match_expressions[*].key
|
||||||
|
operator = affinity.value.label_selector.match_expressions[*].operator
|
||||||
|
values = affinity.value.label_selector.match_expressions[*].values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_affinity {
|
||||||
|
preferred_during_scheduling_ignored_during_execution {
|
||||||
|
pod_affinity_term {
|
||||||
|
preference = affinity.value.preference
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.anti_affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_anti_affinity {
|
||||||
|
required_during_scheduling_ignored_during_execution {
|
||||||
|
label_selector {
|
||||||
|
match_expressions {
|
||||||
|
key = affinity.value.label_selector.match_expressions[*].key
|
||||||
|
operator = affinity.value.label_selector.match_expressions[*].operator
|
||||||
|
values = affinity.value.label_selector.match_expressions[*].values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.anti_affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_anti_affinity {
|
||||||
|
preferred_during_scheduling_ignored_during_execution {
|
||||||
|
pod_affinity_term {
|
||||||
|
label_selector = affinity.value.label_selector.label_selector
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "toleration" {
|
||||||
|
for_each = local.tolerations
|
||||||
|
|
||||||
|
content {
|
||||||
|
key = toleration.env.key
|
||||||
|
operator = toleration.env.operator
|
||||||
|
value = toleration.env.value
|
||||||
|
effect = toleration.env.effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node_selector = local.node_selector
|
||||||
|
|
||||||
|
dynamic "image_pull_secrets" {
|
||||||
|
for_each = var.image_pull_secrets
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = image_pull_secrets.value["name"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
depends_on = [
|
}
|
||||||
resource.kubernetes_job.migration, // Include when migration is enabled
|
depends_on = [
|
||||||
resource.kubernetes_service_account.fleet-sa
|
resource.kubernetes_job.migration, // Include when migration is enabled
|
||||||
]
|
resource.kubernetes_service_account.fleet-sa
|
||||||
|
]
|
||||||
}
|
}
|
||||||
+996
-907
File diff suppressed because it is too large.
Load diff
+9
-9
@@ -1,21 +1,21 @@
|
|||||||
resource "kubernetes_ingress_v1" "fleet-ingress"{
|
resource "kubernetes_ingress_v1" "fleet-ingress" {
|
||||||
count = local.ingress.enabled ? 1 : 0
|
count = local.ingress.enabled ? 1 : 0
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet"
|
name = "fleet"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
labels = local.ingress.labels
|
labels = local.ingress.labels
|
||||||
annotations = local.ingress.annotations
|
annotations = local.ingress.annotations
|
||||||
}
|
}
|
||||||
spec {
|
spec {
|
||||||
ingress_class_name = local.ingress.class_name
|
ingress_class_name = local.ingress.class_name
|
||||||
|
|
||||||
dynamic "tls" {
|
dynamic "tls" {
|
||||||
for_each = local.ingress.tls.hosts
|
for_each = local.ingress.tls.hosts
|
||||||
|
|
||||||
content {
|
content {
|
||||||
hosts = [tls.value]
|
hosts = [tls.value]
|
||||||
secret_name = local.ingress.tls.secret_name
|
secret_name = local.ingress.tls.secret_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic "rule" {
|
dynamic "rule" {
|
||||||
|
|||||||
+320
-320
@@ -1,334 +1,334 @@
|
|||||||
resource "kubernetes_job" "migration" {
|
resource "kubernetes_job" "migration" {
|
||||||
metadata{
|
metadata {
|
||||||
|
name = "fleet-migration"
|
||||||
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
|
labels = {
|
||||||
|
app = "fleet"
|
||||||
|
}
|
||||||
|
annotations = local.pod_annotations
|
||||||
|
}
|
||||||
|
spec {
|
||||||
|
parallelism = local.fleet.migrations.parallelism
|
||||||
|
completions = local.fleet.migrations.completions
|
||||||
|
active_deadline_seconds = local.fleet.migrations.active_deadline_seconds
|
||||||
|
backoff_limit = local.fleet.migrations.backoff_limit
|
||||||
|
|
||||||
|
manual_selector = local.fleet.migrations.manual_selector
|
||||||
|
|
||||||
|
template {
|
||||||
|
metadata {
|
||||||
name = "fleet-migration"
|
name = "fleet-migration"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
|
||||||
labels = {
|
labels = {
|
||||||
app = "fleet"
|
app = "fleet"
|
||||||
}
|
}
|
||||||
annotations = local.pod_annotations
|
annotations = local.pod_annotations
|
||||||
}
|
}
|
||||||
spec {
|
|
||||||
parallelism = local.fleet.migrations.parallelism
|
|
||||||
completions = local.fleet.migrations.completions
|
|
||||||
active_deadline_seconds = local.fleet.migrations.active_deadline_seconds
|
|
||||||
backoff_limit = local.fleet.migrations.backoff_limit
|
|
||||||
|
|
||||||
manual_selector = local.fleet.migrations.manual_selector
|
spec {
|
||||||
|
service_account_name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
||||||
|
share_process_namespace = "true"
|
||||||
|
restart_policy = local.fleet.migrations.restart_policy
|
||||||
|
|
||||||
template {
|
container {
|
||||||
metadata {
|
name = "fleet-migration"
|
||||||
name = "fleet-migration"
|
image = "${local.image_repository}:${local.image_tag}"
|
||||||
labels = {
|
|
||||||
app = "fleet"
|
command = ["/bin/sh", "-c"]
|
||||||
}
|
args = local.gke.cloud_sql.enable_proxy ? [
|
||||||
annotations = local.pod_annotations
|
"/usr/bin/fleet prepare db --no-prompt; sql_proxy_pid=$(pgrep cloud_sql_proxy) && kill -INT $sql_proxy_pid;"
|
||||||
|
] : [
|
||||||
|
"/usr/bin/fleet prepare db --no-prompt;"
|
||||||
|
]
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = [
|
||||||
|
{ name = "FLEET_SERVER_ADDRESS", value = "0.0.0.0:${local.fleet.listen_port}" },
|
||||||
|
{ name = "FLEET_AUTH_BCRYPT_COST", value = local.fleet.auth.b_crypto_cost },
|
||||||
|
{ name = "FLEET_AUTH_SALT_KEY_SIZE", value = local.fleet.auth.salt_key_size },
|
||||||
|
{ name = "FLEET_APP_TOKEN_KEY_SIZE", value = local.fleet.app.token_key_size },
|
||||||
|
{ name = "FLEET_APP_TOKEN_VALIDITY_PERIOD", value = local.fleet.app.invite_token_validity_period },
|
||||||
|
{ name = "FLEET_SESSION_KEY_SIZE", value = local.fleet.session.key_size },
|
||||||
|
{ name = "FLEET_SESSION_DURATION", value = local.fleet.session.duration },
|
||||||
|
{ name = "FLEET_LOGGING_DEBUG", value = local.fleet.logging.debug },
|
||||||
|
{ name = "FLEET_LOGGING_JSON", value = local.fleet.logging.json },
|
||||||
|
{ name = "FLEET_LOGGING_DISABLE_BANNER", value = local.fleet.logging.disable_banner },
|
||||||
|
{ name = "FLEET_SERVER_TLS", value = local.fleet.tls.enabled }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spec {
|
dynamic "env" {
|
||||||
service_account_name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
for_each = local.fleet.tls.enabled ? [
|
||||||
share_process_namespace = "true"
|
{ name = "FLEET_SERVER_TLS_COMPATIBILITY", value = local.fleet.tls.compatibility },
|
||||||
restart_policy = local.fleet.migrations.restart_policy
|
{ name = "FLEET_SERVER_CERT", value = local.fleet.tls.cert_secret_key },
|
||||||
|
{ name = "FLEET_SERVER_KEY", value = local.fleet.tls.key_secret_key }
|
||||||
|
] : []
|
||||||
|
|
||||||
container {
|
content {
|
||||||
name = "fleet-migration"
|
name = env.value.name
|
||||||
image = "${local.image_repository}:${local.image_tag}"
|
value = env.value.value
|
||||||
|
|
||||||
command = ["/bin/sh", "-c"]
|
|
||||||
args = local.gke.cloud_sql.enable_proxy ? [
|
|
||||||
"/usr/bin/fleet prepare db --no-prompt; sql_proxy_pid=$(pgrep cloud_sql_proxy) && kill -INT $sql_proxy_pid;"
|
|
||||||
] : [
|
|
||||||
"/usr/bin/fleet prepare db --no-prompt;"
|
|
||||||
]
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_SERVER_ADDRESS", value = "0.0.0.0:${local.fleet.listen_port}" },
|
|
||||||
{ name = "FLEET_AUTH_BCRYPT_COST", value = local.fleet.auth.b_crypto_cost },
|
|
||||||
{ name = "FLEET_AUTH_SALT_KEY_SIZE", value = local.fleet.auth.salt_key_size },
|
|
||||||
{ name = "FLEET_APP_TOKEN_KEY_SIZE", value = local.fleet.app.token_key_size },
|
|
||||||
{ name = "FLEET_APP_TOKEN_VALIDITY_PERIOD", value = local.fleet.app.invite_token_validity_period },
|
|
||||||
{ name = "FLEET_SESSION_KEY_SIZE", value = local.fleet.session.key_size },
|
|
||||||
{ name = "FLEET_SESSION_DURATION", value = local.fleet.session.duration },
|
|
||||||
{ name = "FLEET_LOGGING_DEBUG", value = local.fleet.logging.debug },
|
|
||||||
{ name = "FLEET_LOGGING_JSON", value = local.fleet.logging.json },
|
|
||||||
{ name = "FLEET_LOGGING_DISABLE_BANNER", value = local.fleet.logging.disable_banner },
|
|
||||||
{ name = "FLEET_SERVER_TLS", value = local.fleet.tls.enabled }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.fleet.tls.enabled ? [
|
|
||||||
{ name = "FLEET_SERVER_TLS_COMPATIBILITY", value = local.fleet.tls.compatibility },
|
|
||||||
{ name = "FLEET_SERVER_CERT", value = local.fleet.tls.cert_secret_key },
|
|
||||||
{ name = "FLEET_SERVER_KEY", value = local.fleet.tls.key_secret_key }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = [
|
|
||||||
{ name = "FLEET_MYSQL_ADDRESS", value = local.database.address },
|
|
||||||
{ name = "FLEET_MYSQL_DATABASE", value = local.database.database },
|
|
||||||
{ name = "FLEET_MYSQL_USERNAME", value = local.database.username },
|
|
||||||
{ name = "FLEET_MYSQL_MAX_OPEN_CONNS", value = local.database.max_open_conns },
|
|
||||||
{ name = "FLEET_MYSQL_MAX_IDLE_CONNS", value = local.database.max_idle_conns },
|
|
||||||
{ name = "FLEET_MYSQL_CONN_MAX_LIFETIME", value = local.database.conn_max_lifetime }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
name = "FLEET_MYSQL_PASSWORD"
|
|
||||||
value_from {
|
|
||||||
secret_key_ref {
|
|
||||||
name = local.database.secret_name
|
|
||||||
key = local.database.password_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "env" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CA", value = "/secrets/mysql/${local.database.tls.ca_cert_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CERT", value = "/secrets/mysql/${local.database.tls.cert_secret_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_KEY", value = "/secrets/mysql/${local.database.tls.key_key}" },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_CONFIG", value = local.database.tls.config },
|
|
||||||
{ name = "FLEET_MYSQL_TLS_SERVER_NAME", value = local.database.tls.server_name }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = env.value.name
|
|
||||||
value = env.value.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
security_context {
|
|
||||||
run_as_user = local.fleet.security_context.run_as_user
|
|
||||||
run_as_group = local.fleet.security_context.run_as_group
|
|
||||||
run_as_non_root = local.fleet.security_context.run_as_non_root
|
|
||||||
read_only_root_filesystem = "true"
|
|
||||||
privileged = "false"
|
|
||||||
allow_privilege_escalation = "false"
|
|
||||||
|
|
||||||
dynamic "capabilities" {
|
|
||||||
for_each = local.gke.cloud_sql.enable_proxy ? [
|
|
||||||
{ name = "add", values = ["SYS_PTRACE"] }
|
|
||||||
] : [
|
|
||||||
{ name = "drop", values = ["ALL"] }
|
|
||||||
]
|
|
||||||
|
|
||||||
content {
|
|
||||||
add = capabilities.value.name == "add" ? capabilities.value.values : []
|
|
||||||
drop = capabilities.value.name == "drop" ? capabilities.value.values : []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resources {
|
|
||||||
limits = {
|
|
||||||
cpu = local.resources.limits.cpu
|
|
||||||
memory = local.resources.limits.memory
|
|
||||||
}
|
|
||||||
requests = {
|
|
||||||
cpu = local.resources.requests.cpu
|
|
||||||
memory = local.resources.requests.memory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "volume_mount" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{ name = "mysql-tls", read_only = true, mount_path = "/secrets/mysql" }
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = volume_mount.value.name
|
|
||||||
read_only = volume_mount.value.read_only
|
|
||||||
mount_path = volume_mount.value.mount_path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "container" {
|
|
||||||
for_each = local.gke.cloud_sql.enable_proxy ? [
|
|
||||||
{
|
|
||||||
name = "cloudql-proxy",
|
|
||||||
image = "${local.gke.cloud_sql.image_repository}:${local.gke.cloud_sql.image_tag}",
|
|
||||||
command = ["/cloud_sql_proxy", "-verbose=${local.gke.cloud_sql.verbose}", "-instances=${local.gke.cloud_sql.instance_name}=tcp:3306"]
|
|
||||||
resources = {
|
|
||||||
limits = {
|
|
||||||
cpu = "0.5",
|
|
||||||
memory = "150Mi"
|
|
||||||
},
|
|
||||||
requests = {
|
|
||||||
cpu = "0.1",
|
|
||||||
memory = "50Mi"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
security_context = {
|
|
||||||
allow_privilege_escalation = false,
|
|
||||||
capabilities = {
|
|
||||||
drop = ["ALL"]
|
|
||||||
},
|
|
||||||
privileged = false,
|
|
||||||
read_only_root_filesystem = true,
|
|
||||||
run_as_user = local.fleet.security_context.run_as_user,
|
|
||||||
run_as_group = local.fleet.security_context.run_as_group,
|
|
||||||
run_as_non_root = local.fleet.security_context.run_as_non_root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = container.value.name
|
|
||||||
image = container.value.image
|
|
||||||
command = container.value.command
|
|
||||||
resources {
|
|
||||||
limits = {
|
|
||||||
cpu = container.value.resources.limits.cpu
|
|
||||||
memory = container.value.resources.limits.memory
|
|
||||||
}
|
|
||||||
requests = {
|
|
||||||
cpu = container.value.resources.requests.cpu
|
|
||||||
memory = container.value.resources.requests.memory
|
|
||||||
}
|
|
||||||
}
|
|
||||||
security_context {
|
|
||||||
allow_privilege_escalation = container.value.security_context.allow_privilege_escalation
|
|
||||||
capabilities {
|
|
||||||
drop = container.value.security_context.capabilities.drop
|
|
||||||
}
|
|
||||||
privileged = container.value.security_context.privileged
|
|
||||||
read_only_root_filesystem = container.value.security_context.read_only_root_filesystem
|
|
||||||
run_as_group = container.value.security_context.run_as_group
|
|
||||||
run_as_user = container.value.security_context.run_as_user
|
|
||||||
run_as_non_root = container.value.security_context.run_as_non_root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "volume" {
|
|
||||||
for_each = local.database.tls.enabled ? [
|
|
||||||
{
|
|
||||||
name = "mysql-tls",
|
|
||||||
secret_name = local.database.tls.secret_name
|
|
||||||
}
|
|
||||||
] : []
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = volume.value.name
|
|
||||||
secret {
|
|
||||||
secret_name = volume.value.secret_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_affinity {
|
|
||||||
required_during_scheduling_ignored_during_execution {
|
|
||||||
label_selector {
|
|
||||||
match_expressions {
|
|
||||||
key = affinity.value.label_selector.match_expressions[*].key
|
|
||||||
operator = affinity.value.label_selector.match_expressions[*].operator
|
|
||||||
values = affinity.value.label_selector.match_expressions[*].values
|
|
||||||
}
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_affinity {
|
|
||||||
preferred_during_scheduling_ignored_during_execution {
|
|
||||||
pod_affinity_term {
|
|
||||||
preference = affinity.value.preference
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.anti_affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_anti_affinity {
|
|
||||||
required_during_scheduling_ignored_during_execution {
|
|
||||||
label_selector {
|
|
||||||
match_expressions {
|
|
||||||
key = affinity.value.label_selector.match_expressions[*].key
|
|
||||||
operator = affinity.value.label_selector.match_expressions[*].operator
|
|
||||||
values = affinity.value.label_selector.match_expressions[*].values
|
|
||||||
}
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "affinity" {
|
|
||||||
for_each = local.anti_affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
|
||||||
|
|
||||||
content {
|
|
||||||
pod_anti_affinity {
|
|
||||||
preferred_during_scheduling_ignored_during_execution {
|
|
||||||
pod_affinity_term {
|
|
||||||
label_selector = affinity.value.label_selector.label_selector
|
|
||||||
}
|
|
||||||
topology_key = affinity.value.topology_key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic "toleration" {
|
|
||||||
for_each = local.tolerations
|
|
||||||
|
|
||||||
content {
|
|
||||||
key = toleration.env.key
|
|
||||||
operator = toleration.env.operator
|
|
||||||
value = toleration.env.value
|
|
||||||
effect = toleration.env.effect
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
node_selector = local.node_selector
|
|
||||||
|
|
||||||
dynamic "image_pull_secrets" {
|
|
||||||
for_each = var.image_pull_secrets
|
|
||||||
|
|
||||||
content {
|
|
||||||
name = image_pull_secrets.value["name"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = [
|
||||||
|
{ name = "FLEET_MYSQL_ADDRESS", value = local.database.address },
|
||||||
|
{ name = "FLEET_MYSQL_DATABASE", value = local.database.database },
|
||||||
|
{ name = "FLEET_MYSQL_USERNAME", value = local.database.username },
|
||||||
|
{ name = "FLEET_MYSQL_MAX_OPEN_CONNS", value = local.database.max_open_conns },
|
||||||
|
{ name = "FLEET_MYSQL_MAX_IDLE_CONNS", value = local.database.max_idle_conns },
|
||||||
|
{ name = "FLEET_MYSQL_CONN_MAX_LIFETIME", value = local.database.conn_max_lifetime }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
name = "FLEET_MYSQL_PASSWORD"
|
||||||
|
value_from {
|
||||||
|
secret_key_ref {
|
||||||
|
name = local.database.secret_name
|
||||||
|
key = local.database.password_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "env" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CA", value = "/secrets/mysql/${local.database.tls.ca_cert_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CERT", value = "/secrets/mysql/${local.database.tls.cert_secret_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_KEY", value = "/secrets/mysql/${local.database.tls.key_key}" },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_CONFIG", value = local.database.tls.config },
|
||||||
|
{ name = "FLEET_MYSQL_TLS_SERVER_NAME", value = local.database.tls.server_name }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = env.value.name
|
||||||
|
value = env.value.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
security_context {
|
||||||
|
run_as_user = local.fleet.security_context.run_as_user
|
||||||
|
run_as_group = local.fleet.security_context.run_as_group
|
||||||
|
run_as_non_root = local.fleet.security_context.run_as_non_root
|
||||||
|
read_only_root_filesystem = "true"
|
||||||
|
privileged = "false"
|
||||||
|
allow_privilege_escalation = "false"
|
||||||
|
|
||||||
|
dynamic "capabilities" {
|
||||||
|
for_each = local.gke.cloud_sql.enable_proxy ? [
|
||||||
|
{ name = "add", values = ["SYS_PTRACE"] }
|
||||||
|
] : [
|
||||||
|
{ name = "drop", values = ["ALL"] }
|
||||||
|
]
|
||||||
|
|
||||||
|
content {
|
||||||
|
add = capabilities.value.name == "add" ? capabilities.value.values : []
|
||||||
|
drop = capabilities.value.name == "drop" ? capabilities.value.values : []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
limits = {
|
||||||
|
cpu = local.resources.limits.cpu
|
||||||
|
memory = local.resources.limits.memory
|
||||||
|
}
|
||||||
|
requests = {
|
||||||
|
cpu = local.resources.requests.cpu
|
||||||
|
memory = local.resources.requests.memory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "volume_mount" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{ name = "mysql-tls", read_only = true, mount_path = "/secrets/mysql" }
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = volume_mount.value.name
|
||||||
|
read_only = volume_mount.value.read_only
|
||||||
|
mount_path = volume_mount.value.mount_path
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic "container" {
|
||||||
|
for_each = local.gke.cloud_sql.enable_proxy ? [
|
||||||
|
{
|
||||||
|
name = "cloudql-proxy",
|
||||||
|
image = "${local.gke.cloud_sql.image_repository}:${local.gke.cloud_sql.image_tag}",
|
||||||
|
command = ["/cloud_sql_proxy", "-verbose=${local.gke.cloud_sql.verbose}", "-instances=${local.gke.cloud_sql.instance_name}=tcp:3306"]
|
||||||
|
resources = {
|
||||||
|
limits = {
|
||||||
|
cpu = "0.5",
|
||||||
|
memory = "150Mi"
|
||||||
|
},
|
||||||
|
requests = {
|
||||||
|
cpu = "0.1",
|
||||||
|
memory = "50Mi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
security_context = {
|
||||||
|
allow_privilege_escalation = false,
|
||||||
|
capabilities = {
|
||||||
|
drop = ["ALL"]
|
||||||
|
},
|
||||||
|
privileged = false,
|
||||||
|
read_only_root_filesystem = true,
|
||||||
|
run_as_user = local.fleet.security_context.run_as_user,
|
||||||
|
run_as_group = local.fleet.security_context.run_as_group,
|
||||||
|
run_as_non_root = local.fleet.security_context.run_as_non_root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = container.value.name
|
||||||
|
image = container.value.image
|
||||||
|
command = container.value.command
|
||||||
|
resources {
|
||||||
|
limits = {
|
||||||
|
cpu = container.value.resources.limits.cpu
|
||||||
|
memory = container.value.resources.limits.memory
|
||||||
|
}
|
||||||
|
requests = {
|
||||||
|
cpu = container.value.resources.requests.cpu
|
||||||
|
memory = container.value.resources.requests.memory
|
||||||
|
}
|
||||||
|
}
|
||||||
|
security_context {
|
||||||
|
allow_privilege_escalation = container.value.security_context.allow_privilege_escalation
|
||||||
|
capabilities {
|
||||||
|
drop = container.value.security_context.capabilities.drop
|
||||||
|
}
|
||||||
|
privileged = container.value.security_context.privileged
|
||||||
|
read_only_root_filesystem = container.value.security_context.read_only_root_filesystem
|
||||||
|
run_as_group = container.value.security_context.run_as_group
|
||||||
|
run_as_user = container.value.security_context.run_as_user
|
||||||
|
run_as_non_root = container.value.security_context.run_as_non_root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "volume" {
|
||||||
|
for_each = local.database.tls.enabled ? [
|
||||||
|
{
|
||||||
|
name = "mysql-tls",
|
||||||
|
secret_name = local.database.tls.secret_name
|
||||||
|
}
|
||||||
|
] : []
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = volume.value.name
|
||||||
|
secret {
|
||||||
|
secret_name = volume.value.secret_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_affinity {
|
||||||
|
required_during_scheduling_ignored_during_execution {
|
||||||
|
label_selector {
|
||||||
|
match_expressions {
|
||||||
|
key = affinity.value.label_selector.match_expressions[*].key
|
||||||
|
operator = affinity.value.label_selector.match_expressions[*].operator
|
||||||
|
values = affinity.value.label_selector.match_expressions[*].values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_affinity {
|
||||||
|
preferred_during_scheduling_ignored_during_execution {
|
||||||
|
pod_affinity_term {
|
||||||
|
preference = affinity.value.preference
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.anti_affinity_rules.required_during_scheduling_ignored_during_execution != null ? local.affinity_rules.required_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_anti_affinity {
|
||||||
|
required_during_scheduling_ignored_during_execution {
|
||||||
|
label_selector {
|
||||||
|
match_expressions {
|
||||||
|
key = affinity.value.label_selector.match_expressions[*].key
|
||||||
|
operator = affinity.value.label_selector.match_expressions[*].operator
|
||||||
|
values = affinity.value.label_selector.match_expressions[*].values
|
||||||
|
}
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "affinity" {
|
||||||
|
for_each = local.anti_affinity_rules.preferred_during_scheduling_ignored_during_execution != null ? local.affinity_rules.preferred_during_scheduling_ignored_during_execution : null
|
||||||
|
|
||||||
|
content {
|
||||||
|
pod_anti_affinity {
|
||||||
|
preferred_during_scheduling_ignored_during_execution {
|
||||||
|
pod_affinity_term {
|
||||||
|
label_selector = affinity.value.label_selector.label_selector
|
||||||
|
}
|
||||||
|
topology_key = affinity.value.topology_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic "toleration" {
|
||||||
|
for_each = local.tolerations
|
||||||
|
|
||||||
|
content {
|
||||||
|
key = toleration.env.key
|
||||||
|
operator = toleration.env.operator
|
||||||
|
value = toleration.env.value
|
||||||
|
effect = toleration.env.effect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node_selector = local.node_selector
|
||||||
|
|
||||||
|
dynamic "image_pull_secrets" {
|
||||||
|
for_each = var.image_pull_secrets
|
||||||
|
|
||||||
|
content {
|
||||||
|
name = image_pull_secrets.value["name"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wait_for_completion = true
|
}
|
||||||
timeouts {
|
wait_for_completion = true
|
||||||
create = "30m"
|
timeouts {
|
||||||
}
|
create = "30m"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+25
-25
@@ -1,27 +1,27 @@
|
|||||||
locals {
|
locals {
|
||||||
namespace = var.namespace
|
namespace = var.namespace
|
||||||
hostname = var.hostname
|
hostname = var.hostname
|
||||||
replicas = var.replicas
|
replicas = var.replicas
|
||||||
image_repository = var.image_repository
|
image_repository = var.image_repository
|
||||||
image_tag = var.image_tag
|
image_tag = var.image_tag
|
||||||
image_pull_secrets = var.image_pull_secrets
|
image_pull_secrets = var.image_pull_secrets
|
||||||
pod_annotations = var.pod_annotations
|
pod_annotations = var.pod_annotations
|
||||||
service_annotations = var.service_annotations
|
service_annotations = var.service_annotations
|
||||||
service_account_annotations = var.service_account_annotations
|
service_account_annotations = var.service_account_annotations
|
||||||
resources = var.resources
|
resources = var.resources
|
||||||
vuln_processing = var.vuln_processing
|
vuln_processing = var.vuln_processing
|
||||||
node_selector = var.node_selector
|
node_selector = var.node_selector
|
||||||
tolerations = var.tolerations
|
tolerations = var.tolerations
|
||||||
affinity_rules = var.affinity_rules
|
affinity_rules = var.affinity_rules
|
||||||
anti_affinity_rules = var.anti_affinity_rules
|
anti_affinity_rules = var.anti_affinity_rules
|
||||||
ingress = var.ingress
|
ingress = var.ingress
|
||||||
fleet = var.fleet
|
fleet = var.fleet
|
||||||
osquery = var.osquery
|
osquery = var.osquery
|
||||||
database = var.database
|
database = var.database
|
||||||
database_read_replica = var.database_read_replica
|
database_read_replica = var.database_read_replica
|
||||||
cache = var.cache
|
cache = var.cache
|
||||||
gke = var.gke
|
gke = var.gke
|
||||||
environment_variables = var.environment_variables
|
environment_variables = var.environment_variables
|
||||||
environment_from_config_maps = var.environment_from_config_maps
|
environment_from_config_maps = var.environment_from_config_maps
|
||||||
environment_from_secrets = var.environment_from_secrets
|
environment_from_secrets = var.environment_from_secrets
|
||||||
}
|
}
|
||||||
@@ -1,55 +1,55 @@
|
|||||||
resource "kubernetes_service_account" "fleet-sa" {
|
resource "kubernetes_service_account" "fleet-sa" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet"
|
name = "fleet"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
app = "fleet"
|
app = "fleet"
|
||||||
}
|
|
||||||
annotations = local.gke.workload_identity_email != "" ? merge(local.service_account_annotations, { "iam.gke.io/gcp-service-account" = local.gke.workload_identity_email}) : local.service_account_annotations
|
|
||||||
}
|
}
|
||||||
|
annotations = local.gke.workload_identity_email != "" ? merge(local.service_account_annotations, { "iam.gke.io/gcp-service-account" = local.gke.workload_identity_email }) : local.service_account_annotations
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "kubernetes_role" "fleet-role" {
|
resource "kubernetes_role" "fleet-role" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet"
|
name = "fleet"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
}
|
}
|
||||||
|
|
||||||
rule {
|
rule {
|
||||||
api_groups = ["core"]
|
api_groups = ["core"]
|
||||||
resources = ["secrets"]
|
resources = ["secrets"]
|
||||||
resource_names = tolist([
|
resource_names = tolist([
|
||||||
local.database.secret_name != "" ? local.database.secret_name : "",
|
local.database.secret_name != "" ? local.database.secret_name : "",
|
||||||
local.cache.secret_name != "" ? local.cache.secret_name : "",
|
local.cache.secret_name != "" ? local.cache.secret_name : "",
|
||||||
local.fleet.secret_name != "" ? local.fleet.secret_name : "",
|
local.fleet.secret_name != "" ? local.fleet.secret_name : "",
|
||||||
local.osquery.secret_name != "" ? local.osquery.secret_name : ""
|
local.osquery.secret_name != "" ? local.osquery.secret_name : ""
|
||||||
])
|
])
|
||||||
verbs = ["get"]
|
verbs = ["get"]
|
||||||
}
|
}
|
||||||
depends_on = [
|
depends_on = [
|
||||||
resource.kubernetes_service_account.fleet-sa
|
resource.kubernetes_service_account.fleet-sa
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "kubernetes_role_binding" "fleet-role-binding" {
|
resource "kubernetes_role_binding" "fleet-role-binding" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet"
|
name = "fleet"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
}
|
}
|
||||||
|
|
||||||
role_ref {
|
role_ref {
|
||||||
api_group = "rbac.authorization.k8s.io"
|
api_group = "rbac.authorization.k8s.io"
|
||||||
kind = "Role"
|
kind = "Role"
|
||||||
name = resource.kubernetes_role.fleet-role.metadata[0].name
|
name = resource.kubernetes_role.fleet-role.metadata[0].name
|
||||||
}
|
}
|
||||||
|
|
||||||
subject {
|
subject {
|
||||||
kind = "ServiceAccount"
|
kind = "ServiceAccount"
|
||||||
name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
name = resource.kubernetes_service_account.fleet-sa.metadata[0].name
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
}
|
}
|
||||||
depends_on = [
|
depends_on = [
|
||||||
resource.kubernetes_role.fleet-role
|
resource.kubernetes_role.fleet-role
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+29
-29
@@ -1,35 +1,35 @@
|
|||||||
resource "kubernetes_service" "fleet-service" {
|
resource "kubernetes_service" "fleet-service" {
|
||||||
metadata {
|
metadata {
|
||||||
name = "fleet"
|
name = "fleet"
|
||||||
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
namespace = data.kubernetes_namespace.fleet.metadata[0].name
|
||||||
annotations = local.service_annotations
|
annotations = local.service_annotations
|
||||||
|
}
|
||||||
|
|
||||||
|
spec {
|
||||||
|
selector = {
|
||||||
|
app = "fleet"
|
||||||
|
component = "fleet-server"
|
||||||
}
|
}
|
||||||
|
|
||||||
spec {
|
dynamic "port" {
|
||||||
selector = {
|
for_each = local.gke.ingress.use_gke_ingress && local.gke.ingress.node_port != "" ? [
|
||||||
app = "fleet"
|
{ name = "fleet", port = local.fleet.listen_port, target_port = local.fleet.listen_port, protocol = "TCP", node_port = local.gke.ingress.node_port }
|
||||||
component = "fleet-server"
|
] : [
|
||||||
}
|
{ name = "fleet", port = local.fleet.listen_port, target_port = local.fleet.listen_port, protocol = "TCP", node_port = null }
|
||||||
|
]
|
||||||
|
|
||||||
dynamic "port" {
|
content {
|
||||||
for_each = local.gke.ingress.use_gke_ingress && local.gke.ingress.node_port != "" ? [
|
name = port.value.name
|
||||||
{ name = "fleet", port = local.fleet.listen_port, target_port = local.fleet.listen_port, protocol = "TCP", node_port = local.gke.ingress.node_port }
|
port = port.value.port
|
||||||
] : [
|
protocol = port.value.protocol
|
||||||
{ name = "fleet", port = local.fleet.listen_port, target_port = local.fleet.listen_port, protocol = "TCP", node_port = null }
|
target_port = port.value.target_port
|
||||||
]
|
node_port = port.value.node_port
|
||||||
|
}
|
||||||
content {
|
|
||||||
name = port.value.name
|
|
||||||
port = port.value.port
|
|
||||||
protocol = port.value.protocol
|
|
||||||
target_port = port.value.target_port
|
|
||||||
node_port = port.value.node_port
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type = local.gke.ingress.use_gke_ingress ? "NodePort" : "ClusterIP"
|
|
||||||
}
|
}
|
||||||
depends_on = [
|
|
||||||
resource.kubernetes_deployment.fleet
|
type = local.gke.ingress.use_gke_ingress ? "NodePort" : "ClusterIP"
|
||||||
]
|
}
|
||||||
|
depends_on = [
|
||||||
|
resource.kubernetes_deployment.fleet
|
||||||
|
]
|
||||||
}
|
}
|
||||||
+303
-288
@@ -1,107 +1,107 @@
|
|||||||
variable "namespace" {
|
variable "namespace" {
|
||||||
type = string
|
type = string
|
||||||
default = "fleet"
|
default = "fleet"
|
||||||
description = "The value for this variable will be used as the name of the namespace that fleet will be deployed to."
|
description = "The value for this variable will be used as the name of the namespace that fleet will be deployed to."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "hostname" {
|
variable "hostname" {
|
||||||
type = string
|
type = string
|
||||||
default = "fleet.localhost"
|
default = "fleet.localhost"
|
||||||
description = "Used as the hostname that you will access fleet on."
|
description = "Used as the hostname that you will access fleet on."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "replicas" {
|
variable "replicas" {
|
||||||
type = number
|
type = number
|
||||||
default = 3
|
default = 3
|
||||||
description = "Used to drive the number of fleet deployment replicas."
|
description = "Used to drive the number of fleet deployment replicas."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "image_repository" {
|
variable "image_repository" {
|
||||||
type = string
|
type = string
|
||||||
default = "fleetdm/fleet"
|
default = "fleetdm/fleet"
|
||||||
description = "Used to populate the image repository for fleet."
|
description = "Used to populate the image repository for fleet."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "image_tag" {
|
variable "image_tag" {
|
||||||
type = string
|
type = string
|
||||||
default = "v4.66.0"
|
default = "v4.66.0"
|
||||||
description = "Used to populate the fleet version that will be deployed."
|
description = "Used to populate the fleet version that will be deployed."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "image_pull_secrets" {
|
variable "image_pull_secrets" {
|
||||||
type = list(object({
|
type = list(object({
|
||||||
name = string
|
name = string
|
||||||
}))
|
}))
|
||||||
default = []
|
default = []
|
||||||
description = "Used to inject image pull secrets for access to a private container registry."
|
description = "Used to inject image pull secrets for access to a private container registry."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "pod_annotations" {
|
variable "pod_annotations" {
|
||||||
type = map
|
type = map(any)
|
||||||
default = {}
|
default = {}
|
||||||
description = "Used to populate the annotations for pods."
|
description = "Used to populate the annotations for pods."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_annotations" {
|
variable "service_annotations" {
|
||||||
type = map
|
type = map(any)
|
||||||
default = {}
|
default = {}
|
||||||
description = "Used to populate the annotations for the fleet service."
|
description = "Used to populate the annotations for the fleet service."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "service_account_annotations" {
|
variable "service_account_annotations" {
|
||||||
type = map
|
type = map(any)
|
||||||
default = {}
|
default = {}
|
||||||
description = "Used to populate the annotations for the fleet service account."
|
description = "Used to populate the annotations for the fleet service account."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "resources" {
|
variable "resources" {
|
||||||
type = object({
|
type = object({
|
||||||
limits = optional(object({
|
limits = optional(object({
|
||||||
cpu = optional(string, "1")
|
cpu = optional(string, "1")
|
||||||
memory = optional(string, "4Gi")
|
memory = optional(string, "4Gi")
|
||||||
}),{
|
}), {
|
||||||
cpu = "1"
|
cpu = "1"
|
||||||
memory = "4Gi"
|
memory = "4Gi"
|
||||||
})
|
|
||||||
requests = optional(object({
|
|
||||||
cpu = optional(string, "0.1")
|
|
||||||
memory = optional(string, "50Mi")
|
|
||||||
}),{
|
|
||||||
cpu = "0.1"
|
|
||||||
memory = "50Mi"
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to populate resource values for the fleet deployment and migration job."
|
requests = optional(object({
|
||||||
|
cpu = optional(string, "0.1")
|
||||||
|
memory = optional(string, "50Mi")
|
||||||
|
}), {
|
||||||
|
cpu = "0.1"
|
||||||
|
memory = "50Mi"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
description = "Used to populate resource values for the fleet deployment and migration job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "node_selector" {
|
variable "node_selector" {
|
||||||
type = map
|
type = map(any)
|
||||||
default = {}
|
default = {}
|
||||||
description = "Used to populate node selector values."
|
description = "Used to populate node selector values."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "tolerations" {
|
variable "tolerations" {
|
||||||
type = list(any)
|
type = list(any)
|
||||||
default = []
|
default = []
|
||||||
description = "Used to configure tolerations."
|
description = "Used to configure tolerations."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment_variables" {
|
variable "environment_variables" {
|
||||||
type = list(map(string))
|
type = list(map(string))
|
||||||
default = []
|
default = []
|
||||||
description = "Used to configure additional environment variables for the fleet deployment and vuln-processing cron job."
|
description = "Used to configure additional environment variables for the fleet deployment and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment_from_config_maps" {
|
variable "environment_from_config_maps" {
|
||||||
type = list(map(string))
|
type = list(map(string))
|
||||||
default = []
|
default = []
|
||||||
description = "Used to configure additional environment variables from a config map for the fleet deployment and vuln-processing cron job."
|
description = "Used to configure additional environment variables from a config map for the fleet deployment and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "environment_from_secrets" {
|
variable "environment_from_secrets" {
|
||||||
type = list(map(string))
|
type = list(map(string))
|
||||||
default = []
|
default = []
|
||||||
description = "Used to configure additional environment variables from a secret for the fleet deployment and vuln-processing cron job."
|
description = "Used to configure additional environment variables from a secret for the fleet deployment and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -110,273 +110,288 @@ variable "environment_from_secrets" {
|
|||||||
|
|
||||||
|
|
||||||
variable "affinity_rules" {
|
variable "affinity_rules" {
|
||||||
type = object({
|
type = object({
|
||||||
required_during_scheduling_ignored_during_execution = optional(list(any), [])
|
required_during_scheduling_ignored_during_execution = optional(list(any), [])
|
||||||
preferred_during_scheduling_ignored_during_execution = optional(list(any), [])
|
preferred_during_scheduling_ignored_during_execution = optional(list(any), [])
|
||||||
})
|
})
|
||||||
description = "Used to configure affinity rules for the fleet deployment, migration job, and vuln-processing cron job."
|
description = "Used to configure affinity rules for the fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "anti_affinity_rules" {
|
variable "anti_affinity_rules" {
|
||||||
type = object({
|
type = object({
|
||||||
required_during_scheduling_ignored_during_execution = optional(list(any), [])
|
required_during_scheduling_ignored_during_execution = optional(list(any), [])
|
||||||
preferred_during_scheduling_ignored_during_execution = optional(list(any),
|
preferred_during_scheduling_ignored_during_execution = optional(list(any),
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
weight = 100
|
weight = 100
|
||||||
label_selector = {
|
label_selector = {
|
||||||
match_expressions = [
|
match_expressions = [
|
||||||
{
|
{
|
||||||
key = "app"
|
key = "app"
|
||||||
operator = "In"
|
operator = "In"
|
||||||
values = ["fleet"]
|
values = ["fleet"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
topology_key = "kubernetes.io/hostname"
|
topology_key = "kubernetes.io/hostname"
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
description = "Used to configure anti-affinity rules for the fleet deployment, migration job, and vuln-processing cron job."
|
description = "Used to configure anti-affinity rules for the fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vuln_processing
|
vuln_processing
|
||||||
*/
|
*/
|
||||||
variable "vuln_processing" {
|
variable "vuln_processing" {
|
||||||
type = object({
|
type = object({
|
||||||
ttl_seconds_after_finished = optional(number, 100)
|
ttl_seconds_after_finished = optional(number, 100)
|
||||||
restart_policy = optional(string, "Never")
|
restart_policy = optional(string, "Never")
|
||||||
dedicated = optional(bool, false)
|
dedicated = optional(bool, false)
|
||||||
schedule = optional(string, "0 * * * *")
|
schedule = optional(string, "0 * * * *")
|
||||||
resources = object({
|
resources = object({
|
||||||
limits = optional(object({
|
limits = optional(object({
|
||||||
cpu = optional(string, "1")
|
cpu = optional(string, "1")
|
||||||
memory = optional(string, "4Gi")
|
memory = optional(string, "4Gi")
|
||||||
}),{
|
}), {
|
||||||
cpu = "1"
|
cpu = "1"
|
||||||
memory = "4Gi"
|
memory = "4Gi"
|
||||||
})
|
})
|
||||||
requests = optional(object({
|
requests = optional(object({
|
||||||
cpu = optional(string, "0.1")
|
cpu = optional(string, "0.1")
|
||||||
memory = optional(string, "50Mi")
|
memory = optional(string, "50Mi")
|
||||||
}),{
|
}), {
|
||||||
cpu = "0.1"
|
cpu = "0.1"
|
||||||
memory = "50Mi"
|
memory = "50Mi"
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure the values for the vuln-processing cron job."
|
})
|
||||||
|
description = "Used to configure the values for the vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ingress
|
ingress
|
||||||
*/
|
*/
|
||||||
variable "ingress" {
|
variable "ingress" {
|
||||||
type = object({
|
type = object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
class_name = optional(string, "nginx")
|
class_name = optional(string, "nginx")
|
||||||
labels = optional(map(string), {})
|
labels = optional(map(string), {})
|
||||||
annotations = optional(map(string), {})
|
annotations = optional(map(string), {})
|
||||||
hosts = optional(list(any), [])
|
hosts = optional(list(any), [])
|
||||||
tls = object({
|
tls = object({
|
||||||
secret_name = optional(string, "")
|
secret_name = optional(string, "")
|
||||||
hosts = optional(list(string),[])
|
hosts = optional(list(string), [])
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure values for ingress."
|
})
|
||||||
|
description = "Used to configure values for ingress."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "fleet" {
|
variable "fleet" {
|
||||||
type = object({
|
type = object({
|
||||||
listen_port = optional(number, 8080)
|
listen_port = optional(number, 8080)
|
||||||
secret_name = optional(string, "fleet")
|
secret_name = optional(string, "fleet")
|
||||||
migrations = object({
|
migrations = object({
|
||||||
auto_apply_sql_migrations = optional(bool, true)
|
auto_apply_sql_migrations = optional(bool, true)
|
||||||
migration_job_annotations = optional(map(string), {})
|
migration_job_annotations = optional(map(string), {})
|
||||||
parallelism = optional(number, 1)
|
parallelism = optional(number, 1)
|
||||||
completions = optional(number, 1)
|
completions = optional(number, 1)
|
||||||
active_deadline_seconds = optional(number, 900)
|
active_deadline_seconds = optional(number, 900)
|
||||||
backoff_limit = optional(number, 6)
|
backoff_limit = optional(number, 6)
|
||||||
manual_selector = optional(bool, false)
|
manual_selector = optional(bool, false)
|
||||||
restart_policy = optional(string, "Never")
|
restart_policy = optional(string, "Never")
|
||||||
})
|
|
||||||
tls = object({
|
|
||||||
enabled = optional(bool, false)
|
|
||||||
unique_tls_secret = optional(bool, false)
|
|
||||||
secret_name = optional(string, "fleet-tls")
|
|
||||||
compatibility = optional(string, "modern")
|
|
||||||
cert_secret_key = optional(string, "server.cert")
|
|
||||||
key_secret_key = optional(string, "server.key")
|
|
||||||
})
|
|
||||||
auth = object({
|
|
||||||
b_crypto_cost = optional(number, 12)
|
|
||||||
salt_key_size = optional(number, 24)
|
|
||||||
})
|
|
||||||
app = object({
|
|
||||||
token_key_size = optional(number, 24)
|
|
||||||
invite_token_validity_period = optional(string, "120h")
|
|
||||||
})
|
|
||||||
session = object({
|
|
||||||
key_size = optional(number, 64)
|
|
||||||
duration = optional(string, "2160h")
|
|
||||||
})
|
|
||||||
logging = object({
|
|
||||||
debug = optional(bool, false)
|
|
||||||
json = optional(bool, false)
|
|
||||||
disable_banner = optional(bool, false)
|
|
||||||
})
|
|
||||||
carving = object({
|
|
||||||
s3 = object({
|
|
||||||
bucket_name = optional(string, "")
|
|
||||||
prefix = optional(string, "")
|
|
||||||
access_key_id = optional(string, "")
|
|
||||||
secret_key = optional(string, "s3-bucket")
|
|
||||||
sts_assume_role_arn = optional(string, "")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
license = object({
|
|
||||||
secret_name = optional(string, "")
|
|
||||||
license_key = optional(string, "license-key")
|
|
||||||
})
|
|
||||||
extra_volumes = optional(list(any), [])
|
|
||||||
extra_volume_mounts = optional(list(any), [])
|
|
||||||
security_context = object({
|
|
||||||
run_as_user = optional(number, null)
|
|
||||||
run_as_group = optional(number, null)
|
|
||||||
run_as_non_root = optional(bool, true)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure Fleet specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
tls = object({
|
||||||
|
enabled = optional(bool, false)
|
||||||
|
unique_tls_secret = optional(bool, false)
|
||||||
|
secret_name = optional(string, "fleet-tls")
|
||||||
|
compatibility = optional(string, "modern")
|
||||||
|
cert_secret_key = optional(string, "server.cert")
|
||||||
|
key_secret_key = optional(string, "server.key")
|
||||||
|
})
|
||||||
|
auth = object({
|
||||||
|
b_crypto_cost = optional(number, 12)
|
||||||
|
salt_key_size = optional(number, 24)
|
||||||
|
})
|
||||||
|
app = object({
|
||||||
|
token_key_size = optional(number, 24)
|
||||||
|
invite_token_validity_period = optional(string, "120h")
|
||||||
|
})
|
||||||
|
session = object({
|
||||||
|
key_size = optional(number, 64)
|
||||||
|
duration = optional(string, "2160h")
|
||||||
|
})
|
||||||
|
logging = object({
|
||||||
|
debug = optional(bool, false)
|
||||||
|
json = optional(bool, false)
|
||||||
|
disable_banner = optional(bool, false)
|
||||||
|
})
|
||||||
|
software_installers = object({
|
||||||
|
s3 = object({
|
||||||
|
bucket_name = optional(string, "")
|
||||||
|
prefix = optional(string, "")
|
||||||
|
endpoint_url = optional(string, "")
|
||||||
|
force_s3_path_style = optional(bool, false)
|
||||||
|
region = optional(string, "")
|
||||||
|
access_key_id = optional(string, "")
|
||||||
|
secret_key = optional(string, "s3-software-installers")
|
||||||
|
sts_assume_role_arn = optional(string, "")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
carving = object({
|
||||||
|
s3 = object({
|
||||||
|
bucket_name = optional(string, "")
|
||||||
|
prefix = optional(string, "")
|
||||||
|
endpoint_url = optional(string, "")
|
||||||
|
force_s3_path_style = optional(bool, false)
|
||||||
|
region = optional(string, "")
|
||||||
|
access_key_id = optional(string, "")
|
||||||
|
secret_key = optional(string, "s3-bucket")
|
||||||
|
sts_assume_role_arn = optional(string, "")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
license = object({
|
||||||
|
secret_name = optional(string, "")
|
||||||
|
license_key = optional(string, "license-key")
|
||||||
|
})
|
||||||
|
extra_volumes = optional(list(any), [])
|
||||||
|
extra_volume_mounts = optional(list(any), [])
|
||||||
|
security_context = object({
|
||||||
|
run_as_user = optional(number, null)
|
||||||
|
run_as_group = optional(number, null)
|
||||||
|
run_as_non_root = optional(bool, true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
description = "Used to configure Fleet specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "osquery" {
|
variable "osquery" {
|
||||||
type = object({
|
type = object({
|
||||||
secret_name = optional(string, "osquery")
|
secret_name = optional(string, "osquery")
|
||||||
node_key_size = optional(number, 24)
|
node_key_size = optional(number, 24)
|
||||||
label_update_interval = optional(string, "30m")
|
label_update_interval = optional(string, "30m")
|
||||||
detail_update_interval = optional(string, "30m")
|
detail_update_interval = optional(string, "30m")
|
||||||
logging = object({
|
logging = object({
|
||||||
status_plugin = optional(string, "filesystem")
|
status_plugin = optional(string, "filesystem")
|
||||||
result_plugin = optional(string, "filesystem")
|
result_plugin = optional(string, "filesystem")
|
||||||
filesystem = object({
|
filesystem = object({
|
||||||
status_log_file = optional(string, "osquery_status")
|
status_log_file = optional(string, "osquery_status")
|
||||||
result_log_file = optional(string, "osquery_result")
|
result_log_file = optional(string, "osquery_result")
|
||||||
enable_rotation = optional(bool, false)
|
enable_rotation = optional(bool, false)
|
||||||
enable_compression = optional(bool, false)
|
enable_compression = optional(bool, false)
|
||||||
volume_size = optional(string, "20Gi")
|
volume_size = optional(string, "20Gi")
|
||||||
})
|
})
|
||||||
firehose = object({
|
firehose = object({
|
||||||
region = optional(string, "")
|
region = optional(string, "")
|
||||||
access_key_id = optional(string, "")
|
access_key_id = optional(string, "")
|
||||||
secret_key = optional(string, "firehose")
|
secret_key = optional(string, "firehose")
|
||||||
sts_assume_role_arn = optional(string, "")
|
sts_assume_role_arn = optional(string, "")
|
||||||
status_stream = optional(string, "")
|
status_stream = optional(string, "")
|
||||||
result_stream = optional(string, "")
|
result_stream = optional(string, "")
|
||||||
})
|
})
|
||||||
kinesis = object({
|
kinesis = object({
|
||||||
region = optional(string, "")
|
region = optional(string, "")
|
||||||
access_key_id = optional(string, "")
|
access_key_id = optional(string, "")
|
||||||
secret_key = optional(string, "kinesis")
|
secret_key = optional(string, "kinesis")
|
||||||
sts_assume_role_arn = optional(string, "")
|
sts_assume_role_arn = optional(string, "")
|
||||||
status_stream = optional(string, "")
|
status_stream = optional(string, "")
|
||||||
result_stream = optional(string, "")
|
result_stream = optional(string, "")
|
||||||
})
|
})
|
||||||
lambda = object({
|
lambda = object({
|
||||||
region = optional(string, "")
|
region = optional(string, "")
|
||||||
access_key_id = optional(string, "")
|
access_key_id = optional(string, "")
|
||||||
secret_key = optional(string, "lambda")
|
secret_key = optional(string, "lambda")
|
||||||
sts_assume_role_arn = optional(string, "")
|
sts_assume_role_arn = optional(string, "")
|
||||||
status_stream = optional(string, "")
|
status_stream = optional(string, "")
|
||||||
result_stream = optional(string, "")
|
result_stream = optional(string, "")
|
||||||
})
|
})
|
||||||
pubsub = object({
|
pubsub = object({
|
||||||
project = optional(string, "")
|
project = optional(string, "")
|
||||||
status_topic = optional(string, "")
|
status_topic = optional(string, "")
|
||||||
result_topic = optional(string, "")
|
result_topic = optional(string, "")
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure osquery specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
})
|
||||||
|
description = "Used to configure osquery specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "database" {
|
variable "database" {
|
||||||
type = object({
|
type = object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
secret_name = optional(string, "mysql")
|
secret_name = optional(string, "mysql")
|
||||||
address = optional(string, "mysql:3306")
|
address = optional(string, "mysql:3306")
|
||||||
database = optional(string, "fleet")
|
database = optional(string, "fleet")
|
||||||
username = optional(string, "fleet")
|
username = optional(string, "fleet")
|
||||||
password_key = optional(string, "password")
|
password_key = optional(string, "password")
|
||||||
max_open_conns = optional(number, 50)
|
max_open_conns = optional(number, 50)
|
||||||
max_idle_conns = optional(number, 50)
|
max_idle_conns = optional(number, 50)
|
||||||
conn_max_lifetime = optional(number, 0)
|
conn_max_lifetime = optional(number, 0)
|
||||||
|
|
||||||
tls = object({
|
tls = object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
config = optional(string, "")
|
config = optional(string, "")
|
||||||
server_name = optional(string, "")
|
server_name = optional(string, "")
|
||||||
ca_cert_key = optional(string, "")
|
ca_cert_key = optional(string, "")
|
||||||
cert_key = optional(string, "")
|
cert_key = optional(string, "")
|
||||||
key_key = optional(string, "")
|
key_key = optional(string, "")
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure database specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
})
|
||||||
|
description = "Used to configure database specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "database_read_replica" {
|
variable "database_read_replica" {
|
||||||
type = object({
|
type = object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
secret_name = optional(string, "mysql")
|
secret_name = optional(string, "mysql")
|
||||||
address = optional(string, "mysql-ro:3306")
|
address = optional(string, "mysql-ro:3306")
|
||||||
database = optional(string, "fleet")
|
database = optional(string, "fleet")
|
||||||
username = optional(string, "fleet-ro")
|
username = optional(string, "fleet-ro")
|
||||||
password_key = optional(string, "ro-password")
|
password_key = optional(string, "ro-password")
|
||||||
password_path = optional(string,"")
|
password_path = optional(string, "")
|
||||||
max_open_conns = optional(number, 50)
|
max_open_conns = optional(number, 50)
|
||||||
max_idle_conns = optional(number, 50)
|
max_idle_conns = optional(number, 50)
|
||||||
conn_max_lifetime = optional(number, 0)
|
conn_max_lifetime = optional(number, 0)
|
||||||
|
|
||||||
tls = optional(object({
|
tls = optional(object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
config = optional(string, "")
|
config = optional(string, "")
|
||||||
server_name = optional(string, "")
|
server_name = optional(string, "")
|
||||||
ca_cert_key = optional(string, "")
|
ca_cert_key = optional(string, "")
|
||||||
cert_key = optional(string, "")
|
cert_key = optional(string, "")
|
||||||
key_key = optional(string, "")
|
key_key = optional(string, "")
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
description = "Used to configure database_read_replica specific values for use in the Fleet deployment and vuln-processing cron job."
|
description = "Used to configure database_read_replica specific values for use in the Fleet deployment and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "cache" {
|
variable "cache" {
|
||||||
type = object({
|
type = object({
|
||||||
enabled = optional(bool, false)
|
enabled = optional(bool, false)
|
||||||
address = optional(string, "redis:6379")
|
address = optional(string, "redis:6379")
|
||||||
database = optional(number, 0)
|
database = optional(number, 0)
|
||||||
use_password = optional(bool, false)
|
use_password = optional(bool, false)
|
||||||
secret_name = optional(string, "redis")
|
secret_name = optional(string, "redis")
|
||||||
password_key = optional(string, "password")
|
password_key = optional(string, "password")
|
||||||
})
|
})
|
||||||
description = "Used to configure redis specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
description = "Used to configure redis specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "gke" {
|
variable "gke" {
|
||||||
type = object({
|
type = object({
|
||||||
workload_identity_email = optional(string, "")
|
workload_identity_email = optional(string, "")
|
||||||
cloud_sql = object({
|
cloud_sql = object({
|
||||||
enable_proxy = optional(bool, false)
|
enable_proxy = optional(bool, false)
|
||||||
image_repository = optional(string, "gcr.io/cloudsql-docker/gce-proxy")
|
image_repository = optional(string, "gcr.io/cloudsql-docker/gce-proxy")
|
||||||
image_tag = optional(string, "1.17-alpine")
|
image_tag = optional(string, "1.17-alpine")
|
||||||
verbose = optional(bool, true)
|
verbose = optional(bool, true)
|
||||||
instance_name = optional(string, "")
|
instance_name = optional(string, "")
|
||||||
})
|
|
||||||
ingress = object({
|
|
||||||
use_managed_certificate = optional(bool, false)
|
|
||||||
use_gke_ingress = optional(bool, false)
|
|
||||||
node_port = optional(number, 0)
|
|
||||||
hostnames = optional(list(string), [""])
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
description = "Used to configure gke specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
ingress = object({
|
||||||
|
use_managed_certificate = optional(bool, false)
|
||||||
|
use_gke_ingress = optional(bool, false)
|
||||||
|
node_port = optional(number, 0)
|
||||||
|
hostnames = optional(list(string), [""])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
description = "Used to configure gke specific values for use in the Fleet deployment, migration job, and vuln-processing cron job."
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user