Skip to content

Commit 079dad5

Browse files
committed
Upgraded to v2.0.0 to include clustertemplate support
1 parent 90492ed commit 079dad5

File tree

1 file changed

+140
-22
lines changed

1 file changed

+140
-22
lines changed

README.md

Lines changed: 140 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ This is a sample "main.tf" file. In this example, we are creating a 3-node Ubun
2323

2424
Additionally, with the "VIP" tag, we enable Kubevip for HA. The Edge Host is now looked up via the "tag" on the Edge Host. Multiple tags can be used for this purpose. See the example for usage with multiple pools. The Tag(s) should be added to the Edge Host before running the plan. This applies to virtual machines as well. For ease of use, we have provided a QRCode giving you the ability to easily copy the UID of the device.
2525

26-
| QR Code | UID Copy |
27-
| --------|--------- |
28-
![QRCode](images/qrcode.png) | ![UID Copy](images/uid_copy.png)
2926

3027
```tf
31-
module "edge-demo-module" {
28+
## #########################################################################################
29+
## Example of using cluster profiles with a cluster template
30+
## #########################################################################################
31+
32+
module "edge-demo-module-template" {
3233
source = "spectrocloud/edge/spectrocloud"
33-
version = "1.5.0"
34+
version = "2.0.0"
3435
# Store Number/Location
3536
name = "demo"
3637
# add tags to the cluster (optional) list(strings)
@@ -44,10 +45,10 @@ module "edge-demo-module" {
4445
]
4546
4647
# Cluster VIP to be used with KubeVIP If not using Overlay
47-
# cluster_vip = "10.10.100.5"
48+
cluster_vip = "10.100.101.71"
4849
4950
# Overlay CIDR Range
50-
overlay_cidr_range = "100.64.128.0/18"
51+
# overlay_cidr_range = "100.64.128.0/18"
5152
5253
# Node Pools for Cluster
5354
machine_pools = [
@@ -61,27 +62,144 @@ module "edge-demo-module" {
6162
}
6263
edge_host = [
6364
{
64-
host_uid = "edge12345"
65-
host_name = "edge1"
66-
static_ip = "10.100.100.31"
67-
subnet_mask = "255.255.255.0"
65+
host_uid = "demo-18b14144f3c7e249be69ea02992a8801"
66+
host_name = "edge1"
67+
static_ip = "10.100.100.31"
68+
subnet_mask = "255.255.255.0"
6869
default_gateway = "10.100.100.1"
69-
dns_servers = ["10.100.100.1","10.100.100.2"]
70+
dns_servers = ["10.100.100.1", "10.100.100.2"]
7071
7172
},
72-
{
73-
host_uid = "edge123456"
74-
host_name = "edge2"
75-
static_ip = "10.100.100.32"
76-
subnet_mask = "255.255.255.0"
73+
{
74+
host_uid = "edge123456"
75+
host_name = "edge2"
76+
static_ip = "10.100.100.32"
77+
subnet_mask = "255.255.255.0"
7778
default_gateway = "10.100.100.1"
78-
dns_servers = ["10.100.100.1","10.100.100.2"]
79-
nic_name = "auto"
79+
dns_servers = ["10.100.100.1", "10.100.100.2"]
80+
nic_name = "auto"
8081
8182
}
8283
]
8384
},
84-
# Add additional node pools
85+
# # Add additional node pools
86+
{
87+
name = "gpu"
88+
control_plane = false
89+
edge_host = [
90+
91+
{
92+
host_uid = "123test"
93+
static_ip = "2.2.2.2"
94+
}
95+
]
96+
additional_labels = {
97+
"type" : "gpu",
98+
"region" : "east"
99+
}
100+
}
101+
102+
]
103+
104+
# Cluster Geolocation (Optional)
105+
location = {
106+
latitude = 40.442829
107+
longitude = -79.950432
108+
}
109+
rbac_bindings = [
110+
{
111+
rbac_type = "ClusterRoleBinding"
112+
rbac_role = {
113+
name = "cluster-admin"
114+
kind = "ClusterRole"
115+
}
116+
subjects = [
117+
{
118+
name = "k8s-admin"
119+
rbac_type = "Group"
120+
}
121+
]
122+
}
123+
]
124+
125+
# Template and profile IDs are looked up automatically by name
126+
cluster_template = {
127+
name = "east-clusters"
128+
context = "project" # Optional: "project" (default) or "tenant"
129+
cluster_profile = [
130+
{
131+
name = "edge-profile"
132+
tag = "1.33.5" # Optional: version tag
133+
context = "project" # Optional: "project" (default), "tenant", or "system"
134+
variables = {
135+
"clusterCIDR" = "10.10.100.0/18"
136+
"svcCIDR" = "10.10.128.0/18"
137+
}
138+
}
139+
]
140+
}
141+
142+
}
143+
144+
145+
## #########################################################################################
146+
## Example of using cluster profiles without a cluster template
147+
## #########################################################################################
148+
149+
module "edge-demo-module-no-template" {
150+
source = "spectrocloud/edge/spectrocloud"
151+
version = "2.0.0"
152+
# Store Number/Location
153+
name = "demo"
154+
# add tags to the cluster (optional) list(strings)
155+
cluster_tags = ["origin:terraform"]
156+
ssh_keys = [
157+
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbm test2",
158+
"ecdsa-sha2-nistp256 AAAAE2VjZHNhL test1"]
159+
ntp_servers = [
160+
"10.10.10.1",
161+
"10.10.10.2"
162+
]
163+
164+
# Cluster VIP to be used with KubeVIP If not using Overlay
165+
cluster_vip = "10.100.101.71"
166+
167+
# Overlay CIDR Range
168+
# overlay_cidr_range = "100.64.128.0/18"
169+
170+
# Node Pools for Cluster
171+
machine_pools = [
172+
# Control Plane Node Pool
173+
{
174+
name = "control-plane"
175+
control_plane = true
176+
control_plane_as_worker = false
177+
additional_labels = {
178+
"region" : "east"
179+
}
180+
edge_host = [
181+
{
182+
host_uid = "demo-18b14144f3c7e249be69ea02992a8801"
183+
host_name = "edge1"
184+
static_ip = "10.100.100.31"
185+
subnet_mask = "255.255.255.0"
186+
default_gateway = "10.100.100.1"
187+
dns_servers = ["10.100.100.1", "10.100.100.2"]
188+
189+
},
190+
{
191+
host_uid = "edge123456"
192+
host_name = "edge2"
193+
static_ip = "10.100.100.32"
194+
subnet_mask = "255.255.255.0"
195+
default_gateway = "10.100.100.1"
196+
dns_servers = ["10.100.100.1", "10.100.100.2"]
197+
nic_name = "auto"
198+
199+
}
200+
]
201+
},
202+
# # Add additional node pools
85203
{
86204
name = "gpu"
87205
control_plane = false
@@ -104,7 +222,7 @@ module "edge-demo-module" {
104222
cluster_profiles = [
105223
{
106224
name = "edge-profile"
107-
tag = "1.30.5-ubuntu"
225+
tag = "1.33.5"
108226
context = "project"
109227
},
110228
{
@@ -138,10 +256,10 @@ module "edge-demo-module" {
138256
]
139257
}
140258
]
141-
142259
}
143260
144261
262+
145263
```
146264
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
147265
## Requirements

0 commit comments

Comments
 (0)