diff --git a/INSTALL.md b/INSTALL.md index bfa94cf..cc0e838 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -7,7 +7,6 @@ These procedures assumes a running Kubernetes cluster [supported by the HPE CSI - TrueNAS 12.0 or later - TrueNAS SCALE 22.02 or later - FreeNAS 11.2-U3 or later -- Kubernetes 1.23 or later - Helm 3.6 or later (recommended, only needed if using Helm to install the CSP) ### TrueNAS Container Storage Provider Helm Chart @@ -22,9 +21,10 @@ The HPE CSI Driver may be installed using either a Helm Chart, Operator or direc **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: +Install HPE CSI Driver using manifests (assumes latest supported Kubernetes version of the CSI driver): ``` +kubectl create ns hpe-storage kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.3.0/hpe-linux-config.yaml kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/master/yaml/csi-driver/v2.3.0/hpe-csi-k8s-1.26.yaml ``` @@ -32,8 +32,7 @@ kubectl create -f https://raw.githubusercontent.com/hpe-storage/co-deployments/m 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.3.0/truenas-csp.yaml +kubectl create -f https://raw.githubusercontent.com/hpe-storage/truenas-csp/master/K8s/v2.3.10/truenas-csp.yaml ``` **Note:** Replace `hpe-csi-k8s-.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. @@ -52,7 +51,7 @@ metadata: stringData: serviceName: truenas-csp-svc servicePort: "8080" - username: hpe-csi (username is a no-op) + username: hpe-csi (username is a no-op when using API key) password: API key or root password of TrueNAS/FreeNAS appliance backend: Management IP address of TrueNAS/FreeNAS appliance ``` @@ -66,15 +65,15 @@ The TrueNAS/FreeNAS appliance require an iSCSI portal to be configured manually ![](https://hpe-storage.github.io/truenas-csp/assets/portal.png) - Description: `hpe-csi` -- IP Address: List of IPs used for iSCSI (do NOT use 0.0.0.0) +- IP Address: List of IPs used for iSCSI (do **NOT** use 0.0.0.0) -The Target Global Configuration needs to be updated with this Base Name: +The Target Global Configuration needs to have an explicit Base Name: ![](https://hpe-storage.github.io/truenas-csp/assets/global-target.png) - Base Name: `iqn.2011-08.org.truenas.ctl` or `iqn.2005-10.org.freenas.ctl` -**Hint:** If TrueNAS/FreeNAS is not giving you the option to select nothing but 0.0.0.0 in the portal configuration is because you're using DHCP. Only statically assigned addresses can be used in the picker. +**Hint:** If TrueNAS/FreeNAS is not giving you the option to select nothing but 0.0.0.0 in the portal configuration is because DHCP is being used. Only statically assigned addresses can be used in the picker. Also make sure the iSCSI service is started and enabled at boot on TrueNAS/FreeNAS. diff --git a/K8s/v2.3.10/hpe-storageclass-nfs.yaml b/K8s/v2.3.10/hpe-storageclass-nfs.yaml new file mode 100644 index 0000000..0cfca16 --- /dev/null +++ b/K8s/v2.3.10/hpe-storageclass-nfs.yaml @@ -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 diff --git a/K8s/v2.3.10/hpe-storageclass.yaml b/K8s/v2.3.10/hpe-storageclass.yaml new file mode 100644 index 0000000..ebc877f --- /dev/null +++ b/K8s/v2.3.10/hpe-storageclass.yaml @@ -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 diff --git a/K8s/v2.3.10/truenas-csp.yaml b/K8s/v2.3.10/truenas-csp.yaml new file mode 100644 index 0000000..5ee1e2a --- /dev/null +++ b/K8s/v2.3.10/truenas-csp.yaml @@ -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.3.10 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 diff --git a/K8s/v2.3.10/truenas-secret.yaml b/K8s/v2.3.10/truenas-secret.yaml new file mode 100644 index 0000000..aa3947e --- /dev/null +++ b/K8s/v2.3.10/truenas-secret.yaml @@ -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 diff --git a/README.md b/README.md index 9c62d89..fab7042 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,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.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 * [TrueNAS CSP v2.2.0](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.2.0) for HPE CSI Driver v2.2.0 * [TrueNAS CSP v2.1.1](https://github.com/hpe-storage/truenas-csp/releases/tag/v2.1.1) for HPE CSI Driver v2.1.1 @@ -37,6 +38,10 @@ Releases will track the upstream versioning of the HPE CSI Driver for Kubernetes * [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 +# Version schemes + +The TrueNAS CSP will track an official release of the HPE CSI Driver for Kubernetes, i.e v2.2.0 and there will be a subsequent release of the TrueNAS CSP v2.2.0. If a patch release of the CSP is needed, the patch position will be incremented by 10. I.e v2.2.10. The last digit will represent the patch version of the CSI driver. The [Helm chart](https://artifacthub.io/packages/helm/truenas-csp/truenas-csp) is it's own deliverable and has its own semantic versioning. + # Install See [INSTALL](INSTALL.md). diff --git a/docs/index.yaml b/docs/index.yaml index 81a0291..66b50dc 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -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.3.10 + created: "2023-05-07T18:50:16.384944624-07:00" + dependencies: + - name: hpe-csi-driver + repository: https://hpe-storage.github.io/co-deployments + version: 2.3.0 + description: TrueNAS Container Storage Provider Helm chart for Kubernetes + digest: ff1b4d617477b6f55d3debd3820b69b7280acd721ad686b736025f30266df380 + 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.4.tgz + version: 1.1.4 - annotations: artifacthub.io/license: MIT artifacthub.io/links: | @@ -166,4 +199,4 @@ entries: urls: - truenas-csp-1.0.0.tgz version: 1.0.0 -generated: "2023-05-04T22:52:19.983893272-07:00" +generated: "2023-05-07T18:50:16.383697211-07:00" diff --git a/docs/truenas-csp-1.1.4.tgz b/docs/truenas-csp-1.1.4.tgz new file mode 100644 index 0000000..8c1da63 Binary files /dev/null and b/docs/truenas-csp-1.1.4.tgz differ diff --git a/helm/charts/truenas-csp/Chart.yaml b/helm/charts/truenas-csp/Chart.yaml index d3d9764..aae6645 100644 --- a/helm/charts/truenas-csp/Chart.yaml +++ b/helm/charts/truenas-csp/Chart.yaml @@ -12,8 +12,8 @@ annotations: - name: Install url: https://github.com/hpe-storage/truenas-csp/blob/master/INSTALL.md artifacthub.io/prerelease: "false" -version: "1.1.3" -appVersion: "2.3.0" +version: "1.1.4" +appVersion: "2.3.10" maintainers: - name: Michael Mattsson email: michael.mattsson@gmail.com diff --git a/helm/charts/truenas-csp/README.md b/helm/charts/truenas-csp/README.md index eefd17a..0f3d546 100644 --- a/helm/charts/truenas-csp/README.md +++ b/helm/charts/truenas-csp/README.md @@ -4,12 +4,11 @@ This Chart provide means to install the dependent [HPE CSI Driver for Kubernetes ## Prerequisites -- Fulfill all requirements of the [HPE CSI Driver for Kubernetes Helm chart](https://artifacthub.io/packages/helm/hpe-storage/hpe-csi-driver/2.3.0) v2.3.0 - TrueNAS 12.0 or later - TrueNAS SCALE 22.02 or later - FreeNAS 11.2-U3 or later -This chart is lock stepped with [HPE CSI Driver for Kubernetes Helm chart](https://artifacthub.io/packages/helm/hpe-storage/hpe-csi-driver) application versions. Other requirements and prerequisites may be found on that chart. +This chart is lock stepped with [HPE CSI Driver for Kubernetes Helm chart](https://artifacthub.io/packages/helm/hpe-storage/hpe-csi-driver) application versions. Other requirements and prerequisites such as supported host OS and Kubernetes versions may be found on that chart. **IMPORTANT:** Do **NOT** install this chart if the HPE CSI Driver for Kubernetes is already installed! diff --git a/helm/charts/truenas-csp/values.yaml b/helm/charts/truenas-csp/values.yaml index d811edf..a4397b1 100644 --- a/helm/charts/truenas-csp/values.yaml +++ b/helm/charts/truenas-csp/values.yaml @@ -11,7 +11,7 @@ image: repository: quay.io/datamattsson/truenas-csp pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "v2.3.0" + tag: "v2.3.10" imagePullSecrets: [] nameOverride: "" diff --git a/truenascsp/backend.py b/truenascsp/backend.py index 443fed6..d0f6313 100755 --- a/truenascsp/backend.py +++ b/truenascsp/backend.py @@ -111,7 +111,7 @@ def ping(self, req): self.logger.debug(' headers: %s', headers) def ipaddrs_to_networks(self, ipaddrs): - interfaces = self.fetch('interface') + interfaces = self.fetch('interface', returnBy=list) networks = [] @@ -255,11 +255,20 @@ def fetch(self, resource, **kwargs): if len(results) == 1: self.logger.debug('API fetch caught 1 item') - return results[0] + + if kwargs.get('returnBy') == list: + return results + else: + return results[0] if len(results) > 1: self.logger.debug('API fetch caught %d items', len(results)) - return results + + if kwargs.get('returnBy') == dict: + self.logger.debug('Returning first row in result set') + return results[0] + else: + return results return None diff --git a/truenascsp/truenascsp.py b/truenascsp/truenascsp.py index 57b6192..a0294d5 100755 --- a/truenascsp/truenascsp.py +++ b/truenascsp/truenascsp.py @@ -128,7 +128,7 @@ def on_put(self, req, resp, volume_id): # grab host initiator = api.fetch( - 'iscsi/initiator', field='comment', value=content.get('host_uuid')) + 'iscsi/initiator', field='comment', value=content.get('host_uuid'), returnBy=dict) # grab portal IPs portal = api.fetch('iscsi/portal', field='comment', @@ -440,10 +440,7 @@ def on_post(self, req, resp): req_backend['auth_network'] = api.cidrs_to_hosts(content.get('networks')) initiator = api.fetch( - 'iscsi/initiator', field='comment', value=content.get('uuid')) - - # rare condition (race during initial creation) - initiator = initiator[0] if isinstance(initiator, list) else initiator + 'iscsi/initiator', field='comment', value=content.get('uuid'), returnBy=dict) if initiator: api.put(