-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0_ocp4_vsphere_upi_init_vars.template
161 lines (140 loc) · 4.82 KB
/
0_ocp4_vsphere_upi_init_vars.template
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
export DISCONNECTED_INSTALL="Y"
export BM_BOOT_STATIC="N"
export CLUSTER="<cluster_name>"
export BASE_DOMAIN="<base_domain>"
export MACHINE_CIDR="10.37.198.0/25"
export MACHINE_NM=$(ipcalc -m ${MACHINE_CIDR} | awk -F= '{print $2}')
export MACHINE_PREFIX=$(ipcalc -p ${MACHINE_CIDR} | awk -F= '{print $2}')
export MACHINE_GW="10.37.198.126"
export MACHINE_DNS1="10.5.30.45"
export MACHINE_DNS2="10.5.30.46"
export BOOTSTRAP_DISABLE_DNS="N"
export BOOTSTRAP_PREFIX="bootstrap"
export BOOTSTRAP_IP='10.37.198.20'
export BOOTSTRAP_CPU=4
export BOOTSTRAP_MEM=8192
export BOOTSTRAP_DISK=60
export MASTER_PREFIX="master"
export MASTER_COUNT=3
export MASTER_IPS='"10.37.198.21", "10.37.198.22", "10.37.198.23"'
export MASTER_CPU=4
export MASTER_MEM=16384
export MASTER_DISK=60
export WORKER_PREFIX="worker"
export WORKER_COUNT=3
export WORKER_IPS='"10.37.198.24", "10.37.198.25", "10.37.198.26"'
export WORKER_CPU=4
export WORKER_MEM=8192
export WORKER_DISK=60
export NAMED_ZONE="<bind/named_zone_file_name>"
export HOST_SHORT=$(hostname -s)
export TERRAFORM_VER="0.12.24"
export GOVC_VER="v0.22.1"
#export RELEASE=latest
export RELEASE=4.12.16
export BUILDNUMBER=$(curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${RELEASE}/release.txt | grep 'Name:' | awk '{print $NF}')
export RHCOS=$(echo $BUILDNUMBER | awk -F. '{print $1"."$2}')
export RHCOS_TEMPLATE="rhcos-${RHCOS}"
export RHCOSMIN=4.5
function convert_to_integer {
echo "$@" | awk -F "." '{ printf("%03d%03d", $1,$2); }';
}
if [ "$(convert_to_integer $RHCOS)" -gt "$(convert_to_integer $RHCOSMIN)" ];then
export INSTPREFIX="live"
else
export INSTPREFIX="installer"
fi
if (( $(echo "${RHCOS} 4.5" | awk '{print ($1 > $2)}') )); then
export INSTPREFIX="live"
else
export INSTPREFIX="installer"
fi
export TERRAFORM="terraform_${TERRAFORM_VER}_linux_amd64.zip"
export CLIENT="openshift-client-linux-${BUILDNUMBER}.tar.gz"
export INSTALLER="openshift-install-linux-${BUILDNUMBER}.tar.gz"
export GOVC_URL="<vpshere/vcenter_hostname>"
export GOVC_USERNAME='<vsphere/vcenter_username>'
export GOVC_PASSWORD='<vsphere/vcenter_password>'
export GOVC_NETWORK='<vsphere_network>'
export GOVC_DATACENTER='<vsphere_datacenter_name>'
export GOVC_CLUSTER='<vsphere_cluster_name>'
export GOVC_DATASTORE='<vsphere_datastore_name>'
export GOVC_INSECURE=1 # If the host above uses a self-signed cert
export GODEBUG=x509ignoreCN=0
export REG_AUTH="${PWD}/opt/registry/auth"
export REG_CERT="${PWD}/opt/registry/certs"
export REG_DATA="${PWD}/opt/registry/data"
export REG_CERT_SUBJ_CA="/C=xx/ST=xx/L=xxxxxxx/O=xxxxxxx/CN=${HOST_SHORT}.${BASE_DOMAIN} Root CA"
export REG_CERT_CSR="[ req ]\ndefault_bits = 4096\nprompt = no\ndefault_md = sha256\nreq_extensions = req_ext\ndistinguished_name = dn\n\n[ dn ]\nC = xx\nST = xx\nL = xxxxxxx\nO = xxx\nOU = xxx\nCN = ${HOST_SHORT}.${BASE_DOMAIN}\n\n[ req_ext ]\nsubjectAltName = @alt_names\n\n[ alt_names ]\nDNS.1 = ${HOST_SHORT}.${BASE_DOMAIN}"
export REG_CERT_DAYS=9999
export LOCAL_REG_PORT=5000
export LOCAL_REG="${HOST_SHORT}.${BASE_DOMAIN}"
export LOCAL_REPO="${CLUSTER}-ocp${RELEASE}"
export LOCAL_REPO_OLM="${CLUSTER}-olm${RELEASE}"
export LOCAL_SECRET_JSON="pull-secret-2.json"
export LOCAL_REG_USER="dummy"
export LOCAL_REG_PWD="dummy"
export SECRET=$(echo -n "${LOCAL_REG_USER}:${LOCAL_REG_PWD}" | base64 -w0)
export UPSTREAM_REPO="openshift-release-dev"
export RELEASE_NAME="ocp-release"
export IMG_DIGEST_PREFIX="ocp-v4.0-art-dev"
export OCP_RELEASE="${RELEASE}-x86_64"
export PULL_SECRET='<copy your pull secret here obtained from cloud.redhat.com>'
export SSH_KEY='<copy your ssh public key here>'
gen_append_ign_file ()
{
ROLE=$1
MACHINE_NAME=$2
MACHINE_IP=$3
cat >${MACHINE_NAME}.yaml.$$ <<EOF
ignition:
config:
append:
- source: http://${HOST_SHORT}.${BASE_DOMAIN}/${CLUSTER}-${ROLE}.ign
storage:
files:
- path: /etc/hostname
filesystem: root
contents:
inline: ${MACHINE_NAME}.${CLUSTER}.${BASE_DOMAIN}
mode: 0644
user:
id: 0
group:
id: 0
- path: /etc/sysconfig/network-scripts/ifcfg-ens192
filesystem: root
contents:
inline: |
TYPE=Ethernet
BOOTPROTO=none
NAME=ens192
DEVICE=ens192
ONBOOT=yes
IPADDR=${MACHINE_IP}
PREFIX=${MACHINE_PREFIX}
GATEWAY=${MACHINE_GW}
DOMAIN=${CLUSTER}.${BASE_DOMAIN}
DNS1=${MACHINE_DNS1}
DNS2=${MACHINE_DNS2}
mode: 0644
user:
id: 0
group:
id: 0
systemd:
units:
- name: restart.service
enabled: true
contents: |
[Unit]
ConditionFirstBoot=yes
[Service]
Type=idle
ExecStart=/sbin/reboot
[Install]
WantedBy=multi-user.target
EOF
ct --in-file ${MACHINE_NAME}.yaml.$$ --out-file /var/www/html/${CLUSTER}-${MACHINE_NAME}-append.ign
rm -f ${MACHINE_NAME}.yaml.$$
}