Skip to content

Commit 68405fe

Browse files
authored
Merge pull request #61 from bgraef/main
add ocne2 fss bits and enhance instance create options
2 parents c34d812 + 21c7cfe commit 68405fe

13 files changed

+282
-5
lines changed

ocne2/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
boot_volume_size_in_gbs: "{{ item.value.boot_volume_size_in_gbs | default(50) | int }}"
1616
shape: "{{ instance_shape }}"
1717
shape_config:
18-
ocpus: "{{ instance_ocpus }}"
19-
memory_in_gbs: "{{ instance_memory }}"
18+
ocpus: "{{ item.value.instance_ocpus | default(instance_ocpus) }}"
19+
memory_in_gbs: "{{ item.value.instance_memory | default(instance_memory) }}"
2020
create_vnic_details:
2121
assign_public_ip: true
2222
hostname_label: "{{ item.value.instance_name | default('instance-'~timestamp) }}"

ocne2/create_fss.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Set file_system mount target
8+
oracle.oci.oci_file_storage_mount_target:
9+
availability_domain: "{{ my_availability_domain }}"
10+
compartment_id: "{{ my_compartment_id }}"
11+
subnet_id: "{{ my_subnet_id }}"
12+
display_name: "mt-ocne"
13+
hostname_label: "ocne-fss"
14+
state: present
15+
register: result
16+
retries: 10
17+
delay: 30
18+
until: result is not failed
19+
20+
- name: Print file_system mount target
21+
ansible.builtin.debug:
22+
var: result
23+
when: debug_enabled
24+
25+
- name: Get file_system mount target facts
26+
ansible.builtin.set_fact:
27+
mount_target_id: "{{ result.mount_target.id }}"
28+
export_set_id: "{{ result.mount_target.export_set_id }}"
29+
mount_target_private_ip_id: "{{ result.mount_target.private_ip_ids[0] }}"
30+
31+
- name: Get file_system mount target private ip facts
32+
oracle.oci.oci_network_private_ip_facts:
33+
id: "{{ mount_target_private_ip_id }}"
34+
register: result
35+
retries: 10
36+
delay: 30
37+
until: result is not failed
38+
39+
- name: Set file_system mount target private ip
40+
ansible.builtin.set_fact:
41+
mount_target_ip_address: "{{ result.private_ips[0].ip_address }}"
42+
43+
- name: Print file_system mount target private ip
44+
ansible.builtin.debug:
45+
msg: "Mount Target Ip Address: {{ mount_target_ip_address }}"
46+
when: debug_enabled
47+
48+
- name: Set file_system
49+
oracle.oci.oci_file_storage_file_system:
50+
availability_domain: "{{ my_availability_domain }}"
51+
compartment_id: "{{ my_compartment_id }}"
52+
display_name: "fss-ocne"
53+
state: present
54+
register: result
55+
retries: 10
56+
delay: 30
57+
until: result is not failed
58+
59+
- name: Get file_system id
60+
ansible.builtin.set_fact:
61+
file_system_id: "{{ result.file_system.id }}"
62+
63+
- name: Set file_system export
64+
oracle.oci.oci_file_storage_export:
65+
export_set_id: "{{ export_set_id }}"
66+
file_system_id: "{{ file_system_id }}"
67+
export_options:
68+
- source: "0.0.0.0/0"
69+
require_privileged_source_port: false
70+
access: "READ_WRITE"
71+
identity_squash: "NONE"
72+
path: "/fss-ocne"
73+
state: present
74+
register: result
75+
retries: 10
76+
delay: 30
77+
until: result is not failed
78+
79+
- name: Get file_system export id and path
80+
ansible.builtin.set_fact:
81+
export_id: "{{ result.export.id }}"
82+
export_path: "{{ result.export.path }}"
83+
84+
- name: Set file_system vars file
85+
ansible.builtin.template:
86+
src: fss_vars.j2
87+
dest: fss_vars.yml
88+
mode: "0664"

ocne2/create_instance.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@
261261
ansible.builtin.include_tasks: "build.yml"
262262
loop: "{{ lookup('dict', compute_instances, wantlist=True) }}"
263263

264+
- name: Set file system storage
265+
ansible.builtin.include_tasks: "create_fss.yml"
266+
when: use_fss
267+
264268
- name: Configure new instances
265269
hosts: all
266270
gather_facts: false
@@ -344,6 +348,10 @@
344348

345349
tasks:
346350

