Skip to content

Commit

Permalink
First pass against v2.1.0 (#25)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Mattsson <[email protected]>
  • Loading branch information
datamattsson authored Jan 31, 2022
1 parent aa5e623 commit ecebf8a
Show file tree
Hide file tree
Showing 41 changed files with 192 additions and 2,522 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
e2e/e2e.test
e2e/ginkgo
e2e/reports/
29 changes: 15 additions & 14 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Install TrueNAS CORE Container Storage Provider
# Install TrueNAS Container Storage Provider

These procedures assumes a running Kubernetes cluster [supported by the HPE CSI Driver](https://scod.hpedev.io/csi_driver/index.html#compatibility_and_support) where the worker nodes have connectivity to a TrueNAS/FreeNAS storage appliance API and networks used for iSCSI traffic. Worker nodes also need their package managers fully functional and connected to their official repos unless iSCSI and multipathing packages have been pre-installed.

## Prerequisites

- HPE CSI Driver for Kubernetes version 2.0.0 or later
- TrueNAS CORE 12 BETA or later
- HPE CSI Driver for Kubernetes version 2.1.0 or later
- TrueNAS 12.0 BETA or later
- TrueNAS SCALE 22.02 RC1 or later
- FreeNAS 11.2-U3 or later
- Kubernetes 1.18 or later
- Kubernetes 1.20 or later
- Helm 3.6 or later (optional, only needed if using Helm to install the CSP)

### TrueNAS CORE Container Storage Provider Helm Chart
### TrueNAS Container Storage Provider Helm Chart

The recommended way to install the CSP is to use Helm, it automatically fulfill all dependencies. Make sure to make it back here to learn [how to configure and use the CSP with the CSI driver](https://github.com/hpe-storage/truenas-csp/blob/master/INSTALL.md#configure-csi-driver).

Expand All @@ -20,23 +21,23 @@ The recommended way to install the CSP is to use Helm, it automatically fulfill

The HPE CSI Driver may be installed using either a Helm Chart, Operator or directly with manifests. Directly below is the complete procedures for the "[Advanced install](https://scod.hpedev.io/csi_driver/deployment.html#advanced_install)".

**Note:** The [TrueNAS CORE Container Storage Provider Helm Chart](https://artifacthub.io/packages/helm/truenas-csp/truenas-csp) has a dependency on the HPE CSI Driver for Kubernetes Helm Chart and makes it a lot easier to manage configuration during runtime. Consider using Helm to deploy the CSP over the YAML manifests.
**Note:** The [TrueNAS Container Storage Provider Helm Chart](https://artifacthub.io/packages/helm/truenas-csp/truenas-csp) has a dependency on the HPE CSI Driver for Kubernetes Helm Chart and makes it a lot easier to manage configuration during runtime. Consider using Helm to deploy the CSP over the YAML manifests.

Install HPE CSI Driver using manifests:

```
kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.0.0/hpe-linux-config.yaml
kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.0.0/hpe-csi-k8s-1.21.yaml
kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.1.0/hpe-linux-config.yaml
kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.1.0/hpe-csi-k8s-1.22.yaml
```

Install the TrueNAS CORE CSP using manifests:
Install the TrueNAS CSP using manifests:

```
kubectl create ns hpe-storage
kubectl create -f https://raw.githubusercontent.com/hpe-storage/truenas-csp/master/K8s/v2.0.0/truenas-csp.yaml
kubectl create -f https://raw.githubusercontent.com/hpe-storage/truenas-csp/master/K8s/v2.1.0/truenas-csp.yaml
```

**Note:** Replace `hpe-csi-k8s-<version>.yaml` with your version of Kubernetes. Also change the version of the HPE CSI Driver manifests where applicable. Using mismatching versions of the TrueNAS CORE CSP and the HPE CSI Driver will most likely **NOT** work.
**Note:** Replace `hpe-csi-k8s-<version>.yaml` with your version of Kubernetes. Also change the version of the HPE CSI Driver manifests where applicable. Using mismatching versions of the TrueNAS CSP and the HPE CSI Driver will most likely **NOT** work.

### Configure CSI driver

Expand All @@ -53,11 +54,11 @@ stringData:
serviceName: truenas-csp-svc
servicePort: "8080"
username: hpe-csi (username is a no-op)
password: TrueNAS CORE API key or root password
backend: TrueNAS CORE management IP address
password: API key or root password of TrueNAS/FreeNAS appliance
backend: Management IP address of TrueNAS/FreeNAS appliance
```

**Hint:** Generate an API key by clicking the cog in the upper right corner of the TrueNAS CORE web UI (FreeNAS does NOT support API keys). What you name the key or the `Secret` `{.stringData.username}` does not matter as it's not being used or referenced during runtime. For tracking purposes it might be a good idea to name the key the same as the username put into the `Secret`.
**Hint:** Generate an API key by clicking the cog in the upper right corner of the TrueNAS web UI (FreeNAS does NOT support API keys). What you name the key or the `Secret` `{.stringData.username}` does not matter as it's not being used or referenced during runtime. For tracking purposes it might be a good idea to name the key the same as the username put into the `Secret`.

### Configure TrueNAS/FreeNAS

Expand Down
25 changes: 25 additions & 0 deletions K8s/v2.1.0/hpe-storageclass-nfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "false"
name: hpe-standard-nfs
provisioner: csi.hpe.com
parameters:
csi.storage.k8s.io/controller-expand-secret-name: truenas-secret
csi.storage.k8s.io/controller-expand-secret-namespace: hpe-storage
csi.storage.k8s.io/controller-publish-secret-name: truenas-secret
csi.storage.k8s.io/controller-publish-secret-namespace: hpe-storage
csi.storage.k8s.io/node-publish-secret-name: truenas-secret
csi.storage.k8s.io/node-publish-secret-namespace: hpe-storage
csi.storage.k8s.io/node-stage-secret-name: truenas-secret
csi.storage.k8s.io/node-stage-secret-namespace: hpe-storage
csi.storage.k8s.io/provisioner-secret-name: truenas-secret
csi.storage.k8s.io/provisioner-secret-namespace: hpe-storage
csi.storage.k8s.io/fstype: xfs
nfsResources: "true"
allowOverrides: sparse,compression,deduplication,volblocksize,sync,description
root: zwimming/csi-volumes
reclaimPolicy: Delete
allowVolumeExpansion: true
24 changes: 24 additions & 0 deletions K8s/v2.1.0/hpe-storageclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "true"
name: hpe-standard
provisioner: csi.hpe.com
parameters:
csi.storage.k8s.io/controller-expand-secret-name: truenas-secret
csi.storage.k8s.io/controller-expand-secret-namespace: hpe-storage
csi.storage.k8s.io/controller-publish-secret-name: truenas-secret
csi.storage.k8s.io/controller-publish-secret-namespace: hpe-storage
csi.storage.k8s.io/node-publish-secret-name: truenas-secret
csi.storage.k8s.io/node-publish-secret-namespace: hpe-storage
csi.storage.k8s.io/node-stage-secret-name: truenas-secret
csi.storage.k8s.io/node-stage-secret-namespace: hpe-storage
csi.storage.k8s.io/provisioner-secret-name: truenas-secret
csi.storage.k8s.io/provisioner-secret-namespace: hpe-storage
csi.storage.k8s.io/fstype: xfs
allowOverrides: sparse,compression,deduplication,volblocksize,sync,description
root: zwimming/csi-volumes
reclaimPolicy: Delete
allowVolumeExpansion: true
38 changes: 38 additions & 0 deletions K8s/v2.1.0/truenas-csp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
kind: Service
apiVersion: v1
metadata:
name: truenas-csp-svc
namespace: hpe-storage
labels:
app: truenas-csp-svc
spec:
ports:
- port: 8080
protocol: TCP
selector:
app: truenas-csp

---
kind: Deployment
apiVersion: apps/v1
metadata:
name: truenas-csp
namespace: hpe-storage
spec:
selector:
matchLabels:
app: truenas-csp
replicas: 1
template:
metadata:
labels:
app: truenas-csp
spec:
priorityClassName: system-cluster-critical
containers:
- name: truenas-csp
image: quay.io/datamattsson/truenas-csp:v2.1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
12 changes: 12 additions & 0 deletions K8s/v2.1.0/truenas-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Secret
metadata:
name: truenas-secret
namespace: hpe-storage
stringData:
serviceName: truenas-csp-svc
servicePort: "8080"
username: hpe-csi (username is a no-op)
password: API key or root password of TrueNAS/FreeNAS appliance
backend: Management IP address of TrueNAS/FreeNAS appliance
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ curl_args = '-v'
all:
python3 -m py_compile truenascsp/*.py
rm -rf truenascsp/__pycache__
docker build -t hpestorage/truenas-csp:edge .
docker build -t quay.io/datamattsson/truenas-csp:edge .

run:
docker rm -f truenas-csp || true
docker run -d -p8080:8080 --name truenas-csp -e LOG_DEBUG=1 hpestorage/truenas-csp:edge
docker run -d -p8080:8080 --name truenas-csp -e LOG_DEBUG=1 quay.io/datamattsson/truenas-csp:edge

test:
# Delete host
Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TrueNAS CORE Container Storage Provider
# TrueNAS Container Storage Provider

The TrueNAS CORE 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 CORE](https://www.truenas.com) and [FreeNAS](https://www.freenas.org/) to provide persistent storage using iSCSI to Kubernetes.
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.

CSP API endpoints:

Expand All @@ -21,14 +21,15 @@ As of version 2.0.0 of the HPE CSI Driver, these parts of the CSI spec are curre
- Data Sources (`PersistentVolumeClaims` and `VolumeSnapshots`)
- Volume Limits
- Volume Stats
- Ephemeral Local Volumes (not supported by the TrueNAS CORE CSP, see [limitations](#limitations))
- Ephemeral Local Volumes (not supported by the TrueNAS CSP, see [limitations](#limitations))

Topology is currently not supported by the HPE CSI Driver.

# Releases

Releases will track the upstream versioning of the HPE CSI Driver for Kubernetes and potential bugfixes in the TrueNAS CORE CSP will be pushed to the same image tag matching the HPE CSI Driver version.
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.1.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.0.0) for HPE CSI Driver v2.1.0
* [TrueNAS CORE CSP v2.0.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.0.0) for HPE CSI Driver v2.0.0
* [TrueNAS CORE CSP v1.4.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v1.4.0) for HPE CSI Driver v1.4.0
* [TrueNAS CORE CSP v1.3.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v1.3.0) for HPE CSI Driver v1.3.0
Expand Down Expand Up @@ -75,40 +76,44 @@ make clean

These are the known limitations.

- **Ephemeral Local Volumes:** Due to how TrueNAS CORE handles ZVol names internally and the long names generated by the HPE CSI Driver when requesting ephemeral storage, Ephemeral Local Volumes is not compatible with the TrueNAS CORE CSP. Generic Ephemeral Volumes introduced as an Alpha feature in Kubernetes 1.19 works as the volumes are derived from a regular `StorageClass`.
- **Volume sizing:** TrueNAS CORE ZVols "volblocksize" need to be even divisible by the requesting volume size. This is a non-issue if you're working with even "Gi" sizes in the `PersistentVolumeClaims`. It gets hairy if working with "Mi" sizes and large volume block sizes.
- **Ephemeral Local Volumes:** Due to how TrueNAS handles ZVol names internally and the long names generated by the HPE CSI Driver when requesting ephemeral storage, Ephemeral Local Volumes is not compatible with the TrueNAS CSP. Generic Ephemeral Volumes introduced as an Alpha feature in Kubernetes 1.19 works as the volumes are derived from a regular `StorageClass`.
- **Volume sizing:** TrueNAS ZVols "volblocksize" need to be even divisible by the requesting volume size. This is a non-issue if you're working with even "Gi" sizes in the `PersistentVolumeClaims`. It gets hairy if working with "Mi" sizes and large volume block sizes.

# Need help?

Please file an [issue](https://github.com/hpe-storage/truenas-csp/issues). This software is not supported by Hewlett Packard Enterprise. It's a voluntary community effort.

# Contributing

Contributing to the TrueNAS CORE CSP is subject to the following [contributing](CONTRIBUTING.md) guidelines.
Contributing to the TrueNAS CSP is subject to the following [contributing](CONTRIBUTING.md) guidelines.

# Other Container Storage Providers for HPE CSI Driver

There's currently no other open source CSPs, but the official HPE CSI Driver for Kubernetes include:

- [HPE Alletra 6000 and Nimble Storage](https://scod.hpedev.io/container_storage_provider/hpe_nimble_storage/index.html)
- [HPE Alletra 9000 and Primera (including 3PAR)](https://scod.hpedev.io/container_storage_provider/hpe_3par_primera/index.html) (also works for HPE 3PAR)
- [HPE Alletra 9000 and Primera (including 3PAR)](https://scod.hpedev.io/container_storage_provider/hpe_3par_primera/index.html)

# Similar projects

The TrueNAS CORE CSP is not the only enabler of TrueNAS/FreeNAS for Kubernetes.
The TrueNAS CSP is not the only enabler of TrueNAS/FreeNAS for Kubernetes.

- [Democratic CSI](https://github.com/democratic-csi/democratic-csi): A generic OpenZFS CSI driver that supports multiple OpenZFS implementations
- [FreeNAS Provisioner](https://github.com/nmaupu/freenas-provisioner): An external provisioner for FreeNAS NFS exports

# License

TrueNAS CORE(R) (C) 2021 iXsystems, Inc.
TrueNAS(R) (C) 2022 iXsystems, Inc.

FreeNAS(R) is (C) 2011-2021 iXsystems
TrueNAS CORE(R) (C) 2022 iXsystems, Inc.

TrueNAS CORE CSP is released under the [MIT License](LICENSE).
TrueNAS SCALE(R) (C) 2022 iXsystems, Inc.

(C) Copyright 2021 Hewlett Packard Enterprise Development LP.
FreeNAS(R) is (C) 2011-2022 iXsystems

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

(C) Copyright 2022 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
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.1.0
created: "2022-01-30T18:45:32.690972362-08:00"
dependencies:
- name: hpe-csi-driver
repository: https://hpe-storage.github.io/co-deployments
version: 2.1.0
description: TrueNAS Container Storage Provider Helm chart for Kubernetes
digest: aaad3b72c7101dcbfbb3f4af61229979b76eeb938cb69cd1c79b8a5e5c13c005
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: [email protected]
name: Michael Mattsson
name: truenas-csp
sources:
- https://github.com/hpe-storage/truenas-csp
type: application
urls:
- truenas-csp-1.1.0.tgz
version: 1.1.0
- annotations:
artifacthub.io/license: MIT
artifacthub.io/links: |
Expand Down Expand Up @@ -34,4 +67,4 @@ entries:
urls:
- truenas-csp-1.0.0.tgz
version: 1.0.0
generated: "2021-10-02T10:25:01.732126837-07:00"
generated: "2022-01-30T18:45:32.68959745-08:00"
Binary file added docs/truenas-csp-1.1.0.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ rwo: mkreports
-ginkgo.focus='External.Storage' \
-ginkgo.skip='\[Feature:|\[Disruptive\]|\[Serial\]' \
-storage.testdriver=test-driver-rwo.yaml \
--non-blocking-taints=node-role.kubernetes.io/controlplane,node-role.kubernetes.io/etcd \
--non-blocking-taints=node-role.kubernetes.io/controlplane,node-role.kubernetes.io/etcd,node-role.kubernetes.io/master \
-report-dir reports

rwx: mkreports
$(E2E) -ginkgo.v \
-ginkgo.focus='External.Storage' \
-ginkgo.skip='\[Feature:|\[Disruptive\]|\[Serial\]' \
-storage.testdriver=test-driver-rwx.yaml \
--non-blocking-taints=node-role.kubernetes.io/controlplane,node-role.kubernetes.io/etcd \
--non-blocking-taints=node-role.kubernetes.io/controlplane,node-role.kubernetes.io/etcd,node-role.kubernetes.io/master \
-report-dir reports

mkreports:
Expand Down
3 changes: 2 additions & 1 deletion helm/charts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ CHART_TARGET:=../../docs

all: truenas-csp
truenas-csp:
helm dependency build $@
helm lint $@
helm package $@ -d .
helm repo index --merge $(CHART_TARGET)/docs/index.yaml .
helm repo index --merge $(CHART_TARGET)/index.yaml .
mv *.tgz $(CHART_TARGET)
mv index.yaml $(CHART_TARGET)
6 changes: 6 additions & 0 deletions helm/charts/truenas-csp/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: hpe-csi-driver
repository: https://hpe-storage.github.io/co-deployments
version: 2.1.0
digest: sha256:5e423cd86a91d6d5fc5f8314e192b76464615bb56f11618b4c29d406397d34c4
generated: "2022-01-30T16:20:09.63119967-08:00"
12 changes: 6 additions & 6 deletions helm/charts/truenas-csp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v2
name: truenas-csp
type: application
description: TrueNAS CORE Container Storage Provider Helm chart for Kubernetes
description: TrueNAS Container Storage Provider Helm chart for Kubernetes
icon: https://hpe-storage.github.io/truenas-csp/assets/icon.svg
annotations:
artifacthub.io/license: MIT
Expand All @@ -11,9 +11,9 @@ annotations:
url: https://scod.hpedev.io
- name: Install
url: https://github.com/hpe-storage/truenas-csp/blob/master/INSTALL.md
artifacthub.io/prerelease: "true"
version: "1.0.0"
appVersion: "2.0.0"
artifacthub.io/prerelease: "false"
version: "1.1.0"
appVersion: "2.1.0"
maintainers:
- name: Michael Mattsson
email: [email protected]
Expand All @@ -22,8 +22,8 @@ sources:
home: https://github.com/hpe-storage/truenas-csp
dependencies:
- name: hpe-csi-driver
version: 2.0.0
# repository: https://hpe-storage.github.io/co-deployments
version: 2.1.0
repository: "https://hpe-storage.github.io/co-deployments"
keywords:
- HPE
- Storage
Expand Down
Loading

0 comments on commit ecebf8a

Please sign in to comment.