You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/patterns/ansible-edge-gitops/ideas-for-customization.adoc
+58-75Lines changed: 58 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,39 +15,43 @@ One of the major goals of the Red Hat patterns development process is to create
15
15
16
16
This demo in particular can be customized in a several ways that might be very interesting and here are some starter ideas with some instructions on exactly what and where changes would need to be made in the pattern to accommodate those changes.
17
17
18
-
== Define your own VM sets using the chart
18
+
== Defining your own VM sets using the chart
19
19
20
-
. Fork the repo or copy the `edge-gitops-vms`` chart out of it.
20
+
. Fork the link:https://github.com/validatedpatterns/ansible-edge-gitops[repo].
21
21
22
-
. Customize the https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/charts/hub/edge-gitops-vms/values.yaml[values.yaml] file
22
+
. Clone the repo to your local machine.
23
23
24
-
The `vms` data structure is designed to support multiple groups and types of VMs. The `kiosk` example defines all of the variables currently supported by the chart, including references to the Vault instance and port definitions. If, for example, you wanted to replace kiosk with new `iotsensor`` and `iotgateway` types, the file might look like this:
24
+
. Change to the `ansible-edge-gitops` directory.
25
25
26
+
. Create and switch to a new branch named `my-branch`, by running the following command:
27
+
+
28
+
[source,shell]
29
+
----
30
+
$ git checkout -b my-branch
31
+
----
32
+
33
+
. Change to the `overides` directory.
34
+
+
35
+
For example, to replace kiosk with new `iotsensor`` and `iotgateway` types, the file might look like this:
36
+
+
26
37
[source,yaml]
27
38
----
28
39
---
29
-
secretStore:
30
-
name: vault-backend
31
-
kind: ClusterSecretStore
32
-
33
-
cloudInit:
34
-
defaultUser: 'cloud-user'
35
-
defaultPassword: '6toh-n1d5-9xpq'
36
-
37
40
vms:
41
+
# Define the iotsensor VMs
38
42
iotsensor:
39
43
count: 4
40
44
flavor: small
41
45
workload: server
42
46
os: rhel8
43
-
role: iotgateway
47
+
role: iotsensor
44
48
storage: 20Gi
45
49
memory: 2Gi
46
50
cores: 1
47
51
sockets: 1
48
52
threads: 1
49
53
cloudInitUser: cloud-user
50
-
cloudInitPassword: 6toh-n1d5-9xpq
54
+
cloudInitPassword: 'password123'
51
55
template: rhel8-server-small
52
56
sshsecret: secret/data/hub/iotsensor-ssh
53
57
sshpubkeyfield: publickey
@@ -56,6 +60,8 @@ vms:
56
60
port: 22
57
61
protocol: TCP
58
62
targetPort: 22
63
+
64
+
# Define the iotgateway VMs
59
65
iotgateway:
60
66
count: 1
61
67
flavor: medium
@@ -68,7 +74,7 @@ vms:
68
74
sockets: 1
69
75
threads: 1
70
76
cloudInitUser: cloud-user
71
-
cloudInitPassword: 6toh-n1d5-9xpq
77
+
cloudInitPassword: 'password123'
72
78
template: rhel8-server-medium
73
79
sshsecret: secret/data/hub/iotgateway-ssh
74
80
sshpubkeyfield: publickey
@@ -85,29 +91,34 @@ vms:
85
91
86
92
This would create 1 `iotgateway` VM and 4 `iotsensor` VMs.
87
93
88
-
Adjustments would also need to be made in https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/values-secret.yaml.template[values-secret] and https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/scripts/ansible_load_controller.sh[ansible-load-controller] to add the `iotgateway-ssh` and `iotsensor-ssh` data structures.
94
+
You also need to to define the SSH secrets (`iotgateway-ssh` and `iotsensor-ssh`) data structures in `~/values-secret.yaml`.
89
95
90
96
== Defining your own VM sets "`from scratch`"
91
97
92
-
. Pick a default template from the standard OpenShift Virtualization
93
-
template library in the `+openshift+` namespace. For this pattern, we
94
-
used `+rhel8-desktop-medium+`:
98
+
. Pick a default template from the standard OpenShift Virtualization template library in the `openshift` namespace. For this pattern, we used `rhel8-desktop-medium`:
95
99
+
96
100
[source,text]
97
101
----
98
102
$ oc get template -n openshift rhel8-desktop-medium
103
+
----
104
+
+
105
+
.Example output
106
+
[source,text]
107
+
----
99
108
NAME DESCRIPTION PARAMETERS OBJECTS
100
109
rhel8-desktop-medium Template for Red Hat Enterprise Linux 8 VM or newer. A PVC with the RHEL disk... 4 (2 generated) 1
101
110
----
102
111
103
-
. Create a VM through the command line template process, and see what objects OpenShift Virtualization creates to bring
104
-
that VM up:
112
+
. Create a VM through the command line template process by running the following command:
105
113
+
106
-
To see the actual JSON that the template converts into:
114
+
[source,shell]
115
+
----
116
+
oc process -n openshift rhel8-desktop-medium | oc apply -f -
117
+
----
107
118
+
119
+
.Example output
108
120
[source,text]
109
121
----
110
-
$ oc process -n openshift rhel8-desktop-medium
111
122
{
112
123
"kind": "List",
113
124
"apiVersion": "v1",
@@ -118,23 +129,23 @@ $ oc process -n openshift rhel8-desktop-medium
118
129
"kind": "VirtualMachine",
119
130
"metadata": {
120
131
"annotations": {
121
-
"vm.kubevirt.io/validations": "[\n {\n \"name\": \"minimal-required-memory\",\n \"path\": \"jsonpath::.spec.domain.resources.requests.memory\",\n \"rule\": \"integer\",\n \"message\": \"This VM requires more memory.\",\n \"min\": 1610612736\n }\n]\n"
132
+
"vm.kubevirt.io/validations": "[\n {\n \"name\": \"minimal-required-memory\",\n \"path\": \"jsonpath::.spec.domain.memory.guest\",\n \"rule\": \"integer\",\n \"message\": \"This VM requires more memory.\",\n \"min\": 1610612736\n }\n]\n"
from the Red Hat Community of Practice https://github.com/redhat-cop/controller_configuration[controller_configuration]
272
-
collection. The order and specific list of roles invoked is taken from there.
273
-
274
-
To customize it, the main thing would be to replace the different variables in the role tasks with the your own. The script includes the
275
-
roles for variable types that this pattern does not manage in order to make that part straightforward. Feel free to add your own roles and
276
-
playbooks (and add them to the controller configuration script).
277
-
278
-
The reason this pattern ships with a script as it does instead of invoking the referenced playbook directly is that several of the
279
-
configuration elements depend on each other, and there was not a super-convenient place to put things like the controller credentials as
280
-
the playbook suggests.
281
-
282
-
== Substitute your own container application (instead of ignition)
283
-
284
-
285
-
. Adjust the query in the https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/inventory_preplay.yml[inventory_preplay.yml]
286
-
either by overriding the vars for the play, or forking the repo and replacing the vars with your own query terms. (That is, use your own
287
-
label(s) and namespace to discover the services you want to connect to.
288
-
289
-
. Adjust or override the vars in the https://github.com/validatedpatterns/ansible-edge-gitops/blob/main/ansible/provision_kiosk.yml[provision_kiosk.yml]
290
-
playbook to suitable values for your own container application. The roles it calls are fairly generic, so changing the vars is all you should need to do.
272
+
+
273
+
Once you have this local template, you can view the elements you want to customize.
0 commit comments