Skip to content

Commit

Permalink
feat(DMVP-1226): Modified template file and related to that variables…
Browse files Browse the repository at this point in the history
… and changes to examples
  • Loading branch information
VahagnMian committed Sep 23, 2022
1 parent eaffc04 commit 4828802
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ module "cluster_max" {
| <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 |
| <a name="input_users"></a> [users](#input\_users) | n/a | `any` | n/a | yes |
| <a name="input_vpc_name"></a> [vpc\_name](#input\_vpc\_name) | Creating VPC name. | `string` | n/a | yes |
| <a name="input_weave_scope_config"></a> [weave\_scope\_config](#input\_weave\_scope\_config) | Weave scope namespace configuration variables | <pre>object({<br> create_namespace = bool<br> namespace = string<br> annotations = map(string)<br> ingress_host = string<br> ingress_class = string<br> service_type = string<br> weave_helm_release_name = string<br> })</pre> | <pre>{<br> "annotations": {},<br> "create_namespace": true,<br> "ingress_class": "",<br> "ingress_host": "",<br> "namespace": "meta-system",<br> "service_type": "NodePort",<br> "weave_helm_release_name": "weave"<br>}</pre> | no |
| <a name="input_weave_scope_config"></a> [weave\_scope\_config](#input\_weave\_scope\_config) | Weave scope namespace configuration variables | <pre>object({<br> create_namespace = bool<br> namespace = string<br> annotations = map(string)<br> ingress_host = string<br> ingress_class = string<br> ingress_name = string<br> service_type = string<br> weave_helm_release_name = string<br> })</pre> | <pre>{<br> "annotations": {},<br> "create_namespace": true,<br> "ingress_class": "",<br> "ingress_host": "",<br> "ingress_name": "weave-ingress",<br> "namespace": "meta-system",<br> "service_type": "NodePort",<br> "weave_helm_release_name": "weave"<br>}</pre> | no |
| <a name="input_weave_scope_enabled"></a> [weave\_scope\_enabled](#input\_weave\_scope\_enabled) | Weather enable Weave Scope or not | `bool` | `false` | no |
| <a name="input_worker_groups"></a> [worker\_groups](#input\_worker\_groups) | Worker groups. | `any` | `{}` | no |
| <a name="input_workers_group_defaults"></a> [workers\_group\_defaults](#input\_workers\_group\_defaults) | Worker group defaults. | `any` | <pre>{<br> "launch_template_name": "default",<br> "launch_template_use_name_prefix": true,<br> "root_volume_size": 50,<br> "root_volume_type": "gp2"<br>}</pre> | no |
Expand Down
1 change: 1 addition & 0 deletions modules/weave-scope/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ No modules.
| <a name="input_create_namespace"></a> [create\_namespace](#input\_create\_namespace) | Weather create namespace or not | `bool` | `true` | no |
| <a name="input_ingress_class"></a> [ingress\_class](#input\_ingress\_class) | Ingress class name used for Ingress configuration | `string` | `""` | no |
| <a name="input_ingress_host"></a> [ingress\_host](#input\_ingress\_host) | Ingress host name used for Ingress configuration | `string` | `""` | no |
| <a name="input_ingress_name"></a> [ingress\_name](#input\_ingress\_name) | Ingress name to configure in helm chart | `string` | `"weave-ingress"` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Kubernetes namespace, in which Weave Scope will be deployed | `string` | `"meta-system"` | no |
| <a name="input_release_name"></a> [release\_name](#input\_release\_name) | Helm chart release name | `string` | `"weave-scope"` | no |
| <a name="input_service_type"></a> [service\_type](#input\_service\_type) | Service type configuration Valid attributes are NodePort, LoadBalancer, ClusterIP | `string` | `"ClusterIP"` | no |
Expand Down
17 changes: 16 additions & 1 deletion modules/weave-scope/examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# examples

```
module "weave-scope" {
source = "./modules/weave-scope"
namespace = "weave-scope"
create_namespace = true
release_name = "weave"
ingress_class = "nginx"
ingress_host = "www.weave-scope.com"
ingress_name = "weave-ingress"
annotations = {"key1" = "value1", "key2" = "value2"}
service_type = NodePort
}
```

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

Expand All @@ -13,7 +27,8 @@ No providers.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_weave-scope-with-ingress"></a> [weave-scope-with-ingress](#module\_weave-scope-with-ingress) | ../ | n/a |
| <a name="module_weave-scope-minimal"></a> [weave-scope-minimal](#module\_weave-scope-minimal) | ./modules/weave-scope | n/a |
| <a name="module_weave-scope-with-ingress"></a> [weave-scope-with-ingress](#module\_weave-scope-with-ingress) | ./modules/weave-scope | n/a |

## Resources

Expand Down
4 changes: 2 additions & 2 deletions modules/weave-scope/examples/minimal.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module "weave-scope-with-ingress" {
source = "../"
module "weave-scope-minimal" {
source = "./modules/weave-scope"
}
8 changes: 4 additions & 4 deletions modules/weave-scope/examples/with-ingress.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "weave-scope-with-ingress" {
source = "../"

ingress_enabled = true
ingress_host = "some.domain.name"
source = "./modules/weave-scope"
ingress_class = "nginx"
ingress_host = "www.weave-scope.com"
ingress_name = "weave-ingress"
}
7 changes: 5 additions & 2 deletions modules/weave-scope/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ resource "helm_release" "weave-scope" {
values = [
templatefile("${path.module}/resources/values.yaml.tpl",
{
config = var.annotations
service_type = var.service_type
config = var.annotations
service_type = var.service_type
ingress_host = var.ingress_host
ingress_name = var.ingress_name
ingress_class = var.ingress_class
})
]
}
12 changes: 3 additions & 9 deletions modules/weave-scope/resources/values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ weave-scope-frontend:

ingress:
enabled: enabled
name: ingress-name
host: weave.miandevops.xyz
name: ${ingress_name}
host: ${ingress_host}
path: "/"
className: ""
className: ${ingress_class}
extraPaths: ""
annotations:
%{~ for config_key, config_value in config ~}
Expand All @@ -26,12 +26,6 @@ weave-scope-frontend:
servicePort: 80
externalPort: 8080

# hosts:
# - name: chartmuseum.domain1.com
# path: /
# tls: false
# - name: chartmuseum.domain2.com
# path: /
weave-scope-agent:
enabled: true
dockerBridge: "docker0"
Expand Down
6 changes: 6 additions & 0 deletions modules/weave-scope/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ variable "service_type" {
error_message = "The valid attributes are [NodePort], [LoadBalancer], [ClusterIP]"
}
}

variable "ingress_name" {
description = "Ingress name to configure in helm chart"
type = string
default = "weave-ingress"
}
2 changes: 2 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ variable "weave_scope_config" {
annotations = map(string)
ingress_host = string
ingress_class = string
ingress_name = string
service_type = string
weave_helm_release_name = string
})
Expand All @@ -190,6 +191,7 @@ variable "weave_scope_config" {
ingress_class = ""
service_type = "NodePort"
weave_helm_release_name = "weave"
ingress_name = "weave-ingress"
}
}

Expand Down
2 changes: 2 additions & 0 deletions wave-scope-dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module "weave-scope" {
release_name = var.weave_scope_config.weave_helm_release_name
ingress_class = var.weave_scope_config.ingress_class
ingress_host = var.weave_scope_config.ingress_host
ingress_name = var.weave_scope_config.ingress_name
annotations = var.weave_scope_config.annotations
service_type = var.weave_scope_config.service_type

}

0 comments on commit 4828802

Please sign in to comment.