Skip to content

Commit 2cf89ce

Browse files
committed
feat: first commit with single working cluster
Signed-off-by: Ali Mukadam <ali.mukadam@oracle.com>
1 parent d9ef4f7 commit 2cf89ce

File tree

10 files changed

+1146
-1
lines changed

10 files changed

+1146
-1
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
provider.tf
5+
6+
# .tfstate files
7+
*.tfstate
8+
*.tfstate.*
9+
10+
# .tfvars files
11+
*.tfvars
12+
13+
generated/**
14+
15+
# visual code
16+
**/.vscode/*

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,56 @@
1-
# terraform-oci-verrazzano
1+
[terraform-oci-oke]: https://github.com/oracle-terraform-modules/terraform-oci-oke
2+
[verrazzano]: https://verrazzano.io
3+
4+
# Installing Verrazzano on Oracle Container Engine for Kubernetes (OKE)
5+
6+
This module automates the installation of [Verrazzano][verrazzano] on top of this [terraform-oci-oke][terraform-oci-oke].
7+
8+
## Quick start
9+
10+
### 1. Creating Providers
11+
12+
You need to create 2 providers:
13+
* 1 provider for the region where your OKE cluster and other resources will be created
14+
* 1 provider for your tenancy's home region. This is required for conducting identity operations.
15+
16+
> **Note that your home region may not necessarily be the same as the region where you want to create the cluster.**
17+
18+
### 2. Update Terraform values
19+
20+
* Copy or rename the `terraform.tfvars.example` to `terraform.tfvars`
21+
22+
```
23+
cp terraform.tfvars.example terraform.tfvars
24+
```
25+
26+
* Enter or update the values to `terraform.tfvars`:
27+
28+
```
29+
api_fingerprint = ""
30+
api_private_key_path = ""
31+
verrazzano_regions = {
32+
home = "us-phoenix-1"
33+
v8o = "ap-sydney-1"
34+
}
35+
tenancy_id = ""
36+
user_id = ""
37+
38+
# general oci parameters
39+
compartment_id = ""
40+
label_prefix = "dev"
41+
42+
ssh_private_key_path = "~/.ssh/id_rsa"
43+
ssh_public_key_path = "~/.ssh/id_rsa.pub"
44+
```
45+
46+
### 3. Run Terraform
47+
48+
Run Terraform:
49+
50+
. Run Terraform:
51+
52+
```
53+
terraform init
54+
terraform plan
55+
terraform apply
56+
```

oke.tf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
module "oke" {
2+
source = "oracle-terraform-modules/oke/oci"
3+
version = "4.0.3"
4+
5+
home_region = var.home_region
6+
region = var.region
7+
8+
tenancy_id = var.tenancy_id
9+
10+
# general oci parameters
11+
compartment_id = var.compartment_id
12+
label_prefix = var.label_prefix
13+
14+
# ssh keys
15+
ssh_private_key_path = var.ssh_private_key_path
16+
ssh_public_key_path = var.ssh_public_key_path
17+
18+
# networking
19+
create_drg = var.verrazzano_type == "admin" || var.verrazzano_type == "managed" ? true : false
20+
internet_gateway_route_rules = []
21+
nat_gateway_route_rules = []
22+
23+
vcn_cidrs = var.vcn_cidrs
24+
vcn_dns_label = var.vcn_dns_label
25+
vcn_name = var.vcn_name
26+
27+
# bastion host
28+
create_bastion_host = var.verrazzano_type == "managed" ? false : true
29+
upgrade_bastion = false
30+
31+
# operator host
32+
create_operator = var.verrazzano_type == "managed" ? false : true
33+
enable_operator_instance_principal = true
34+
upgrade_operator = false
35+
36+
# oke cluster options
37+
cluster_name = "${var.region}-${var.cluster_name}"
38+
control_plane_type = "private"
39+
control_plane_allowed_cidrs = var.control_plane_allowed_cidrs
40+
kubernetes_version = var.kubernetes_version
41+
pods_cidr = var.pods_cidr
42+
services_cidr = var.services_cidr
43+
44+
# node pools
45+
node_pools = var.node_pools
46+
node_pool_name_prefix = var.node_pool_name_prefix
47+
48+
# oke load balancers
49+
load_balancers = var.load_balancers
50+
preferred_load_balancer = var.preferred_load_balancer
51+
52+
# oke internal load balancer
53+
internal_lb_allowed_cidrs = var.internal_lb_allowed_cidrs
54+
internal_lb_allowed_ports = var.internal_lb_allowed_ports
55+
56+
# oke public load balancer
57+
public_lb_allowed_cidrs = var.public_lb_allowed_cidrs
58+
public_lb_allowed_ports = var.public_lb_allowed_ports
59+
60+
# freeform_tags
61+
freeform_tags = var.freeform_tags
62+
63+
providers = {
64+
oci.home = oci.home
65+
}
66+
}

resources/verrazzano.template.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: install.verrazzano.io/v1alpha1
2+
kind: Verrazzano
3+
metadata:
4+
name: example-verrazzano
5+
spec:
6+
profile: dev
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# Copyright 2017, 2021 Oracle Corporation and/or affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
4+
5+
echo "Installing Verrazzano"
6+
7+
if [[ ${verrazzano_type} = "admin" ]]
8+
then
9+
sed -i -e "s?profile: dev?profile: prod?g" verrazzano.yaml
10+
echo "profile type set to prod for an admin cluster"
11+
elif [[ ${verrazzano_type} = "dev" ]]
12+
then
13+
echo "profile type set to dev for a dev cluster"
14+
elif [[ ${verrazzano_type} = "managed" ]]
15+
then
16+
sed -i -e "s?profile: dev?profile: managed?g" verrazzano.yaml
17+
echo "profile type set to managed for a managed cluster"
18+
else
19+
sed -i -e "s?profile: dev?profile: prod?g" verrazzano.yaml
20+
echo "profile type set to prod for a custom cluster cluster"
21+
fi
22+
23+
sed -i -e "s?example-verrazzano?${verrazzano_name}?g" verrazzano.yaml
24+
25+
kubectl apply -f verrazzano.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Copyright 2017, 2021 Oracle Corporation and/or affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
4+
5+
echo "Installing Verrazzano Enterprise Container Platform"
6+
7+
kubectl apply -f https://github.com/verrazzano/verrazzano/releases/download/v${verrazzano_version}/operator.yaml
8+
9+
kubectl -n verrazzano-install rollout status deployment/verrazzano-platform-operator
10+

templates.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2017, 2021 Oracle Corporation and/or affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
3+
4+
locals {
5+
# scripting templates
6+
7+
install_verrazzano_operator_template = templatefile("${path.module}/scripts/install_verrazzano_operator.template.sh",
8+
{
9+
verrazzano_version = var.verrazzano_version
10+
}
11+
)
12+
13+
install_verrazzano_template = templatefile("${path.module}/scripts/install_verrazzano.template.sh",
14+
{
15+
verrazzano_name = var.verrazzano_name
16+
verrazzano_type = var.verrazzano_type
17+
}
18+
)
19+
20+
verrazzano_profile_template = templatefile("${path.module}/resources/verrazzano.template.yaml",{})
21+
22+
}

terraform.tfvars.example

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright (c) 2019, 2021 Oracle Corporation and/or affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
3+
4+
# provider identity parameters
5+
6+
api_fingerprint = ""
7+
8+
api_private_key_path = ""
9+
10+
region = "us-phoenix-1"
11+
12+
tenancy_id = ""
13+
14+
user_id = ""
15+
16+
# general oci parameters
17+
18+
compartment_id = ""
19+
20+
label_prefix = "dev"
21+
22+
# network parameters
23+
24+
availability_domain = 1
25+
26+
bastion_access = ["anywhere"]
27+
28+
ig_route_id = ""
29+
30+
netnum = 30
31+
32+
newbits = 14
33+
34+
vcn_id = ""
35+
36+
bastion_image_id = "Autonomous"
37+
38+
bastion_os_version = "7.9"
39+
40+
bastion_shape = {
41+
shape="VM.Standard.E4.Flex",
42+
ocpus=1,
43+
memory=4,
44+
boot_volume_size=50
45+
}
46+
47+
bastion_state= "RUNNING"
48+
49+
bastion_timezone = "Australia/Sydney"
50+
51+
bastion_type = "public"
52+
53+
ssh_public_key = ""
54+
55+
ssh_public_key_path = ""
56+
57+
upgrade_bastion = false
58+
59+
# notification
60+
61+
enable_bastion_notification = false
62+
63+
bastion_notification_endpoint = ""
64+
65+
bastion_notification_protocol = "EMAIL"
66+
67+
bastion_notification_topic = "bastion"
68+
69+
freeform_tags = {
70+
access = "public"
71+
environment = "dev"
72+
role = "bastion"
73+
}
74+
75+
verrazzano_name = "v8o"
76+
verrazzano_type = "dev"
77+
verrazzano_version = "1.0.3"

0 commit comments

Comments
 (0)