Skip to content

Commit

Permalink
feat(sks): add configuration to make Traefik work with new SKS module (
Browse files Browse the repository at this point in the history
…#44)

* feat(sks): add configuration to make Traefik work with new SKS module

* docs(terraform-docs): generate docs and write to README.adoc

* docs(terraform-docs): generate docs and write to README.adoc

---------

Co-authored-by: lentidas <[email protected]>
  • Loading branch information
lentidas and lentidas authored May 17, 2023
1 parent 781ad8d commit 50f4f8f
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ The following requirements are needed by this module:

The following providers are used by this module:

- [[provider_null]] <<provider_null,null>>

- [[provider_utils]] <<provider_utils,utils>> (>= 1)

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 4)

- [[provider_null]] <<provider_null,null>>

=== Resources

The following resources are used by this module:
Expand Down Expand Up @@ -140,9 +140,9 @@ Description: ID to pass other modules in order to refer to this module as a depe
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 4
|[[provider_null]] <<provider_null,null>> |n/a
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 4
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|===

= Resources
Expand Down Expand Up @@ -245,4 +245,4 @@ object({
|Name |Description
|[[output_id]] <<output_id,id>> |ID to pass other modules in order to refer to this module as a dependency.
|===
// END_TF_TABLES
// END_TF_TABLES
44 changes: 40 additions & 4 deletions sks/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@ The following Modules are called:

==== [[module_traefik]] <<module_traefik,traefik>>

Source: ../nodeport/
Source: ../

Version:

=== Required Inputs

The following input variables are required:

==== [[input_nlb_id]] <<input_nlb_id,nlb_id>>

Description: ID of the Exoscale NLB to use for the SKS cluster.

Type: `string`

==== [[input_router_nodepool_id]] <<input_router_nodepool_id,router_nodepool_id>>

Description: ID of the node pool specifically created for Traefik.

Type: `string`

==== [[input_router_instance_pool_id]] <<input_router_instance_pool_id,router_instance_pool_id>>

Description: Instance pool ID of the node pool specifically created for Traefik.

Type: `string`

==== [[input_cluster_name]] <<input_cluster_name,cluster_name>>

Description: Name given to the cluster. Value used for the ingress' URL of the application.
Expand Down Expand Up @@ -113,7 +131,7 @@ The following outputs are exported:

==== [[output_id]] <<output_id,id>>

Description: n/a
Description: ID to pass other modules in order to refer to this module as a dependency. It takes the ID that comes from the main module and passes it along to the code that called this variant in the first place.
// END_TF_DOCS
// BEGIN_TF_TABLES
= Requirements
Expand All @@ -130,14 +148,32 @@ Description: n/a
[cols="a,a,a",options="header,autowidth"]
|===
|Name |Source |Version
|[[module_traefik]] <<module_traefik,traefik>> |../nodeport/ |
|[[module_traefik]] <<module_traefik,traefik>> |../ |
|===

= Inputs

[cols="a,a,a,a,a",options="header,autowidth"]
|===
|Name |Description |Type |Default |Required
|[[input_nlb_id]] <<input_nlb_id,nlb_id>>
|ID of the Exoscale NLB to use for the SKS cluster.
|`string`
|n/a
|yes

|[[input_router_nodepool_id]] <<input_router_nodepool_id,router_nodepool_id>>
|ID of the node pool specifically created for Traefik.
|`string`
|n/a
|yes

|[[input_router_instance_pool_id]] <<input_router_instance_pool_id,router_instance_pool_id>>
|Instance pool ID of the node pool specifically created for Traefik.
|`string`
|n/a
|yes

|[[input_cluster_name]] <<input_cluster_name,cluster_name>>
|Name given to the cluster. Value used for the ingress' URL of the application.
|`string`
Expand Down Expand Up @@ -219,6 +255,6 @@ object({
[cols="a,a",options="header,autowidth"]
|===
|Name |Description
|[[output_id]] <<output_id,id>> |n/a
|[[output_id]] <<output_id,id>> |ID to pass other modules in order to refer to this module as a dependency. It takes the ID that comes from the main module and passes it along to the code that called this variant in the first place.
|===
// END_TF_TABLES
14 changes: 14 additions & 0 deletions sks/extra-variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "nlb_id" {
description = "ID of the Exoscale NLB to use for the SKS cluster."
type = string
}

variable "router_nodepool_id" {
description = "ID of the node pool specifically created for Traefik."
type = string
}

variable "router_instance_pool_id" {
description = "Instance pool ID of the node pool specifically created for Traefik."
type = string
}
21 changes: 20 additions & 1 deletion sks/locals.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
locals {
helm_values = []
helm_values = [{
traefik = {
service = {
annotations = {
"service.beta.kubernetes.io/exoscale-loadbalancer-id" = var.nlb_id
"service.beta.kubernetes.io/exoscale-loadbalancer-external" = "true"
"service.beta.kubernetes.io/exoscale-loadbalancer-service-instancepool-id" = var.router_instance_pool_id
}
}
nodeSelector = {
"node.exoscale.net/nodepool-id" = var.router_nodepool_id
}
tolerations = [{
key = "nodepool"
operator = "Equal"
value = "router"
effect = "NoSchedule"
}]
}
}]
}
2 changes: 1 addition & 1 deletion sks/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "traefik" {
source = "../nodeport/"
source = "../"

cluster_name = var.cluster_name
base_domain = var.base_domain
Expand Down
3 changes: 2 additions & 1 deletion sks/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "id" {
value = module.traefik.id
description = "ID to pass other modules in order to refer to this module as a dependency. It takes the ID that comes from the main module and passes it along to the code that called this variant in the first place."
value = module.traefik.id
}

0 comments on commit 50f4f8f

Please sign in to comment.