351+
- name: Delete file system storage
352+
ansible.builtin.include_tasks: "delete_fss.yml"
353+
when: use_fss
354+
347355
- name: Terminate the instances
348356
oracle.oci.oci_compute_instance:
349357
id: "{{ hostvars[item]['instance_ocid'] }}"
@@ -380,4 +388,5 @@
380388
state: absent
381389
path: "{{ item }}"
382390
loop:
391+
- fss_vars.yml
383392
- oci_vars.yml

ocne2/default_vars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ ocne_cluster_name: "ocne"
2828
num_cp_nodes: 3
2929
num_wk_nodes: 3
3030
update_all: false
31-
#oci_yum_region: ".uk-london-1"
31+
#oci_yum_region: ".uk-london-1"
32+
use_fss: false

ocne2/delete_fss.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Delete Export
8+
oracle.oci.oci_file_storage_export:
9+
id: "{{ export_id }}"
10+
state: 'absent'
11+
12+
- name: Delete Mount Target
13+
oracle.oci.oci_file_storage_mount_target:
14+
id: "{{ mount_target_id }}"
15+
state: 'absent'
16+
17+
- name: Delete File System
18+
oracle.oci.oci_file_storage_file_system:
19+
id: "{{ file_system_id }}"
20+
state: 'absent'

ocne2/deploy_ocne_oci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@
276276
name: {{ ocne_cluster_name }}
277277
controlPlaneNodes: {{ num_cp_nodes }}
278278
workerNodes: {{ num_wk_nodes }}
279+
ephemeralCluster:
280+
node:
281+
cpu: 4
282+
memory: 16384
279283
providers:
280284
oci:
281285
imageBucket: ocne-images-{{ rnd_str.0 }}
@@ -284,6 +288,10 @@
284288
become: true
285289
become_user: "{{ username }}"
286290

291+
- name: Create fss deployment descriptors
292+
ansible.builtin.include_tasks: "fss_deployments.yml"
293+
when: use_fss
294+
287295
- name: Provision the cluster
288296
ansible.builtin.shell: |
289297
ocne cluster start -u false -c myconfig.yaml

ocne2/fss_deployments.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Include file_system vars
8+
ansible.builtin.include_vars:
9+
file: fss_vars.yml
10+
11+
- name: Create fss pv deployment
12+
ansible.builtin.template:
13+
src: fss_pv.j2
14+
dest: ~/fss-pv.yaml
15+
mode: "0644"
16+
become: true
17+
become_user: "{{ username }}"
18+
19+
- name: Create fss pvc deployment
20+
ansible.builtin.template:
21+
src: fss_pvc.j2
22+
dest: ~/fss-pvc.yaml
23+
mode: "0644"
24+
become: true
25+
become_user: "{{ username }}"
26+
27+
- name: Create fss pod deployment
28+
ansible.builtin.template:
29+
src: fss_pod.j2
30+
dest: ~/fss-pod.yaml
31+
mode: "0644"
32+
become: true
33+
become_user: "{{ username }}"

ocne2/templates/egress_security_rules.j2

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,24 @@
66

77
instance_egress_security_rules:
88
- destination: "0.0.0.0/0"
9-
protocol: 6
9+
protocol: 6
10+
{% if use_fss %}
11+
- destination: "10.0.0.0/24"
12+
protocol: 6
13+
tcp_options:
14+
source_port_range:
15+
max: 111
16+
min: 111
17+
- destination: "10.0.0.0/24"
18+
protocol: 6
19+
tcp_options:
20+
source_port_range:
21+
max: 2050
22+
min: 2048
23+
- destination: "10.0.0.0/24"
24+
protocol: 17
25+
udp_options:
26+
destination_port_range:
27+
max: 111
28+
min: 111
29+
{% endif %}

ocne2/templates/fss_pod.j2

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
apiVersion: v1
8+
kind: Pod
9+
metadata:
10+
name: app
11+
spec:
12+
containers:
13+
- name: app
14+
image: ghcr.io/oracle/oraclelinux:8
15+
command: ["/bin/bash"]
16+
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
17+
volumeMounts:
18+
- name: persistent-storage
19+
mountPath: /data
20+
volumes:
21+
- name: persistent-storage
22+
persistentVolumeClaim:
23+
claimName: fss-pvc

ocne2/templates/fss_pv.j2

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
apiVersion: v1
8+
kind: PersistentVolume
9+
metadata:
10+
name: fss-pv
11+
spec:
12+
capacity:
13+
storage: 50Gi
14+
volumeMode: Filesystem
15+
accessModes:
16+
- ReadWriteMany
17+
persistentVolumeReclaimPolicy: Retain
18+
csi:
19+
driver: fss.csi.oraclecloud.com
20+
volumeHandle: {{ file_system_id }}:{{ mount_target_ip_address }}:{{ export_path }}

0 commit comments

Comments
 (0)