-
Notifications
You must be signed in to change notification settings - Fork 3
/
02_generate_workloadpartitioning_config.sh
executable file
·41 lines (37 loc) · 1.52 KB
/
02_generate_workloadpartitioning_config.sh
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
#!/bin/bash
CPUSET=$1; shift
if [ -z "$CPUSET" ]
then
echo "Run the script like ./02_generate_workloadpartitioning_config.sh <CPUSET>, for example ./02_generate_workloadpartitioning_config.sh 0-3,16-19"
exit 1
fi
cat <<EOF > assets/99_workload_partitioning.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 02-master-workload-partitioning
spec:
config:
ignition:
version: 3.2.0
storage:
files:
- contents:
source: data:text/plain;charset=utf-8;base64,WP01
mode: 420
overwrite: true
path: /etc/crio/crio.conf.d/01-workload-partitioning
user:
name: root
- contents:
source: data:text/plain;charset=utf-8;base64,WP02
mode: 420
overwrite: true
path: /etc/kubernetes/openshift-workload-pinning
user:
name: root
EOF
sed -i "s/WP01/$(echo "W2NyaW8ucnVudGltZS53b3JrbG9hZHMubWFuYWdlbWVudF0KYWN0aXZhdGlvbl9hbm5vdGF0aW9uID0gInRhcmdldC53b3JrbG9hZC5vcGVuc2hpZnQuaW8vbWFuYWdlbWVudCIKYW5ub3RhdGlvbl9wcmVmaXggPSAicmVzb3VyY2VzLndvcmtsb2FkLm9wZW5zaGlmdC5pbyIKcmVzb3VyY2VzID0geyAiY3B1c2hhcmVzIiA9IDAsICJjcHVzZXQiID0gIkNIQU5HRU1FIiB9Cg==" | base64 -d | sed "s/CHANGEME/${CPUSET}/" | base64 -w0)/" assets/99_workload_partitioning.yaml
sed -i "s/WP02/$(echo "ewogICJtYW5hZ2VtZW50IjogewogICAgImNwdXNldCI6ICJDSEFOR0VNRSIKICB9Cn0K" | base64 -d | sed "s/CHANGEME/${CPUSET}/" | base64 -w0)/" assets/99_workload_partitioning.yaml