Skip to content
This repository was archived by the owner on Oct 31, 2019. It is now read-only.

Commit 7d7fa24

Browse files
jrosinskjlamillan
authored andcommitted
Support provisioning OEL instances.
1 parent 0235811 commit 7d7fa24

22 files changed

+197
-157
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ worker_ssh_ingress = "0.0.0.0/0"
164164
$ terraform output ssh_private_key > generated/instances_id_rsa
165165
# Retrieve public IP for etcd nodes
166166
$ terraform output etcd_public_ips
167-
# Log in as user ubuntu to the Canonical Ubuntu OS
168-
$ ssh -i `pwd`/generated/instances_id_rsa ubuntu@ETCD_INSTANCE_IP
167+
# Log in as user opc to the OEL OS
168+
$ ssh -i `pwd`/generated/instances_id_rsa oel@ETCD_INSTANCE_IP
169169
# Retrieve public IP for k8s masters
170170
$ terraform output master_public_ips
171-
$ ssh -i `pwd`/generated/instances_id_rsa ubuntu@K8SMASTER_INSTANCE_IP
171+
$ ssh -i `pwd`/generated/instances_id_rsa oel@K8SMASTER_INSTANCE_IP
172172
# Retrieve public IP for k8s workers
173173
$ terraform output worker_public_ips
174-
$ ssh -i `pwd`/generated/instances_id_rsa ubuntu@K8SWORKER_INSTANCE_IP
174+
$ ssh -i `pwd`/generated/instances_id_rsa oel@K8SWORKER_INSTANCE_IP
175175
```
176176

177177
### Mandatory Input Variables:
@@ -238,7 +238,7 @@ flannel_ver | v0.7.1 | Version of Flannel to
238238
k8s_ver | 1.7.4 | Version of K8s to install (master and workers)
239239
k8s_dns_ver | 1.14.2 | Version of Kube DNS to install
240240
k8s_dashboard_ver | 1.6.3 | Version of Kubernetes dashboard to install
241-
instance_os_ver | 16.04 | Version of Ubuntu operating system
241+
instance_os_ver | 7.4 | Version of OEL operating system
242242

243243
#### Other
244244
name | default | description
@@ -353,7 +353,7 @@ See [CONTRIBUTING](CONTRIBUTING.md) for details.
353353

354354
## Installed on OCI Instances
355355

356-
* Canonical Ubuntu (14.04)
356+
* Oracle Linux Enterprise (7.4)
357357
* etcd - (default v3.2.2)
358358
* flannel - (default v0.7.1)
359359
* docker - (default 17.03.0-ce)

instances/etcd/cloud_init/bootstrap.template.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
#!/bin/bash -x
22

3-
# Set working dir
4-
cd /home/ubuntu
3+
# Turn off SELinux
4+
setenforce 0
55

6-
# Install Docker dependencies
7-
until apt-get install -y aufs-tools cgroupfs-mount libltdl7; do sleep 1 && echo -n "."; done
6+
# Set working dir
7+
cd /home/opc
88

9-
# Download Docker
10-
curl -L --retry 3 https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/${docker_ver}.deb -o /tmp/${docker_ver}.deb
9+
# enable ol7 addons
10+
yum-config-manager --disable ol7_UEKR3
11+
yum-config-manager --enable ol7_addons ol7_latest ol7_UEKR4 ol7_optional ol7_optional_latest
1112

1213
# Install Docker
13-
until dpkg -i /tmp/${docker_ver}.deb; do sleep 1 && echo -n "."; done
14+
until yum -y install docker-engine-${docker_ver}; do sleep 1 && echo -n "."; done
15+
16+
# Start Docker
17+
systemctl daemon-reload
18+
systemctl restart docker
19+
20+
docker info
1421

1522
###################
1623
# Drop firewall rules
@@ -28,7 +35,7 @@ FQDN_HOSTNAME="$(getent hosts $IP_LOCAL | awk '{print $2}')"
2835

2936
docker run -d \
3037
-p 2380:2380 -p 2379:2379 \
31-
-v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt \
38+
-v /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-bundle.crt \
3239
--net=host \
3340
quay.io/coreos/etcd:${etcd_ver} \
3441
/usr/local/bin/etcd \
@@ -62,7 +69,3 @@ done
6269

6370
# put the flannel config in etcd
6471
curl -sf -L http://$FQDN_HOSTNAME:2379/v2/keys/flannel/network/config -X PUT --data-urlencode value@/tmp/flannel-network.json
65-
66-
# make sure ubuntu owns home dir
67-
chown ubuntu:ubuntu /home/ubuntu
68-

instances/etcd/datasources.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Cloud call to get the OCID of the OS image to use
1+
# Gets the OCID of the OS image to use
22
data "oci_core_images" "ImageOCID" {
33
compartment_id = "${var.compartment_ocid}"
4-
operating_system = "Canonical Ubuntu"
4+
operating_system = "Oracle Linux"
55
operating_system_version = "${var.instance_os_ver}"
66
}
77

instances/etcd/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ resource "oci_core_instance" "TFInstanceEtcd" {
1212
shape = "${var.shape}"
1313
subnet_id = "${var.subnet_id}"
1414

15-
metadata {
15+
extended_metadata {
1616
roles = "etcd"
1717
ssh_authorized_keys = "${var.ssh_public_key_openssh}"
1818
user_data = "${base64encode(data.template_file.etcd-bootstrap.rendered)}"
19+
tags = "group:etcd"
1920
}
2021

2122
timeouts {

instances/etcd/variables.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ variable "shape" {
1010
variable "subnet_id" {}
1111
variable "ssh_public_key_openssh" {}
1212
variable "domain_name" {}
13-
1413
variable "label_prefix" {
1514
default = ""
1615
}
1716

1817
variable "docker_ver" {
19-
default = "docker-ce_17.03.0~ce-0~ubuntu-xenial_amd64"
18+
default = "17.03.1.ce"
2019
}
2120

2221
variable "instance_os_ver" {
23-
default = "16.04"
22+
default = "7.4"
2423
}
2524

2625
variable "etcd_ver" {

instances/k8smaster/cloud_init/bootstrap.template.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#cloud-config
22

3+
bootcmd:
4+
# Turn off SELinux
5+
- setenforce 0
6+
37
write_files:
48
# setup script
5-
- path: "/tmp/setup.preflight.sh"
9+
- path: "/root/setup.preflight.sh"
610
permissions: "0777"
711
encoding: b64
812
content: |
913
${setup_preflight_sh_content}
10-
- path: "/tmp/setup.sh"
14+
- path: "/root/setup.sh"
1115
permissions: "0777"
1216
encoding: b64
1317
content: |
@@ -23,7 +27,7 @@ write_files:
2327
encoding: b64
2428
content: |
2529
${kube_controller_manager_template_content}
26-
- path: "/etc/kubernetes/manifests/kube-dns.yaml"
30+
- path: "/root/services/kube-dns.yaml"
2731
permissions: "0755"
2832
encoding: b64
2933
content: |
@@ -38,38 +42,39 @@ write_files:
3842
encoding: b64
3943
content: |
4044
${kube_scheduler_template_content}
41-
- path: "/etc/kubernetes/manifests/kubernetes-dashboard.yaml"
45+
- path: "/root/services/kubernetes-dashboard.yaml"
4246
permissions: "0755"
4347
encoding: b64
4448
content: |
4549
${kube_dashboard_template_content}
50+
- path: "/root/services/docker.service"
4651
- path: "/etc/kubernetes/manifests/kube-rbac-role-binding.yaml"
4752
permissions: "0755"
4853
encoding: b64
4954
content: |
5055
${kube_rbac_content}
51-
- path: "/home/ubuntu/services/docker.service"
56+
- path: "/root/services/docker.service"
5257
permissions: "0600"
5358
encoding: b64
5459
content: |
5560
${docker_service_content}
56-
- path: "/home/ubuntu/services/flannel.service"
61+
- path: "/root/services/flannel.service"
5762
permissions: "0600"
5863
encoding: b64
5964
content: |
6065
${flannel_service_content}
61-
- path: "/home/ubuntu/services/cni-bridge.service"
66+
- path: "/root/services/cni-bridge.service"
6267
permissions: "0600"
6368
encoding: b64
6469
content: |
6570
${cnibridge_service_content}
66-
- path: "/home/ubuntu/services/cni-bridge.sh"
71+
- path: "/root/services/cni-bridge.sh"
6772
permissions: "0600"
6873
encoding: b64
6974
content: |
7075
${cnibridge_sh_content}
7176
# systemd services
72-
- path: "/home/ubuntu/services/kubelet.service"
77+
- path: "/root/services/kubelet.service"
7378
permissions: "0600"
7479
encoding: b64
7580
content: |
@@ -99,5 +104,5 @@ write_files:
99104
100105
runcmd:
101106
- echo "Running k8s init..."
102-
- /tmp/setup.preflight.sh
107+
- /root/setup.preflight.sh
103108
- echo "Finished k8s init."

instances/k8smaster/datasources.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Gets the OCID of the OS image to use
22
data "oci_core_images" "ImageOCID" {
33
compartment_id = "${var.compartment_ocid}"
4-
operating_system = "Canonical Ubuntu"
4+
operating_system = "Oracle Linux"
55
operating_system_version = "${var.instance_os_ver}"
66
}
77

instances/k8smaster/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ resource "oci_core_instance" "TFInstanceK8sMaster" {
1212
shape = "${var.shape}"
1313
subnet_id = "${var.subnet_id}"
1414

15-
metadata {
15+
extended_metadata {
1616
roles = "masters"
1717
ssh_authorized_keys = "${var.ssh_public_key_openssh}"
1818
user_data = "${data.template_cloudinit_config.master.rendered}"
19+
tags = "group:k8s-master"
1920
}
2021

22+
2123
timeouts {
2224
create = "60m"
2325
}

instances/k8smaster/scripts/docker.service

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[Unit]
22
Description=Docker Application Container Engine
33
Documentation=https://docs.docker.com
4-
After=network.target docker.socket firewalld.service cni-bridge.service
5-
Requires=docker.socket cni-bridge.service
4+
After=network.target firewalld.service cni-bridge.service
5+
Requires=cni-bridge.service
66

77
[Service]
88
Type=notify
@@ -17,7 +17,6 @@ ExecReload=/bin/kill -s HUP $MAINPID
1717
LimitNOFILE=1048576
1818
LimitNPROC=infinity
1919
LimitCORE=infinity
20-
TasksMax=infinity
2120
TimeoutStartSec=0
2221
Delegate=yes
2322
KillMode=process

instances/k8smaster/scripts/setup.preflight.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ EXTERNAL_IP=$(curl -s -m 10 http://whatismyip.akamai.com/)
44

55
mkdir -p /etc/kubernetes/auth /etc/kubernetes/manifests/
66

7-
bash -x /tmp/setup.sh | tee -a /root/setup.log
7+
bash -x /root/setup.sh | tee -a /root/setup.log

0 commit comments

Comments
 (0)