Skip to content

Commit 7befc11

Browse files
authored
updated base module to use Autonomous platform image instead of marke… (#118)
* updated base module to use Autonomous platform image instead of marketplace. Also disabled kubernetes dashboard by default (#116) Signed-off-by: Ali Mukadam <[email protected]> * updated instructions Signed-off-by: Ali Mukadam <[email protected]> * base module pointing directly to terraform-oci-base, local copy removed, kubernetes dashboard disabled by default, changelog updated Signed-off-by: Ali Mukadam <[email protected]> * minor doc correction Signed-off-by: Ali Mukadam <[email protected]>
1 parent 0ef1cef commit 7befc11

40 files changed

+106
-1208
lines changed

CHANGELOG.adoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ 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+
== v2.1.0 (January 17, 2019)
11+
* Base module now pointing directly to https://github.com/oracle-terraform-modules/terraform-oci-base v1.1.0
12+
* Local copy of base module removed
13+
* Disabled Kubernetes dashboard by default (#117)
14+
15+
== v2.0.1 (January 16, 2019)
16+
* fixed issue with compartment id when using KMS #112
17+
* added ServiceAccount for CI/CD #113
18+
19+
== v2.0.0 (November 28, 2019)
20+
* Use compartment id instead of compartment name for policies #86
21+
* Updated available list of Kubernetes versions in Terraform options #90
22+
* Added admin host for operations instead of using the bastion server. This is required because of changing to kubeconfig v2 #91
23+
* Installed Python3, oci-cli on admin host. oci-cli will require Python3 after January 2020 #91
24+
* Switched all operations from bastion to admin host #91
25+
* Switched from kubeconfig v1 to v2, generated by oci-cli instead of uploading #98
26+
* Helm upgraded to version 3.0.0 #100
27+
* incubator and jetstack helm repos removed as they can now be searched from helm hub #100
28+
* tiller disabled and option to enable it is removed #100
29+
* Fixed bug for empty tuple in data.oci_core_images.oracle_images when use_autonomous=true #103
30+
* Set minimum version of Terraform to 0.12.16
31+
1032
== v2.0.0-beta.2 (November 21, 2019)
1133
* Helm upgraded to version 3.0.0 #100
1234
* incubator and jetstack helm repos removed as they can now be searched from helm hub #100

docs/instructions.adoc

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,21 @@
4848
. link:#creating-the-oke-cluster[Creating the OKE Cluster]
4949
. link:#adding-the-bastion-host[Adding the bastion host]
5050
. link:#using-the-bastion-host[Using the bastion host]
51-
.. link:#enabling-instance_principal-on-the-bastion-host[Enabling instance_principal on the bastion host]
52-
.. link:#disabling-instance_principal-on-the-bastion-host[Disabling instance_principal on the bastion host]
51+
. link:#adding-the-admin-host[Adding the admin host]
52+
.. link:#upgrading-the-admin-host[Upgrading the admin host]
53+
. link:#using-the-admin-host[Using the admin host]
54+
.. link:#enabling-instance_principal-on-the-admin-host[Enabling instance_principal on the admin host]
55+
.. link:#disabling-instance_principal-on-the-admin-host[Disabling instance_principal on the admin host]
5356
.. link:#recommendations-for-using-instance_principal[Recommendations for using instance_principal]
54-
. link:#interacting-with-the-oke-cluster-locally[Interacting with the OKE Cluster locally]
57+
. link:#interacting-with-the-oke-cluster[Interacting with the OKE Cluster locally]
5558
. link:#creating-an-auth-token-for-ocir[Creating an auth token for OCIR]
5659
. link:#installing-helm[Installing helm]
5760
. link:#installing-calico[Installing Calico]
5861
. link:#installing-kubernetes-metrics-server[Installing Kubernetes Metrics Server]
59-
. link:#scaling-the-number-of-worker-nodes[Scaling the number of worker nodes]
6062
. link:#scaling-the-number-of-node-pools[Scaling the number of node pools]
6163
. link:#accessing-the-kubernetes-dashboard[Accessing the Kubernetes dashboard]
6264
. link:#destroying-the-cluster[Destroying the cluster]
65+
. link:#creating-a-service-account-for-cicd-tools[Creating a service account for CI/CD tools]
6366

6467
=== Assumptions
6568

@@ -103,43 +106,28 @@ Use the parameter *cluster_name* to change the name of the cluster as per your n
103106

104107
If you want to use bastion host, set the parameter *bastion_enabled* to *true* in terraform.tfvars. Refer to {uri-terraform-options}#bastion-host[Bastion Host] for other available bastion related parameters.
105108

106-
==== bastion_package_upgrade
107-
108-
There is 1 additional parameter for the bastion:
109-
110-
* bastion_package_upgrade
111-
112-
_bastion_package_upgrade_ will upgrade the bastion compute instance on first boot.
113-
114-
****
115-
N.B. It is good and recommended practice to upgrade your bastion host to the latest packages to minimize the possibility of vulnerabilities. However, it will also take slightly longer before the bastion host is available.
116-
****
117109

118110
=== Using the bastion host
119111

120112
****
121113
*Assumption: you have set the bastion_enabled parameter to true in terraform.tfvars*
122114
****
123115

124-
Once the terraform apply is successful you will get the bastion_public_ip as output and also a ssh command .You can also run the below command to get the output:
116+
Once the terraform apply is successful you will get the bastion_public_ip as output and also a ssh command. You can also run the below command to get the output:
125117

126118
----
127119
terraform output
128120
----
129121

130-
A utility script is also generated that contains the command to ssh to the bastion. You can run it directly:
131-
132-
----
133-
scripts/tesseract.sh
134-
----
122+
You can then copy the ssh_to_bastion command, paste and run it in a terminal.
135123

136124
=== Adding the admin host
137125

138126
The admin host is used to minimize local dependencies such as oci-cli, kubectl and so on.
139127

140128
If you want to use the admin host, set the parameter *admin_enabled* to *true* in terraform.tfvars. Refer to {uri-terraform-options}#admin-host[Admin Host] for other available bastion related parameters.
141129

142-
==== admin_package_upgrade
130+
==== Upgrading the admin host
143131

144132
There is 1 additional parameter for the admin:
145133

@@ -157,12 +145,14 @@ N.B. It is good and recommended practice to upgrade your package host to the lat
157145
*Assumption: you have set the admin_enabled parameter to true in terraform.tfvars*
158146
****
159147

160-
Once the terraform apply is successful you will get the admin_private_ip as output and also a ssh command .You can also run the below command to get the output:
148+
Once the terraform apply is successful you will get the admin_private_ip as output and also a ssh command. You can also run the below command to get the output:
161149

162150
----
163151
terraform output
164152
----
165153

154+
You can then copy the ssh_to_admin command, paste and run it in a terminal.
155+
166156
==== Enabling instance_principal on the admin host
167157
{uri-oci-instance-principal}[instance_principal] is an IAM service feature that enables instances to be authorized actors (or principals) to perform actions on service resources. Each compute instance has its own identity, and it authenticates using the certificates that are added to it. These certificates are automatically created, assigned to instances and rotated, preventing the need for you to distribute credentials to your hosts and rotate them.
168158

@@ -208,9 +198,15 @@ terraform apply
208198
. Enable instance_principal *_if and only if_* you are using link:#kms-integration[KMS Integration], calico, metricserver, helm or creating the OCIR secret.
209199
. Disable instance_principal once the cluster is created
210200

211-
=== Interacting with the OKE Cluster locally
201+
=== Interacting with the OKE Cluster
202+
203+
kubectl installed on the admin host by default and the kubeconfig file is set in the default location (~/.kube/config) so you don't need to set the KUBECONFIG environment variable every time you log in to the admin host.
204+
205+
****
206+
N.B. In order for kubeconfig to be created on the admin host, you need to link:#enabling-instance_principal-on-the-admin-host[enable instance_principal on the admin host].
207+
****
212208

213-
kubectl installed in bastion host by default and the kubeconfig file is set in the default location (~/.kube/config) so you don't need to set the KUBECONFIG environment variable every time you log in to the bastion. An alias "*k*" will be created for kubectl on the bastion host.
209+
An alias "*k*" will be created for kubectl on the admin host.
214210

215211
If you would like to use kubectl locally, {uri-install-kubectl}[install kubectl]. Then, set the KUBECONFIG to the config file path. The kubeconfig file will be saved generated locally under the folder *generated*:
216212

@@ -228,11 +224,13 @@ export KUBECONFIG=generated/kubeconfig
228224

229225
=== Installing helm
230226

231-
{uri-helm}[Helm] is a package manager for kubernetes.If you want to install helm, set the parameter *install_helm = true* in terraform.tfvars. By default, it is set to true. An alias "*h*" will be created for helm on the bastion host. For other available parameters, refer to {uri-terraform-options}#helm[Helm parameters].
227+
{uri-helm}[Helm] is a package manager for kubernetes. If you want to install helm on the admin host, set the parameter *install_helm = true* in terraform.tfvars. By default, it is set to false.
228+
229+
An alias "*h*" will be created for helm on the admin host. For other available parameters, refer to {uri-terraform-options}#helm[Helm parameters].
232230

233231
=== Installing Calico
234232

235-
Calico enables network policy in Kubernetes clusters across the cloud. To install calico set the parameter *install_calico = true* in terraform.tfvars. By default its set to false. Refer to {uri-terraform-options}#calico[Calico parameters] for other available parameters.
233+
Calico enables network policy in Kubernetes clusters. To install calico set the parameter *install_calico = true* in terraform.tfvars. By default its set to false. Refer to {uri-terraform-options}#calico[Calico parameters] for other available parameters.
236234

237235
=== Installing Kubernetes Metrics Server
238236

@@ -249,6 +247,8 @@ Set the parameter *node_pools* to the desired quantities to scale the node pools
249247

250248
=== Accessing the Kubernetes dashboard
251249

250+
By default, the Kubernetes dashboard is now disabled. To enable it, set the *dashboard_enabled = true* _before_ creating the cluster. The dashboard will then be deployed.
251+
252252
In a terminal window, run the command:
253253

254254
----
@@ -267,4 +267,21 @@ terraform destroy
267267

268268
****
269269
*Only infrastructure created by terraform will get destroyed.*
270-
****
270+
****
271+
272+
273+
=== Creating a service account for CI/CD tools
274+
275+
OKE now uses Kubeconfig v2 which means the default token has a limited lifespan. In order to allow CI/CD tools to deploy to OKE, a service account must be created.
276+
277+
Set the *create_service_account = true* and you can name the other parameters as appropriate:
278+
279+
----
280+
create_service_account = true
281+
282+
service_account_name = "kubeconfigsa"
283+
284+
service_account_namespace = "kube-system"
285+
286+
service_account_cluster_role_binding = ""
287+
````

docs/terraformoptions.adoc

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ newbits = {
222222

223223
|bastion_image_id
224224
|Custom image id for the bastion host
225-
|image_id or NONE. If the value is set to NONE, an Oracle Platform image will be used instead. Set use_autonomous to _false_ if you want to use your own image.
226-
|NONE
225+
|image_id or Autonomous. If the value is set to 'Autonomous', an Oracle Autonomous Linux Platform image will be used instead. If you want to use a custom image, set the image id instead.
226+
|Autonomous
227227

228228
|bastion_notification_enabled
229229
|Whether to enable ONS notification for the bastion host.
@@ -260,11 +260,6 @@ newbits = {
260260
|
261261
|Australia/Sydney
262262

263-
|bastion_use_autonomous
264-
|Whether to use Autonomous Linux or an Oracle Linux Platform image or custom image. Set to false if you want to use your own image id or Oracle Linux Platform image.
265-
|true/false
266-
|true
267-
268263
|===
269264

270265
== Admin Host
@@ -283,8 +278,8 @@ newbits = {
283278

284279
|admin_image_id
285280
|Custom image id for the admin host
286-
|image_id or NONE. If the value is set to NONE, an Oracle Platform image will be used instead. Set use_autonomous to _false_ if you want to use your own image. For now, *do not use Autonomous for the admin host.*
287-
|NONE
281+
|image_id or Oracle. If the value is set to Oracle, an Oracle Platform image will be used instead.
282+
|Oracle
288283

289284
|admin_instance_principal
290285
|Whether to enable instance_principal on the admin server. Refer to {uri-docs}/instructions.adoc/#enabling-instance_principal-on-the-admin-host[instance_principal]
@@ -326,11 +321,6 @@ newbits = {
326321
|
327322
|Australia/Sydney
328323

329-
|admin_use_autonomous
330-
|Whether to use Autonomous Linux or an Oracle Linux Platform image or custom image. Set to false if you want to use your own image id or Oracle Linux Platform image. *Do not use autonomous for now*
331-
|true/false
332-
|false
333-
334324
|===
335325

336326
== Availability Domain
@@ -389,7 +379,7 @@ availability_domains = {
389379
|dashboard_enabled
390380
|Whether to create the default Kubernetes dashboard.
391381
|true/false
392-
|true
382+
|false
393383

394384
|kubernetes_version
395385
|The version of Kubernetes to provision. This is based on the available versions in OKE. By default, the available versions will be queries and the latest version selected. To provision a specific version, choose from available versions and override the 'LATEST' value.

locals.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
oci_base_general = {
2020
label_prefix = var.label_prefix
2121
region = var.region
22-
disable_auto_retries = var.disable_auto_retries
22+
# disable_auto_retries = var.disable_auto_retries
2323
}
2424

2525
oci_base_vcn = {
@@ -46,13 +46,13 @@ locals {
4646
ssh_private_key_path = var.ssh_private_key_path
4747
ssh_public_key_path = var.ssh_public_key_path
4848
timezone = var.bastion_timezone
49-
use_autonomous = var.bastion_use_autonomous
49+
# use_autonomous = var.bastion_use_autonomous
5050
}
5151

5252
oci_base_admin = {
5353
availability_domains = var.availability_domains["admin"]
5454
admin_enabled = var.admin_enabled
55-
admin_image_id = "NONE"
55+
admin_image_id = var.admin_image_id
5656
admin_shape = var.admin_shape
5757
admin_upgrade = var.admin_package_upgrade
5858
enable_instance_principal = var.admin_instance_principal
@@ -65,7 +65,7 @@ locals {
6565
ssh_private_key_path = var.ssh_private_key_path
6666
ssh_public_key_path = var.ssh_public_key_path
6767
timezone = var.admin_timezone
68-
use_autonomous = var.admin_use_autonomous
68+
# use_autonomous = var.admin_use_autonomous
6969
}
7070

7171
ocir = {

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
}
77

88
module "base" {
9-
source = "./modules/base"
9+
source = "github.com/oracle-terraform-modules/terraform-oci-base?ref=v1.1.0"
1010

1111
# identity
1212
oci_base_identity = local.oci_base_identity

modules/base/admin/cloudinit/admin.template.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

modules/base/admin/compute.tf

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)