Skip to content

Commit 2f9531b

Browse files
committed
feat: improved multi-cluster handling, added thanos storage manifests
updated docs as well Signed-off-by: Ali Mukadam <ali.mukadam@oracle.com>
1 parent 59b889c commit 2f9531b

28 files changed

+340
-201
lines changed

admin.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ resource "oci_objectstorage_bucket" "thanos_admin" {
103103

104104
provider = oci.sydney
105105

106-
count = lookup(var.thanos, "enabled", "false") ? 1 : 0
106+
count = tobool(lookup(var.thanos, "enabled", "false")) ? 1 : 0
107107
}

docs/src/advanced/thanos.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ When the above is configured, they will be generated and added to the Custom Res
3434
1. For each cluster, use the following to configure your user principal authentication for Thanos:
3535

3636
``` yaml, editable
37-
{{#include ../../../modules/verrazzano/resources/thanos-storage.yaml.example:4:}}
37+
{{#include ../../../modules/verrazzano/resources/thanos-storage.yaml.example:1:}}
3838
```
3939
2. Save the file as storage.yaml
4040

@@ -54,7 +54,6 @@ TODO
5454
Before enabling Thanos, ensure the following secret is created:
5555

5656
``` bash
57-
5857
kubectl create namespace verrazzano-monitoring
5958
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=storage.yaml
6059
```

docs/src/multi/multi.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ whereas a managed cluster typically consists only of the application workload, t
99
![Managed Cluster](../images/managedcluster.svg)
1010

1111
- [With Public Endpoints](./pub-ep.md)
12-
- [With Private Endpoints](./pri-ep.md)
13-
- [With Public Load Balancers](./pub-lb.md)
14-
- [With Private Load Balancers](./pri-lb.md)
12+
- [With Private Endpoints](./pri-ep.md)

docs/src/multi/pri-ep.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,26 @@ for cluster in admin phoenix ; do
335335
done
336336
```
337337

338-
5. Install the Verrazzano Admin cluster:
338+
5. If you are using Thanos, configure your secret for OCI Object Storage now. For each enabled cluster, a storage file is created. Edit them and enter the following and create a secret:
339+
340+
- compartment_ocid
341+
- region
342+
- tenancy_ocid
343+
- user_ocid
344+
- fingerprint
345+
- and the private key
346+
347+
```
348+
cd /home/opc/vz/clusters
349+
for cluster in admin phoenix; do
350+
kubectx $cluster
351+
kubectl create namespace verrazzano-monitoring
352+
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=thanos_$cluster_storage.yaml
353+
done
354+
355+
```
356+
357+
6. Install the Verrazzano Admin cluster:
339358

340359
```
341360
cd /home/opc/vz/clusters
@@ -345,7 +364,7 @@ bash install_vz_cluster_admin.sh
345364
The Admin cluster has more components to install and takes longer, so we install it separately. This allows us to install the managed clusters in parallel.
346365
```
347366

348-
6. While the Admin cluster is being installed in the background, you can install the managed clusters in parallel:
367+
7. While the Admin cluster is being installed in the background, you can install the managed clusters in parallel:
349368

350369
```bash, editable
351370
cd /home/opc/vz/clusters
@@ -354,7 +373,7 @@ for cluster in phoenix ; do
354373
done
355374
```
356375

357-
7. Wait for Verrazzano to be installed in all clusters:
376+
8. Wait for Verrazzano to be installed in all clusters:
358377

359378
```
360379
# check managed clusters' status
@@ -365,7 +384,7 @@ kubectx admin
365384
kubectl wait --timeout=20m --for=condition=InstallComplete verrazzano/admin
366385
```
367386

368-
8. Create the certificates secrets for each managed cluster:
387+
9. Create the certificates secrets for each managed cluster:
369388

370389
```bash, editable
371390
cd /home/opc/vz/certs
@@ -374,14 +393,14 @@ for cluster in phoenix; do
374393
done
375394
```
376395

377-
9. Create the ConfigMap for the API Server:
396+
10. Create the ConfigMap for the API Server:
378397

379398
```
380399
cd /home/opc/vz/cm
381400
bash create_api_cm.sh
382401
```
383402

384-
10. Create the Verrazzano managed cluster objects for each managed cluster:
403+
11. Create the Verrazzano managed cluster objects for each managed cluster:
385404

386405
```bash, editable
387406
cd /home/opc/vz/clusters
@@ -390,7 +409,7 @@ for cluster in phoenix; do
390409
done
391410
```
392411

393-
11. Register all the managed clusters:
412+
12. Register all the managed clusters:
394413

395414
```bash, editable
396415
for cluster in phoenix; do

