commit
						ba01d1ca56
					
				|  | @ -35,4 +35,4 @@ jobs: | |||
|           DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||||
|           DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||||
|           DOCKER_CLI_EXPERIMENTAL: enabled | ||||
|           DOCKER_BUILD_PLATFORM: linux/amd64,linux/arm/v7,linux/arm64 | ||||
|           DOCKER_BUILD_PLATFORM: linux/amd64,linux/arm64,linux/arm/v7 | ||||
|  |  | |||
|  | @ -0,0 +1,15 @@ | |||
| # v1.0.1 | ||||
| 
 | ||||
| Released 2021-01-29 | ||||
| 
 | ||||
| - targetCli fixes when used in conjunction with `nameTemplate` (see #49) | ||||
| - multi-stage docker builds to shrink image size dramatically | ||||
| - using pre-compiled grpc binaries to dramatically speed build times | ||||
| - dep updates | ||||
| - remove `fsck` during stage operations due to sig-storage recommendations (see #52) | ||||
| 
 | ||||
| # v1.0.0 | ||||
| 
 | ||||
| Released 2021-01-07 | ||||
| 
 | ||||
| - initial release | ||||
|  | @ -32,7 +32,7 @@ WORKDIR /home/csi/app | |||
| USER csi | ||||
| 
 | ||||
| COPY package*.json ./ | ||||
| RUN npm install | ||||
| RUN npm install --grpc_node_binary_host_mirror=https://grpc-uds-binaries.s3-us-west-2.amazonaws.com/debian-buster | ||||
| COPY --chown=csi:csi . . | ||||
| RUN rm -rf docker | ||||
| 
 | ||||
|  | @ -55,8 +55,9 @@ RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* | |||
| ENV LANG=en_US.utf8 | ||||
| 
 | ||||
| # install node | ||||
| ENV PATH=/usr/local/lib/nodejs/bin:$PATH | ||||
| COPY --from=build /usr/local/lib/nodejs /usr/local/lib/nodejs | ||||
| #ENV PATH=/usr/local/lib/nodejs/bin:$PATH | ||||
| #COPY --from=build /usr/local/lib/nodejs /usr/local/lib/nodejs | ||||
| COPY --from=build /usr/local/lib/nodejs/bin/node /usr/local/bin/node | ||||
| 
 | ||||
| # node service requirements | ||||
| # netbase is required by rpcbind/rpcinfo to work properly | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ const args = require("yargs") | |||
|       } catch (e) {} | ||||
| 
 | ||||
|       try { | ||||
|         options = yaml.safeLoad(fs.readFileSync(path, "utf8")); | ||||
|         options = yaml.load(fs.readFileSync(path, "utf8")); | ||||
|         return true; | ||||
|       } catch (e) {} | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										18
									
								
								package.json
								
								
								
								
							
							
						
						
									
										18
									
								
								package.json
								
								
								
								
							|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   "name": "democratic-csi", | ||||
|   "version": "1.0.0", | ||||
|   "version": "1.0.1", | ||||
|   "description": "kubernetes csi driver framework", | ||||
|   "main": "bin/democratic-csi", | ||||
|   "scripts": { | ||||
|  | @ -18,18 +18,18 @@ | |||
|     "url": "https://github.com/democratic-csi/democratic-csi.git" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@grpc/proto-loader": "^0.5.5", | ||||
|     "bunyan": "^1.8.14", | ||||
|     "eslint": "^7.14.0", | ||||
|     "grpc-uds": "^0.1.4", | ||||
|     "@grpc/proto-loader": "^0.5.6", | ||||
|     "bunyan": "^1.8.15", | ||||
|     "eslint": "^7.18.0", | ||||
|     "grpc-uds": "^0.1.6", | ||||
|     "handlebars": "^4.7.6", | ||||
|     "js-yaml": "^3.14.0", | ||||
|     "js-yaml": "^4.0.0", | ||||
|     "lru-cache": "^6.0.0", | ||||
|     "request": "^2.88.2", | ||||
|     "ssh2": "^0.8.9", | ||||
|     "uri-js": "^4.4.0", | ||||
|     "uuid": "^8.3.1", | ||||
|     "uri-js": "^4.4.1", | ||||
|     "uuid": "^8.3.2", | ||||
|     "winston": "^3.3.3", | ||||
|     "yargs": "^16.1.1" | ||||
|     "yargs": "^16.2.0" | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -3,6 +3,8 @@ const { GrpcError, grpc } = require("../../utils/grpc"); | |||
| 
 | ||||
| const Handlebars = require("handlebars"); | ||||
| 
 | ||||
| const ISCSI_ASSETS_NAME_PROPERTY_NAME = "democratic-csi:iscsi_assets_name"; | ||||
| 
 | ||||
| class ControllerZfsGenericDriver extends ControllerZfsSshBaseDriver { | ||||
|   /** | ||||
|    * cannot make this a storage class parameter as storage class/etc context is *not* sent | ||||
|  | @ -159,6 +161,11 @@ create /backstores/block/${iscsiName} | |||
|         let iqn = basename + ":" + iscsiName; | ||||
|         this.ctx.logger.info("iqn: " + iqn); | ||||
| 
 | ||||
|         // store this off to make delete process more bullet proof
 | ||||
|         await zb.zfs.set(datasetName, { | ||||
|           [ISCSI_ASSETS_NAME_PROPERTY_NAME]: iscsiName, | ||||
|         }); | ||||
| 
 | ||||
|         volume_context = { | ||||
|           node_attach_driver: "iscsi", | ||||
|           portal: this.options.iscsi.targetPortal, | ||||
|  | @ -182,6 +189,7 @@ create /backstores/block/${iscsiName} | |||
|     const sshClient = this.getSshClient(); | ||||
| 
 | ||||
|     let response; | ||||
|     let properties; | ||||
| 
 | ||||
|     switch (this.options.driver) { | ||||
|       case "zfs-generic-nfs": | ||||
|  | @ -198,13 +206,37 @@ create /backstores/block/${iscsiName} | |||
| 
 | ||||
|       case "zfs-generic-iscsi": | ||||
|         let basename; | ||||
|         let iscsiName = zb.helpers.extractLeafName(datasetName); | ||||
|         if (this.options.iscsi.namePrefix) { | ||||
|           iscsiName = this.options.iscsi.namePrefix + iscsiName; | ||||
|         let iscsiName; | ||||
| 
 | ||||
|         // Delete iscsi assets
 | ||||
|         try { | ||||
|           properties = await zb.zfs.get(datasetName, [ | ||||
|             ISCSI_ASSETS_NAME_PROPERTY_NAME, | ||||
|           ]); | ||||
|         } catch (err) { | ||||
|           if (err.toString().includes("dataset does not exist")) { | ||||
|             return; | ||||
|           } | ||||
|           throw err; | ||||
|         } | ||||
| 
 | ||||
|         if (this.options.iscsi.nameSuffix) { | ||||
|           iscsiName += this.options.iscsi.nameSuffix; | ||||
|         properties = properties[datasetName]; | ||||
|         this.ctx.logger.debug("zfs props data: %j", properties); | ||||
| 
 | ||||
|         iscsiName = properties[ISCSI_ASSETS_NAME_PROPERTY_NAME].value; | ||||
| 
 | ||||
|         if (zb.helpers.isPropertyValueSet(iscsiName)) { | ||||
|           //do nothing
 | ||||
|         } else { | ||||
|           iscsiName = zb.helpers.extractLeafName(datasetName); | ||||
| 
 | ||||
|           if (this.options.iscsi.namePrefix) { | ||||
|             iscsiName = this.options.iscsi.namePrefix + iscsiName; | ||||
|           } | ||||
| 
 | ||||
|           if (this.options.iscsi.nameSuffix) { | ||||
|             iscsiName += this.options.iscsi.nameSuffix; | ||||
|           } | ||||
|         } | ||||
| 
 | ||||
|         iscsiName = iscsiName.toLowerCase(); | ||||
|  | @ -213,9 +245,11 @@ create /backstores/block/${iscsiName} | |||
|             basename = this.options.iscsi.shareStrategyTargetCli.basename; | ||||
|             response = await this.targetCliCommand( | ||||
|               ` | ||||
| # delete target | ||||
| cd /iscsi | ||||
| delete ${basename}:${iscsiName} | ||||
| 
 | ||||
| # delete extent | ||||
| cd /backstores/block | ||||
| delete ${iscsiName} | ||||
| ` | ||||
|  | @ -258,6 +292,8 @@ delete ${iscsiName} | |||
| 
 | ||||
|   async targetCliCommand(data) { | ||||
|     const sshClient = this.getSshClient(); | ||||
|     const driver = this; | ||||
| 
 | ||||
|     data = data.trim(); | ||||
| 
 | ||||
|     let command = "sh"; | ||||
|  | @ -274,7 +310,28 @@ delete ${iscsiName} | |||
| 
 | ||||
|     args.push("'" + taregetCliCommand.join(" ") + "'"); | ||||
| 
 | ||||
|     return sshClient.exec(sshClient.buildCommand(command, args)); | ||||
|     let logCommandTmp = command + " " + args.join(" "); | ||||
|     let logCommand = ""; | ||||
| 
 | ||||
|     logCommandTmp.split("\n").forEach((line) => { | ||||
|       if (line.startsWith("set auth password=")) { | ||||
|         logCommand += "set auth password=<redacted>"; | ||||
|       } else if (line.startsWith("set auth mutual_password=")) { | ||||
|         logCommand += "set auth mutual_password=<redacted>"; | ||||
|       } else { | ||||
|         logCommand += line; | ||||
|       } | ||||
| 
 | ||||
|       logCommand += "\n"; | ||||
|     }); | ||||
| 
 | ||||
|     driver.ctx.logger.verbose("TargetCLI command: " + logCommand); | ||||
| 
 | ||||
|     let response = await sshClient.exec(sshClient.buildCommand(command, args)); | ||||
|     driver.ctx.logger.verbose( | ||||
|       "TargetCLI response: " + JSON.stringify(response) | ||||
|     ); | ||||
|     return response; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -479,7 +479,9 @@ class CsiBaseDriver { | |||
|                 staging_target_path | ||||
|               ); | ||||
|               if (!result) { | ||||
|                 await filesystem.checkFilesystem(device, fs_type); | ||||
|                 // TODO: add a parameter to control this behavior
 | ||||
|                 // https://github.com/democratic-csi/democratic-csi/issues/52#issuecomment-768463401
 | ||||
|                 //await filesystem.checkFilesystem(device, fs_type);
 | ||||
|               } | ||||
|             } | ||||
|             break; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue