diff --git a/README.md b/README.md index f371fd9..c020499 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ worker_groups = { | [enable\_waf\_for\_alb](#input\_enable\_waf\_for\_alb) | Enables WAF and WAF V2 addons for ALB | `bool` | `false` | no | | [external\_dns](#input\_external\_dns) | Allows to install external-dns helm chart and related roles, which allows to automatically create R53 records based on ingress/service domain/host configs |
object({
enabled = optional(bool, false)
configs = optional(any, {})
})
|
{
"enabled": false
}
| no | | [external\_secrets\_namespace](#input\_external\_secrets\_namespace) | The namespace of external-secret operator | `string` | `"kube-system"` | no | -| [flagger](#input\_flagger) | Allows to create/deploy flagger operator to have custom rollout strategies like canary/blue-green and also it allows to create custom flagger metric templates |
object({
enabled = optional(bool, false)
namespace = optional(string, "ingress-nginx") # The flagger operator helm being installed on same namespace as mesh/ingress provider so this field need to be set based on which ingress/mesh we are going to use, more info in https://artifacthub.io/packages/helm/flagger/flagger
configs = optional(any, {}) # available options can be found in https://artifacthub.io/packages/helm/flagger/flagger
metric_template_configs = optional(any, {}) # available options can be found in https://github.com/dasmeta/helm/tree/flagger-metric-template-0.1.0/charts/flagger-metric-template
enable_metric_template = optional(bool, false)
enable_loadtester = optional(bool, false)
})
|
{
"enabled": false
}
| no | +| [flagger](#input\_flagger) | Allows to create/deploy flagger operator to have custom rollout strategies like canary/blue-green and also it allows to create custom flagger metric templates |
object({
enabled = optional(bool, false)
namespace = optional(string, "ingress-nginx") # The flagger operator helm being installed on same namespace as mesh/ingress provider so this field need to be set based on which ingress/mesh we are going to use, more info in https://artifacthub.io/packages/helm/flagger/flagger
configs = optional(any, {}) # Available options can be found in https://artifacthub.io/packages/helm/flagger/flagger
metrics_and_alerts_configs = optional(any, {}) # Available options can be found in https://github.com/dasmeta/helm/tree/flagger-metrics-and-alerts-0.1.0/charts/flagger-metrics-and-alerts
enable_loadtester = optional(bool, false) # Whether to install flagger loadtester helm
})
|
{
"enabled": false
}
| no | | [fluent\_bit\_configs](#input\_fluent\_bit\_configs) | Fluent Bit configs |
object({
enabled = optional(string, true)
fluent_bit_name = optional(string, "")
log_group_name = optional(string, "")
system_log_group_name = optional(string, "")
log_retention_days = optional(number, 90)
values_yaml = optional(string, "")
configs = optional(object({
inputs = optional(string, "")
filters = optional(string, "")
outputs = optional(string, "")
cloudwatch_outputs_enabled = optional(bool, true)
}), {})
drop_namespaces = optional(list(string), [])
log_filters = optional(list(string), [])
additional_log_filters = optional(list(string), [])
kube_namespaces = optional(list(string), [])
image_pull_secrets = optional(list(string), [])
})
|
{
"additional_log_filters": [
"ELB-HealthChecker",
"Amazon-Route53-Health-Check-Service"
],
"configs": {
"cloudwatch_outputs_enabled": true,
"filters": "",
"inputs": "",
"outputs": ""
},
"drop_namespaces": [
"kube-system",
"opentelemetry-operator-system",
"adot",
"cert-manager",
"opentelemetry.*",
"meta.*"
],
"enabled": true,
"fluent_bit_name": "",
"image_pull_secrets": [],
"kube_namespaces": [
"kube.*",
"meta.*",
"adot.*",
"devops.*",
"cert-manager.*",
"git.*",
"opentelemetry.*",
"stakater.*",
"renovate.*"
],
"log_filters": [
"kube-probe",
"health",
"prometheus",
"liveness"
],
"log_group_name": "",
"log_retention_days": 90,
"system_log_group_name": "",
"values_yaml": ""
}
| no | | [manage\_aws\_auth](#input\_manage\_aws\_auth) | n/a | `bool` | `true` | no | | [map\_roles](#input\_map\_roles) | Additional IAM roles to add to the aws-auth configmap. |
list(object({
rolearn = string
username = string
groups = list(string)
}))
| `[]` | no | diff --git a/examples/basic/README.md b/examples/basic/README.md index bcd75fe..3f65220 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -9,7 +9,7 @@ No requirements. | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.67.0 | +| [aws](#provider\_aws) | n/a | ## Modules diff --git a/examples/eks-fluent-bit/README.md b/examples/eks-fluent-bit/README.md index ee3b419..48f1b86 100644 --- a/examples/eks-fluent-bit/README.md +++ b/examples/eks-fluent-bit/README.md @@ -12,7 +12,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.67.0 | +| [aws](#provider\_aws) | >= 3.41 | ## Modules diff --git a/examples/eks-with-flagger/1-example.tf b/examples/eks-with-flagger/1-example.tf index 3cdc6c0..f834e66 100644 --- a/examples/eks-with-flagger/1-example.tf +++ b/examples/eks-with-flagger/1-example.tf @@ -63,7 +63,33 @@ module "this" { prometheus = { install = true } + # slack = { # (optional) enable global flagger slack notify + # channel = "#test-canary-notifications" + # url = "https://hooks.slack.com/services/xx/yyy/zzzz" + # user = "Flagger" + # } } + # metrics_and_alerts_configs = { # (optional) configure custom flagger metric template and alert providers + # # createNginxCustomMetricTemplates: true # false by default + # metricTemplates : { + # "my-custom-request-rate-metric-template" : { + # provider : { # (optional, defaults to metricTemplatesDefaultProvider) + # type : "prometheus" + # address : "http://flagger-prometheus.ingress-nginx:9090" + # } + # query : "sum(rate(nginx_ingress_controller_requests{namespace=\"{{ namespace }}\",ingress=\"{{ ingress }}\",status!~\"5.*\"}[1m]))/sum(rate(nginx_ingress_controller_requests{namespace=\"{{ namespace }\",ingress=\"{{ ingress }}\"}[1m]))*100" + # } + # } + + # alertProviders : { + # on-call : { # The uniq name of channel + # type : "slack" + # channel : "test-canary-notifications-alert-provider" # The channel of notify/alerting (optional default to "general") # The channel of notify/alerting (optional default to "general") + # username : "flagger" # The sender name in notify/alert (optional default to "flagger") + # address : "https://hooks.slack.com/services/xx/yyy/zzzz" + # } + # } + # } } } @@ -72,7 +98,7 @@ resource "helm_release" "http_echo" { repository = "https://dasmeta.github.io/helm" chart = "base" namespace = "default" - version = "0.2.7" + version = "0.2.8" wait = true values = [file("${path.module}/http-echo-canary-eks.yaml")] diff --git a/examples/eks-with-flagger/http-echo-canary-eks.yaml b/examples/eks-with-flagger/http-echo-canary-eks.yaml index 054780b..643d817 100644 --- a/examples/eks-with-flagger/http-echo-canary-eks.yaml +++ b/examples/eks-with-flagger/http-echo-canary-eks.yaml @@ -2,6 +2,9 @@ image: repository: mendhak/http-https-echo tag: 34 +config: + TEST_CONFIG_FOR_ROLLOUT_TRIGGER: "1" + containerPort: 8080 service: diff --git a/examples/external-dns-enabled/README.md b/examples/external-dns-enabled/README.md index 0bb326b..41252e4 100644 --- a/examples/external-dns-enabled/README.md +++ b/examples/external-dns-enabled/README.md @@ -12,7 +12,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.67.0 | +| [aws](#provider\_aws) | >= 3.41 | ## Modules diff --git a/examples/spot-instance/README.md b/examples/spot-instance/README.md index 0bb326b..41252e4 100644 --- a/examples/spot-instance/README.md +++ b/examples/spot-instance/README.md @@ -12,7 +12,7 @@ | Name | Version | |------|---------| -| [aws](#provider\_aws) | 4.67.0 | +| [aws](#provider\_aws) | >= 3.41 | ## Modules diff --git a/main.tf b/main.tf index 1efbe9e..2101037 100644 --- a/main.tf +++ b/main.tf @@ -392,12 +392,11 @@ module "external-dns" { module "flagger" { count = var.create && var.flagger.enabled ? 1 : 0 - source = "./modules/flagger" - namespace = var.flagger.namespace - configs = var.flagger.configs - metric_template_configs = var.flagger.metric_template_configs - enable_metric_template = var.flagger.enable_metric_template - enable_loadtester = var.flagger.enable_loadtester + source = "./modules/flagger" + namespace = var.flagger.namespace + configs = var.flagger.configs + metrics_and_alerts_configs = var.flagger.metrics_and_alerts_configs + enable_loadtester = var.flagger.enable_loadtester depends_on = [ module.eks-cluster diff --git a/modules/flagger/README.md b/modules/flagger/README.md index 74be722..4fa84bd 100644 --- a/modules/flagger/README.md +++ b/modules/flagger/README.md @@ -39,7 +39,7 @@ No modules. | Name | Type | |------|------| | [helm_release.flagger_loadtester](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | -| [helm_release.flagger_metric_template](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.flagger_metrics_and_alerts](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.this](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | ## Inputs @@ -48,12 +48,11 @@ No modules. |------|-------------|------|---------|:--------:| | [atomic](#input\_atomic) | Whether use helm deploy with --atomic flag | `bool` | `false` | no | | [chart\_version](#input\_chart\_version) | The app chart version | `string` | `"1.38.0"` | no | -| [configs](#input\_configs) | Configurations to pass and override default ones. Check the helm chart available configs here: https://artifacthub.io/packages/helm/flagger/flagger?modal=values | `any` | `{}` | no | +| [configs](#input\_configs) | Configurations to pass and override default flagger chart configs. Check the helm chart available configs here: https://artifacthub.io/packages/helm/flagger/flagger?modal=values | `any` | `{}` | no | | [create\_namespace](#input\_create\_namespace) | Create namespace if requested | `bool` | `true` | no | -| [enable\_loadtester](#input\_enable\_loadtester) | Whether to install loadtester helm | `bool` | `false` | no | -| [enable\_metric\_template](#input\_enable\_metric\_template) | Whether to install flagger-metric-template helm | `bool` | `false` | no | +| [enable\_loadtester](#input\_enable\_loadtester) | Whether to install flagger loadtester helm | `bool` | `false` | no | | [metric\_template\_chart\_version](#input\_metric\_template\_chart\_version) | The metric template chart version | `string` | `"0.1.0"` | no | -| [metric\_template\_configs](#input\_metric\_template\_configs) | Configurations to pass and override default ones. Check the helm chart available configs here: https://github.com/dasmeta/helm/tree/flagger-metric-template-0.1.0/charts/flagger-metric-template | `any` | `{}` | no | +| [metrics\_and\_alerts\_configs](#input\_metrics\_and\_alerts\_configs) | Configurations to pass and override default flagger-metrics-and-alerts chart configs. If empty no chart will be deployed. Check the helm chart available configs here: https://github.com/dasmeta/helm/tree/flagger-metrics-and-alerts-0.1.0/charts/flagger-metrics-and-alerts | `any` | `{}` | no | | [namespace](#input\_namespace) | The namespace to install main helm. | `string` | `"ingress-nginx"` | no | | [wait](#input\_wait) | Whether use helm deploy with --wait flag | `bool` | `true` | no | diff --git a/modules/flagger/metric-template.tf b/modules/flagger/metric-template.tf index 964fd7e..f38f052 100644 --- a/modules/flagger/metric-template.tf +++ b/modules/flagger/metric-template.tf @@ -1,16 +1,16 @@ -resource "helm_release" "flagger_metric_template" { - count = var.enable_metric_template ? 1 : 0 +resource "helm_release" "flagger_metrics_and_alerts" { + count = var.metrics_and_alerts_configs != {} ? 1 : 0 - name = "flagger-metric-template" + name = "flagger-metrics-and-alerts" repository = "https://dasmeta.github.io/helm" - chart = "flagger-metric-template" + chart = "flagger-metrics-and-alerts" namespace = var.namespace version = var.metric_template_chart_version create_namespace = false atomic = var.atomic wait = var.wait - values = [jsonencode(var.metric_template_configs)] + values = [jsonencode(var.metrics_and_alerts_configs)] depends_on = [helm_release.this] } diff --git a/modules/flagger/variables.tf b/modules/flagger/variables.tf index 46997ce..4ea1391 100644 --- a/modules/flagger/variables.tf +++ b/modules/flagger/variables.tf @@ -37,23 +37,17 @@ variable "wait" { variable "configs" { type = any default = {} - description = "Configurations to pass and override default ones. Check the helm chart available configs here: https://artifacthub.io/packages/helm/flagger/flagger?modal=values" + description = "Configurations to pass and override default flagger chart configs. Check the helm chart available configs here: https://artifacthub.io/packages/helm/flagger/flagger?modal=values" } -variable "enable_metric_template" { - type = bool - default = false - description = "Whether to install flagger-metric-template helm" -} - -variable "metric_template_configs" { +variable "metrics_and_alerts_configs" { type = any default = {} - description = "Configurations to pass and override default ones. Check the helm chart available configs here: https://github.com/dasmeta/helm/tree/flagger-metric-template-0.1.0/charts/flagger-metric-template" + description = "Configurations to pass and override default flagger-metrics-and-alerts chart configs. If empty no chart will be deployed. Check the helm chart available configs here: https://github.com/dasmeta/helm/tree/flagger-metrics-and-alerts-0.1.0/charts/flagger-metrics-and-alerts" } variable "enable_loadtester" { type = bool default = false - description = "Whether to install loadtester helm" + description = "Whether to install flagger loadtester helm" } diff --git a/variables.tf b/variables.tf index 22ba5c9..5557ab2 100644 --- a/variables.tf +++ b/variables.tf @@ -600,12 +600,11 @@ variable "external_dns" { variable "flagger" { type = object({ - enabled = optional(bool, false) - namespace = optional(string, "ingress-nginx") # The flagger operator helm being installed on same namespace as mesh/ingress provider so this field need to be set based on which ingress/mesh we are going to use, more info in https://artifacthub.io/packages/helm/flagger/flagger - configs = optional(any, {}) # available options can be found in https://artifacthub.io/packages/helm/flagger/flagger - metric_template_configs = optional(any, {}) # available options can be found in https://github.com/dasmeta/helm/tree/flagger-metric-template-0.1.0/charts/flagger-metric-template - enable_metric_template = optional(bool, false) - enable_loadtester = optional(bool, false) + enabled = optional(bool, false) + namespace = optional(string, "ingress-nginx") # The flagger operator helm being installed on same namespace as mesh/ingress provider so this field need to be set based on which ingress/mesh we are going to use, more info in https://artifacthub.io/packages/helm/flagger/flagger + configs = optional(any, {}) # Available options can be found in https://artifacthub.io/packages/helm/flagger/flagger + metrics_and_alerts_configs = optional(any, {}) # Available options can be found in https://github.com/dasmeta/helm/tree/flagger-metrics-and-alerts-0.1.0/charts/flagger-metrics-and-alerts + enable_loadtester = optional(bool, false) # Whether to install flagger loadtester helm }) default = { enabled = false