-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding conda-store terraform charts along with postgres/minio charts
- Loading branch information
Showing
10 changed files
with
231 additions
and
52 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...ry }}/infrastructure/modules/kubernetes/services/conda-store/config/conda-store-config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import logging | ||
|
||
from conda_store_server.storage import S3Storage | ||
from conda_store_server.server.auth import DummyAuthentication | ||
|
||
# ================================== | ||
# conda-store settings | ||
# ================================== | ||
c.CondaStore.storage_class = S3Storage | ||
c.CondaStore.store_directory = "/opt/conda-store/" | ||
c.CondaStore.environment_directory = "/opt/environments/" | ||
c.CondaStore.database_url = "postgresql+psycopg2://admin:password@postgres/conda-store" | ||
c.CondaStore.default_uid = 1000 | ||
c.CondaStore.default_gid = 100 | ||
c.CondaStore.default_permissions = "775" | ||
|
||
c.S3Storage.internal_endpoint = "minio:9000" | ||
c.S3Storage.external_endpoint = "localhost:30900" | ||
c.S3Storage.access_key = "admin" | ||
c.S3Storage.secret_key = "password" | ||
c.S3Storage.region = "us-east-1" # minio region default | ||
c.S3Storage.bucket_name = "conda-store" | ||
c.S3Storage.secure = False | ||
|
||
# ================================== | ||
# server settings | ||
# ================================== | ||
c.CondaStoreServer.log_level = logging.INFO | ||
c.CondaStoreServer.enable_ui = True | ||
c.CondaStoreServer.enable_api = True | ||
c.CondaStoreServer.enable_registry = True | ||
c.CondaStoreServer.enable_metrics = True | ||
c.CondaStoreServer.address = "0.0.0.0" | ||
c.CondaStoreServer.port = 5000 | ||
# This MUST start with `/` | ||
c.CondaStoreServer.url_prefix = "/" | ||
|
||
|
||
# ================================== | ||
# auth settings | ||
# ================================== | ||
c.CondaStoreServer.authentication_class = DummyAuthentication | ||
|
||
# ================================== | ||
# worker settings | ||
# ================================== | ||
c.CondaStoreWorker.log_level = logging.INFO | ||
c.CondaStoreWorker.watch_paths = ["/opt/environments"] |
4 changes: 2 additions & 2 deletions
4
...cutter.repo_directory }}/infrastructure/modules/kubernetes/services/conda-store/output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
output "endpoint" { | ||
description = "Endpoint dns name of conda-store nfs server" | ||
value = "${var.name}-nfs.${var.namespace}.svc.cluster.local" | ||
value = "${kubernetes_service.nfs.metadata.0.name}.${var.namespace}.svc.cluster.local" | ||
} | ||
|
||
output "endpoint_ip" { | ||
description = "IP Address of conda-store nfs server" | ||
value = kubernetes_service.main.spec.0.cluster_ip | ||
value = kubernetes_service.nfs.spec.0.cluster_ip | ||
} |
97 changes: 97 additions & 0 deletions
97
...cutter.repo_directory }}/infrastructure/modules/kubernetes/services/conda-store/server.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
resource "kubernetes_config_map" "conda-store-config" { | ||
metadata { | ||
name = "conda-store-config" | ||
namespace = var.namespace | ||
} | ||
|
||
"conda-store-config.py" = file("${path.module}/config/conda-store-config.py") | ||
} | ||
|
||
|
||
resource "kubernetes_service" "server" { | ||
metadata { | ||
name = "${var.name}-conda-store-server" | ||
namespace = var.namespace | ||
} | ||
|
||
spec { | ||
selector = { | ||
role = "${var.name}-conda-store-server" | ||
} | ||
|
||
port { | ||
name = "conda-store-server" | ||
port = 5000 | ||
} | ||
} | ||
} | ||
|
||
|
||
resource "kubernetes_deployment" "main" { | ||
metadata { | ||
name = "${var.name}-conda-store-server" | ||
namespace = var.namespace | ||
labels = { | ||
role = "${var.name}-conda-store-server" | ||
} | ||
} | ||
|
||
spec { | ||
replicas = 1 | ||
|
||
selector { | ||
match_labels = { | ||
role = "${var.name}-conda-store-server" | ||
} | ||
} | ||
|
||
template { | ||
metadata { | ||
labels = { | ||
role = "${var.name}-conda-store-server" | ||
} | ||
} | ||
|
||
spec { | ||
affinity { | ||
node_affinity { | ||
required_during_scheduling_ignored_during_execution { | ||
node_selector_term { | ||
match_expressions { | ||
key = var.node-group.key | ||
operator = "In" | ||
values = [ | ||
var.node-group.value | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
container { | ||
name = "conda-store-server" | ||
image = "${var.conda-store-image.name}:${var.conda-store-image.tag}" | ||
|
||
command = [ | ||
- "conda-store-server" | ||
- "--config" | ||
- "/etc/conda-store/conda_store_config.py" | ||
] | ||
|
||
volume_mount { | ||
name = "config" | ||
mount_path = "/etc/conda-store" | ||
} | ||
} | ||
|
||
volume { | ||
name = "config" | ||
config_map { | ||
name = kubernetes_config_map.conda-store-config.metadata.0.name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...{ cookiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/minio/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "helm_release" "minio" { | ||
name = "minio" | ||
namespace = var.namespace | ||
|
||
repository = "https://charts.bitnami.com/bitnami" | ||
chart = "bitnami/minio" | ||
version = "9.2.4" | ||
|
||
values = concat([ | ||
file("${path.module}/values.yaml"), | ||
], var.overrides) | ||
} |
Empty file.
Empty file.
12 changes: 12 additions & 0 deletions
12
...kiecutter.repo_directory }}/infrastructure/modules/kubernetes/services/postgresql/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "helm_release" "postgresql" { | ||
name = "postgresql" | ||
namespace = var.namespace | ||
|
||
repository = "https://charts.bitnami.com/bitnami" | ||
chart = "bitnami/postgresql" | ||
version = "10.13.12" | ||
|
||
values = concat([ | ||
file("${path.module}/values.yaml"), | ||
], var.overrides) | ||
} |
Empty file.
Empty file.