Skip to content

Commit 47ab4de

Browse files
committed
feat: added support for Thanos and Cluster API
Signed-off-by: Ali Mukadam <ali.mukadam@oracle.com>
1 parent a8ee643 commit 47ab4de

21 files changed

+243
-51
lines changed

admin.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,13 @@ module "admin" {
9595
oci.home = oci.home
9696
}
9797
}
98+
99+
resource "oci_objectstorage_bucket" "thanos_admin" {
100+
compartment_id = var.compartment_id
101+
name = "${lookup(var.admin_region, "admin_name")}-${lookup(var.thanos, "bucket_name", "thanos")}"
102+
namespace = lookup(var.thanos, "bucket_namespace")
103+
104+
provider = oci.sydney
105+
106+
count = lookup(var.thanos, "enabled", "false") ? 1 : 0
107+
}

docs/src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616
- [Control plane](./advanced/controlplane.md)
1717
- [Data plane](./advanced/dataplane.md)
1818
- [DNS](./advanced/dns.md)
19+
- [Observability]()
20+
- [Prometheus]()
21+
- [Thanos](./advanced/thanos.md)
1922
- [Terraform Options](./terraformoptions.md)

docs/src/advanced/dataplane.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Data plane
22

3-
The data plane is where the workload are run. This is usually done as part of the service mesh (Istio).
3+
The data plane is where the workloads are run. This is usually done as part of the service mesh (Istio).
44

55
Istio usually has an ingress gateway that allows incoming traffic into the mesh.
66

77
On OCI, the service mesh is front-ended by an OCI Load Balancer and Istio's ingress gateway.
8-
the ingress gateway is front-ended by an OCI Load Balancer. As such a number of configuration options are possible depending on the use case:
8+
As such a number of configuration options are possible depending on the use case:
99

1010
1. access: the control plane can be made public or private. By default, it is public.
1111
2. shape: the load balancer shape can be configured including the bandwidth, security posture

docs/src/advanced/thanos.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Thanos
2+
3+
Verrazzano includes Thanos, an open source CNCF-projet that provides the following features:
4+
5+
- Global Query across multiple clusters
6+
- Cheap, long time metrics storage using Object Storage
7+
- Downsampling and compaction
8+
- A Prometheus-compatible API
9+
10+
## Configuring Thanos
11+
12+
Configure the following parameters to use Thanos:
13+
14+
``` yaml, editable
15+
prometheus = true
16+
17+
prometheus_operator = true
18+
19+
thanos = {
20+
bucket = "vzthanos"
21+
bucket_namespace = "<replace-me>"
22+
enabled = "true"
23+
integration = "sidecar"
24+
storage_gateway = "true"
25+
}
26+
```
27+
28+
When the above is configured, they will be generated and added to the Custom Resource of each Verrazzano instance.
29+
30+
## Configuring OCI Authentication
31+
32+
### User principal
33+
34+
1. For each cluster, use the following to configure your user principal authentication for Thanos:
35+
36+
``` yaml, editable
37+
{{#include ../../../modules/verrazzano/resources/thanos-storage.yaml.example:4:}}
38+
```
39+
2. Save the file as storage.yaml
40+
41+
```admonish important
42+
If you are using multiple clusters and your clusters are in different regions, ensure:
43+
44+
1. each cluster has its own storage configuration
45+
2. you replace the region value in the region parameter above
46+
```
47+
48+
### Instance principal
49+
50+
TODO
51+
52+
## Create the secret
53+
54+
Before enabling Thanos, ensure the following secret is created:
55+
56+
``` bash
57+
58+
kubectl create namespace verrazzano-monitoring
59+
kubectl create secret generic objstore-config -n verrazzano-monitoring --from-file=objstore.yml=storage.yaml
60+
```
61+
62+
You can now enable Thanos.

main.tf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ module "clusters" {
3131

3232
nodepools = var.nodepools
3333

34+
thanos = var.thanos
35+
3436
providers = {
3537
oci.home = oci.home,
3638
oci.johannesburg = oci.johannesburg,
@@ -92,13 +94,14 @@ module "verrazzano" {
9294
verrazzano_control_plane = var.verrazzano_control_plane
9395
verrazzano_data_plane = var.verrazzano_data_plane
9496
verrazzano_load_balancer = var.verrazzano_load_balancer
95-
cluster_ids = merge({ "admin" = module.admin.cluster_id }, module.clusters.cluster_ids)
96-
int_nsg_ids = merge({ "admin" = lookup(module.admin.nsg_ids, "int_lb") }, module.clusters.int_nsg_ids)
97-
int_lb_subnet_ids = merge({ "admin" = lookup(module.admin.subnet_ids, "int_lb") }, module.clusters.int_lb_subnet_ids)
98-
pub_nsg_ids = merge({ "admin" = lookup(module.admin.nsg_ids, "pub_lb") }, module.clusters.pub_nsg_ids)
97+
cluster_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = module.admin.cluster_id }, module.clusters.cluster_ids)
98+
int_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = lookup(module.admin.nsg_ids, "int_lb") }, module.clusters.int_nsg_ids)
99+
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)
100+
pub_nsg_ids = merge({ lookup(var.admin_region, "admin_name", "admin") = lookup(module.admin.nsg_ids, "pub_lb") }, module.clusters.pub_nsg_ids)
99101

