diff --git a/go.work b/go.work index c8aa42bd..0c16edc9 100644 --- a/go.work +++ b/go.work @@ -4,5 +4,4 @@ use ( ./examples/hello-world-service/src ./nvidia-gpu/nvidia-container-toolkit/nvidia-container-runtime-wrapper ./nvidia-gpu/nvidia-container-toolkit/nvidia-persistenced-wrapper - ./storage/iscsi-tools/iscsid-wrapper ) diff --git a/storage/iscsi-tools/iscsid-wrapper/go.mod b/storage/iscsi-tools/iscsid-wrapper/go.mod deleted file mode 100644 index 09e594d3..00000000 --- a/storage/iscsi-tools/iscsid-wrapper/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module iscsid-wrapper - -go 1.23.0 - -require golang.org/x/sys v0.28.0 diff --git a/storage/iscsi-tools/iscsid-wrapper/go.sum b/storage/iscsi-tools/iscsid-wrapper/go.sum deleted file mode 100644 index bc1eec1f..00000000 --- a/storage/iscsi-tools/iscsid-wrapper/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= diff --git a/storage/iscsi-tools/iscsid-wrapper/main.go b/storage/iscsi-tools/iscsid-wrapper/main.go deleted file mode 100644 index f88b26d0..00000000 --- a/storage/iscsi-tools/iscsid-wrapper/main.go +++ /dev/null @@ -1,46 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -package main - -import ( - "bytes" - "errors" - "fmt" - "log" - "os" - "os/exec" - - "golang.org/x/sys/unix" -) - -func main() { - log.Println("iscsid-wrapper: starting...") - cmd := exec.Command("/usr/local/sbin/iscsi-iname") - - var cmdOut bytes.Buffer - - cmd.Stdout = &cmdOut - - if _, err := os.Stat("/etc/iscsi/initiatorname.iscsi"); err != nil { - if errors.Is(err, os.ErrNotExist) { - log.Println("iscsid-wrapper: /etc/iscsi/initiatorname.iscsi does not exist, creating") - if err := cmd.Run(); err != nil { - log.Printf("iscsi-iname: error generating iscsi initiatorname %v\n", err) - } - - initiatorName := fmt.Sprintf("InitiatorName=%s", cmdOut.String()) - log.Printf("iscsid-wrapper: writing %s to /etc/iscsi/initiatorname.iscsi", initiatorName) - - if err := os.WriteFile("/etc/iscsi/initiatorname.iscsi", []byte(initiatorName), 0o644); err != nil { - log.Printf("iscsi-iname: error saving iscsi initiatorname %v\n", err) - } - } - } - - log.Println("iscsid-wrapper: completed..., execing into iscsid") - if err := unix.Exec("/usr/local/sbin/iscsid", []string{"iscsid", "-f"}, os.Environ()); err != nil { - log.Fatalf("iscsid: error execing /usr/local/sbin/iscsid %v\n", err) - } -} diff --git a/storage/iscsi-tools/iscsid-wrapper/pkg.yaml b/storage/iscsi-tools/iscsid-wrapper/pkg.yaml deleted file mode 100644 index 92b92924..00000000 --- a/storage/iscsi-tools/iscsid-wrapper/pkg.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: iscsid-wrapper -variant: scratch -shell: /toolchain/bin/bash -dependencies: - - stage: base -steps: - - cachePaths: - - /.cache/go-build - - /go/pkg - build: - - | - export PATH=${PATH}:${TOOLCHAIN}/go/bin - - cp -r /pkg/* . - - CGO_ENABLED=0 go build -o iscsid-wrapper main.go - install: - - | - mkdir -p /rootfs/usr/local/sbin - - cp iscsid-wrapper /rootfs/usr/local/sbin/iscsid-wrapper -finalize: - - from: /rootfs - to: /rootfs diff --git a/storage/iscsi-tools/iscsid.yaml b/storage/iscsi-tools/iscsid.yaml index e61a7cbf..1cbf4af8 100644 --- a/storage/iscsi-tools/iscsid.yaml +++ b/storage/iscsi-tools/iscsid.yaml @@ -1,14 +1,16 @@ name: iscsid depends: - service: cri - - service: ext-tgtd - network: - addresses - connectivity - hostname - etcfiles + - path: /etc/iscsi/initiatorname.iscsi container: - entrypoint: /usr/local/sbin/iscsid-wrapper + entrypoint: /usr/local/sbin/iscsid + args: + - -f security: maskedPaths: [] readonlyPaths: [] @@ -41,25 +43,13 @@ container: options: - bind - ro - # persistent storage for iscsi - - source: /system/iscsi + # iscsi etc folder + - source: /etc/iscsi destination: /etc/iscsi type: bind options: - rshared - rbind - - rw - - source: /usr/local/etc/iscsi/iscsid.conf - destination: /etc/iscsi/iscsid.conf - type: bind - options: - - bind - - ro - - source: /usr/local/etc/passwd - destination: /etc/passwd - type: bind - options: - - bind - ro - source: /var/lib/iscsi destination: /var/lib/iscsi diff --git a/storage/iscsi-tools/open-iscsi/files/passwd b/storage/iscsi-tools/open-iscsi/files/passwd deleted file mode 100644 index 35a01eb6..00000000 --- a/storage/iscsi-tools/open-iscsi/files/passwd +++ /dev/null @@ -1 +0,0 @@ -root:x:0:0:root:/:/sbin/false diff --git a/storage/iscsi-tools/open-iscsi/pkg.yaml b/storage/iscsi-tools/open-iscsi/pkg.yaml index dc6d7b35..ee3aaed5 100644 --- a/storage/iscsi-tools/open-iscsi/pkg.yaml +++ b/storage/iscsi-tools/open-iscsi/pkg.yaml @@ -6,8 +6,6 @@ dependencies: - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/kmod:{{ .BUILD_ARG_PKGS }}" - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/openssl:{{ .BUILD_ARG_PKGS }}" - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/util-linux:{{ .BUILD_ARG_PKGS }}" - - stage: open-isns - from: /rootfs steps: - sources: - url: https://github.com/open-iscsi/open-iscsi/archive/refs/tags/{{ .OPEN_ISCSI_VERSION }}.tar.gz @@ -49,10 +47,11 @@ steps: meson setup \ -Db_lto=true \ -Dno_systemd=true \ + -Disns=disabled \ + -Dhomedir=/etc/iscsi \ -Dprefix=/usr/local \ -Discsi_sbindir=/usr/local/sbin \ -Drulesdir=/usr/lib/udev/rules.d \ - -Dc_args="$CFLAGS -I/usr/local/include -DNO_SYSTEMD -DGLOB_ONLYDIR=0" \ output ninja -C output @@ -62,11 +61,10 @@ steps: DESTDIR=/rootfs ninja -C output install # cleanup - # we generate a one time initiatorname.iscsi when the iscsid-wrapper starts. - rm -rf /rootfs/usr/local/{etc/iscsi/initiatorname.iscsi,share,include,pkgconfig} - rm -rf /rootfs/var/lib/iscsi - - cp /pkg/files/passwd /rootfs/usr/local/etc/passwd + # we generate initiatorname.iscsi on talos side. + rm -rf /rootfs/etc + rm -rf /rootfs/usr/local/{etc,share,include,pkgconfig} + rm -rf /rootfs/var finalize: - from: /rootfs to: /rootfs diff --git a/storage/iscsi-tools/open-isns/pkg.yaml b/storage/iscsi-tools/open-isns/pkg.yaml deleted file mode 100644 index 3768dd5a..00000000 --- a/storage/iscsi-tools/open-isns/pkg.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: open-isns -variant: scratch -shell: /toolchain/bin/bash -dependencies: - - stage: base - - image: "{{ .BUILD_ARG_PKGS_PREFIX }}/openssl:{{ .BUILD_ARG_PKGS }}" -steps: - - sources: - - url: https://github.com/open-iscsi/open-isns/archive/refs/tags/v{{ .OPEN_ISNS_VERSION }}.tar.gz - destination: open-isns.tar.gz - sha256: 47499f3ce87a832840884dcf3eedbec8c039f472fe921a5378e3b206a3fc1a32 - sha512: 219dd4f7e0a8459f5acaf2036fc737b90604cdcfe78b5492d50e4826744923afe35c9c331b3e39aa7c9bb5ebb2c378c464dced204d51da46e2b7474c6ca94057 - prepare: - - | - tar -xzf open-isns.tar.gz --strip-components=1 - - | - mkdir -p /usr/bin - - ln -s /toolchain/bin/env /usr/bin/env - ln -s /toolchain/bin/python3 /toolchain/bin/python - - pip3 install ninja packaging - build: - - | - export PKG_CONFIG_PATH=/usr/lib/pkgconfig - - meson setup \ - -Dlibdir=lib \ - -Dprefix=/usr/local \ - _build - - ninja -C _build - install: - - | - DESTDIR=/rootfs ninja -C _build install - - # cleanup - rm -rf /rootfs/var - rm -rf /rootfs/usr/local/sbin - rm -rf /rootfs/usr/local/etc - rm -rf /rootfs/usr/lib - rm -rf /rootfs/usr/local/lib/pkgconfig -finalize: - - from: /rootfs - to: /rootfs diff --git a/storage/iscsi-tools/pkg.yaml b/storage/iscsi-tools/pkg.yaml index a4b8b1aa..7afec1ac 100644 --- a/storage/iscsi-tools/pkg.yaml +++ b/storage/iscsi-tools/pkg.yaml @@ -5,14 +5,11 @@ dependencies: # `base` dependency is used for doing cleanups # not copied to rootfs - stage: base - - stage: open-isns - stage: open-iscsi - - stage: tgt - - stage: iscsid-wrapper steps: - install: - | - mkdir -p /rootfs/usr/local/lib/containers/{iscsid,tgtd} + mkdir -p /rootfs/usr/local/lib/containers/iscsid sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml @@ -23,7 +20,6 @@ steps: mkdir -p /rootfs/usr/local/etc/containers cp /pkg/iscsid.yaml /rootfs/usr/local/etc/containers/iscsid.yaml - cp /pkg/tgtd.yaml /rootfs/usr/local/etc/containers/tgtd.yaml test: - | mkdir -p /extensions-validator-rootfs diff --git a/storage/iscsi-tools/tgt/musl.patch b/storage/iscsi-tools/tgt/musl.patch deleted file mode 100644 index 8973a9d3..00000000 --- a/storage/iscsi-tools/tgt/musl.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/usr/tgtd.h b/usr/tgtd.h -index 6e517f6..a41d0e5 100644 ---- a/usr/tgtd.h -+++ b/usr/tgtd.h -@@ -1,6 +1,8 @@ - #ifndef __TARGET_DAEMON_H - #define __TARGET_DAEMON_H - -+#include -+ - #include "log.h" - #include "scsi_cmnd.h" - #include "tgtadm_error.h" -diff --git a/usr/util.h b/usr/util.h -index eefce74..1e60fd5 100644 ---- a/usr/util.h -+++ b/usr/util.h -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #include "be_byteshift.h" - diff --git a/storage/iscsi-tools/tgt/pkg.yaml b/storage/iscsi-tools/tgt/pkg.yaml deleted file mode 100644 index fc91f185..00000000 --- a/storage/iscsi-tools/tgt/pkg.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: tgt -variant: scratch -shell: /toolchain/bin/bash -dependencies: - - stage: base -steps: - - sources: - - url: https://github.com/fujita/tgt/archive/refs/tags/v1.0.82.tar.gz - destination: tgtadm.tar.gz - sha256: 35156277465e0ced5f3ca7e301110a937a7a2b90bbb5aecbca1349b91ada1c2c - sha512: e81a56fae8010ee2af8643b6accc1e51f6667e27b07c986e6a5412dcb483b46ccc0e4fe1aeb399c352282284fe516f3fc1cab5d8cbb431cc9f97f00d5faa0430 - env: - PREFIX: /usr/local - prepare: - - | - tar -xzf tgtadm.tar.gz --strip-components=1 - - | - patch -p1 < /pkg/musl.patch - build: - - | - CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE" \ - make -j $(nproc) - install: - - | - make install-programs DESTDIR=/rootfs -finalize: - - from: /rootfs - to: /rootfs diff --git a/storage/iscsi-tools/tgtd.yaml b/storage/iscsi-tools/tgtd.yaml deleted file mode 100644 index 5654faae..00000000 --- a/storage/iscsi-tools/tgtd.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: tgtd -depends: - - service: cri - - network: - - addresses - - connectivity - - hostname - - etcfiles -container: - security: - rootfsPropagation: shared - entrypoint: /usr/local/sbin/tgtd - args: - - -f - mounts: - # ld-musl-x86_64.so.1 - - source: /lib - destination: /lib - type: bind - options: - - bind - - ro - # libcrypto.so and libc.so - - source: /usr/lib - destination: /usr/lib - type: bind - options: - - bind - - ro - - source: /var/run/tgtd - destination: /var/run/tgtd - type: bind - options: - - rshared - - rbind - - rw - - source: /usr/local/sbin - destination: /usr/local/sbin - type: bind - options: - - bind - - ro -restart: always diff --git a/storage/iscsi-tools/vars.yaml b/storage/iscsi-tools/vars.yaml index 5cf82f96..97b84a4d 100644 --- a/storage/iscsi-tools/vars.yaml +++ b/storage/iscsi-tools/vars.yaml @@ -1,5 +1,3 @@ -VERSION: v0.1.6 +VERSION: v0.2.0 # renovate: datasource=github-tags depName=open-iscsi/open-iscsi OPEN_ISCSI_VERSION: 2.1.10 -# renovate: datasource=github-tags extractVersion=^v(?.*)$ depName=open-iscsi/open-isns -OPEN_ISNS_VERSION: 0.103