Skip to content

Commit

Permalink
CASMINST-4471 adjust init script for podman load behavior
Browse files Browse the repository at this point in the history
podman load no longer allows the tagging of the image during a load op: containers/podman#7387

to adjust the script for this, I filter the images to match metal-basecamp, get
the image id, and then tag it in a separate command after the image has loaded

Signed-off-by: Jacob Salmela <[email protected]>

prevent error
```
Apr 25 20:58:20 redbull-ncn-m001-pit systemd[1]: /usr/lib/systemd/system/basecamp.service:14: Unit configured to use KillMode=none. Support for KillMode=none is deprecated and will be eventually removed in future SLE versions. Please see SUSE TID https://www.suse.com/support/kb/doc/?id=000020394 for more details.
```
by setting the killmode to control-group

Signed-off-by: Jacob Salmela <[email protected]>
  • Loading branch information
jacobsalmela committed Apr 25, 2022
1 parent 1e25cd3 commit a757e4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.11
1.1.12
8 changes: 6 additions & 2 deletions init/basecamp-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fi
BASECAMP_PIDFILE="$1"
BASECAMP_CIDFILE="$2"
BASECAMP_CONTAINER_NAME="${3-metal\-basecamp}"
BASECAMP_VOLUME_NAME="${4:-${BASECAMP_CONTAINER_NAME}-configs}"

BASECAMP_IMAGE_PATH="@@basecamp-path@@"
BASECAMP_IMAGE="@@basecamp-image@@"
Expand Down Expand Up @@ -72,7 +71,12 @@ if ! podman inspect "$BASECAMP_CONTAINER_NAME" ; then
rm -f "$BASECAMP_CIDFILE" || exit
# Load basecamp image if it doesn't already exist
if ! podman image inspect "$BASECAMP_IMAGE" >dev/null; then
podman load "$BASECAMP_IMAGE_PATH" "$BASECAMP_IMAGE" || exit
# load the image
podman load -i "$BASECAMP_IMAGE_PATH" || exit
# get the image id
BASECAMP_IMAGE_ID=$(podman images --noheading --format "{{.Id}}" --filter label="org.label-schema.name=$BASECAMP_CONTAINER_NAME")
# tag the image
podman tag "$BASECAMP_IMAGE_ID" "$BASECAMP_IMAGE"
fi
podman create \
--conmon-pidfile "$BASECAMP_PIDFILE" \
Expand Down
8 changes: 5 additions & 3 deletions init/basecamp.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ After=network-online.target
[Service]
Restart=on-failure
Environment=GIN_MODE=release
ExecStartPre=/usr/sbin/basecamp-init.sh %t/%n-pid %t/%n-cid basecamp
ExecStartPre=/usr/sbin/basecamp-init.sh %t/%n-pid %t/%n-cid metal-basecamp
ExecStart=/usr/bin/podman start basecamp
ExecStop=/usr/bin/podman stop --ignore -t 10 basecamp
PIDFile=%t/%n-pid
KillMode=none
# all remaining processes in the control group of this unit will be killed on unit stop
# https://www.suse.com/support/kb/doc/?id=000020394
KillMode=control-group
Type=forking

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

0 comments on commit a757e4f

Please sign in to comment.