docs/src/multi/pub-ep.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Replace phoenix with a list of your clusters e.g.
295295
`for cluster in admin sanjose chicago ;...`
296296
```
297297

298-
2. Check if the operator has installed sucessfully in all clusters:
298+
2. Check if the operator has installed successfully in all clusters:
299299

300300
```bash, editable
301301
for cluster in admin phoenix; do
@@ -319,7 +319,26 @@ for cluster in admin phoenix ; do
319319
done
320320
```
321321

322-
5. Install the Verrazzano Admin cluster:
322+
5. If you are using Thanos, configure your secret for OCI Object Storage now. For each enabled cluster, a storage file is created. Edit them and enter the following and create a secret:
323+
324+
- compartment_ocid
325+
- region
326+
- tenancy_ocid
327+
- user_ocid
328+
- fingerprint
329+
- and the private key
330+
331+
```
332+
cd /home/opc/vz/clusters
333+
for cluster in admin phoenix; do
334+
kubectx $cluster
335+
kubectl create namespace verrazzano-monitoring
336+
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=thanos_$cluster_storage.yaml
337+
done
338+
339+
```
340+
341+
6. Install the Verrazzano Admin cluster:
323342

324343
```
325344
cd /home/opc/vz/clusters
@@ -329,7 +348,7 @@ bash install_vz_cluster_admin.sh
329348
The Admin cluster has more components to install and takes longer, so we install it separately. This allows us to install the managed clusters in parallel.
330349
```
331350

332-
6. While the Admin cluster is being installed in the background, you can install the managed clusters in parallel:
351+
7. While the Admin cluster is being installed in the background, you can install the managed clusters in parallel:
333352

334353
```bash, editable
335354
cd /home/opc/vz/clusters
@@ -338,7 +357,7 @@ for cluster in phoenix ; do
338357
done
339358
```
340359

341-
7. Wait for Verrazzano to be installed in all clusters:
360+
8. Wait for Verrazzano to be installed in all clusters:
342361

343362
```
344363
# check managed clusters' status
@@ -349,7 +368,7 @@ kubectx admin
349368
kubectl wait --timeout=20m --for=condition=InstallComplete verrazzano/admin
350369
```
351370

352-
8. Create the certificates secrets for each managed cluster:
371+
9. Create the certificates secrets for each managed cluster:
353372

354373
```bash, editable
355374
cd /home/opc/vz/certs
@@ -358,14 +377,14 @@ for cluster in phoenix; do
358377
done
359378
```
360379

361-
9. Create the ConfigMap for the API Server:
380+
10. Create the ConfigMap for the API Server:
362381

363382
```
364383
cd /home/opc/vz/cm
365384
bash create_api_cm.sh
366385
```
367386

368-
10. Create the Verrazzano managed cluster objects for each managed cluster:
387+
11. Create the Verrazzano managed cluster objects for each managed cluster:
369388

370389
```bash, editable
371390
cd /home/opc/vz/clusters
@@ -374,7 +393,7 @@ for cluster in phoenix; do
374393
done
375394
```
376395

377-
11. Register all the managed clusters:
396+
12. Register all the managed clusters:
378397

379398
```bash, editable
380399
for cluster in phoenix; do

