-
Notifications
You must be signed in to change notification settings - Fork 0
/
70-vms.yml
217 lines (214 loc) · 7.73 KB
/
70-vms.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
name: bigip0
namespace: f5-lb
annotations:
k8s.v1.cni.cncf.io/networks: bigip0ens2f1vf0
k8s.v1.cni.cncf.io/networks: bigip0ens2f1vf1
labels:
f5type: bigip-ve
spec:
runStrategy: Always
template:
metadata:
labels:
f5type: bigip-ve
spec:
nodeSelector:
kubernetes.io/hostname: worker000
domain:
resources:
requests:
memory: "8192Mi"
cpu: "4"
devices:
disks:
- name: bigip0-volume
disk:
bus: sata
- name: cloudinitvolume
disk:
bus: virtio
interfaces:
- name: mgmt
bridge: {}
- name: ha
bridge: {}
- name: int-sriov
macAddress: 02:02:02:02:05:01
sriov: {}
- name: ext-sriov
macAddress: 02:02:02:02:05:02
sriov: {}
volumes:
- name: bigip0-volume
dataVolume:
name: bigip0-volume
- name: cloudinitvolume
cloudInitConfigDrive:
userData: |-
#cloud-config
write_files:
- path: /config/cloud/config.sh
permissions: 0755
owner: root:root
content: |
#!/bin/bash
echo "Hello World" >> /var/tmp/cloud-init-output
source /usr/lib/bigstart/bigip-ready-functions
wait_bigip_ready
LOGGER_TAG="OpenShift-cloud-init"
LOGGER_CMD="logger -t $LOGGER_TAG"
function log() {
echo "$1" | eval "$LOGGER_CMD"
}
tmsh save /sys config
log "Setting up mgmt IP address and GW..."
tmsh modify sys global-settings mgmt-dhcp disabled
tmsh create sys management-ip 192.168.223.100/24
tmsh create sys management-route default gateway 192.168.223.1
tmsh modify sys global-settings hostname bigip0.apps.muralitest973.myocp4.com
log "Setting up VLANS and selfIPs..."
tmsh create net vlan int-sriov interfaces add { 1.2 { untagged } } tag 4093
tmsh create net self 192.168.222.100/24 vlan int-sriov allow-service all
log "Creating paritions.."
tmsh create auth partition kubernetes default-route-domain 0
log "Changing the root and admin passwords..."
echo -en "changepwd\nchangepwd\n" | tmsh modify auth password root
echo -en "changepwd\nchangepwd\n" | tmsh modify auth user admin prompt-for-password
sleep 30
tmsh modify /sys global-settings gui-setup disabled
tmsh modify ltm global-settings general snat-packet-forward enabled
tmsh modify sys db connection.vlankeyed value disable
tmsh modify sys db arp.verifyreturnroute value disable
tmsh modify sys disk directory /shared new-size 10485770
tmsh modify sys disk directory /var new-size 10485770
tmsh save sys config
log "cloud-init configuration is saved..."
sleep 60
reboot
runcmd:
# NOTE: Commands must be non-blocking so send long running commands (polling/waiting for mcpd) to the background
- /config/cloud/config.sh &
networks:
- name: mgmt
multus:
networkName: bigip-mgmt
- name: ha
multus:
networkName: bigip-ha
- name: int-sriov
multus:
networkName: bigip0ens2f1vf0
- name: ext-sriov
multus:
networkName: bigip0ens2f1vf1
---
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
name: bigip1
namespace: f5-lb
annotations:
k8s.v1.cni.cncf.io/networks: bigip1ens2f1vf2
k8s.v1.cni.cncf.io/networks: bigip1ens2f1vf3
labels:
f5type: bigip-ve
spec:
runStrategy: Always
template:
metadata:
labels:
f5type: bigip-ve
spec:
nodeSelector:
kubernetes.io/hostname: worker001
domain:
resources:
requests:
memory: "8192Mi"
cpu: "4"
devices:
disks:
- name: bigip1-volume
disk:
bus: sata
- name: cloudinitvolume
disk:
bus: virtio
interfaces:
- name: mgmt
bridge: {}
- name: ha
bridge: {}
- name: int-sriov
macAddress: 02:02:02:02:05:03
sriov: {}
- name: ext-sriov
macAddress: 02:02:02:02:05:04
sriov: {}
volumes:
- name: bigip1-volume
dataVolume:
name: bigip1-volume
- name: cloudinitvolume
cloudInitConfigDrive:
userData: |-
#cloud-config
write_files:
- path: /config/cloud/config.sh
permissions: 0755
owner: root:root
content: |
#!/bin/bash
echo "Hello World" >> /var/tmp/cloud-init-output
source /usr/lib/bigstart/bigip-ready-functions
wait_bigip_ready
LOGGER_TAG="OpenShift-cloud-init"
LOGGER_CMD="logger -t $LOGGER_TAG"
function log() {
echo "$1" | eval "$LOGGER_CMD"
}
tmsh save /sys config
log "Setting up mgmt IP address and GW..."
tmsh modify sys global-settings mgmt-dhcp disabled
tmsh create sys management-ip 192.168.223.101/24
tmsh create sys management-route default gateway 192.168.223.1
tmsh modify sys global-settings hostname bigip1.apps.muralitest973.myocp4.com
log "Setting up VLANS and selfIPs..."
tmsh create net vlan int-sriov interfaces add { 1.2 { untagged } } tag 4093
tmsh create net self 192.168.222.101/24 vlan int-sriov allow-service all
log "Creating paritions.."
tmsh create auth partition kubernetes default-route-domain 0
log "Changing the root and admin passwords..."
echo -en "changepwd\nchangepwd\n" | tmsh modify auth password root
echo -en "changepwd\nchangepwd\n" | tmsh modify auth user admin prompt-for-password
sleep 30
tmsh modify /sys global-settings gui-setup disabled
tmsh modify ltm global-settings general snat-packet-forward enabled
tmsh modify sys db connection.vlankeyed value disable
tmsh modify sys db arp.verifyreturnroute value disable
tmsh modify sys disk directory /shared new-size 10485770
tmsh modify sys disk directory /var new-size 10485770
tmsh save sys config
log "cloud-init configuration is saved..."
sleep 60
reboot
runcmd:
# NOTE: Commands must be non-blocking so send long running commands (polling/waiting for mcpd) to the background
- /config/cloud/config.sh &
networks:
- name: mgmt
multus:
networkName: bigip-mgmt
- name: ha
multus:
networkName: bigip-ha
- name: int-sriov
multus:
networkName: bigip1ens2f1vf2
- name: ext-sriov
multus:
networkName: bigip1ens2f1vf3