Skip to content

Commit

Permalink
Merge pull request #28 from junior/5G-NF-Infra-w-calico-example
Browse files Browse the repository at this point in the history
5G NF Infra example code refactoring
  • Loading branch information
junior authored Dec 16, 2022
2 parents fd8b436 + ec00334 commit 0ff894c
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 17 deletions.
1 change: 0 additions & 1 deletion examples/5G-NF-Infra-with-native-cni/VERSION

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ git clone github.com/oracle-quickstart/terraform-oci-oke-quickstart
```

```bash
cd terraform-oci-oke-quickstart/examples/5G-NF-Infra-with-native-cni
cd terraform-oci-oke-quickstart/examples/5G-NF-Infra
```

### Updating Terraform variables
Expand Down Expand Up @@ -48,11 +48,9 @@ terraform destroy -refresh=false
### Deploying the demo app

After the infrastructure is deployed, you can deploy the demo app using the following commands:
After the infrastructure is deployed, you can deploy the demo app using the steps for your Network Functions.

```bash
TBD
```
This example creates 5 subnets in the VCN and attach VNIcs on each worker node for each subnet in addition to the default VNIC and Pods Network VNIC.

## Questions

Expand Down
1 change: 1 addition & 0 deletions examples/5G-NF-Infra/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.4
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ locals {

# Node Pool 1 info for 5G VNICs attachments
data "oci_containerengine_node_pool" "node_pool_1" {
node_pool_id = module.oke-quickstart.oke_node_pools["pool1"].node_pool_id # local.node_pool_1_id # module.oke-quickstart.oke_node_pools["pool1"].node_pool_id
node_pool_id = module.oke-quickstart.oke_node_pools[var.node_pool_name_1].node_pool_id # local.node_pool_1_id # module.oke-quickstart.oke_node_pools["pool1"].node_pool_id
}

# 5G NF VNICs attachments for each node in the node pool
Expand All @@ -313,6 +313,8 @@ resource "oci_core_vnic_attachment" "vnic_attachment_5gc_oam" {
freeform_tags = { "Network" : "5GC-OAM" }
}
instance_id = data.oci_containerengine_node_pool.node_pool_1.nodes[count.index].id

depends_on = [oci_core_vnic_attachment.vnic_attachment_5gc_signalling]
}
resource "oci_core_vnic_attachment" "vnic_attachment_5g_ran" {
count = var.node_pool_initial_num_worker_nodes_1
Expand All @@ -324,6 +326,8 @@ resource "oci_core_vnic_attachment" "vnic_attachment_5g_ran" {
freeform_tags = { "Network" : "5G RAN" }
}
instance_id = data.oci_containerengine_node_pool.node_pool_1.nodes[count.index].id

depends_on = [oci_core_vnic_attachment.vnic_attachment_5gc_oam]
}
resource "oci_core_vnic_attachment" "vnic_attachment_5g_legal_intercept" {
count = var.node_pool_initial_num_worker_nodes_1
Expand All @@ -335,6 +339,8 @@ resource "oci_core_vnic_attachment" "vnic_attachment_5g_legal_intercept" {
freeform_tags = { "Network" : "5G Legal Intercept" }
}
instance_id = data.oci_containerengine_node_pool.node_pool_1.nodes[count.index].id

depends_on = [oci_core_vnic_attachment.vnic_attachment_5g_ran]
}
resource "oci_core_vnic_attachment" "vnic_attachment_5g_epc" {
count = var.node_pool_initial_num_worker_nodes_1
Expand All @@ -346,4 +352,6 @@ resource "oci_core_vnic_attachment" "vnic_attachment_5g_epc" {
freeform_tags = { "Network" : "5G-EPC" }
}
instance_id = data.oci_containerengine_node_pool.node_pool_1.nodes[count.index].id

depends_on = [oci_core_vnic_attachment.vnic_attachment_5g_legal_intercept]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module "oke-quickstart" {

# OKE Node Pool 1 arguments
node_pool_cni_type_1 = "OCI_VCN_IP_NATIVE" # Use "FLANNEL_OVERLAY" for overlay network or "OCI_VCN_IP_NATIVE" for VCN Native PODs Network. If the node pool 1 uses the OCI_VCN_IP_NATIVE, the cluster will also be configured with same cni
cluster_autoscaler_enabled = true
node_pool_name_1 = "pool1"
cluster_autoscaler_enabled = false
node_pool_name_1 = var.node_pool_name_1
node_pool_initial_num_worker_nodes_1 = var.node_pool_initial_num_worker_nodes_1 # Minimum number of nodes in the node pool
node_pool_max_num_worker_nodes_1 = var.node_pool_max_num_worker_nodes_1 # Maximum number of nodes in the node pool
node_pool_instance_shape_1 = var.node_pool_instance_shape_1
Expand All @@ -37,18 +37,37 @@ module "oke-quickstart" {
content_type = "text/cloud-config"
content = <<EOF
#cloud-config
write_files:
- path: "/etc/systemd/system/secondary_vnic_all_configure.service"
permissions: "0644"
content: |
[Unit]
Description=Configure secondary VNICs at boot
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/secondary_vnic_all_configure.sh -c
[Install]
WantedBy=multi-user.target
runcmd:
- echo "Preparing Nodes for 5G-NF-Infra..."
- echo 'sctp' | tee -a /etc/modules-load.d/sctp.conf
- modprobe sctp
- sysctl -w kernel.core_pattern=/var/crash/core.%p
- echo "Configuring VNICs..."
- wget https://docs.oracle.com/en-us/iaas/Content/Resources/Assets/secondary_vnic_all_configure.sh && chmod +x secondary_vnic_all_configure.sh
- ./secondary_vnic_all_configure.sh -c
- echo "Finished prep nodes."
- echo "Configuring secondary VNICs..."
- [ wget, "https://docs.oracle.com/en-us/iaas/Content/Resources/Assets/secondary_vnic_all_configure.sh", -O, /root/secondary_vnic_all_configure.sh ]
- chmod +x /root/secondary_vnic_all_configure.sh
- cp /root/secondary_vnic_all_configure.sh /usr/local/sbin
- systemctl enable secondary_vnic_all_configure.service
- echo "Finished configuring secondary VNICs."
final_message: "The system is finally up, after $UPTIME seconds"
output: {all: '| tee -a /tmp/cloud-init-output.log'}
output: {all: '| tee -a /root/cloud-init-output.log'}
EOF
filename = "cloud-config.yaml"
}]
Expand All @@ -60,4 +79,5 @@ EOF
# Cluster Tools
# ingress_nginx_enabled = true
# cert_manager_enabled = true
prometheus_enabled = true
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ region = "us-ashburn-1"
# VCN CIDRs
vcn_cidr_blocks = "10.75.0.0/16"

node_pool_initial_num_worker_nodes_1 = 5
node_pool_max_num_worker_nodes_1 = 5

# Default Node Pool
node_pool_instance_shape_1 = {
"instanceShape" = "VM.Standard3.Flex"
"ocpus" = 8 # Minimum 8 OCPUs to match minimum number of VNICs for 5G network for AMF
"ocpus" = 8 # Minimum 8 OCPUs to match minimum number of VNICs for 5G network
"memory" = 96
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ variable "node_pool_initial_num_worker_nodes_1" {
variable "node_pool_max_num_worker_nodes_1" {
default = 10
description = "Maximum number of nodes on the node pool to be scheduled by the Kubernetes (pool1)"
}
variable "node_pool_name_1" {
default = "pool1"
description = "Name of the node pool 1"
}

0 comments on commit 0ff894c

Please sign in to comment.