Skip to content

Commit be67661

Browse files
authored
Merge pull request #128 from pluralsh/byok
Add support to BYOK
2 parents 4d06fea + c324f24 commit be67661

6 files changed

Lines changed: 137 additions & 0 deletions

File tree

charts/runtime/values.yaml.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ ingress-nginx-private:
4545
enabled: false
4646
{{ end }}
4747

48+
{{ if eq .Provider "byok" }}
49+
external-dns:
50+
enabled: false
51+
52+
plural-certmanager-webhook:
53+
enabled: true
54+
55+
operator:
56+
enabled: true
57+
58+
application:
59+
enabled: false
60+
61+
plural:
62+
enabled: false
63+
64+
ingress-nginx:
65+
enabled: false
66+
ingress-nginx-private:
67+
enabled: false
68+
{{ end }}
69+
4870
{{ if and (eq .Provider "aws") (not .Cloud) }}
4971
ingress-nginx:
5072
controller:

templates/providers/apps/byok.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
backend "local" {}
5+
6+
required_providers {
7+
kubernetes = {
8+
source = "hashicorp/kubernetes"
9+
version = ">= 2.10"
10+
}
11+
plural = {
12+
source = "pluralsh/plural"
13+
version = ">= 0.2.16"
14+
}
15+
}
16+
}
17+
18+
provider "kubernetes" {
19+
config_path = "~/.kube/config"
20+
}
21+
22+
data "kubernetes_secret_v1" "console-auth" {
23+
metadata {
24+
name = "console-auth-token"
25+
namespace = "plrl-console"
26+
}
27+
}
28+
29+
provider "plural" {
30+
console_url = "https://console.{{ .Subdomain }}"
31+
access_token = data.kubernetes_secret_v1.console-auth.data["access-token"]
32+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
backend "local" {}
5+
6+
required_providers {
7+
kubernetes = {
8+
source = "hashicorp/kubernetes"
9+
version = ">= 2.10"
10+
}
11+
helm = {
12+
source = "hashicorp/helm"
13+
version = "2.14.0"
14+
}
15+
local = {
16+
source = "hashicorp/local"
17+
version = "2.5.2"
18+
}
19+
null = {
20+
source = "hashicorp/null"
21+
version = ">= 3.0"
22+
}
23+
}
24+
}
25+
26+
provider "kubernetes" {
27+
config_path = "~/.kube/config"
28+
}
29+
30+
provider "helm" {
31+
kubernetes {
32+
config_path = "~/.kube/config"
33+
}
34+
}
35+

templates/setup/providers/byok.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// BYOK – the cluster already exists externally, so the mgmt module is just a
2+
// stub that provides the outputs expected by console.tf without provisioning anything.
3+
module "mgmt" {
4+
source = "./cluster"
5+
db_url = "{{ .Context.DbUrl }}"
6+
}
7+

templates/setup/stacks/byok.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: stacks
5+
namespace: plrl-deploy-operator
6+

terraform/clouds/byok/main.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# BYOK stub cluster module.
2+
# The cluster already exists externally; this module only supplies the output
3+
# attributes that console.tf depends on so that file can be used unchanged
4+
# across all providers.
5+
6+
# Optional external database URL. Leave empty to run the console without a
7+
# managed database (SQLite / in-cluster DB depending on the console chart).
8+
variable "db_url" {
9+
type = string
10+
default = ""
11+
sensitive = true
12+
}
13+
14+
resource "null_resource" "cluster" {}
15+
16+
# Represents the cluster being "ready" – satisfied immediately for BYOK since
17+
# the cluster is pre-existing.
18+
output "cluster" {
19+
value = null_resource.cluster.id
20+
}
21+
22+
output "ready" {
23+
value = null_resource.cluster.id
24+
}
25+
26+
output "db_url" {
27+
value = var.db_url
28+
sensitive = true
29+
}
30+
31+
# No cloud IAM identity needed for BYOK.
32+
output "identity" {
33+
value = ""
34+
}
35+

0 commit comments

Comments
 (0)