docs/src/single/dev.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,37 @@ echo >> oci.yaml
127127
bash create_oci_secret_admin.sh
128128
```
129129

130-
5. Install Verrazzano:
130+
5. If you are using Thanos, configure your secret for OCI Object Storage now.
131+
132+
```
133+
cd /home/opc/vz/clusters
134+
```
135+
136+
6. Edit `thanos_admin_storage.yaml` file and enter the following parameters:
137+
138+
- compartment_ocid
139+
- region
140+
- tenancy_ocid
141+
- user_ocid
142+
- fingerprint
143+
- and the private key
144+
145+
7. Create the secret:
146+
147+
```
148+
149+
kubectl create namespace verrazzano-monitoring
150+
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=thanos_admin_storage.yaml
151+
```
152+
153+
8. Install Verrazzano:
131154

132155
```
133156
cd /home/opc/vz/clusters
134157
bash install_vz_cluster_admin.sh
135158
```
136159

137-
6. Wait for Verrazzano to be installed:
160+
9. Wait for Verrazzano to be installed:
138161

139162
```
140163
bash vz_status.sh

docs/src/single/production.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,37 @@ echo >> oci.yaml
126126
bash create_oci_secret_admin.sh
127127
```
128128

129-
5. Install Verrazzano:
129+
5. If you are using Thanos, configure your secret for OCI Object Storage now.
130+
131+
```
132+
cd /home/opc/vz/clusters
133+
```
134+
135+
6. Edit `thanos_admin_storage.yaml` file and enter the following parameters:
136+
137+
- compartment_ocid
138+
- region
139+
- tenancy_ocid
140+
- user_ocid
141+
- fingerprint
142+
- and the private key
143+
144+
7. Create the secret:
145+
146+
```
147+
148+
kubectl create namespace verrazzano-monitoring
149+
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=thanos_admin_storage.yaml
150+
```
151+
152+
8. Install Verrazzano:
130153

131154
```
132155
cd /home/opc/vz/clusters
133156
bash install_vz_cluster_admin.sh
134157
```
135158

136-
6. Wait for Verrazzano to be installed:
159+
9. Wait for Verrazzano to be installed:
137160

138161
```
139162
bash vz_status.sh

locals.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ locals {
5656
sanjose = "us-sanjose-1"
5757
toronto = "ca-toronto-1"
5858
}
59+
60+
managed_clusters = { for k,v in module.clusters.cluster_ids: k => v if v != null }
5961
}

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ module "verrazzano" {
9494
verrazzano_control_plane = var.verrazzano_control_plane
9595
verrazzano_data_plane = var.verrazzano_data_plane
9696
verrazzano_load_balancer = var.verrazzano_load_balancer
97-
cluster_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.cluster_id }, module.clusters.cluster_ids)
97+
all_cluster_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.cluster_id }, local.managed_clusters)
98+
managed_cluster_ids = local.managed_clusters
9899
int_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = lookup(module.admin.nsg_ids, "int_lb") }, module.clusters.int_nsg_ids)
99100
int_lb_subnet_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = lookup(module.admin.subnet_ids, "int_lb") }, module.clusters.int_lb_subnet_ids)
100101
pub_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = lookup(module.admin.nsg_ids, "pub_lb") }, module.clusters.pub_nsg_ids)

modules/clusters/australia.tf

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ resource "oci_objectstorage_bucket" "thanos_melbourne" {
9494

9595
provider = oci.melbourne
9696

97-
count = tobool(lookup(var.clusters, "melbourne")) && lookup(var.thanos, "enabled", "false") ? 1 : 0
97+
count = tobool(lookup(var.clusters, "melbourne", "false")) && tobool(lookup(var.thanos, "enabled", "false")) ? 1 : 0
9898
}
9999

100100
module "sydney" {
@@ -181,7 +181,16 @@ module "sydney" {
181181
oci.home = oci.home
182182
}
183183

184-
count = tobool(lookup(var.clusters, "sydney")) ? 1 : 0
184+
count = tobool(lookup(var.clusters, "sydney", )) ? 1 : 0
185185

186186
}
187187

188+
resource "oci_objectstorage_bucket" "thanos_sydney" {
189+
compartment_id = var.compartment_id
190+
name = "syd-${lookup(var.thanos, "bucket_name", "thanos")}"
191+
namespace = lookup(var.thanos, "bucket_namespace")
192+
193+
provider = oci.sydney
194+
195+
count = tobool(lookup(var.clusters, "sydney", "false")) && tobool(lookup(var.thanos, "enabled", "false")) ? 1 : 0
196+
}

0 commit comments

Comments
 (0)