Skip to content

Commit 53ca2cc

Browse files
authored
Base module to 2.0.0 (#255)
* updated default kubernetes version to v1.18.10, fixed deprecated interpolation-only expressions * updated base module to 2.0.0 * added support for vertical pod autoscaler * updated and simplified calico installation
1 parent 516831b commit 53ca2cc

16 files changed

+159
-82
lines changed

CHANGELOG.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ All notable changes to this project are documented in this file.
77

88
The format is based on {uri-changelog}[Keep a Changelog].
99

10+
= 2.3.3 (October 30, 2020)
11+
* Upgraded base module to 1.3.3 to temporarily disable OSMS as fix for #225
12+
1013
== 2.3.2 (August 19, 2020)
1114
* Unable to install kube in operator (#197)
1215
* node_pool_image_id value should be "none" in case no custom image is used. In previous versions, this was in upper case (#207)

docs/configuration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
. link:#configure-oci-parameters[Configure OCI parameters]
5151
. link:#configure-oci-networking-parameters[Configure OCI Networking parameters]
5252
. link:#configure-bastion-host-parameters[Configure Bastion Host parameters]
53-
. link:#configure-operator-host-parameters[Configure Admin Host parameters]
53+
. link:#configure-operator-host-parameters[Configure Operator Host parameters]
5454
. link:#configure-oke-parameters[Configure OKE parameters]
5555
. link:#configure-oke-node-pool-parameters[Configure OKE Node Pool parameters]
5656
. link:#configure-oke-load-balancer-parameters[Configure OKE Load Balancer parameters]

docs/dependencies.adoc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,30 @@ The following table documents the {uri-terraform-options}[Terraform Options] dep
2828

2929
|create_service_account
3030
|Creates a service account that can be used for CI/CD.
31-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true
31+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true
3232

3333
|calico_enabled
3434
|Installs calico as network policy engine
35-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true
35+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true
3636

3737
|metricserver_enabled
3838
|Installs Kubernetes metrics server for Horizontal Pod Autoscaling
39-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true
39+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true
4040

4141
|node_pools_to_drain
4242
|Drains existing node pools before upgrading
43-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true
43+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true
4444

4545
|ocir secret
4646
|Whether to create an authentication secret for OCIR
47-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true, secret_id = secret ocid
47+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true, secret_id = secret ocid
4848

4949
|use_encryption
5050
|Uses OCI KMS to encrypt data in OKE's underlying etcd
51-
|bastion_enabled = true, admin_enabled = true, admin_instance_principal = true
51+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true
52+
53+
|vpa
54+
|Installs Kubernetes Vertical Pod Autoscaler
55+
|bastion_enabled = true, operator_enabled = true, admin_instance_principal = true, metricserver_enabled = true
56+
57+
|===

docs/instructions.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
:uri-metricserver: https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/#metrics-server
5050
:uri-k8s-dashboard: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
5151
:uri-psp: https://docs.cloud.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengusingpspswithoke.htm#Using_Pod_Security_Polices_with_Container_Engine_for_Kubernetes
52+
:uri-kubernetes-vpa: https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler
5253

5354
. link:#assumptions[Assumptions]
5455
. link:#kms-integration[KMS Integration]
@@ -65,6 +66,7 @@
6566
. link:#creating-a-secret-for-ocir[Creating a Secret for OCIR]
6667
. link:#installing-calico[Installing Calico]
6768
. link:#installing-kubernetes-metrics-server[Installing Kubernetes Metrics Server]
69+
. link:#installing-vertical-pod-autoscaler[Installing Vertical Pod Autoscaler]
6870
. link:#scaling-the-number-of-node-pools[Scaling the number of node pools]
6971
. link:#accessing-the-kubernetes-dashboard[Accessing the Kubernetes dashboard]
7072
. link:#destroying-the-cluster[Destroying the cluster]
@@ -247,6 +249,17 @@ Calico enables network policy in Kubernetes clusters. To install calico set the
247249

248250
{uri-metricserver}[Kubernetes Metrics Server] can be installed by setting the parameter *metricserver_enabled = true* in terraform.tfvars. By default, the latest version is installed in kube-system namespace. This is required if you need to use Horizontal Pod Autoscaling.
249251

252+
=== Installing Vertical Pod Autoscaler
253+
254+
{uri-kubernetes-vpa}[Vertical Pod Autoscaler] can be installed by configuring the `vpa` parameter:
255+
256+
`vpa = {
257+
enabled = true,
258+
version = 0.8
259+
}`
260+
261+
NOTE: Installing the Vertical Pod Autoscaler also requires installing the Metrics Server, so you need to enable that too.
262+
250263
=== Scaling the node pools
251264

252265
There are 2 ways you can scale the node pools:

docs/terraformoptions.adoc

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
:uri-rel-file-base: link:{uri-repo}/blob/master
99
:uri-rel-tree-base: link:{uri-repo}/tree/master
1010
:uri-calico: https://www.projectcalico.org/
11-
:uri-calico-policy: https://docs.projectcalico.org/v3.8/getting-started/kubernetes/installation/other
11+
:uri-calico-policy: https://docs.projectcalico.org/getting-started/kubernetes/flannel/flannel
1212
:uri-cert-manager: https://cert-manager.readthedocs.io/en/latest/
1313
:uri-docs: {uri-rel-file-base}/docs
1414
:uri-kubernetes-hpa: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
15+
:uri-kubernetes-vpa: https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler
1516
:uri-metrics-server: https://github.com/kubernetes-incubator/metrics-server
1617
:uri-oci-images: https://docs.cloud.oracle.com/iaas/images/
1718
:uri-oci-kms: https://docs.cloud.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm
@@ -29,7 +30,7 @@ Configuration Terraform Options:
2930
. link:#general-oci[General OCI]
3031
. link:#oci-networking[OCI Networking]
3132
. link:#bastion-host[Bastion Host]
32-
. link:#operator-host[Admin Host]
33+
. link:#operator-host[Operator Host]
3334
. link:#oke[OKE]
3435
. link:#oke-load-balancers[OKE Load Balancers]
3536
. link:#ocir[OCIR]
@@ -244,7 +245,13 @@ newbits = {
244245
|`bastion_shape`
245246
|The shape of bastion instance. *Required*
246247
|
247-
|VM.Standard.E2.1
248+
|`bastion_shape = {
249+
# shape = "VM.Standard.E2.2"
250+
shape = "VM.Standard.E3.Flex",
251+
ocpus = 1,
252+
memory = 4,
253+
boot_volume_size = 50
254+
}`
248255

249256
|`bastion_timezone`
250257
|The preferred timezone for the bastion host. {uri-timezones}[List of timezones]. *Required*
@@ -253,7 +260,7 @@ newbits = {
253260

254261
|===
255262

256-
== Admin Host
263+
== Operator Host
257264

258265
[stripes=odd,cols="1d,4d,3a,3a", options=header,width="100%"]
259266
|===
@@ -305,7 +312,13 @@ newbits = {
305312
|`operator_shape`
306313
|The shape of operator instance. *Required*
307314
|
308-
|
315+
|`operator_shape = {
316+
# shape = "VM.Standard.E2.2"
317+
shape = "VM.Standard.E3.Flex",
318+
ocpus = 1,
319+
memory = 4,
320+
boot_volume_size = 50
321+
}`
309322

310323
|`operator_timezone`
311324
|The preferred timezone for the operator host. {uri-timezones}[List of timezones]. *Required*
@@ -462,7 +475,7 @@ a|The number, shape of node pools and node_pool_size to create. Each key and tup
462475
* node_pool_size defines the number of worker nodes in each nodepool
463476
* boot_volume_size defines the custom boot volume size in GBs for the worker nodes.
464477

465-
If an empty nodepool like np3 = {} is specified, then a nodepool will default values:
478+
If an empty nodepool like np3 = {} is specified, then a nodepool will have the following default values:
466479

467480
* shape=VM.Standard.E3.Flex
468481
* ocpus=1
@@ -520,7 +533,7 @@ node_pools = {
520533
|`node_pool_os_version`
521534
|The corresponding version of the Operating System image to use to provision the worker nodes.
522535
|
523-
|7.8
536+
|7.9
524537

525538
|`pods_cidr`
526539
|The CIDR for the Kubernetes POD network for flannel networking. CIDR blocks for pods must not overlap with the CIDR blocks for workers and load balancer subnets (calculated using vcn_cidr, newbits and subnets parameters).
@@ -621,11 +634,6 @@ Refer to {uri-topology}[topology] for more thorough examples.
621634
|Values
622635
|Default
623636

624-
|`calico_version`
625-
|Version of {uri-calico}[Calico] to install.
626-
|
627-
|3.12
628-
629637
|`calico_enabled`
630638
|Whether to install {uri-calico}[Calico] as {uri-calico-policy}[pod network policy].
631639
|true/false
@@ -645,6 +653,17 @@ Refer to {uri-topology}[topology] for more thorough examples.
645653
|Whether to install {uri-metrics-server}[Kubernetes Metrics Server]. *Required* for {uri-kubernetes-hpa}[Horizontal Pod Autoscaling].
646654
|true/false
647655
|false
656+
657+
|`vpa`
658+
|Whether to install {uri-kubernetes-vpa}[Vertical Pod Autoscaler] and the version to install. *Requires* {uri-metrics-server}[Kubernetes Metrics Server].
659+
|`vpa = {
660+
enabled = true,
661+
version = 0.8
662+
}`
663+
|`vpa = {
664+
enabled = false,
665+
version = 0.8
666+
}`
648667
|===
649668

650669
== KMS integration

locals.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ locals {
129129
username = var.username
130130
}
131131

132-
calico = {
133-
calico_enabled = var.calico_enabled
134-
calico_version = var.calico_version
135-
}
136-
137132
oke_kms = {
138133
use_encryption = var.use_encryption
139134
key_id = var.existing_key_id

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module "base" {
55
source = "oracle-terraform-modules/base/oci"
6-
version = "2.0.0-RC1"
6+
version = "2.0.0"
77

88
# general oci parameters
99
oci_base_general = local.oci_base_general
@@ -103,10 +103,11 @@ module "oke" {
103103
oke_ocir = local.oke_ocir
104104

105105
# calico parameters
106-
calico = local.calico
106+
calico_enabled = var.calico_enabled
107107

108108
# metric server
109109
metricserver_enabled = var.metricserver_enabled
110+
vpa = var.vpa
110111

111112
# service account
112113
service_account = local.service_account

modules/oke/calico.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
data "template_file" "calico_enabled" {
55
template = file("${path.module}/scripts/install_calico.template.sh")
66

7-
vars = {
8-
calico_version = var.calico.calico_version
9-
number_of_nodes = local.total_nodes
10-
pod_cidr = var.oke_cluster.cluster_options_kubernetes_network_config_pods_cidr
11-
number_of_replicas = min(20, max((local.total_nodes) / 200, 3))
12-
}
13-
14-
count = var.calico.calico_enabled == true ? 1 : 0
7+
count = var.calico_enabled == true ? 1 : 0
158
}
169

1710
resource null_resource "calico_enabled" {
@@ -42,5 +35,5 @@ resource null_resource "calico_enabled" {
4235
]
4336
}
4437

45-
count = var.oke_operator.bastion_enabled == true && var.oke_operator.operator_enabled == true && var.calico.calico_enabled == true ? 1 : 0
38+
count = var.oke_operator.bastion_enabled == true && var.oke_operator.operator_enabled == true && var.calico_enabled == true ? 1 : 0
4639
}

modules/oke/metricserver.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
data "template_file" "metricserver_enabled" {
55
template = file("${path.module}/scripts/install_metricserver.template.sh")
66

7+
vars = {
8+
vpa_enabled = var.vpa.enabled
9+
vpa_version = var.vpa.version
10+
}
11+
712
count = var.metricserver_enabled == true ? 1 : 0
813
}
914

modules/oke/scripts/install_calico.template.sh

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,10 @@
22
# Copyright 2017, 2019, Oracle Corporation and/or affiliates. All rights reserved.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
44

5-
mkdir calico
5+
echo "Installing calico for network policy"
66

7-
cd calico
7+
mkdir calico && cd calico > /dev/null 2>&1
88

9-
curl https://docs.projectcalico.org/v${calico_version}/manifests/calico-policy-only.yaml -O
9+
curl https://docs.projectcalico.org/manifests/canal.yaml -O > /dev/null 2>&1
1010

11-
sed -i -e "s?192.168.0.0/16?${pod_cidr}?g" calico-policy-only.yaml
12-
13-
sleep 10
14-
15-
if [ ${number_of_nodes} -gt 50 ]; then
16-
echo "More than 50 nodes detected. Setting the typha service name"
17-
sed -i -e 's/typha_service_name:\s"none"/typha_service_name: calico-typha/g' calico-policy-only.yaml
18-
kubectl apply -f calico-policy-only.yaml
19-
kubectl -n kube-system scale --current-replicas=1 --replicas=${number_of_replicas} deployment/calico-typha
20-
else
21-
kubectl apply -f calico-policy-only.yaml
22-
fi
11+
kubectl apply -f canal.yaml > /dev/null 2>&1

0 commit comments

Comments
 (0)