Skip to content

Commit

Permalink
TrueNAS CSP v2.4.2 (#57)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Mattsson <michael.mattsson@gmail.com>
  • Loading branch information
datamattsson authored May 6, 2024
1 parent 1657b8f commit 1adedee
Show file tree
Hide file tree
Showing 40 changed files with 594 additions and 173 deletions.
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM alpine:3
RUN apk add --no-cache python3 py3-pip && \
pip3 install --upgrade pip && \
mkdir /app
ADD requirements.txt /
RUN pip3 install -r requirements.txt
RUN apk add --no-cache python3 py3-pip && \
python3 -m venv /app && \
/app/bin/pip install -r requirements.txt
ADD truenascsp/*.py /app/
WORKDIR /app
ENTRYPOINT [ "gunicorn", "--workers", "3", "--bind", "0.0.0.0:8080", "--timeout", "60", "csp:SERVE" ]
ENTRYPOINT [ "/app/bin/gunicorn", "--workers", "3", "--bind", "0.0.0.0:8080", "--timeout", "180", "csp:SERVE" ]
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ Set `root` to a dataset that will serve as the base dataset where the ZVols will
**Important:** Do NOT use underscore "`_`" in your root dataset for now, it will most likely break.

Once the `Secret` and `StorageClass` have been created, all functionality is provided by the HPE CSI Driver and is [documented here](https://scod.hpedev.io/csi_driver/using.html).

**Tip:** If `VolumeSnapshots` are needed, follow the guidance in HPE CSI Driver documentation on how to [enable CSI snapshots](https://scod.hpedev.io/csi_driver/using.html#enabling_csi_snapshots) and [how to use them](https://scod.hpedev.io/csi_driver/using.html#using_csi_snapshots).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2020 Hewlett Packard Enterprise Development LP
Copyright 2024 Hewlett Packard Enterprise Development LP

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
75 changes: 62 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,36 @@ run:
docker run -d -p8080:8080 --name truenas-csp -e LOG_DEBUG=1 $(REPO_NAME):$(IMAGE_TAG)

test:
# Delete host
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \

# Delete host 1
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db0 -f || true

# Unpublish volume
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish.yaml -H 'Content-Type: application/json' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db0 -f

# Delete host 2
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db1 -f

# Unpublish volume host 1
- $(curl) $(curl_args) -XPUT -d @tests/csp/unpublish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f || true
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f

# Unpublish volume host 2
- $(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f

# Delete volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
- $(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' -H 'X-Auth-Token: $(password)' \
-H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f || true
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f

# Delete thick volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume18 -f

# "Create" password
$(curl) $(curl_args) -XPOST \
Expand All @@ -49,16 +65,28 @@ test:
# Fail auth
$(curl) $(curl_args) -XGET -H 'Content-Type: application/json' $(csp)/containers/v1/tokens/123 -f || true

# Create host
# Create host 1
$(curl) $(curl_args) -XPOST -d @tests/csp/initiator.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts -f

# Create host 2
$(curl) $(curl_args) -XPOST -d @tests/csp/initiator-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts -f

# Create volume
$(curl) $(curl_args) -XPOST -d @tests/csp/volume.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f

# Create thick volume
$(curl) $(curl_args) -XPOST -d @tests/csp/volume-thick.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes -f

sleep 120

# Get volume
$(curl) $(curl_args) -XGET -H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes?name=my-new-volume16 -f
Expand All @@ -76,10 +104,15 @@ test:
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f || true

# Publish volume
# Publish volume host 1
$(curl) $(curl_args) -XPUT -d @tests/csp/publish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/publish -f

# Publish volume host 2
$(curl) $(curl_args) -XPUT -d @tests/csp/publish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/publish -f

# Create snapshots
$(curl) $(curl_args) -XPOST -d @tests/csp/snapshot1.yaml -H 'Content-Type: application/json' \
Expand Down Expand Up @@ -111,17 +144,33 @@ test:
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/snapshots/tank_my-new-volume16@my-first-snapshot -f
# Unpublish volume

# Unpublish volume host 1
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f

# Unpublish volume host 2
$(curl) $(curl_args) -XPUT -d @tests/csp/unpublish-multi.yaml -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16/actions/unpublish -f

# Delete volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume16 -f

# Delete host
# Delete thick volume
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/volumes/tank_my-new-volume18 -f

# Delete host 1
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db0 -f

# Delete host 2
$(curl) $(curl_args) -XDELETE -H 'Content-Type: application/json' \
-H 'X-Auth-Token: $(password)' -H 'X-Array-IP: $(backend)' \
$(csp)/containers/v1/hosts/41302701-0196-420f-b319-834a79891db1 -f
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/truenas-csp)](https://artifacthub.io/packages/search?repo=truenas-csp)
# TrueNAS Container Storage Provider

The TrueNAS Container Storage Provider (CSP) is an API gateway to provide iSCSI block storage provisioning using the [HPE CSI Driver for Kubernetes](https://github.com/hpe-storage/csi-driver). It allows you to use [TrueNAS](https://www.truenas.com) and [FreeNAS](https://www.freenas.org/) to provide persistent storage using iSCSI to Kubernetes.
Expand Down Expand Up @@ -29,6 +30,7 @@ Topology is currently not supported by the HPE CSI Driver.

Releases will track the upstream versioning of the HPE CSI Driver for Kubernetes and potential bugfixes in the TrueNAS CSP will be pushed to the same image tag matching the HPE CSI Driver version.

* [TrueNAS CSP v2.4.2](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.4.2) for HPE CSI Driver v2.4.2
* [TrueNAS CSP v2.4.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.4.0) for HPE CSI Driver v2.4.0
* [TrueNAS CSP v2.3.10](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.3.10) for HPE CSI Driver v2.3.0
* [TrueNAS CSP v2.3.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.3.0) for HPE CSI Driver v2.3.0
Expand Down Expand Up @@ -70,16 +72,7 @@ make test backend=<IP address of management interface on the TrueNAS appliance>

**Note:** None of the tests are comprehensive nor provide full coverage and should be considered equivalent to "Does the light come on?".

A Kubernetes e2e test `Makefile` is provided in [e2e](e2e) for both RWO and RWX modes. Ensure everything is [installed](INSTALL.md) and a `Secret` named "truenas-secret" exists in the "hpe-storage" `Namespace`. Then run:

```
cd e2e
make rwo
make rwx
make clean
```

**Note:** FreeNAS, TrueNAS CORE and SCALE should pass all tests when configured properly.
See [e2e/README.md](e2e/README.md) how to configure and run Kubernetes e2e test suite focused the CSI tests for the TrueNAS CSP.

# Limitations

Expand All @@ -90,6 +83,8 @@ These are the known limitations.
- **Dataset naming:** The underscore character `_` is used as an internal separator for naming snapshots and datasets. Do NOT use underscores in your pool or dataset names.
- **FreeNAS ctl_max_luns:** FreeNAS has an internal limit of 1024 LUNs. That number increments for every new LUN created, even if deleted. The iSCSI Target service won't start and it leads to all sorts of problems. This is the log message on the console: `requested LUN ID 1031 is higher than ctl_max_luns` (this system had two iSCSI Targets).
- **FreeNAS iSCSI Target:** On systems with a high degree of churn, especially during e2e testing, the iSCSI Target sometimes croak and needs to be restarted. It's recommended to starve the CSP to ease the API requests against FreeNAS and let failures be handled by CSI driver and Kubernetes (see [Helm chart](https://artifacthub.io/packages/helm/truenas-csp/truenas-csp)).
- **KubeVirt support:** Live migration for KubeVirt is not yet implemented in the CSP. Running KubeVirt without live migration on RWO claims should be fine. This will be implemented in a later released.
- **iSCSI CHAP:** Using CHAP with the HPE CSI Driver will not propagate to the TrueNAS CSP. This will be implemented in a later release of the TrueNAS CSP.

# Need help?

Expand Down Expand Up @@ -125,7 +120,7 @@ FreeNAS(R) is (C) 2011-2023 iXsystems

TrueNAS CSP is released under the [MIT License](LICENSE).

(C) Copyright 2023 Hewlett Packard Enterprise Development LP.
(C) Copyright 2024 Hewlett Packard Enterprise Development LP.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This page intentionally left blank.

(C) Copyright 2023 Hewlett Packard Enterprise Development LP.
(C) Copyright 2024 Hewlett Packard Enterprise Development LP.
35 changes: 34 additions & 1 deletion docs/index.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
apiVersion: v1
entries:
truenas-csp:
- annotations:
artifacthub.io/license: MIT
artifacthub.io/links: |
- name: HPE CSI Driver for Kubernetes
url: https://scod.hpedev.io
- name: Install
url: https://github.com/hpe-storage/truenas-csp/blob/master/INSTALL.md
artifacthub.io/prerelease: "false"
apiVersion: v2
appVersion: 2.4.2
created: "2024-05-05T17:25:24.566162137Z"
dependencies:
- name: hpe-csi-driver
repository: https://hpe-storage.github.io/co-deployments
version: 2.4.2
description: TrueNAS Container Storage Provider Helm chart for Kubernetes
digest: a0df2e41a2441fef306c2d8291b44a2b4a05eccd8a0e6d7cc4795972fca4732d
home: https://github.com/hpe-storage/truenas-csp
icon: https://hpe-storage.github.io/truenas-csp/assets/icon.svg
keywords:
- HPE
- Storage
- CSI
maintainers:
- email: michael.mattsson@gmail.com
name: Michael Mattsson
name: truenas-csp
sources:
- https://github.com/hpe-storage/truenas-csp
type: application
urls:
- truenas-csp-1.1.6.tgz
version: 1.1.6
- annotations:
artifacthub.io/license: MIT
artifacthub.io/links: |
Expand Down Expand Up @@ -232,4 +265,4 @@ entries:
urls:
- truenas-csp-1.0.0.tgz
version: 1.0.0
generated: "2023-10-10T00:04:32.481206987Z"
generated: "2024-05-05T17:25:24.564919127Z"
Binary file added docs/truenas-csp-1.1.6.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secret.yaml
14 changes: 14 additions & 0 deletions e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM almalinux

# Install stuff
RUN dnf install -y curl jq && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

# Manipulate stuff
ENV HERE=/cut/csi-e2e
ENV PATH=${PATH}:${HERE}
RUN mkdir -p ${HERE}
ADD cache ${HERE}
ADD runner.sh ${HERE}
WORKDIR ${HERE}
54 changes: 0 additions & 54 deletions e2e/Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Synopsis

Performs CSI e2e tests.

```text
kubectl apply -f resources.yaml
kubectl apply -k .
kubectl replace --force -f job-rwo.yaml
kubectl replace --force -f job-rwx.yaml
kubectl logs -n csi-e2e job/csi-e2e -f
```
47 changes: 47 additions & 0 deletions e2e/job-rwo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
kind: Job
apiVersion: batch/v1
metadata:
name: csi-e2e
namespace: csi-e2e
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: csi-e2e
image: quay.io/datamattsson/csi-e2e:v2.4.0
command:
- runner.sh
args:
- --ginkgo.fail-fast
- --ginkgo.v
- --ginkgo.timeout=12h
- --ginkgo.focus=External.Storage.\[Driver:.csi.hpe.com\].*
- --ginkgo.skip=\[Disruptive\]|\[Serial\]
- --non-blocking-taints=node-role.kubernetes.io/control-plane,node-role.kubernetes.io/etcd,node-role.kubernetes.io/master
- -storage.testdriver=test-driver-rwo.yaml
- -report-dir=../report
env:
- name: ARG_DEBUG
value: ""
- name: FORCE_VERSION
value: ""
volumeMounts:
- name: tests
mountPath: /cut/csi-e2e/tests
volumes:
- name: tests
projected:
sources:
- configMap:
name: storage-class-rwx.yaml
- configMap:
name: storage-class-rwo.yaml
- configMap:
name: volume-snapshot-class.yaml
- configMap:
name: test-driver-rwx.yaml
- configMap:
name: test-driver-rwo.yaml
Loading

0 comments on commit 1adedee

Please sign in to comment.