Skip to content

Commit

Permalink
Enable and restart all units of OSC with purpose provision (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-goetz authored Jan 29, 2024
1 parent b449421 commit 28c5ca5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 9 additions & 3 deletions pkg/controller/operatingsystemconfig/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,23 @@ systemctl daemon-reload
ln -s /usr/sbin/containerd-ctr /usr/sbin/ctr
systemctl enable containerd && systemctl restart containerd
systemctl enable docker && systemctl restart docker
systemctl enable gardener-node-init && systemctl restart gardener-node-init
#Set journald storage to persistent such that logs are written to /var/log instead of /run/log
# Set journald storage to persistent such that logs are written to /var/log instead of /run/log
if [[ ! -f /etc/systemd/journald.conf.d/10-use-persistent-log-storage.conf ]]; then
mkdir -p /etc/systemd/journald.conf.d
cat <<EOF > /etc/systemd/journald.conf.d/10-use-persistent-log-storage.conf
[Journal]
Storage=persistent
EOF
systemctl restart systemd-journald
fi`
fi
`

for _, unit := range osc.Spec.Units {
script += fmt.Sprintf(`systemctl enable '%s' && systemctl restart --no-block '%s'
`, unit.Name, unit.Name)
}

if osc.Spec.Type == memoryone.OSTypeMemoryOneCHost {
return wrapIntoMemoryOneHeaderAndFooter(osc, script)
Expand Down
8 changes: 5 additions & 3 deletions pkg/controller/operatingsystemconfig/actuator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,19 @@ systemctl daemon-reload
ln -s /usr/sbin/containerd-ctr /usr/sbin/ctr
systemctl enable containerd && systemctl restart containerd
systemctl enable docker && systemctl restart docker
systemctl enable gardener-node-init && systemctl restart gardener-node-init
#Set journald storage to persistent such that logs are written to /var/log instead of /run/log
# Set journald storage to persistent such that logs are written to /var/log instead of /run/log
if [[ ! -f /etc/systemd/journald.conf.d/10-use-persistent-log-storage.conf ]]; then
mkdir -p /etc/systemd/journald.conf.d
cat <<EOF > /etc/systemd/journald.conf.d/10-use-persistent-log-storage.conf
[Journal]
Storage=persistent
EOF
systemctl restart systemd-journald
fi`
fi
systemctl enable 'some-unit' && systemctl restart --no-block 'some-unit'
`

When("OS type is 'suse-chost'", func() {
Describe("#Reconcile", func() {
Expand Down

0 comments on commit 28c5ca5

Please sign in to comment.