-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add systemd services for configuration after start
this adds 4 small systemd services that: - creates crc specific configurations for dnsmasq - sets a new uuid as cluster id - creates the pod for routes-controller - tries to grow the disk and filesystem
- Loading branch information
Showing
9 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=CRC Unit for configuring dnsmasq | ||
Requires=ovs-configuration.service | ||
After=ovs-configuration.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/crc-dnsmasq.sh | ||
StandardOutput=journal | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
# exit early if user-mode networking | ||
ping -c1 gateway > /dev/null 2>&1 | ||
[ $? -eq 0 ] && exit 0 | ||
|
||
hostName=$(hostname) | ||
ip=$(ip -4 addr show br-ex | grep -oP '(?<=inet\s)192+(\.\d+){3}') | ||
iip=$(hostname -i) | ||
|
||
cat << EOF > /etc/dnsmasq.d/crc-dnsmasq.conf | ||
listen-address=$ip | ||
expand-hosts | ||
log-queries | ||
local=/crc.testing/ | ||
domain=crc.testing | ||
address=/apps-crc.testing/$ip | ||
address=/api.crc.testing/$ip | ||
address=/api-int.crc.testing/$ip | ||
address=/$hostName.crc.testing/$iip | ||
EOF | ||
|
||
sleep 2 | ||
|
||
systemctl enable dnsmasq.service | ||
systemctl start dnsmasq.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=CRC Unit starting routes controller | ||
After=kubelet.service | ||
Requires=kubelet.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/crc-routes-controller.sh | ||
StandardOutput=journal | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
# exit early if system-mode networking | ||
ping -c1 gateway > /dev/null 2>&1 | ||
[ $? -eq 2 ] && exit 0 | ||
|
||
export KUBECONFIG=/opt/kubeconfig | ||
oc apply -f /opt/crc/routes-controller.yaml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=CRC Unit setting random cluster ID | ||
After=kubelet.service | ||
Requires=kubelet.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/ocp-clusterid.sh | ||
StandardOutput=journal | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
export KUBECONFIG="/opt/kubeconfig" | ||
uuid=$(uuidgen) | ||
|
||
retry=0 | ||
max_retry=20 | ||
until `oc get clusterversion > /dev/null 2>&1` | ||
do | ||
[ $retry == $max_retry ] && exit 1 | ||
sleep 5 | ||
((retry++)) | ||
done | ||
|
||
oc patch clusterversion version -p "{\"spec\":{\"clusterID\":\"${uuid}\"}}" --type merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=CRC Unit to grow the root filesystem | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/local/bin/ocp-growfs.sh | ||
StandardOutput=journal | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
root_partition=$(/usr/sbin/blkid -t TYPE=xfs -o device) | ||
/usr/bin/growpart "${root_partition#?}" "${root_partition#/dev/???}" | ||
|
||
rootFS="/sysroot" | ||
mount -o remount,rw "${rootFS}" | ||
xfs_growfs "${rootFS}" | ||
#mount -o remount,ro "${rootFS}" |