Skip to content

Commit

Permalink
feat: add SKS variant with needed configuration to use SOS
Browse files Browse the repository at this point in the history
  • Loading branch information
lentidas committed Jun 28, 2023
1 parent 35d92f4 commit 145e08b
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
terraform-docs:
uses: camptocamp/devops-stack/.github/workflows/modules-terraform-docs.yaml@main
with:
variants: "aks,eks,kind"
variants: "aks,eks,kind,sks"
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 "cluster_id" {
description = "ID of the SKS cluster."
type = string
}

variable "logs_storage" {
description = "Exoscale SOS bucket configuration values for the bucket where the logs will be stored."
type = object({
bucket_name = string
bucket_region = string
access_key = string
secret_access_key = string
})
}
83 changes: 83 additions & 0 deletions sks/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
locals {
helm_values = [var.distributed_mode ? {
loki-distributed = {
global = {
clusterDomain = "${var.cluster_id}.cluster.local"
}
loki = {
schemaConfig = local.schema_config
storageConfig = local.storage_config
structuredConfig = {
compactor = local.compactor
}
}
}
promtail = {
tolerations = local.promtail_tolerations
}
} : null, var.distributed_mode ? null : {
loki_stack = {
loki = {
config = {
ingester = {
lifecycler = {
ring = {
kvstore = {
store = "memberlist"
}
replication_factor = 1
}
final_sleep = "0s"
}
chunk_idle_period = "5m"
chunk_retain_period = "30s"
}
schema_config = local.schema_config
storage_config = local.storage_config
compactor = local.compactor
}
}
}
}]

schema_config = {
configs = [{
from = "2020-10-24"
store = "boltdb-shipper"
object_store = "s3"
schema = "v11"
index = {
prefix = "index_"
period = "24h"
}
}]
}

storage_config = {
aws = {
bucketnames = "${var.logs_storage.bucket_name}"
region = "${var.logs_storage.bucket_region}"
endpoint = "sos-${var.logs_storage.bucket_region}.exo.io"
access_key_id = "${var.logs_storage.access_key}"
secret_access_key = "${var.logs_storage.secret_access_key}"
s3forcepathstyle = true
}
boltdb_shipper = {
shared_store = "s3"
}
}

compactor = {
working_directory = "/data/compactor"
shared_store = "s3"
}

promtail_tolerations = [
{
key = "nodepool"
operator = "Equal"
value = "router"
effect = "NoSchedule"
},
]
}
15 changes: 15 additions & 0 deletions sks/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module "loki-stack" {
source = "../"

argocd_namespace = var.argocd_namespace
target_revision = var.target_revision
namespace = var.namespace
app_autosync = var.app_autosync
dependency_ids = var.dependency_ids

distributed_mode = var.distributed_mode
ingress = var.ingress
enable_filebeat = var.enable_filebeat

helm_values = concat(local.helm_values, var.helm_values)
}
10 changes: 10 additions & 0 deletions sks/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
output "id" {
description = "ID to pass other modules in order to refer to this module as a dependency."
value = module.loki-stack.id
}

output "loki_credentials" {
description = "Credentials to access the Loki ingress, if activated."
value = module.loki-stack.loki_credentials
sensitive = true
}
1 change: 1 addition & 0 deletions sks/terraform.tf
1 change: 1 addition & 0 deletions sks/variables.tf

0 comments on commit 145e08b

Please sign in to comment.