-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from dasmeta/DMVP-5664-flagger
feat(DMVP-5664): flagger operator integration
- Loading branch information
Showing
19 changed files
with
503 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
provider "aws" { | ||
region = "eu-central-1" | ||
} | ||
|
||
provider "helm" { | ||
kubernetes { | ||
host = module.this.cluster_host | ||
cluster_ca_certificate = module.this.cluster_certificate | ||
token = module.this.cluster_token | ||
} | ||
} | ||
|
||
# Prepare for test | ||
data "aws_availability_zones" "available" {} | ||
data "aws_vpcs" "ids" { | ||
tags = { | ||
Name = "default" | ||
} | ||
} | ||
data "aws_subnet_ids" "subnets" { | ||
vpc_id = data.aws_vpcs.ids.ids[0] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
module "this" { | ||
source = "../.." | ||
|
||
cluster_name = "test-cluster-with-flagger" | ||
|
||
vpc = { | ||
link = { | ||
id = data.aws_vpcs.ids.ids[0] | ||
private_subnet_ids = data.aws_subnet_ids.subnets.ids | ||
} | ||
} | ||
|
||
node_groups = { | ||
"default" : { | ||
"desired_size" : 1, | ||
"max_capacity" : 1, | ||
"max_size" : 1, | ||
"min_size" : 1 | ||
} | ||
|
||
} | ||
node_groups_default = { | ||
"capacity_type" : "SPOT", | ||
"instance_types" : ["t3.medium"] | ||
} | ||
|
||
alarms = { | ||
enabled = false | ||
sns_topic = "" | ||
} | ||
enable_ebs_driver = false | ||
enable_external_secrets = false | ||
create_cert_manager = false | ||
enable_alb_ingress_controller = false | ||
enable_node_problem_detector = false | ||
metrics_exporter = "disabled" | ||
fluent_bit_configs = { | ||
enabled = false | ||
} | ||
|
||
nginx_ingress_controller_config = { | ||
enabled = true | ||
name = "nginx" | ||
create_namespace = true | ||
namespace = "ingress-nginx" | ||
replicacount = 1 | ||
metrics_enabled = true | ||
} | ||
|
||
external_dns = { | ||
enabled = true | ||
configs = { | ||
configs = { sources = ["service", "ingress"] } | ||
} | ||
} | ||
|
||
flagger = { | ||
enabled = true | ||
namespace = "ingress-nginx" | ||
enable_loadtester = true | ||
configs = { | ||
meshProvider = "nginx" | ||
prometheus = { | ||
install = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "helm_release" "http_echo" { | ||
name = "http-echo" | ||
repository = "https://dasmeta.github.io/helm" | ||
chart = "base" | ||
namespace = "default" | ||
version = "0.2.7" | ||
wait = true | ||
|
||
values = [file("${path.module}/http-echo-canary-eks.yaml")] | ||
|
||
depends_on = [module.this] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# eks-with-flagger | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 | | ||
| <a name="provider_helm"></a> [helm](#provider\_helm) | 2.16.1 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_this"></a> [this](#module\_this) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [helm_release.http_echo](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | ||
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source | | ||
| [aws_subnet_ids.subnets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet_ids) | data source | | ||
| [aws_vpcs.ids](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpcs) | data source | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
image: | ||
repository: mendhak/http-https-echo | ||
tag: 34 | ||
|
||
containerPort: 8080 | ||
|
||
service: | ||
enabled: true | ||
type: ClusterIP | ||
|
||
autoscaling: | ||
enabled: true | ||
minReplicas: 1 | ||
maxReplicas: 2 | ||
targetCPUUtilizationPercentage: 99 | ||
|
||
readinessProbe: | ||
initialDelaySeconds: 5 | ||
failureThreshold: 1 | ||
httpGet: | ||
path: /health | ||
port: http | ||
livenessProbe: | ||
initialDelaySeconds: 5 | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /health | ||
port: http | ||
resources: | ||
requests: | ||
cpu: 6m | ||
|
||
ingress: | ||
enabled: true | ||
class: nginx | ||
hosts: | ||
- host: http-echo.devops.dasmeta.com | ||
paths: | ||
- path: "/ping" | ||
backend: | ||
serviceName: http-echo | ||
servicePort: 80 | ||
|
||
rolloutStrategy: | ||
enabled: true | ||
operator: flagger | ||
configs: | ||
progressDeadlineSeconds: 60 # the maximum time in seconds for the canary deployment to make progress before it is rollback (default 600s) | ||
canaryReadyThreshold: 51 # minimum percentage of canary pods that must be ready before considering canary ready for traffic shifting (default 100) | ||
primaryReadyThreshold: 51 # minimum percentage of primary pods that must be ready before considering primary ready for traffic shifting (default 100) | ||
interval: 11s # schedule interval (default 60s) | ||
threshold: 11 # max number of failed metric checks before rollback (default 10) | ||
maxWeight: 31 # max traffic percentage (0-100) routed to canary (default 30) | ||
stepWeight: 11 # canary increment step percentage (0-100) (default 10) | ||
# min and max replicas count for primary hpa, default to main app hpa, the main app hpa values also being used for canary deploy hpa so we use this options to have custom values for primary hpa | ||
primaryScalerMinReplicas: 2 | ||
primaryScalerMaxReplicas: 5 | ||
metrics: # metrics template configs to use for identifying if canary deploy handles request normally, the `request-success-rate` and `request-duration` named ones are available by default, and you can create custom metric templates | ||
- name: request-success-rate | ||
# minimum req success rate (non 5xx responses) percentage (0-100) | ||
thresholdRange: | ||
min: 99 | ||
interval: 1m | ||
- name: request-duration | ||
# maximum req duration P99, milliseconds | ||
thresholdRange: | ||
max: 500 | ||
interval: 1m | ||
|
||
webhooks: # webhooks can be used for load testing before traffic switching to canaries by using `pre-rollout` type and also generating traffic | ||
- name: acceptance-test | ||
type: pre-rollout | ||
url: http://flagger-loadtester.ingress-nginx/ | ||
timeout: 30s | ||
metadata: | ||
type: bash | ||
cmd: "curl -sd 'test' http://http-echo-canary/ping | grep ping" | ||
- name: load-test | ||
url: http://flagger-loadtester.ingress-nginx/ | ||
timeout: 5s | ||
metadata: | ||
cmd: "hey -z 1m -q 3 -c 1 http://http-echo.devops.dasmeta.com/ping" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# terraform module 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 | ||
## for more info check https://flagger.app and https://artifacthub.io/packages/helm/flagger/flagger | ||
|
||
|
||
## example | ||
```terraform | ||
module "flagger" { | ||
source = "dasmeta/eks/aws//modules/flagger" | ||
version = "2.18.0" | ||
configs = { | ||
meshProvider = "nginx" | ||
prometheus = { | ||
install = true # most possibly the prometheus is already installed, in that case set this to false and use `metricsServer` option to set the endpoint to prometheus | ||
} | ||
} | ||
} | ||
``` | ||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 | | ||
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | >= 2.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_helm"></a> [helm](#provider\_helm) | >= 2.0 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| 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.this](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_atomic"></a> [atomic](#input\_atomic) | Whether use helm deploy with --atomic flag | `bool` | `false` | no | | ||
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | The app chart version | `string` | `"1.38.0"` | no | | ||
| <a name="input_configs"></a> [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 | | ||
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Create namespace if requested | `bool` | `true` | no | | ||
| <a name="input_enable_loadtester"></a> [enable\_loadtester](#input\_enable\_loadtester) | Whether to install loadtester helm | `bool` | `false` | no | | ||
| <a name="input_enable_metric_template"></a> [enable\_metric\_template](#input\_enable\_metric\_template) | Whether to install flagger-metric-template helm | `bool` | `false` | no | | ||
| <a name="input_metric_template_chart_version"></a> [metric\_template\_chart\_version](#input\_metric\_template\_chart\_version) | The metric template chart version | `string` | `"0.1.0"` | no | | ||
| <a name="input_metric_template_configs"></a> [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 | | ||
| <a name="input_namespace"></a> [namespace](#input\_namespace) | The namespace to install main helm. | `string` | `"ingress-nginx"` | no | | ||
| <a name="input_wait"></a> [wait](#input\_wait) | Whether use helm deploy with --wait flag | `bool` | `true` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_helm_metadata"></a> [helm\_metadata](#output\_helm\_metadata) | Helm release metadata | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = ">= 1.3.0" | ||
|
||
required_providers { | ||
helm = ">= 2.0" | ||
} | ||
} | ||
|
||
provider "helm" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module "this" { | ||
source = "../.." | ||
|
||
configs = { | ||
meshProvider = "nginx" | ||
prometheus = { | ||
install = true # most possibly the prometheus is already installed, in that case set this to false and use `metricsServer` option to set the endpoint to prometheus | ||
} | ||
} | ||
} |
Oops, something went wrong.