Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMVP-1645: Add Portainer module #29

Merged
merged 8 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ worker_groups = {
| <a name="module_metrics-server"></a> [metrics-server](#module\_metrics-server) | ./modules/metrics-server | n/a |
| <a name="module_node-problem-detector"></a> [node-problem-detector](#module\_node-problem-detector) | ./modules/node-problem-detector | n/a |
| <a name="module_olm"></a> [olm](#module\_olm) | ./modules/olm | n/a |
| <a name="module_portainer"></a> [portainer](#module\_portainer) | ./modules/portainer | n/a |
| <a name="module_sso-rbac"></a> [sso-rbac](#module\_sso-rbac) | ./modules/sso-rbac | n/a |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | dasmeta/vpc/aws | 1.0.1 |
| <a name="module_weave-scope"></a> [weave-scope](#module\_weave-scope) | ./modules/weave-scope | n/a |
Expand Down Expand Up @@ -259,6 +260,7 @@ worker_groups = {
| <a name="input_enable_metrics_server"></a> [enable\_metrics\_server](#input\_enable\_metrics\_server) | METRICS-SERVER | `bool` | `false` | no |
| <a name="input_enable_node_problem_detector"></a> [enable\_node\_problem\_detector](#input\_enable\_node\_problem\_detector) | n/a | `bool` | `true` | no |
| <a name="input_enable_olm"></a> [enable\_olm](#input\_enable\_olm) | To install OLM controller (experimental). | `bool` | `false` | no |
| <a name="input_enable_portainer"></a> [enable\_portainer](#input\_enable\_portainer) | Enable Portainer provisioning or not | `bool` | `false` | no |
| <a name="input_enable_sso_rbac"></a> [enable\_sso\_rbac](#input\_enable\_sso\_rbac) | Enable SSO RBAC integration or not | `bool` | `false` | no |
| <a name="input_external_secrets_namespace"></a> [external\_secrets\_namespace](#input\_external\_secrets\_namespace) | The namespace of external-secret operator | `string` | `"kube-system"` | no |
| <a name="input_fluent_bit_configs"></a> [fluent\_bit\_configs](#input\_fluent\_bit\_configs) | Fluent Bit configs | <pre>object({<br> fluent_bit_name = optional(string, "")<br> log_group_name = optional(string, "")<br> system_log_group_name = optional(string, "")<br> log_retention_days = optional(number, 90)<br> values_yaml = optional(string, "")<br> configs = optional(object({<br> inputs = optional(string, "")<br> filters = optional(string, "")<br> outputs = optional(string, "")<br> }), {})<br> drop_namespaces = optional(list(string), [])<br> log_filters = optional(list(string), [])<br> additional_log_filters = optional(list(string), [])<br> kube_namespaces = optional(list(string), [])<br> })</pre> | <pre>{<br> "additional_log_filters": [<br> "ELB-HealthChecker",<br> "Amazon-Route53-Health-Check-Service"<br> ],<br> "configs": {<br> "filters": "",<br> "inputs": "",<br> "outputs": ""<br> },<br> "drop_namespaces": [<br> "kube-system",<br> "opentelemetry-operator-system",<br> "adot",<br> "cert-manager",<br> "opentelemetry.*",<br> "meta.*"<br> ],<br> "fluent_bit_name": "",<br> "kube_namespaces": [<br> "kube.*",<br> "meta.*",<br> "adot.*",<br> "devops.*",<br> "cert-manager.*",<br> "git.*",<br> "opentelemetry.*",<br> "stakater.*",<br> "renovate.*"<br> ],<br> "log_filters": [<br> "kube-probe",<br> "health",<br> "prometheus",<br> "liveness"<br> ],<br> "log_group_name": "",<br> "log_retention_days": 90,<br> "system_log_group_name": "",<br> "values_yaml": ""<br>}</pre> | no |
Expand All @@ -269,6 +271,7 @@ worker_groups = {
| <a name="input_node_groups"></a> [node\_groups](#input\_node\_groups) | Map of EKS managed node group definitions to create | `any` | <pre>{<br> "default": {<br> "desired_size": 2,<br> "iam_role_additional_policies": [<br> "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"<br> ],<br> "instance_types": [<br> "t3.medium"<br> ],<br> "max_size": 4,<br> "min_size": 2<br> }<br>}</pre> | no |
| <a name="input_node_groups_default"></a> [node\_groups\_default](#input\_node\_groups\_default) | Map of EKS managed node group default configurations | `any` | <pre>{<br> "disk_size": 50,<br> "iam_role_additional_policies": [<br> "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"<br> ],<br> "instance_types": [<br> "t3.medium"<br> ]<br>}</pre> | no |
| <a name="input_node_security_group_additional_rules"></a> [node\_security\_group\_additional\_rules](#input\_node\_security\_group\_additional\_rules) | n/a | `any` | <pre>{<br> "ingress_cluster_10250": {<br> "description": "Metric server to node groups",<br> "from_port": 10250,<br> "protocol": "tcp",<br> "self": true,<br> "to_port": 10250,<br> "type": "ingress"<br> },<br> "ingress_cluster_8443": {<br> "description": "Metric server to node groups",<br> "from_port": 8443,<br> "protocol": "tcp",<br> "source_cluster_security_group": true,<br> "to_port": 8443,<br> "type": "ingress"<br> }<br>}</pre> | no |
| <a name="input_portainer_config"></a> [portainer\_config](#input\_portainer\_config) | Portainer hostname and ingress config. | <pre>object({<br> host = optional(string, "portainer.dasmeta.com")<br> enable_ingress = optional(bool, true)<br> })</pre> | `{}` | no |
| <a name="input_prometheus_metrics"></a> [prometheus\_metrics](#input\_prometheus\_metrics) | Prometheus Metrics | `any` | `[]` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS Region name. | `string` | `null` | no |
| <a name="input_roles"></a> [roles](#input\_roles) | Variable describes which role will user have K8s | <pre>list(object({<br> actions = list(string)<br> resources = list(string)<br> }))</pre> | `[]` | no |
Expand Down
2 changes: 1 addition & 1 deletion examples/spot-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.41 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 |

## Modules

Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,11 @@ module "api-gw-controller" {
vpc_id = var.api_gateway_resources[0].vpc_links != null ? module.vpc[0].id : null
subnet_ids = var.api_gateway_resources[0].vpc_links != null ? (var.vpc.create.private_subnets != {} ? module.vpc[0].private_subnets : var.vpc.link.private_subnet_ids) : null
}

module "portainer" {
count = var.enable_portainer ? 1 : 0

source = "./modules/portainer"
host = var.portainer_config.host
enable_ingress = var.portainer_config.enable_ingress
}
38 changes: 38 additions & 0 deletions modules/portainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# portainer

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <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.portainer](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_enable_ingress"></a> [enable\_ingress](#input\_enable\_ingress) | Weather create ingress or not in k8s | `bool` | `true` | no |
| <a name="input_host"></a> [host](#input\_host) | Ingress host name | `string` | `"portainer.dasmeta.com"` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_portainer_host"></a> [portainer\_host](#output\_portainer\_host) | n/a |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Empty file added modules/portainer/README.tf
Empty file.
62 changes: 62 additions & 0 deletions modules/portainer/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
resource "helm_release" "portainer" {
name = "portainer"
repository = "https://portainer.github.io/k8s/"
chart = "portainer"
version = "1.0.38"
create_namespace = true
namespace = "portainer"

set {
name = "service.type"
value = "NodePort"
}

set {
name = "tls.force"
value = "true"
}

set {
name = "ingress.enabled"
value = "true" ? var.enable_ingress : "false"
}

set {
name = "ingress.annotations.alb\\.ingress\\.kubernetes\\.io/group\\.name"
value = "portainer"
}

set {
name = "ingress.annotations.kubernetes\\.io/ingress\\.class"
value = "alb"
}

set {
name = "ingress.annotations.alb\\.ingress\\.kubernetes\\.io/listen-ports"
value = "[{'HTTPS':443}]"
}

set {
name = "ingress.hosts[0].host"
value = local.host
}

set {
name = "ingress.hosts[0].paths[0].path"
value = "/"
}

set {
name = "persistence.size"
value = "10Gi"
}

set {
name = "persistence.storageClass"
value = "gp2"
}
}

locals {
host = join("\\.", split(".", var.host))
}
3 changes: 3 additions & 0 deletions modules/portainer/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "portainer_host" {
value = var.host
}
11 changes: 11 additions & 0 deletions modules/portainer/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
variable "host" {
description = "Ingress host name"
type = string
default = "portainer.dasmeta.com"
}

variable "enable_ingress" {
description = "Weather create ingress or not in k8s"
type = bool
default = true
}
5 changes: 5 additions & 0 deletions modules/portainer/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
terraform {
required_providers {
helm = ">= 2.0"
}
}
15 changes: 15 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,18 @@ variable "prometheus_metrics" {
type = any
default = []
}

variable "enable_portainer" {
description = "Enable Portainer provisioning or not"
type = bool
default = false
}

variable "portainer_config" {
description = "Portainer hostname and ingress config."
type = object({
host = optional(string, "portainer.dasmeta.com")
enable_ingress = optional(bool, true)
})
default = {}
}
Loading