Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree: various tweaks #1

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM quay.io/centos/centos:stream9

COPY saveconfig.json /etc/target/saveconfig.json

RUN dnf install -y targetcli kmod && dnf clean all
RUN systemctl enable target

Expand Down
22 changes: 6 additions & 16 deletions ignition/target.bu
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,24 @@ storage:
- path: /etc/containers/systemd/target.container
contents:
local: target.container
- path: /targetcli_script
- path: /usr/local/bin/targetcli_script
contents:
local: targetcli_script
mode: 0755
systemd:
units:
- name: var-shared-virtiofs.mount
enabled: true
contents: |
[Unit]
Description=Mount virtiofs shared filesystem
[Mount]
What=var-shared
Where=/var/shared/
Type=virtiofs
[Install]
WantedBy=multi-user.target
- name: setup-targetcli.service
enabled: true
contents: |
[Unit]
Description=Setup targetcli
ConditionPathExists=/var/shared/fcos.raw
Requires=target.container
After=target.container
ConditionPathExists=/var/mnt/workdir-tmp/fcos.raw
Requires=target.service
After=target.service
ConditionFirstBoot=true
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/targetcli_script
ExecStart=/usr/local/bin/targetcli_script
[Install]
WantedBy=multi-user.target
11 changes: 5 additions & 6 deletions ignition/target.container
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@
Description=Targetd container
Documentation=https://github.com/jbtrystram/targetcli-containers
After=local-fs.target
ConditionPathExists=/var/shared/
ConditionPathExists=/var/mnt/workdir-tmp
After=network-online.target
Wants=network-online.target

[Container]
Image=quay.io/jbtrystram/targetcli:latest
ContainerName=target
AddCapability=CAP_SYS_MODULE
Network=host
Volume=/lib/modules:/lib/modules
Volume=/var/run/dbus:/var/run/dbus
Volume=/sys/kernel/config:/sys/kernel/config
Volume=/var/shared:/var/shared/
Volume=/var/mnt/workdir-tmp/:/var/mnt/workdir-tmp/
PodmanArgs=--privileged

[Install]
# Start by default on boot
WantedBy=multi-user.target default.target
After=network-online.target, shared-virtiofs.mount
Wants=network-online.target, shared-virtiofs.mount
WantedBy=multi-user.target

[Service]
# Extend Timeout to allow time to pull the image
Expand Down
11 changes: 7 additions & 4 deletions ignition/targetcli_script
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash

podman exec target targetcli /backstores/fileio create coreos /fcos.raw
podman exec target targetcli iscsi/ create iqn.2023-10.coreos.target.vm:coreos
podman exec target targetcli iscsi/iqn.2023-10.coreos.target.vm:coreos/tpg1/ set attribute authentication=0
podman exec target targetcli iscsi/iqn.2023-10.coreos.target.vm:coreos/tpg1/luns create /backstores/fileio/coreos
podman exec target bash -exc "
targetcli /backstores/fileio create coreos /var/mnt/workdir-tmp/fcos.raw
targetcli iscsi/ create iqn.2023-10.coreos.target.vm:coreos
targetcli iscsi/iqn.2023-10.coreos.target.vm:coreos/tpg1/luns create /backstores/fileio/coreos
targetcli iscsi/iqn.2023-10.coreos.target.vm:coreos/tpg1/ set attribute authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1
"

138 changes: 0 additions & 138 deletions saveconfig.json

This file was deleted.