100102
# verrazzano components
101103
argocd = var.argocd
104+
cluster_api = var.cluster_api
102105
coherence = var.coherence
103106
configure_dns = var.configure_dns
104107
console = var.console
@@ -112,6 +115,7 @@ module "verrazzano" {
112115
prometheus = var.prometheus
113116
prometheus_operator = var.prometheus_operator
114117
rancher = var.rancher
118+
thanos = var.thanos
115119
velero = var.velero
116120
weblogic_operator = var.weblogic_operator
117121

modules/clusters/australia.tf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ module "melbourne" {
8787

8888
}
8989

90+
resource "oci_objectstorage_bucket" "thanos_melbourne" {
91+
compartment_id = var.compartment_id
92+
name = "mel-${lookup(var.thanos, "bucket_name", "thanos")}"
93+
namespace = lookup(var.thanos, "bucket_namespace")
94+
95+
provider = oci.melbourne
96+
97+
count = tobool(lookup(var.clusters, "melbourne")) && lookup(var.thanos, "enabled", "false") ? 1 : 0
98+
}
99+
90100
module "sydney" {
91101
source = "oracle-terraform-modules/oke/oci"
92102
version = "4.5.9"
@@ -152,9 +162,9 @@ module "sydney" {
152162

153163

154164
# node pools
155-
kubeproxy_mode = "ipvs"
156-
node_pools = local.managed_nodepools
157-
cloudinit_nodepool_common = var.cloudinit_nodepool_common
165+
kubeproxy_mode = "ipvs"
166+
node_pools = local.managed_nodepools
167+
cloudinit_nodepool_common = var.cloudinit_nodepool_common
158168

159169
node_pool_image_type = "oke"
160170

modules/clusters/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ output "int_lb_subnet_ids" {
143143
# "jeddah" = coalesce(lookup(module.jeddah[0].subnet_ids,"int_lb"))
144144
# "jerusalem" = coalesce(lookup(module.jerusalem[0].subnet_ids,"int_lb"))
145145
"melbourne" = coalesce(lookup(module.melbourne[0].subnet_ids,"int_lb"))
146-
"sydney" = coalesce(lookup(module.sydney[0].subnet_ids,"int_lb"))
146+
# "sydney" = coalesce(lookup(module.sydney[0].subnet_ids,"int_lb"))
147147
# "santiago" = coalesce(lookup(module.santiago[0].subnet_ids,"int_lb"))
148148
# "saupaulo" = coalesce(lookup(module.saupaulo[0].subnet_ids,"int_lb"))
149149
# "vinhedo" = coalesce(lookup(module.vinhedo[0].subnet_ids,"int_lb"))

modules/clusters/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ variable "nodepools" {
6161

6262
variable "cloudinit_nodepool_common" {
6363
type = string
64+
}
65+
66+
variable "thanos" {
67+
type = map(string)
6468
}

modules/verrazzano/install_vz.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ resource "null_resource" "install_vz_admin" {
1616

1717
provisioner "file" {
1818
content = local.vz_admin_template
19-
destination = "/home/opc/vz/clusters/vz_admin.yaml"
19+
destination = "/home/opc/vz/clusters/vz_${local.admin_region_name}.yaml"
2020
}
2121

2222
provisioner "file" {
2323
content = local.install_admin_script
24-
destination = "/home/opc/vz/clusters/install_vz_cluster_admin.sh"
24+
destination = "/home/opc/vz/clusters/install_vz_cluster_${local.admin_region_name}.sh"
2525
}
2626

2727
provisioner "file" {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
type: OCI
2+
config:
3+
provider: "raw"
4+
bucket: "thanos"
5+
compartment_ocid: "ocid1.compartment.oc1....."
6+
region: "us-ashburn-1"
7+
tenancy_ocid: "ocid1.tenancy.oc1....."
8+
user_ocid: "ocid1.user.oc1....."
9+
fingerprint: "12:d3:4c:..."
10+
privatekey: |
11+
-----BEGIN RSA PRIVATE KEY-----
12+
...
13+
-----END RSA PRIVATE KEY-----

0 commit comments

Comments
 (0)