Skip to content

Commit

Permalink
Clickhouse fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanNWatt committed Oct 30, 2024
1 parent c6deb2c commit a30cbc7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
17 changes: 13 additions & 4 deletions examples/local_clickhouse/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@ provider "kubectl" {
config_path = "~/.kube/config"
}

module "relativistic" {
source = "../../"
clickhouse_enabled = true
}
# module "relativistic" {
# source = "../../"
# clickhouse_enabled = true
# clickhouse_password_sha256_hex = "153913a8df6d33f356847fb367ab0da2b1f828fc7a96cf38898560112983ae4a"
# }

module "relativistic2" {
source = "../../"
clickhouse_enabled = true
superset_enabled = true
airbyte_enabled = true
airbyte_enable_proxy = false
}

# module "clickhouse" {
# source = "../../modules/clickhouse"
# clickhouse_password_sha256_hex = "153913a8df6d33f356847fb367ab0da2b1f828fc7a96cf38898560112983ae4a"
# }


terraform {
required_providers {
Expand Down
24 changes: 5 additions & 19 deletions modules/clickhouse/clickhouse.yaml.tpl
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
#
# AWS resizable disk example
#
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: "${name}"
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
reclaimPolicy: Delete
#volumeBindingMode: Immediate
allowVolumeExpansion: true
---
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: "pv-multi-resize-${name}"
name: "ch-${name}"
spec:
configuration:
users:
# printf 'test_password' | sha256sum
test_user/password_sha256_hex: 10a6e6cc8311a3e2bcc09bf6c199adecd5dd59408c343e926b129c4914f3cb01
test_user/password_sha256_hex: ${clickhouse_password_sha256_hex}
# to allow access outside from kubernetes
test_user/networks/ip:
- 0.0.0.0/0
clusters:
- name: "pv-multi-resize-${name}"
- name: "ch-${name}"
templates:
podTemplate: pod-template-with-volumes-${name}
layout:
Expand All @@ -34,7 +20,7 @@ spec:

templates:
podTemplates:
- name: pod-template-with-volumes-${name}
- name: ch-pod-template-${name}
spec:
containers:
- name: clickhouse
Expand All @@ -44,7 +30,7 @@ spec:
mountPath: /data/clickhouse-01

volumeClaimTemplates:
- name: data-storage-vc-template-1-${name}
- name: ch-vc-template-1-${name}
spec:
storageClassName: "${name}"
accessModes:
Expand Down
14 changes: 14 additions & 0 deletions modules/clickhouse/clickhouse_storage.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# AWS resizable disk example
#
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: "${name}"
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
reclaimPolicy: Delete
#volumeBindingMode: Immediate
allowVolumeExpansion: true
---
13 changes: 10 additions & 3 deletions modules/clickhouse/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
zresource "random_string" "clickhouse_suffix" {
length = 8
resource "random_string" "clickhouse_suffix" {
length = 4
special = false
upper = false
}
Expand Down Expand Up @@ -30,9 +30,16 @@ variable "clickhouse_password_sha256_hex" {
default = "10a6e6cc8311a3e2bcc09bf6c199adecd5dd59408c343e926b129c4914f3cb01"
}

resource "kubectl_manifest" "clickhouse_storage_class" {
yaml_body = templatefile("${path.module}/clickhouse_storage.yaml.tpl", {
name = "${random_string.clickhouse_suffix.result}"
})
}

resource "kubectl_manifest" "clickhouse_instance" {
depends_on = [kubectl_manifest.clickhouse_storage_class]
yaml_body = templatefile("${path.module}/clickhouse.yaml.tpl", {
name = "clickhouse-1",
name = "${random_string.clickhouse_suffix.result}",
clickhouse_password_sha256_hex = var.clickhouse_password_sha256_hex
})
}
Expand Down
4 changes: 2 additions & 2 deletions modules/superset/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ variable "superset_default_user" {
}

variable "superset_default_password" {
description = "Default user for Superset"
description = "Default User Password for Superset"
type = string
default = "admin"
}

variable "superset_secret_key" {
description = "Default user for Superset"
description = "Default Secret Jey for Superset"
type = string
}

Expand Down

0 comments on commit a30cbc7

Please sign in to comment.