author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
141,908
08.07.2021 21:14:22
-28,800
f672fd94b52acbd95617727018cfd85a3794aa07
Support export schema.
[ { "change_type": "MODIFY", "old_path": "src/common/util.ts", "new_path": "src/common/util.ts", "diff": "@@ -136,18 +136,19 @@ export class Util {\nlet hasTrigger = false;\nexec(command, (err, stdout, stderr) => {\nif (hasTrigger) return;\n- hasTrigger = true;\nif (err) {\nrej(err)\n} else if (stderr) {\nrej(stderr)\n- } else {\n+ } else if(!hasTrigger){\n+ hasTrigger = true;\nres(null)\n}\n}).on(\"exit\", (code) => {\n- if (hasTrigger) return;\n+ if (!hasTrigger && code===0){\nhasTrigger = true;\n- code ? rej(null) : res(null);\n+ res(null)\n+ };\n})\n})\n}\n" }, { "change_type": "MODIFY", "old_path": "src/service/dump/dumpService.ts", "new_path": "src/service/dump/dumpService.ts", "diff": "@@ -16,6 +16,7 @@ import { SchemaNode } from \"@/model/database/schemaNode\";\nimport { DumpDocument as GenerateDocument } from \"./generateDocument\";\nimport { createWriteStream } from \"fs\";\nimport { ColumnNode } from \"@/model/other/columnNode\";\n+import { Console } from \"@/common/Console\";\nexport class DumpService {\n@@ -83,7 +84,7 @@ export class DumpService {\nvscode.commands.executeCommand('vscode.open', vscode.Uri.file(dumpFilePath));\n}\n})\n- }).finally(done)\n+ }).catch(err => Console.log(err.message)).finally(done)\n})\n}\n" }, { "change_type": "MODIFY", "old_path": "src/service/dump/mysqlDumpService.ts", "new_path": "src/service/dump/mysqlDumpService.ts", "diff": "@@ -10,11 +10,15 @@ export class MysqlDumpService extends DumpService {\nprotected processDump(option: Options, node: Node): Promise<void> {\n+ /**\n+ * https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html\n+ */\nif (commandExistsSync('mysqldump')) {\nNodeUtil.of(node)\nconst host = node.usingSSH ? \"127.0.0.1\" : node.host\nconst port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port;\n- const command = `mysqldump -h ${host} -P ${port} -u ${node.user} -p${node.password} ${node.schema}>${option.dumpToFile}`\n+ const data = option.dump.data === false ? ' --no-data' : '';\n+ const command = `mysqldump -h ${host} -P ${port} -u ${node.user}${data} -p${node.password} ${node.schema}>${option.dumpToFile}`\nConsole.log(`Executing: ${command}`);\nreturn Util.execute(command)\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support export schema.
141,908
08.07.2021 21:19:54
-28,800
b56ed203eff0d2f2817b0b280b27c9455d9d1680
Support export single table
[ { "change_type": "MODIFY", "old_path": "src/service/dump/mysqlDumpService.ts", "new_path": "src/service/dump/mysqlDumpService.ts", "diff": "@@ -18,7 +18,8 @@ export class MysqlDumpService extends DumpService {\nconst host = node.usingSSH ? \"127.0.0.1\" : node.host\nconst port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port;\nconst data = option.dump.data === false ? ' --no-data' : '';\n- const command = `mysqldump -h ${host} -P ${port} -u ${node.user}${data} -p${node.password} ${node.schema}>${option.dumpToFile}`\n+ const tables=option.dump.tables?.length>0?' --tables '+option.dump.tables.join(\" \"):'';\n+ const command = `mysqldump -h ${host} -P ${port} -u ${node.user} -p${node.password}${data}${tables} ${node.schema}>${option.dumpToFile}`\nConsole.log(`Executing: ${command}`);\nreturn Util.execute(command)\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support export single table
141,908
08.07.2021 22:30:27
-28,800
303f3e4f6160463ed4e8a226d2b58059009f8db7
Remove popup item
[ { "change_type": "MODIFY", "old_path": "src/service/dump/dumpService.ts", "new_path": "src/service/dump/dumpService.ts", "diff": "@@ -48,10 +48,7 @@ export class DumpService {\n}\n}\n- const tableName = node instanceof TableNode ? node.table : null;\n- const exportSqlName = `${tableName ? tableName : ''}_${format('yyyy-MM-dd_hhmmss', new Date())}_${node.schema}.sql`;\n-\n- vscode.window.showSaveDialog({ saveLabel: \"Select export file path\", defaultUri: vscode.Uri.file(exportSqlName), filters: { 'sql': ['sql'] } }).then((folderPath) => {\n+ this.triggerSave(node).then((folderPath) => {\nif (folderPath) {\nthis.dumpData(node, folderPath.fsPath, withData, nodes)\n}\n@@ -59,6 +56,13 @@ export class DumpService {\n}\n+ protected triggerSave(node: Node) {\n+ const tableName = node instanceof TableNode ? node.table : null;\n+ const exportSqlName = `${tableName ? tableName : ''}_${format('yyyy-MM-dd_hhmmss', new Date())}_${node.schema}.sql`;\n+\n+ return vscode.window.showSaveDialog({ saveLabel: \"Select export file path\", defaultUri: vscode.Uri.file(exportSqlName), filters: { 'sql': ['sql'] } });\n+ }\n+\nprivate dumpData(node: Node, dumpFilePath: string, withData: boolean, items: vscode.QuickPickItem[]): void {\nconst tables = items.filter(item => item.description == ModelType.TABLE).map(item => item.label)\n@@ -78,7 +82,7 @@ export class DumpService {\noption.dump.data = false;\n}\nUtil.process(`Doing backup ${node.host}_${node.schema}...`, (done) => {\n- this.processDump(option, node).then(() => {\n+ mysqldump(option, node).then(() => {\nvscode.window.showInformationMessage(`Backup ${node.getHost()}_${node.schema} success!`, 'open').then(action => {\nif (action == 'open') {\nvscode.commands.executeCommand('vscode.open', vscode.Uri.file(dumpFilePath));\n@@ -89,10 +93,6 @@ export class DumpService {\n}\n- protected processDump(option: Options, node: Node): Promise<void> {\n- return mysqldump(option, node);\n- }\n-\npublic async generateDocument(node: Node) {\nconst exportSqlName = `${format('yyyy-MM-dd_hhmmss', new Date())}_${node.schema}.docx`;\n" }, { "change_type": "MODIFY", "old_path": "src/service/dump/mysqlDumpService.ts", "new_path": "src/service/dump/mysqlDumpService.ts", "diff": "import { Console } from \"@/common/Console\";\nimport { Util } from \"@/common/util\";\nimport { Node } from \"@/model/interface/node\";\n+import { TableNode } from \"@/model/main/tableNode\";\n+import { ViewNode } from \"@/model/main/viewNode\";\nimport { NodeUtil } from \"@/model/nodeUtil\";\nimport { DumpService } from \"./dumpService\";\n-import { Options } from \"./mysql/main\";\n+import * as vscode from \"vscode\";\nvar commandExistsSync = require('command-exists').sync;\nexport class MysqlDumpService extends DumpService {\n- protected processDump(option: Options, node: Node): Promise<void> {\n+ public async dump(node: Node, withData: boolean) {\n/**\n* https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html\n*/\nif (commandExistsSync('mysqldump')) {\n+ const folderPath = await this.triggerSave(node);\n+ if (folderPath) {\nNodeUtil.of(node)\n+ const isTable = node instanceof TableNode || node instanceof ViewNode;\nconst host = node.usingSSH ? \"127.0.0.1\" : node.host\nconst port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port;\n- const data = option.dump.data === false ? ' --no-data' : '';\n- const tables=option.dump.tables?.length>0?' --tables '+option.dump.tables.join(\" \"):'';\n- const command = `mysqldump -h ${host} -P ${port} -u ${node.user} -p${node.password}${data}${tables} ${node.schema}>${option.dumpToFile}`\n+ const data = withData ? '' : ' --no-data';\n+ const tables = isTable ? ` --skip-triggers ${node.label}` : '';\n+ const command = `mysqldump -h ${host} -P ${port} -u ${node.user} -p${node.password}${data} --skip-add-locks ${node.schema} ${tables}>${folderPath.fsPath}`\nConsole.log(`Executing: ${command}`);\n- return Util.execute(command)\n+ Util.execute(command).then(() => {\n+ vscode.window.showInformationMessage(`Backup ${node.getHost()}_${node.schema} success!`, 'open').then(action => {\n+ if (action == 'open') {\n+ vscode.commands.executeCommand('vscode.open', vscode.Uri.file(folderPath.fsPath));\n+ }\n+ })\n+ }).catch(err => Console.log(err.message))\n+ }\n+ return Promise.reject(\"Dump canceled.\");\n}\n- return super.processDump(option, node);\n+ return super.dump(node, withData);\n}\n}\n\\ No newline at end of file\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Remove popup item
141,908
08.07.2021 22:30:57
-28,800
6f6f79a9deb909ce52ddbb9d81bfc332af752844
Not print dump command.
[ { "change_type": "MODIFY", "old_path": "src/service/dump/mysqlDumpService.ts", "new_path": "src/service/dump/mysqlDumpService.ts", "diff": "@@ -25,7 +25,7 @@ export class MysqlDumpService extends DumpService {\nconst data = withData ? '' : ' --no-data';\nconst tables = isTable ? ` --skip-triggers ${node.label}` : '';\nconst command = `mysqldump -h ${host} -P ${port} -u ${node.user} -p${node.password}${data} --skip-add-locks ${node.schema} ${tables}>${folderPath.fsPath}`\n- Console.log(`Executing: ${command}`);\n+ // Console.log(`Executing: ${command}`);\nUtil.execute(command).then(() => {\nvscode.window.showInformationMessage(`Backup ${node.getHost()}_${node.schema} success!`, 'open').then(action => {\nif (action == 'open') {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Not print dump command.
141,908
08.07.2021 22:42:55
-28,800
df667e0525d696780a7770012aabcb5829931bf6
Fix execute dml fail with valid table name,
[ { "change_type": "MODIFY", "old_path": "src/vue/result/App.vue", "new_path": "src/vue/result/App.vue", "diff": "@@ -35,6 +35,7 @@ import ExportDialog from \"./component/ExportDialog.vue\";\nimport Toolbar from \"./component/Toolbar\";\nimport EditDialog from \"./component/EditDialog\";\nimport { util } from \"./mixin/util\";\n+import { wrapByDb } from \"@/common/wrapper\";\nlet vscodeEvent;\nexport default {\n@@ -327,12 +328,11 @@ export default {\n}\")\n.deleteMany({_id:{$in:[${checkboxRecords.join(\",\")}]}})`;\n} else {\n+ const table=wrapByDb(this.result.table,this.result.dbType);\ndeleteSql =\ncheckboxRecords.length > 1\n- ? `DELETE FROM ${this.result.table} WHERE ${\n- this.result.primaryKey\n- } in (${checkboxRecords.join(\",\")})`\n- : `DELETE FROM ${this.result.table} WHERE ${this.result.primaryKey}=${checkboxRecords[0]}`;\n+ ? `DELETE FROM ${table} WHERE ${this.result.primaryKey} in (${checkboxRecords.join(\",\")})`\n+ : `DELETE FROM ${table} WHERE ${this.result.primaryKey}=${checkboxRecords[0]}`;\n}\nthis.execute(deleteSql);\n})\n" }, { "change_type": "MODIFY", "old_path": "src/vue/result/component/EditDialog/index.vue", "new_path": "src/vue/result/component/EditDialog/index.vue", "diff": "@@ -145,7 +145,8 @@ export default {\nreturn \"\";\n}\n- let updateSql=`UPDATE ${this.table} SET ${change.replace(/,$/, \"\")}`;\n+ const table=wrapByDb(this.table, this.dbType);\n+ let updateSql=`UPDATE ${table} SET ${change.replace(/,$/, \"\")}`;\nfor (let i = 0; i < this.primaryKeyList.length; i++) {\nconst pk = this.primaryKeyList[i];\nconst pkName = pk.name;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix execute dml fail with valid table name, #245.
141,908
08.07.2021 22:51:06
-28,800
6d0cdf49294b0126180e9d2737e0541fd0fb19ca
Support cost time when change page.
[ { "change_type": "MODIFY", "old_path": "src/service/result/query.ts", "new_path": "src/service/result/query.ts", "diff": "@@ -48,9 +48,11 @@ export class QueryPage {\n}).on('execute', (params) => {\nQueryUnit.runQuery(params.sql, dbOption, queryParam.queryOption);\n}).on('next', async (params) => {\n+ const executeTime = new Date().getTime();\nconst sql = ServiceManager.getPageService(dbOption.dbType).build(params.sql, params.pageNum, params.pageSize)\ndbOption.execute(sql).then((rows) => {\n- handler.emit(MessageType.NEXT_PAGE, { sql, data: rows })\n+ const costTime = new Date().getTime() - executeTime;\n+ handler.emit(MessageType.NEXT_PAGE, { sql, data: rows ,costTime})\n})\n}).on(\"full\", () => {\nhandler.panel.reveal(ViewColumn.One)\n" }, { "change_type": "MODIFY", "old_path": "src/vue/result/App.vue", "new_path": "src/vue/result/App.vue", "diff": "@@ -177,6 +177,7 @@ export default {\nbreak;\ncase \"NEXT_PAGE\":\nthis.result.data = response.data;\n+ this.result.costTime=response.costTime;\nthis.toolbar.sql = response.sql;\nthis.result.data.unshift({ isFilter: true, content: \"\" });\nbreak;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support cost time when change page.
141,908
09.07.2021 09:20:05
-28,800
69b8f088a70202d88412d9eaf084d4d092e6a7bd
Update util.ts Trim code.
[ { "change_type": "MODIFY", "old_path": "src/common/util.ts", "new_path": "src/common/util.ts", "diff": "@@ -7,7 +7,6 @@ import { exec } from \"child_process\";\nimport { wrapByDb } from \"./wrapper.js\";\nimport { GlobalState } from \"./state\";\nimport { Console } from \"./Console\";\n-import { close } from \"node:fs\";\nexport class Util {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Update util.ts Trim code.
141,908
13.07.2021 21:27:48
-28,800
2013b7d011ad811a9578fa555c6f07f94f507a16
Postgresql support open terminal by database
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "},\n{\n\"command\": \"mysql.connection.terminal\",\n- \"when\": \"view =~ /cweijan.+?ql/ && viewItem == connection\",\n+ \"when\": \"view =~ /cweijan.+?ql/ && viewItem =~ /^(connection|catalog)$/\",\n\"group\": \"inline@2\"\n},\n{\n" }, { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -285,7 +285,7 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\ncommand = `mysql -u ${this.user} -p${this.password} -h ${this.host} -P ${this.port} \\n`;\n} else if (this.dbType == DatabaseType.PG) {\nthis.checkCommand('psql');\n- command = `set \"PGPASSWORD=${this.password}\" && psql -U ${this.user} -h ${this.host} -p ${this.port} \\n`;\n+ command = `set \"PGPASSWORD=${this.password}\" && psql -U ${this.user} -h ${this.host} -p ${this.port} -d ${this.database} \\n`;\n} else if (this.dbType == DatabaseType.REDIS) {\nthis.checkCommand('redis-cli');\ncommand = `redis-cli -h ${this.host} -p ${this.port} \\n`;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Postgresql support open terminal by database #247.
141,908
13.07.2021 21:35:42
-28,800
5846bbe35363b9af7c8b360e40bb1d1c16db74ec
Fix set variable fail on linux
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -8,6 +8,7 @@ import { ConnectionManager } from \"@/service/connectionManager\";\nimport { SqlDialect } from \"@/service/dialect/sqlDialect\";\nimport { QueryUnit } from \"@/service/queryUnit\";\nimport { ServiceManager } from \"@/service/serviceManager\";\n+import { platform } from \"node:os\";\nimport * as vscode from \"vscode\";\nimport { Memento } from \"vscode\";\nvar commandExistsSync = require('command-exists').sync;\n@@ -285,7 +286,8 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\ncommand = `mysql -u ${this.user} -p${this.password} -h ${this.host} -P ${this.port} \\n`;\n} else if (this.dbType == DatabaseType.PG) {\nthis.checkCommand('psql');\n- command = `set \"PGPASSWORD=${this.password}\" && psql -U ${this.user} -h ${this.host} -p ${this.port} -d ${this.database} \\n`;\n+ let prefix = platform() == 'win32' ? 'set' : 'export';\n+ command = `${prefix} \"PGPASSWORD=${this.password}\" && psql -U ${this.user} -h ${this.host} -p ${this.port} -d ${this.database} \\n`;\n} else if (this.dbType == DatabaseType.REDIS) {\nthis.checkCommand('redis-cli');\ncommand = `redis-cli -h ${this.host} -p ${this.port} \\n`;\n" }, { "change_type": "MODIFY", "old_path": "src/service/import/postgresqlImortService.ts", "new_path": "src/service/import/postgresqlImortService.ts", "diff": "@@ -2,6 +2,7 @@ import { Console } from \"@/common/Console\";\nimport { Node } from \"@/model/interface/node\";\nimport { NodeUtil } from \"@/model/nodeUtil\";\nimport { exec } from \"child_process\";\n+import { platform } from \"os\";\nimport { ImportService } from \"./importService\";\nvar commandExistsSync = require('command-exists').sync;\n@@ -14,7 +15,8 @@ export class PostgresqlImortService extends ImportService {\nconst port = node.usingSSH ? NodeUtil.getTunnelPort(node.getConnectId()) : node.port;\nconst command = `psql -h ${host} -p ${port} -U ${node.user} -d ${node.database} < ${importPath}`\nConsole.log(`Executing: ${command}`);\n- exec(`set \"PGPASSWORD=${node.password}\" && ${command}`, (err,stdout,stderr) => {\n+ let prefix = platform() == 'win32' ? 'set' : 'export';\n+ exec(`${prefix} \"PGPASSWORD=${node.password}\" && ${command}`, (err,stdout,stderr) => {\nif (err) {\nConsole.log(err);\n}else if(stderr){\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix set variable fail on linux #248.
141,908
13.07.2021 21:48:21
-28,800
9d84b01cdb8638b9ec85974d71259d6d989560c1
Remove complete span.
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -8,7 +8,7 @@ import { ConnectionManager } from \"@/service/connectionManager\";\nimport { SqlDialect } from \"@/service/dialect/sqlDialect\";\nimport { QueryUnit } from \"@/service/queryUnit\";\nimport { ServiceManager } from \"@/service/serviceManager\";\n-import { platform } from \"node:os\";\n+import { platform } from \"os\";\nimport * as vscode from \"vscode\";\nimport { Memento } from \"vscode\";\nvar commandExistsSync = require('command-exists').sync;\n" }, { "change_type": "MODIFY", "old_path": "src/provider/complete/chain/keywordChain.ts", "new_path": "src/provider/complete/chain/keywordChain.ts", "diff": "@@ -12,7 +12,7 @@ export class KeywordChain implements ComplectionChain {\nconstructor() {\nthis.keywordList.forEach((keyword) => {\n- const keywordComplectionItem = new vscode.CompletionItem(keyword + \" \");\n+ const keywordComplectionItem = new vscode.CompletionItem(keyword);\nkeywordComplectionItem.kind = vscode.CompletionItemKind.Keyword;\nthis.keywordComplectionItems.push(keywordComplectionItem);\n});\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Remove complete span.
141,908
13.07.2021 21:54:35
-28,800
50487fd29d401594463552572e3cf457dfd29c48
Add error trace.
[ { "change_type": "MODIFY", "old_path": "src/common/Console.ts", "new_path": "src/common/Console.ts", "diff": "@@ -7,6 +7,9 @@ export class Console {\nif (this.outputChannel == null) {\nthis.outputChannel = vscode.window.createOutputChannel(\"MySQL\");\n}\n+ if(value instanceof Error){\n+ console.trace(value)\n+ }\nthis.outputChannel.show(true);\nconst begin = format('yyyy-MM-dd hh:mm:ss', new Date());\nthis.outputChannel.appendLine(`${begin} ${value}`);\n" }, { "change_type": "MODIFY", "old_path": "src/extension.ts", "new_path": "src/extension.ts", "diff": "@@ -339,8 +339,7 @@ function commandWrapper(commandDefinition: any, command: string): (...args: any[\nreturn (...args: any[]) => {\ntry {\ncommandDefinition[command](...args);\n- }\n- catch (err) {\n+ }catch (err) {\nConsole.log(err);\n}\n};\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Add error trace.
141,908
13.07.2021 22:03:30
-28,800
7448807d538c4db546dbc85a08a2a7e2ae73ddc6
Fix occur error when active node is connection
[ { "change_type": "MODIFY", "old_path": "src/provider/complete/nodeFinder.ts", "new_path": "src/provider/complete/nodeFinder.ts", "diff": "import { ModelType } from \"@/common/constants\";\n+import { ConnectionNode } from \"@/model/database/connectionNode\";\nimport { UserGroup } from \"@/model/database/userGroup\";\nimport { Node } from \"@/model/interface/node\";\nimport { FunctionGroup } from \"@/model/main/functionGroup\";\n@@ -34,18 +35,23 @@ export class NodeFinder {\nnodeList.push(...databaseNodes.filter(databaseNodes => !(databaseNodes instanceof UserGroup)))\nbreak;\ncase ModelType.TABLE:\n+ if(lcp instanceof ConnectionNode) break;\nnodeList.push(...await groupNodes.find(n => n instanceof TableGroup).getChildren())\nbreak;\ncase ModelType.VIEW:\n+ if(lcp instanceof ConnectionNode) break;\nnodeList.push(...await groupNodes.find(n => n instanceof ViewGroup).getChildren())\nbreak;\ncase ModelType.PROCEDURE:\n+ if(lcp instanceof ConnectionNode) break;\nnodeList.push(...await groupNodes.find(n => n instanceof ProcedureGroup).getChildren())\nbreak;\ncase ModelType.TRIGGER:\n+ if(lcp instanceof ConnectionNode) break;\nnodeList.push(...await groupNodes.find(n => n instanceof TriggerGroup).getChildren())\nbreak;\ncase ModelType.FUNCTION:\n+ if(lcp instanceof ConnectionNode) break;\nnodeList.push(...await groupNodes.find(n => n instanceof FunctionGroup).getChildren())\nbreak;\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix occur error when active node is connection #246.
141,904
14.07.2021 14:27:18
-28,800
dbe78462fed2c7a91a07f16432b52ae783283843
fix "the table name is missing issue" There is no need to execute the "tables.shift()" function, just use the table name!
[ { "change_type": "MODIFY", "old_path": "src/model/main/tableNode.ts", "new_path": "src/model/main/tableNode.ts", "diff": "@@ -65,14 +65,8 @@ export class TableNode extends Node implements CopyAble {\nsql = sql.replace(/\\\\n/g, '\\n');\n}\n} else {\n- const childs = await this.getChildren()\n- let table = this.table;\n- if (this.dbType == DatabaseType.MSSQL) {\n- const tables = this.table.split(\".\")\n- tables.shift()\n- table = tables.join(\".\")\n- }\n- sql = `CREATE TABLE ${table}(\\n`\n+ const childs = await this.getChildren();\n+ sql = `CREATE TABLE ${this.table}(\\n`\nfor (let i = 0; i < childs.length; i++) {\nconst child: ColumnNode = childs[i] as ColumnNode;\nif (i == childs.length - 1) {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
fix "the table name is missing issue" There is no need to execute the "tables.shift()" function, just use the table name!
141,908
19.07.2021 16:45:03
-28,800
4aed752ed2a6fb928d418ac1d23e2ac3aa4c5908
Version 3.9.5.
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# CHANGELOG\n+# 3.9.5 2021-7-19\n+\n+- Using mysqldump to dump database.\n+- Fix connect to elasticsearch using ssh tunnel fail.\n+- Better postgresql support.\n+\n# 3.9.3 2021-7-2\n- Better sql complection.\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"name\": \"vscode-mysql-client2\",\n\"displayName\": \"MySQL\",\n\"description\": \"Database Client for vscode\",\n- \"version\": \"3.9.4\",\n+ \"version\": \"3.9.5\",\n\"publisher\": \"cweijan\",\n\"icon\": \"resources/logo.png\",\n\"engines\": {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Version 3.9.5.
141,908
19.07.2021 20:45:51
-28,800
2389469b4ce35fcb0b9f75628a21e8ef1dfcdf08
Support run selected sql.
[ { "change_type": "MODIFY", "old_path": "src/extension.ts", "new_path": "src/extension.ts", "diff": "@@ -185,7 +185,7 @@ export function activate(context: vscode.ExtensionContext) {\n},\n// query node\n...{\n- \"mysql.runQuery\": (sql) => {\n+ \"mysql.runQuery\": (sql:string) => {\nif (typeof sql != 'string') { sql = null; }\nQueryUnit.runQuery(sql, ConnectionManager.tryGetConnection());\n},\n" }, { "change_type": "MODIFY", "old_path": "src/provider/tableInfoHoverProvider.ts", "new_path": "src/provider/tableInfoHoverProvider.ts", "diff": "@@ -17,6 +17,18 @@ export class TableInfoHoverProvider implements HoverProvider {\nreturn new vscode.Hover(markdownStr);\n}\n+ const selections = vscode.window.activeTextEditor?.selections || []\n+ for (const selection of selections) {\n+ if (selection.contains(position)) {\n+ const args = [{ sql: document.getText(selection) }];\n+ const runCommandUri = vscode.Uri.parse(`command:mysql.runQuery?${encodeURIComponent(JSON.stringify(args))}`);\n+ const contents = new vscode.MarkdownString(`[Run Selected SQL](${runCommandUri})`);\n+ contents.isTrusted = true;\n+ const hover = new vscode.Hover(contents);\n+ return hover;\n+ }\n+ }\n+\nreturn null;\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support run selected sql.
141,908
19.07.2021 22:14:36
-28,800
5fd9b84bd4cd3734dd78f828990c9fa7adf2321d
ElasticSearch support setting timeout.
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</template>\n+ <section class=\"mb-2\" v-if=\"connectionOption.dbType=='ElasticSearch'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n+ <input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n+ </div>\n+ </section>\n+\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.dbType=='MySQL'\">\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\">Timezone</label>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
ElasticSearch support setting timeout.
141,908
19.07.2021 23:03:33
-28,800
57f9768054cadd4f734081776f99941a11a2cdea
Add empty es server check.
[ { "change_type": "MODIFY", "old_path": "src/model/es/model/esIndexGroupNode.ts", "new_path": "src/model/es/model/esIndexGroupNode.ts", "diff": "import { Node } from \"@/model/interface/node\";\nimport { TableGroup } from \"@/model/main/tableGroup\";\n+import { InfoNode } from \"@/model/other/infoNode\";\nimport { QueryUnit } from \"@/service/queryUnit\";\nimport { ThemeIcon } from \"vscode\";\nimport { ESIndexNode } from \"./esIndexNode\";\n@@ -15,6 +16,9 @@ export class EsIndexGroup extends TableGroup {\nreturn this.execute(`get /_cat/indices`).then((res: string) => {\nlet indexes = [];\nconst results = res.match(/[^\\r\\n]+/g);\n+ if(!results){\n+ return [new InfoNode(\"This server has no index!\")]\n+ }\nfor (const result of results) {\nindexes.push(new ESIndexNode(result, this))\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Add empty es server check.
141,908
22.07.2021 01:03:27
-28,800
f9dbb04e2c516806295dfbb5b41c798f4d8f0087
Add select sql to table node.
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"title\": \"%command.column.drop%\",\n\"category\": \"MySQL\"\n},\n+ {\n+ \"command\": \"mysql.template.sql\",\n+ \"title\": \"%command.template.sql%\",\n+ \"category\": \"MySQL\",\n+ \"icon\": \"$(symbol-file)\"\n+ },\n{\n\"command\": \"mysql.template.table\",\n\"title\": \"%command.template.table%\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem == table\",\n\"group\": \"1_inline@0\"\n},\n+ {\n+ \"command\": \"mysql.template.sql\",\n+ \"when\": \"view =~ /cweijan.+?ql/ && viewItem == table\",\n+ \"group\": \"inline@5\"\n+ },\n{\n\"command\": \"mysql.table.source\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem =~ /^(table)$/\",\n" }, { "change_type": "MODIFY", "old_path": "package.nls.json", "new_path": "package.nls.json", "diff": "\"command.column.update\": \"Modify Column\",\n\"command.column.drop\": \"Drop column\",\n\"command.template.table\": \"Create New Table\",\n+ \"command.template.sql\": \"Select Table SQL\",\n\"command.template.view\": \"Create New View\",\n\"command.template.procedure\": \"Create New Procedure\",\n\"command.template.trigger\": \"Create New Trigger\",\n" }, { "change_type": "MODIFY", "old_path": "src/extension.ts", "new_path": "src/extension.ts", "diff": "@@ -283,6 +283,9 @@ export function activate(context: vscode.ExtensionContext) {\n},\n// create template\n...{\n+ \"mysql.template.sql\": (tableNode: TableNode) => {\n+ tableNode.selectSqlTemplate();\n+ },\n\"mysql.template.table\": (tableGroup: TableGroup) => {\ntableGroup.createTemplate();\n},\n" }, { "change_type": "MODIFY", "old_path": "src/model/main/tableNode.ts", "new_path": "src/model/main/tableNode.ts", "diff": "@@ -209,6 +209,12 @@ ROW_FORMAT : ${meta.row_format}\n})\n}\n+ public async selectSqlTemplate() {\n+ const sql = `SELECT * FROM ${Util.wrap(this.table)}`;\n+ QueryUnit.showSQLTextDocument(this, sql, Template.table);\n+\n+ }\n+\npublic deleteSqlTemplate(): any {\nthis\n.getChildren()\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Add select sql to table node.
141,908
22.07.2021 01:04:52
-28,800
07fe925df30f69eb4672ee52702365b68bffee96
Version 3.9.6.
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# CHANGELOG\n+# 3.9.6 2021-7-22\n+\n+- Add hover to run selected sql.\n+- Add sql template action icon to table node.\n+\n# 3.9.5 2021-7-19\n- Using mysqldump to dump database.\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"name\": \"vscode-mysql-client2\",\n\"displayName\": \"MySQL\",\n\"description\": \"Database Client for vscode\",\n- \"version\": \"3.9.5\",\n+ \"version\": \"3.9.6\",\n\"publisher\": \"cweijan\",\n\"icon\": \"resources/logo.png\",\n\"engines\": {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Version 3.9.6.
141,900
21.07.2021 20:24:10
-3,600
f266b9a472dd1f2478402758758a3445e8634390
feat: add support for connecting with MongoDB connection url
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -38,7 +38,7 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\npublic connectTimeout?: number;\npublic requestTimeout?: number;\npublic includeDatabases?: string;\n-\n+ public connectionUrl?: string;\n/**\n* ssh\n*/\n@@ -114,6 +114,7 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\nthis.connectionKey = source.connectionKey\nthis.global = source.global\nthis.dbType = source.dbType\n+ this.connectionUrl = source.connectionUrl\nif (source.connectTimeout) {\nthis.connectTimeout = parseInt(source.connectTimeout as any)\nsource.connectTimeout = parseInt(source.connectTimeout as any)\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/mongoConnection.ts", "new_path": "src/service/connect/mongoConnection.ts", "diff": "@@ -18,10 +18,16 @@ export class MongoConnection extends IConnection {\n}\nconnect(callback: (err: Error) => void): void {\n+ let url;\n+ if (this.node.connectionUrl) {\n+ url = this.node.connectionUrl;\n+ this.option = { useNewUrlParser: true}\n+ } else {\nlet url = `mongodb://${this.node.host}:${this.node.port}`;\nif (this.node.user || this.node.password) {\nurl = `mongodb://${this.node.user}:${this.node.password}@${this.node.host}:${this.node.port}`;\n}\n+ }\nMongoClient.connect(url, this.option, (err, client) => {\nif (!err) {\nthis.client = client;\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<label class=\"font-bold mr-5 inline-block w-18\">Use SSL</label>\n<el-switch v-model=\"connectionOption.useSSL\"></el-switch>\n</div>\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n+ <label class=\"inline-block mr-5 font-bold w-18\">SRV Record</label>\n+ <el-switch v-model=\"connectionOption.srv\"></el-switch>\n+ </div>\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n+ <label class=\"inline-block mr-5 font-bold w-18\">Use Connection String</label>\n+ <el-switch v-model=\"connectionOption.useConnectionString\"></el-switch>\n+ </div>\n</section>\n</template>\n+ <section class=\"flex items-center mb-2\" v-if=\"connectionOption.useConnectionString\">\n+ <div class=\"flex w-full mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Connection String</label>\n+ <input class=\"w-4/5 field__input\" placeholder=\"e.g mongodb+srv://username:password@server-url/admin\" v-model=\"connectionOption.connectionUrl\"\n+ />\n+ </div>\n+ </section>\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.useSSL\">\n<div class=\"inline-block mr-10\">\nincludeDatabases: null,\ndbType: \"MySQL\",\nencrypt: true,\n+ connectionUrl: \"\",\n+ srv: false,\n+\nglobal: true,\nkey: null,\nscheme: \"http\",\n}\nthis.$forceUpdate()\n},\n+ \"connectionOption.connectionUrl\"(value) {\n+ let connectionUrl = this.connectionOption.connectionUrl;\n+\n+ const srvRegex = /(?<=mongodb\\+).+?(?=:\\/\\/)/\n+ const srv = connectionUrl.match(srvRegex)\n+ if (srv) {\n+ this.connectionOption.srv = true\n+ connectionUrl = connectionUrl.replace(srvRegex, \"\")\n+ }\n+ const userRegex = /(?<=\\/\\/).+?(?=\\:)/\n+ const user = connectionUrl.match(userRegex)\n+ if (user) {\n+ this.connectionOption.user = user[0]\n+ connectionUrl = connectionUrl.replace(userRegex, \"\")\n+ }\n+ const passwordRegex = /(?<=\\/\\/:).+?(?=@)/\n+ const password = connectionUrl.match(passwordRegex)\n+ if (password) {\n+ this.connectionOption.password = password[0]\n+ connectionUrl = connectionUrl.replace(passwordRegex, \"\")\n+\n+ }\n+\n+ const hostRegex = /(?<=@).+?(?=[:\\/])/\n+ const host = connectionUrl.match(hostRegex)\n+ if (host) {\n+ this.connectionOption.host = host[0]\n+ connectionUrl = connectionUrl.replace(hostRegex, \"\")\n+\n+ }\n+\n+\n+ if (!this.connectionOption.srv) {\n+ const portRegex = /(?<=\\:).\\d+/\n+ const port = connectionUrl.match(portRegex)\n+ if (port) {\n+ this.connectionOption.port = port[0]\n+ connectionUrl = connectionUrl.replace(portRegex, \"\")\n+\n+ }\n+\n+ }\n+\n+ this.$forceUpdate()\n+ },\n},\n};\n</script>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
feat: add support for connecting with MongoDB connection url
141,908
26.07.2021 14:50:52
-28,800
945f755bc59dd24e375333dd2b6ecf42788165e1
Using es6 default import.
[ { "change_type": "MODIFY", "old_path": "src/model/es/model/esConnectionNode.ts", "new_path": "src/model/es/model/esConnectionNode.ts", "diff": "@@ -3,7 +3,7 @@ import { Util } from \"@/common/util\";\nimport { QueryGroup } from \"@/model/query/queryGroup\";\nimport { DbTreeDataProvider } from \"@/provider/treeDataProvider\";\nimport { QueryUnit } from \"@/service/queryUnit\";\n-import * as compareVersions from 'compare-versions';\n+import compareVersions from 'compare-versions';\nimport * as path from \"path\";\nimport { ExtensionContext, ThemeIcon, TreeItemCollapsibleState } from \"vscode\";\nimport { ConfigKey, Constants, ModelType } from \"../../../common/constants\";\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/esConnection.ts", "new_path": "src/service/connect/esConnection.ts", "diff": "@@ -2,7 +2,7 @@ import axios from \"axios\";\nimport { Node } from \"@/model/interface/node\";\nimport { IConnection, queryCallback } from \"./connection\";\nimport { EsIndexGroup } from \"@/model/es/model/esIndexGroupNode\";\n-import * as compareVersions from 'compare-versions';\n+import compareVersions from 'compare-versions';\nconst extPackage = require(\"@/../package.json\")\nexport class EsConnection extends IConnection {\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/ftpConnection.ts", "new_path": "src/service/connect/ftpConnection.ts", "diff": "import { Node } from \"@/model/interface/node\";\nimport EventEmitter = require(\"events\");\nimport { IConnection, queryCallback } from \"./connection\";\n-import * as Client from '@/model/ftp/lib/connection'\n+import Client from '@/model/ftp/lib/connection'\nexport class FTPConnection extends IConnection {\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/redisConnection.ts", "new_path": "src/service/connect/redisConnection.ts", "diff": "import { Node } from \"@/model/interface/node\";\nimport { IConnection, queryCallback } from \"./connection\";\nimport * as fs from \"fs\";\n-import * as IoRedis from \"ioredis\";\n+import IoRedis from \"ioredis\";\nexport class RedisConnection extends IConnection {\nprivate conneted: boolean;\n" }, { "change_type": "MODIFY", "old_path": "tsconfig.json", "new_path": "tsconfig.json", "diff": "\"es2017\",\n\"es2019\"\n],\n+ \"esModuleInterop\": true,\n+ \"allowSyntheticDefaultImports\": true,\n\"sourceMap\": true,\n\"baseUrl\": \".\",\n\"paths\": {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Using es6 default import.
141,908
26.07.2021 15:30:49
-28,800
4f28e29c82065013f2c13b1533e58298e68d1e06
Init esbuild.
[ { "change_type": "ADD", "old_path": null, "new_path": "build.js", "diff": "+const { build } = require(\"esbuild\")\n+\n+build({\n+ entryPoints: ['./src/extension.ts'],\n+ format: 'cjs',\n+ bundle: true,\n+ outfile: \"out/extension.js\",\n+ platform: 'node',\n+ logLevel: 'error',\n+ metafile: true,\n+ sourcemap:'external',\n+ sourceRoot:__dirname,\n+ minify:false,\n+ watch:false,\n+ external: ['vscode', 'pg-native', 'cardinal', 'aws4', 'mongodb-client-encryption'],\n+ plugins: [\n+ {\n+ name: 'build notice',\n+ setup(build) {\n+ console.log('build')\n+ },\n+ },\n+ ],\n+})\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"date-format\": \"^3.0.0\",\n\"deepmerge\": \"^3.2.0\",\n\"element-ui\": \"^2.13.2\",\n+ \"esbuild\": \"^0.12.16\",\n\"g2\": \"^2.3.13\",\n\"ioredis\": \"^4.23.0\",\n\"json-format-highlight\": \"^1.0.4\",\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Init esbuild.
141,908
26.07.2021 22:21:20
-28,800
a986bfbdea8af04f13bf385509e35036e8630c66
Table hover add query action.
[ { "change_type": "MODIFY", "old_path": "src/provider/tableInfoHoverProvider.ts", "new_path": "src/provider/tableInfoHoverProvider.ts", "diff": "@@ -12,7 +12,10 @@ export class TableInfoHoverProvider implements HoverProvider {\nconst sourceCode = await tableNode?.execute<any[]>(tableNode.dialect.showTableSource(tableNode.schema, tableNode.table))\nif (sourceCode) {\n- const markdownStr = new vscode.MarkdownString();\n+ const args = [{ sql: `SELECT * FROM ${tableNode.table}` }];\n+ const runCommandUri = vscode.Uri.parse(`command:mysql.runQuery?${encodeURIComponent(JSON.stringify(args))}`);\n+ const markdownStr = new vscode.MarkdownString(`[Query Table](${runCommandUri})`);\n+ markdownStr.isTrusted=true;\nmarkdownStr.appendCodeblock(sourceCode[0]['Create Table'], \"sql\");\nreturn new vscode.Hover(markdownStr);\n}\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Table hover add query action.
141,908
26.07.2021 22:28:15
-28,800
3c128e70436e7f53c9654c9a33454dc413737b85
Add run query command.
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"title\": \"%command.query.rename%\",\n\"category\": \"MySQL\"\n},\n+ {\n+ \"command\": \"mysql.query.run\",\n+ \"title\": \"%command.query.run%\",\n+ \"icon\": \"$(run)\",\n+ \"category\": \"MySQL\"\n+ },\n{\n\"command\": \"mysql.connection.add\",\n\"title\": \"%command.connection.add%\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem == query\",\n\"group\": \"2_mysql@0\"\n},\n+ {\n+ \"command\": \"mysql.query.run\",\n+ \"when\": \"view =~ /cweijan.+?ql/ && viewItem == query\",\n+ \"group\": \"2_mysql@0\"\n+ },\n{\n\"command\": \"mysql.refresh\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem =~ /^(esConnection|ftpConnection|ftpFolder)$/\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem == queryGroup\",\n\"group\": \"inline@0\"\n},\n+ {\n+ \"command\": \"mysql.query.run\",\n+ \"when\": \"view =~ /cweijan.+?ql/ && viewItem == query\",\n+ \"group\": \"inline@0\"\n+ },\n{\n\"command\": \"mysql.template.user\",\n\"when\": \"view =~ /cweijan.+?ql/ && viewItem == userGroup\",\n" }, { "change_type": "MODIFY", "old_path": "package.nls.json", "new_path": "package.nls.json", "diff": "\"command.diagram.add\": \"Create Diagram\",\n\"command.query.add\": \"Create Query\",\n\"command.query.rename\": \"Rename Query\",\n+ \"command.query.run\": \"Run This Query\",\n\"command.diagram.open\": \"Open Diagram\",\n\"command.diagram.drop\": \"Drop Diagram\",\n\"command.connection.add\": \"Add Connection\",\n" }, { "change_type": "MODIFY", "old_path": "src/extension.ts", "new_path": "src/extension.ts", "diff": "@@ -201,6 +201,9 @@ export function activate(context: vscode.ExtensionContext) {\n});\n}\n},\n+ \"mysql.query.run\": (queryNode: QueryNode) => {\n+ queryNode.run()\n+ },\n\"mysql.query.open\": (queryNode: QueryNode) => {\nqueryNode.open()\n},\n" }, { "change_type": "MODIFY", "old_path": "src/model/query/queryNode.ts", "new_path": "src/model/query/queryNode.ts", "diff": "import { Constants, ModelType } from \"@/common/constants\";\nimport { FileManager } from \"@/common/filesManager\";\nimport { DbTreeDataProvider } from \"@/provider/treeDataProvider\";\n-import { renameSync } from \"fs\";\n+import { QueryUnit } from \"@/service/queryUnit\";\n+import { readFileSync, renameSync, writeFileSync } from \"fs\";\nimport * as path from \"path\";\nimport * as vscode from \"vscode\";\nimport { TreeItemCollapsibleState } from \"vscode\";\n@@ -21,6 +22,11 @@ export class QueryNode extends Node {\n}\n}\n+ public async run() {\n+ const content = readFileSync(this.getFilePath(),'utf8')\n+ QueryUnit.runQuery(content,this)\n+ }\n+\npublic async open() {\nawait vscode.window.showTextDocument(\nawait vscode.workspace.openTextDocument(this.getFilePath())\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Add run query command.
141,908
26.07.2021 22:34:40
-28,800
688e080e69da477907d3d469b3dc861411698c81
Fix complection bug.
[ { "change_type": "MODIFY", "old_path": "src/provider/complete/complectionContext.ts", "new_path": "src/provider/complete/complectionContext.ts", "diff": "@@ -28,11 +28,12 @@ export class ComplectionContext {\ncontext.tokens = context.sqlBlock.tokens\nfor (let i = 0; i < context.tokens.length; i++) {\nconst token = context.tokens[i];\n- if (token.range.contains(position)) {\n+ if (token.range.contains(position) || token.range.start.isAfter(position)) {\ncontext.currentToken = token;\nif (context.tokens[i - 1]) {\ncontext.previousToken = context.tokens[i - 1];\n}\n+ break;\n}\n}\nif (!context.previousToken && context.tokens.length > 0) {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix complection bug.
141,908
26.07.2021 22:48:47
-28,800
fe8cc6a8cc74fd468f8ca9ce044c286f9aaf417f
Support config ca certifacate
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -63,6 +63,7 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\npublic parent?: Node;\npublic useSSL?: boolean;\n+ public caPath?: string;\npublic clientCertPath?: string;\npublic clientKeyPath?: string;\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/mysqlConnection.ts", "new_path": "src/service/connect/mysqlConnection.ts", "diff": "@@ -25,6 +25,7 @@ export class MysqlConnection extends IConnection {\nif (node.useSSL) {\nconfig.ssl = {\nrejectUnauthorized: false,\n+ ca: (node.caPath) ? fs.readFileSync(node.caPath) : null,\ncert: (node.clientCertPath) ? fs.readFileSync(node.clientCertPath) : null,\nkey: (node.clientKeyPath) ? fs.readFileSync(node.clientKeyPath) : null,\nminVersion: 'TLSv1'\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/postgreSqlConnection.ts", "new_path": "src/service/connect/postgreSqlConnection.ts", "diff": "@@ -21,6 +21,7 @@ export class PostgreSqlConnection extends IConnection {\nif (node.useSSL) {\nconfig.ssl = {\nrejectUnauthorized: false,\n+ ca: (node.caPath) ? fs.readFileSync(node.caPath) : null,\ncert: (node.clientCertPath) ? fs.readFileSync(node.clientCertPath) : null,\nkey: (node.clientKeyPath) ? fs.readFileSync(node.clientKeyPath) : null,\n}\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/redisConnection.ts", "new_path": "src/service/connect/redisConnection.ts", "diff": "@@ -19,6 +19,7 @@ export class RedisConnection extends IConnection {\nif(node.useSSL){\nconfig.tls={\nrejectUnauthorized: false,\n+ ca: (node.caPath) ? fs.readFileSync(node.caPath) : null,\ncert: ( node.clientCertPath) ? fs.readFileSync(node.clientCertPath) : null,\nkey: ( node.clientKeyPath) ? fs.readFileSync(node.clientKeyPath) : null,\nminVersion: 'TLSv1'\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<section class=\"flex items-center mb-2\" v-if=\"connectionOption.useSSL\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">SSL Client Cert</label>\n+ <label class=\"font-bold mr-5 inline-block w-32\">CA Certificate</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSL CA Certificate Path\"\n+ v-model=\"connectionOption.caPath\" />\n+ </div>\n+ </section>\n+\n+ <section class=\"flex items-center mb-2\" v-if=\"connectionOption.useSSL\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Client Cert</label>\n<input class=\"w-64 field__input\" placeholder=\"SSL Client Certificate Path\"\nv-model=\"connectionOption.clientCertPath\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">SSL Client Key</label>\n+ <label class=\"font-bold mr-5 inline-block w-32\">Client Key</label>\n<input class=\"w-64 field__input\" placeholder=\"SSL Client Key Path\" v-model=\"connectionOption.clientKeyPath\" />\n</div>\n</section>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support config ca certifacate #251.
141,908
26.07.2021 23:45:40
-28,800
8ca83e9fc83fc790d1ca3c8a065bed613004fd4f
Support native ssh command.
[ { "change_type": "MODIFY", "old_path": "src/model/interface/sshConfig.ts", "new_path": "src/model/interface/sshConfig.ts", "diff": "@@ -7,7 +7,12 @@ export interface SSHConfig {\nport: number;\nusername: string;\npassword?: string;\n+ /**\n+ * password privateKey native\n+ */\n+ type?: string;\nprivateKeyPath?: string;\n+ watingTime?: number;\n/**\n* only support private keys generated by ssh-keygen, which means pkcs8 is not support.\n*/\n" }, { "change_type": "MODIFY", "old_path": "src/service/tunnel/sshTunnelService.ts", "new_path": "src/service/tunnel/sshTunnelService.ts", "diff": "@@ -4,6 +4,7 @@ import { Console } from '../../common/Console';\nimport { existsSync } from 'fs';\nimport * as portfinder from 'portfinder'\nimport { DatabaseType } from '@/common/constants';\n+import { spawn } from \"child_process\";\nexport class SSHTunnelService {\n@@ -51,6 +52,27 @@ export class SSHTunnelService {\nconfig.dstPort = parseInt(portStr)\n}\n+ if (ssh.type == 'native') {\n+ let args = ['-TnNL', `${port}:${config.dstHost}:${config.dstPort}`, config.host, '-p', `${config.port}`];\n+ if (ssh.privateKeyPath) {\n+ args.push('-i', ssh.privateKeyPath)\n+ }\n+ const bat = spawn('ssh', args);\n+ const successHandler = setTimeout(() => {\n+ resolve({ ...node, host: \"127.0.0.1\", port } as Node)\n+ }, ssh.watingTime);\n+ bat.stderr.on('data', (chunk) => {\n+ if (chunk?.toString().match(/^[@\\s]+$/)) return;\n+ delete this.tunelMark[key]\n+ errorCallback(new Error(chunk.toString()?.replace(/@/g, '')))\n+ clearTimeout(successHandler)\n+ });\n+ bat.on('close', (code, signal) => {\n+ delete this.tunelMark[key]\n+ });\n+ return;\n+ }\n+\nconst localTunnel = tunnel(config, (error, server) => {\nthis.tunelMark[key] = { tunnel: localTunnel, tunnelPort: port }\nif (error && errorCallback) {\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<section class=\"mb-2\">\n<label class=\"font-bold mr-5 inline-block w-28\">Type</label>\n- <el-radio v-model=\"type\" label=\"password\">Password</el-radio>\n- <el-radio v-model=\"type\" label=\"privateKey\">Private Key</el-radio>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"password\">Password</el-radio>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"privateKey\">Private Key</el-radio>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"native\">Native SSH</el-radio>\n</section>\n- <div v-if=\"type == 'password'\">\n+ <div v-if=\"connectionOption.ssh.type == 'password'\">\n<section class=\"mb-2\">\n<label class=\"font-bold mr-5 inline-block w-28\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" required type=\"password\"\nv-model=\"connectionOption.ssh.passphrase\" />\n</div>\n</section>\n+ <section class=\"mb-2\" v-if=\"connectionOption.ssh.type == 'native'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Waiting Time</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Waiting time for ssh command.\" v-model=\"connectionOption.ssh.watingTime\" />\n+ </div>\n+ </section>\n</div>\n</div>\n</template>\nprivateKeyPath: \"\",\nport: 22,\nusername: \"root\",\n+ type: \"password\",\n+ watingTime: 5000,\nalgorithms: {\ncipher: [],\n},\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Support native ssh command.
141,911
26.07.2021 20:23:18
-10,800
4741429418f9c551bd7d82a53204e582115081d1
Update mongoConnection.ts Encode for unescaped signs that doesn't support mongo client
[ { "change_type": "MODIFY", "old_path": "src/service/connect/mongoConnection.ts", "new_path": "src/service/connect/mongoConnection.ts", "diff": "@@ -25,7 +25,9 @@ export class MongoConnection extends IConnection {\n} else {\nlet url = `mongodb://${this.node.host}:${this.node.port}`;\nif (this.node.user || this.node.password) {\n- url = `mongodb://${this.node.user}:${this.node.password}@${this.node.host}:${this.node.port}`;\n+ const escapedUser = encodeURIComponent(this.node.user)\n+ const escapedPassword = encodeURIComponent(this.node.password)\n+ url = `mongodb://${escapedUser}:${escapedPassword}@${this.node.host}:${this.node.port}`;\n}\n}\nMongoClient.connect(url, this.option, (err, client) => {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Update mongoConnection.ts Encode for unescaped signs that doesn't support mongo client
141,908
27.07.2021 14:31:37
-28,800
ae973b2a148ff18483d72f6644fcfd0121eda31a
Extract connect component.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "+<template>\n+ <div>\n+ <section class=\"mb-2\">\n+ <section class=\"mb-2\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Scheme</label>\n+ <el-radio v-model=\"connectionOption.scheme\" label=\"http\">Http</el-radio>\n+ <el-radio v-model=\"connectionOption.scheme\" label=\"https\">Https</el-radio>\n+ </section>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>\n+ <span v-if=\"connectionOption.dbType=='ElasticSearch'\">URL</span>\n+ <span v-if=\"connectionOption.dbType!='ElasticSearch'\">Host</span>\n+ </label>\n+ <input class=\"w-64 field__input\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n+ </div>\n+ </section>\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='Redis'\">\n+ <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\" v-if=\"connectionOption.dbType!='ElasticSearch'\">*</span>Username</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\" v-if=\"connectionOption.dbType!='ElasticSearch'\">*</span>Password</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n+ </div>\n+ </section>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n+ <input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n+ </div>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\"],\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/FTP.vue", "diff": "+<template>\n+ <div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Encoding</label>\n+ <input class=\"w-64 field__input\" placeholder=\"UTF8\" required v-model=\"connectionOption.encoding\" />\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n+ <el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n+ </div>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\"],\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/SQLServer.vue", "diff": "+<template>\n+ <div>\n+ <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Instance Name</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Connection named instance\" title=\"The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.(no default)\" v-model=\"connectionOption.instanceName\" />\n+ </div>\n+ <span>\n+ (If instance name is specified, the port config is ignored)\n+ </span>\n+ </section>\n+\n+ <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer'\">\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType=='SqlServer'\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Auth Type</label>\n+ <el-select v-model=\"connectionOption.authType\">\n+ <el-option :label=\"'default'\" value=\"default\"></el-option>\n+ <el-option :label=\"'ntlm(Windows Auth)'\" value=\"ntlm\"></el-option>\n+ <!-- <el-option :label=\"'azure-active-directory-password'\" value=\"azure-active-directory-password\"></el-option>\n+ <el-option :label=\"'azure-active-directory-msi-vm'\" value=\"azure-active-directory-msi-vm\"></el-option>\n+ <el-option :label=\"'azure-active-directory-msi-app-service'\" value=\"azure-active-directory-msi-app-service\"></el-option> -->\n+ </el-select>\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-18\">Encrypt</label>\n+ <el-switch v-model=\"connectionOption.encrypt\"></el-switch>\n+ </div>\n+ </section>\n+\n+ <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer' && connectionOption.authType=='ntlm'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Domain</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Domain\" v-model=\"connectionOption.domain\" />\n+ </div>\n+ </section>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\"],\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/SQLite.vue", "diff": "+<template>\n+ <div>\n+ <div>\n+ <section class=\"mb-2\" v-if=\"!sqliteState\">\n+ <div class=\"font-bold mr-5 inline-block w-1/4\">\n+ <el-alert title=\"sqlite not installed\" type=\"warning\" show-icon />\n+ </div>\n+ <div class=\"font-bold mr-5 inline-block w-36\">\n+ <button class=\"button button--primary w-128 inline\" @click=\"install\">Install Sqlite</button>\n+ </div>\n+ </section>\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">SQLite File Path</label>\n+ <input class=\"w-80 field__input\" placeholder=\"SQLite File Path\" v-model=\"connectionOption.dbPath\" />\n+ <button class=\"button button--primary w-128 inline\" @click=\"choose('sqlite')\">Choose Database File</button>\n+ </div>\n+ </section>\n+ </div>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\",\"sqliteState\"],\n+ methods:{\n+ install(){\n+ this.$emit(\"installSqlite\")\n+ }\n+ }\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/SSH.vue", "diff": "+<template>\n+ <div>\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Host</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSH Host\" required v-model=\"connectionOption.ssh.host\" />\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Port</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSH Port\" required type=\"number\" v-model=\"connectionOption.ssh.port\" />\n+ </div>\n+ </section>\n+\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Username</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSH Username\" required v-model=\"connectionOption.ssh.username\" />\n+ </div>\n+\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">SSH Cipher</label>\n+ <el-select v-model=\"connectionOption.ssh.algorithms.cipher[0]\" placeholder=\"Default\">\n+ <el-option value=\"aes128-cbc\">aes128-cbc</el-option>\n+ <el-option value=\"aes192-cbc\">aes192-cbc</el-option>\n+ <el-option value=\"aes256-cbc\">aes256-cbc</el-option>\n+ <el-option value=\"3des-cbc\">3des-cbc</el-option>\n+ <el-option value=\"aes128-ctr\">aes128-ctr</el-option>\n+ <el-option value=\"aes192-ctr\">aes192-ctr</el-option>\n+ <el-option value=\"aes256-ctr\">aes256-ctr</el-option>\n+ </el-select>\n+ </div>\n+ </section>\n+\n+ <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SSH'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n+ <el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n+ </div>\n+ </section>\n+\n+ <section class=\"mb-2\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Type</label>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"password\">Password</el-radio>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"privateKey\">Private Key</el-radio>\n+ <el-radio v-model=\"connectionOption.ssh.type\" label=\"native\">Native SSH</el-radio>\n+ </section>\n+\n+ <div v-if=\"connectionOption.ssh.type == 'password'\">\n+ <section class=\"mb-2\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Password</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Password\" required type=\"password\" v-model=\"connectionOption.ssh.password\" />\n+ </section>\n+ </div>\n+ <div v-else>\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Private Key Path</label>\n+ <input class=\"w-52 field__input\" placeholder=\"Private Key Path\" v-model=\"connectionOption.ssh.privateKeyPath\" />\n+ <button @click=\"choose('privateKey')\" class=\" w-12\">Choose</button>\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Passphrase</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Passphrase\" type=\"passphrase\" v-model=\"connectionOption.ssh.passphrase\" />\n+ </div>\n+ </section>\n+ <section class=\"mb-2\" v-if=\"connectionOption.ssh.type == 'native'\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-28\">Waiting Time</label>\n+ <input class=\"w-64 field__input\" placeholder=\"Waiting time for ssh command.\" v-model=\"connectionOption.ssh.watingTime\" />\n+ </div>\n+ </section>\n+ </div>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\"],\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/vue/connect/component/SSL.vue", "diff": "+<template>\n+ <div>\n+ <section class=\"flex items-center mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">CA Certificate</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSL CA Certificate Path\" v-model=\"connectionOption.caPath\" />\n+ </div>\n+ </section>\n+ <section class=\"flex items-center mb-2\">\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Client Cert</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSL Client Certificate Path\" v-model=\"connectionOption.clientCertPath\" />\n+ </div>\n+ <div class=\"inline-block mr-10\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Client Key</label>\n+ <input class=\"w-64 field__input\" placeholder=\"SSL Client Key Path\" v-model=\"connectionOption.clientKeyPath\" />\n+ </div>\n+ </section>\n+ </div>\n+</template>\n+\n+<script>\n+export default {\n+ props: [\"connectionOption\"],\n+};\n+</script>\n+\n+<style>\n+</style>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<section class=\"mb-2\">\n<label class=\"block font-bold\">Database Type</label>\n<ul class=\"tab\">\n- <li class=\"tab__item \" :class=\"{'tab__item--active':supportDatabase==connectionOption.dbType}\"\n- v-for=\"supportDatabase in supportDatabases\" :key=\"supportDatabase\"\n- @click=\"connectionOption.dbType=supportDatabase\">\n+ <li class=\"tab__item \" :class=\"{'tab__item--active':supportDatabase==connectionOption.dbType}\" v-for=\"supportDatabase in supportDatabases\" :key=\"supportDatabase\" @click=\"connectionOption.dbType=supportDatabase\">\n{{supportDatabase}}\n</li>\n</ul>\n</section>\n- <template v-if=\"connectionOption.dbType=='SQLite'\">\n- <div>\n- <section class=\"mb-2\" v-if=\"!sqliteState\">\n- <div class=\"font-bold mr-5 inline-block w-1/4\">\n- <el-alert title=\"sqlite not installed\" type=\"warning\" show-icon/>\n- </div>\n- <div class=\"font-bold mr-5 inline-block w-36\">\n- <button class=\"button button--primary w-128 inline\" @click=\"installSqlite\">Install Sqlite</button>\n- </div>\n- </section>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SQLite File Path</label>\n- <input class=\"w-80 field__input\" placeholder=\"SQLite File Path\" v-model=\"connectionOption.dbPath\" />\n- <button class=\"button button--primary w-128 inline\" @click=\"choose('sqlite')\">Choose Database File</button>\n- </div>\n- </section>\n- </div>\n- </template>\n-\n- <template v-if=\"connectionOption.dbType!='SQLite'\">\n+ <ElasticSearch v-if=\"connectionOption.dbType=='ElasticSearch'\" :connectionOption=\"connectionOption\" />\n+ <SQLite v-else-if=\"connectionOption.dbType=='SQLite'\" :connectionOption=\"connectionOption\" :sqliteState=\"sqliteState\" @install=\"installSqlite\" />\n+ <SSH v-else-if=\"connectionOption.dbType=='SSH'\" :connectionOption=\"connectionOption\" />\n- <template v-if=\"connectionOption.dbType!='SSH'\">\n- <template v-if=\"connectionOption.dbType=='ElasticSearch'\">\n- <section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Scheme</label>\n- <el-radio v-model=\"connectionOption.scheme\" label=\"http\">Http</el-radio>\n- <el-radio v-model=\"connectionOption.scheme\" label=\"https\">Https</el-radio>\n- </section>\n- </template>\n+ <template v-else>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>\n- <span v-if=\"connectionOption.dbType=='ElasticSearch'\">URL</span>\n- <span v-if=\"connectionOption.dbType!='ElasticSearch'\">Host</span>\n+ <span>Host</span>\n</label>\n- <input class=\"w-64 field__input\" placeholder=\"The host of connection\" required\n- v-model=\"connectionOption.host\" />\n- </div>\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='ElasticSearch'\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Port</label>\n- <input class=\"w-64 field__input\" placeholder=\"The port of connection\" required type=\"number\"\n- v-model=\"connectionOption.port\" />\n- </div>\n- </section>\n-\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Instance Name</label>\n- <input class=\"w-64 field__input\" placeholder=\"Connection named instance\"\n- title=\"The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.(no default)\"\n- v-model=\"connectionOption.instanceName\" />\n- </div>\n- <span>\n- (If instance name is specified, the port config is ignored)\n- </span>\n- </section>\n-\n- <template v-if=\"connectionOption.dbType!='ElasticSearch'\">\n-\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer'\">\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType=='SqlServer'\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Auth Type</label>\n- <el-select v-model=\"connectionOption.authType\">\n- <el-option :label=\"'default'\" value=\"default\"></el-option>\n- <el-option :label=\"'ntlm(Windows Auth)'\" value=\"ntlm\"></el-option>\n- <!-- <el-option :label=\"'azure-active-directory-password'\" value=\"azure-active-directory-password\"></el-option>\n- <el-option :label=\"'azure-active-directory-msi-vm'\" value=\"azure-active-directory-msi-vm\"></el-option>\n- <el-option :label=\"'azure-active-directory-msi-app-service'\" value=\"azure-active-directory-msi-app-service\"></el-option> -->\n- </el-select>\n+ <input class=\"w-64 field__input\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-18\">Encrypt</label>\n- <el-switch v-model=\"connectionOption.encrypt\"></el-switch>\n+ <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Port</label>\n+ <input class=\"w-64 field__input\" placeholder=\"The port of connection\" required type=\"number\" v-model=\"connectionOption.port\" />\n</div>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SqlServer' && connectionOption.authType=='ntlm'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Domain</label>\n- <input class=\"w-64 field__input\" placeholder=\"Domain\" v-model=\"connectionOption.domain\" />\n- </div>\n- </section>\n+ <SQLServer :connectionOption=\"connectionOption\" v-if=\"connectionOption.dbType=='SqlServer'\" />\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='Redis'\">\n</div>\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Password</label>\n- <input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\"\n- v-model=\"connectionOption.password\" />\n+ <input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType!='FTP' && connectionOption.dbType!='MongoDB'\">\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\">Databases</label>\n- <input class=\"w-64 field__input\" placeholder=\"Special connection database\"\n- v-model=\"connectionOption.database\" />\n+ <input class=\"w-64 field__input\" placeholder=\"Special connection database\" v-model=\"connectionOption.database\" />\n</div>\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='Redis' \">\n<label class=\"font-bold mr-5 inline-block w-32\">Include Databases</label>\n</div>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='FTP'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Encoding</label>\n- <input class=\"w-64 field__input\" placeholder=\"UTF8\" required v-model=\"connectionOption.encoding\" />\n- </div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n- <el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n- </div>\n- </section>\n+ <FTP v-if=\"connectionOption.dbType=='FTP'\" :connectionOption=\"connectionOption\" />\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n</div>\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\">RequestTimeout</label>\n- <input class=\"w-64 field__input\" placeholder=\"10000\" required type=\"number\"\n- v-model=\"connectionOption.requestTimeout\" />\n- </div>\n- </section>\n-\n- </template>\n-\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='ElasticSearch'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n- <input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n+ <input class=\"w-64 field__input\" placeholder=\"10000\" required type=\"number\" v-model=\"connectionOption.requestTimeout\" />\n</div>\n</section>\n<input class=\"w-64 field__input\" placeholder=\"+HH:MM\" v-model=\"connectionOption.timezone\" />\n</div>\n</section>\n+ </template>\n<section class=\"flex items-center mb-2\">\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='SSH' && connectionOption.dbType!='SQLite'\">\n<label class=\"mr-2 font-bold\">SSH Tunnel</label>\n<el-switch v-model=\"connectionOption.usingSSH\"></el-switch>\n</div>\n- <div class=\"inline-block mr-10\"\n- v-if=\"connectionOption.dbType=='MySQL' || connectionOption.dbType=='PostgreSQL' || connectionOption.dbType=='MongoDB' || connectionOption.dbType=='Redis' \">\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType=='MySQL' || connectionOption.dbType=='PostgreSQL' || connectionOption.dbType=='MongoDB' || connectionOption.dbType=='Redis' \">\n<label class=\"font-bold mr-5 inline-block w-18\">Use SSL</label>\n<el-switch v-model=\"connectionOption.useSSL\"></el-switch>\n</div>\n<el-switch v-model=\"connectionOption.useConnectionString\"></el-switch>\n</div>\n</section>\n- </template>\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.useConnectionString\">\n<div class=\"flex w-full mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Connection String</label>\n- <input class=\"w-4/5 field__input\" placeholder=\"e.g mongodb+srv://username:password@server-url/admin\" v-model=\"connectionOption.connectionUrl\"\n- />\n+ <input class=\"w-4/5 field__input\" placeholder=\"e.g mongodb+srv://username:password@server-url/admin\" v-model=\"connectionOption.connectionUrl\" />\n</div>\n</section>\n- <section class=\"flex items-center mb-2\" v-if=\"connectionOption.useSSL\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">CA Certificate</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSL CA Certificate Path\"\n- v-model=\"connectionOption.caPath\" />\n- </div>\n- </section>\n+ <SSL :connectionOption=\"connectionOption\" v-if=\"connectionOption.useSSL\" />\n+ <SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH\" />\n- <section class=\"flex items-center mb-2\" v-if=\"connectionOption.useSSL\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Client Cert</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSL Client Certificate Path\"\n- v-model=\"connectionOption.clientCertPath\" />\n- </div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Client Key</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSL Client Key Path\" v-model=\"connectionOption.clientKeyPath\" />\n- </div>\n- </section>\n-\n- <div v-if=\"connectionOption.usingSSH || connectionOption.dbType=='SSH'\">\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SSH Host</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSH Host\" required v-model=\"connectionOption.ssh.host\" />\n- </div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SSH Port</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSH Port\" required type=\"number\"\n- v-model=\"connectionOption.ssh.port\" />\n- </div>\n- </section>\n-\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SSH Username</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSH Username\" required\n- v-model=\"connectionOption.ssh.username\" />\n- </div>\n-\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SSH Cipher</label>\n- <el-select v-model=\"connectionOption.ssh.algorithms.cipher[0]\" placeholder=\"Default\">\n- <el-option value=\"aes128-cbc\">aes128-cbc</el-option>\n- <el-option value=\"aes192-cbc\">aes192-cbc</el-option>\n- <el-option value=\"aes256-cbc\">aes256-cbc</el-option>\n- <el-option value=\"3des-cbc\">3des-cbc</el-option>\n- <el-option value=\"aes128-ctr\">aes128-ctr</el-option>\n- <el-option value=\"aes192-ctr\">aes192-ctr</el-option>\n- <el-option value=\"aes256-ctr\">aes256-ctr</el-option>\n- </el-select>\n- </div>\n- </section>\n-\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType=='SSH'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n- <el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n- </div>\n- </section>\n-\n- <section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Type</label>\n- <el-radio v-model=\"connectionOption.ssh.type\" label=\"password\">Password</el-radio>\n- <el-radio v-model=\"connectionOption.ssh.type\" label=\"privateKey\">Private Key</el-radio>\n- <el-radio v-model=\"connectionOption.ssh.type\" label=\"native\">Native SSH</el-radio>\n- </section>\n-\n- <div v-if=\"connectionOption.ssh.type == 'password'\">\n- <section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Password</label>\n- <input class=\"w-64 field__input\" placeholder=\"Password\" required type=\"password\"\n- v-model=\"connectionOption.ssh.password\" />\n- </section>\n- </div>\n- <div v-else>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Private Key Path</label>\n- <input class=\"w-52 field__input\" placeholder=\"Private Key Path\"\n- v-model=\"connectionOption.ssh.privateKeyPath\" />\n- <button @click=\"choose('privateKey')\" class=\" w-12\">Choose</button>\n- </div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Passphrase</label>\n- <input class=\"w-64 field__input\" placeholder=\"Passphrase\" type=\"passphrase\"\n- v-model=\"connectionOption.ssh.passphrase\" />\n- </div>\n- </section>\n- <section class=\"mb-2\" v-if=\"connectionOption.ssh.type == 'native'\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Waiting Time</label>\n- <input class=\"w-64 field__input\" placeholder=\"Waiting time for ssh command.\" v-model=\"connectionOption.ssh.watingTime\" />\n- </div>\n- </section>\n- </div>\n- </div>\n- </template>\n<div>\n- <button class=\"button button--primary w-28 inline mr-4\" @click=\"tryConnect\"\n- v-loading=\"connect.loading\">Connect</button>\n+ <button class=\"button button--primary w-28 inline mr-4\" @click=\"tryConnect\" v-loading=\"connect.loading\">Connect</button>\n<button class=\"button button--primary w-28 inline\" @click=\"close\">Close</button>\n</div>\n</div>\n</template>\n<script>\n+import ElasticSearch from \"./component/ElasticSearch.vue\";\n+import SQLite from \"./component/SQLite.vue\";\n+import SQLServer from \"./component/SQLServer.vue\";\n+import SSH from \"./component/SSH.vue\";\n+import FTP from \"./component/FTP.vue\";\n+import SSL from \"./component/SSL.vue\";\nimport { getVscodeEvent } from \"../util/vscode\";\nlet vscodeEvent;\nexport default {\nname: \"Connect\",\n+ components: { ElasticSearch, SQLite, SQLServer, SSH, SSL, FTP },\ndata() {\nreturn {\nconnectionOption: {\nhost: \"127.0.0.1\",\n- dbPath: '',\n+ dbPath: \"\",\nport: \"3306\",\nuser: \"root\",\nauthType: \"default\",\n\"Redis\",\n\"ElasticSearch\",\n\"SSH\",\n- \"FTP\"\n+ \"FTP\",\n],\nconnect: {\nloading: false,\nvscodeEvent\n.on(\"edit\", (node) => {\nthis.editModel = true;\n- console.log(node)\n+ console.log(node);\nthis.connectionOption = node;\n})\n.on(\"connect\", (node) => {\n})\n.on(\"choose\", ({ event, path }) => {\nswitch (event) {\n- case 'sqlite':\n+ case \"sqlite\":\nthis.connectionOption.dbPath = path;\nbreak;\n- case 'privateKey':\n+ case \"privateKey\":\nthis.connectionOption.ssh.privateKeyPath = path;\nbreak;\n}\n- this.$forceUpdate()\n+ this.$forceUpdate();\n})\n- .on(\"sqliteState\", sqliteState => {\n+ .on(\"sqliteState\", (sqliteState) => {\nthis.sqliteState = sqliteState;\n})\n.on(\"error\", (err) => {\n},\nmethods: {\ninstallSqlite() {\n- vscodeEvent.emit(\"installSqlite\")\n+ vscodeEvent.emit(\"installSqlite\");\nthis.sqliteState = true;\n},\ntryConnect() {\nchoose(event) {\nlet filters = {};\nswitch (event) {\n- case 'sqlite':\n- filters[\"SQLiteDb\"] = [\"db\"]\n+ case \"sqlite\":\n+ filters[\"SQLiteDb\"] = [\"db\"];\nbreak;\n- case 'privateKey':\n- filters[\"PrivateKey\"] = [\"key\", \"cer\", \"crt\", \"der\", \"pub\", \"pem\", \"pk\"]\n+ case \"privateKey\":\n+ filters[\"PrivateKey\"] = [\n+ \"key\",\n+ \"cer\",\n+ \"crt\",\n+ \"der\",\n+ \"pub\",\n+ \"pem\",\n+ \"pk\",\n+ ];\nbreak;\n}\n- filters[\"File\"] = [\"*\"]\n+ filters[\"File\"] = [\"*\"];\nvscodeEvent.emit(\"choose\", {\n- event, filters\n- })\n+ event,\n+ filters,\n+ });\n},\nclose() {\nvscodeEvent.emit(\"close\");\nif (this.editModel) {\nreturn;\n}\n- this.connectionOption.host = \"127.0.0.1\"\n+ this.connectionOption.host = \"127.0.0.1\";\nswitch (value) {\ncase \"MySQL\":\nthis.connectionOption.user = \"root\";\nthis.connectionOption.database = \"master\";\nbreak;\ncase \"ElasticSearch\":\n- this.connectionOption.host = \"127.0.0.1:9200\"\n+ this.connectionOption.host = \"127.0.0.1:9200\";\nthis.connectionOption.user = null;\nthis.connectionOption.port = null;\nthis.connectionOption.database = null;\ncase \"SSH\":\nbreak;\n}\n- this.$forceUpdate()\n+ this.$forceUpdate();\n},\n\"connectionOption.connectionUrl\"(value) {\nlet connectionUrl = this.connectionOption.connectionUrl;\n- const srvRegex = /(?<=mongodb\\+).+?(?=:\\/\\/)/\n- const srv = connectionUrl.match(srvRegex)\n+ const srvRegex = /(?<=mongodb\\+).+?(?=:\\/\\/)/;\n+ const srv = connectionUrl.match(srvRegex);\nif (srv) {\n- this.connectionOption.srv = true\n- connectionUrl = connectionUrl.replace(srvRegex, \"\")\n+ this.connectionOption.srv = true;\n+ connectionUrl = connectionUrl.replace(srvRegex, \"\");\n}\n- const userRegex = /(?<=\\/\\/).+?(?=\\:)/\n- const user = connectionUrl.match(userRegex)\n+ const userRegex = /(?<=\\/\\/).+?(?=\\:)/;\n+ const user = connectionUrl.match(userRegex);\nif (user) {\n- this.connectionOption.user = user[0]\n- connectionUrl = connectionUrl.replace(userRegex, \"\")\n+ this.connectionOption.user = user[0];\n+ connectionUrl = connectionUrl.replace(userRegex, \"\");\n}\n- const passwordRegex = /(?<=\\/\\/:).+?(?=@)/\n- const password = connectionUrl.match(passwordRegex)\n+ const passwordRegex = /(?<=\\/\\/:).+?(?=@)/;\n+ const password = connectionUrl.match(passwordRegex);\nif (password) {\n- this.connectionOption.password = password[0]\n- connectionUrl = connectionUrl.replace(passwordRegex, \"\")\n-\n+ this.connectionOption.password = password[0];\n+ connectionUrl = connectionUrl.replace(passwordRegex, \"\");\n}\n- const hostRegex = /(?<=@).+?(?=[:\\/])/\n- const host = connectionUrl.match(hostRegex)\n+ const hostRegex = /(?<=@).+?(?=[:\\/])/;\n+ const host = connectionUrl.match(hostRegex);\nif (host) {\n- this.connectionOption.host = host[0]\n- connectionUrl = connectionUrl.replace(hostRegex, \"\")\n-\n+ this.connectionOption.host = host[0];\n+ connectionUrl = connectionUrl.replace(hostRegex, \"\");\n}\n-\nif (!this.connectionOption.srv) {\n- const portRegex = /(?<=\\:).\\d+/\n- const port = connectionUrl.match(portRegex)\n+ const portRegex = /(?<=\\:).\\d+/;\n+ const port = connectionUrl.match(portRegex);\nif (port) {\n- this.connectionOption.port = port[0]\n- connectionUrl = connectionUrl.replace(portRegex, \"\")\n-\n+ this.connectionOption.port = port[0];\n+ connectionUrl = connectionUrl.replace(portRegex, \"\");\n}\n-\n}\n- this.$forceUpdate()\n+ this.$forceUpdate();\n},\n},\n};\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Extract connect component.
141,908
27.07.2021 15:11:28
-28,800
5c37d437e7a80647fad7970b94d8e0aa76fa86d5
Es support auth token and account.
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -84,6 +84,8 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\n* es only\n*/\npublic scheme: string;\n+ public esAuth: string;\n+ public esToken: string;\n/**\n* encoding, ftp only\n@@ -110,6 +112,8 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\nthis.ssh = source.ssh\nthis.usingSSH = source.usingSSH\nthis.scheme = source.scheme\n+ this.esAuth = source.esAuth\n+ this.esToken = source.esToken\nthis.encoding = source.encoding\nthis.showHidden = source.showHidden\nthis.connectionKey = source.connectionKey\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/esConnection.ts", "new_path": "src/service/connect/esConnection.ts", "diff": "-import axios from \"axios\";\n+import axios, { AxiosRequestConfig } from \"axios\";\nimport { Node } from \"@/model/interface/node\";\nimport { IConnection, queryCallback } from \"./connection\";\nimport { EsIndexGroup } from \"@/model/es/model/esIndexGroupNode\";\n-import compareVersions from 'compare-versions';\n-const extPackage = require(\"@/../package.json\")\nexport class EsConnection extends IConnection {\n@@ -11,10 +9,9 @@ export class EsConnection extends IConnection {\nprivate conneted: boolean;\nconstructor(private opt: Node) {\nsuper()\n- if (compareVersions(extPackage.version, '3.6.6') === 1) {\n- this.url = opt.usingSSH ? `${opt.scheme}://${opt.host}:${opt.port}` : `${opt.scheme}://${opt.host}`\n- } else {\n- this.url = `${opt.scheme}://${opt.host}:${opt.port}`\n+ this.url = opt.usingSSH ? `${opt.host}:${opt.port}` : `${opt.host}`\n+ if (!this.url.match(/^(http|https):/)) {\n+ this.url = `${opt.scheme || \"http\"}://${this.url}`;\n}\n}\n@@ -31,7 +28,7 @@ export class EsConnection extends IConnection {\n}\nconst body = splitIndex == -1 ? null : sql.substring(splitIndex + 1) + \"\\n\"\n- axios({\n+ let config: AxiosRequestConfig = {\nmethod: type,\nurl: `${this.url}${path}`,\nheaders: {\n@@ -40,7 +37,11 @@ export class EsConnection extends IConnection {\ntimeout: this.opt.connectTimeout || 2000,\nresponseType: 'json',\ndata: body\n- }).then(async ({ data }) => {\n+ };\n+\n+ this.bindAuth(config);\n+\n+ axios(config).then(async ({ data }) => {\nif (values == \"dontParse\") {\ncallback(null, data)\nreturn;\n@@ -64,6 +65,22 @@ export class EsConnection extends IConnection {\ncallback(err)\n})\n}\n+ bindAuth(config: AxiosRequestConfig) {\n+ if (this.opt.esAuth == 'account' && this.opt.user && this.opt.password) {\n+ config.auth = {\n+ username: this.opt.user,\n+ password: this.opt.password\n+ }\n+ } else if (this.opt.esAuth == 'token' && this.opt.esToken) {\n+ if (config.headers) {\n+ config.headers.Authorization = this.opt.esToken;\n+ } else {\n+ config.headers = {\n+ Authorization: this.opt.esToken\n+ }\n+ }\n+ }\n+ }\nprivate async handleSearch(path: any, data: any, callback: any) {\nlet fields = null;\n@@ -98,7 +115,9 @@ export class EsConnection extends IConnection {\n}\nconnect(callback: (err: Error) => void): void {\n- axios.get(`${this.url}/_cluster/health`).then(res => {\n+ const config = {};\n+ this.bindAuth(config)\n+ axios.get(`${this.url}/_cluster/health`, config).then(res => {\nthis.conneted = true;\ncallback(null)\n}).catch(err => {\n" }, { "change_type": "MODIFY", "old_path": "src/service/tunnel/sshTunnelService.ts", "new_path": "src/service/tunnel/sshTunnelService.ts", "diff": "@@ -45,12 +45,8 @@ export class SSHTunnelService {\nreturn null\n})()\n};\n- if (node.dbType == DatabaseType.ES) {\n- config.dstHost = node.host.split(\":\")[0]\n- // config.dstPort= (node.host.split(\":\")[1] || '80') as any\n- const portStr = node.host.split(\":\")[1] || '80'\n- config.dstPort = parseInt(portStr)\n- }\n+\n+ this.adapterES(node, config);\nif (ssh.type == 'native') {\nlet args = ['-TnNL', `${port}:${config.dstHost}:${config.dstPort}`, config.host, '-p', `${config.port}`];\n@@ -93,4 +89,13 @@ export class SSHTunnelService {\n})\n}\n+ private adapterES(node: Node, config: any) {\n+ if (node.dbType == DatabaseType.ES) {\n+ const split = node.host.split(\":\");\n+ let splitIndex = split[0]?.match(/^(http|https):/) ? 1 : 0;\n+ config.dstHost = split[splitIndex]\n+ config.dstPort = parseInt(split[++splitIndex] || '80')\n+ }\n+ }\n+\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "<template>\n<div>\n<section class=\"mb-2\">\n- <section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Scheme</label>\n- <el-radio v-model=\"connectionOption.scheme\" label=\"http\">Http</el-radio>\n- <el-radio v-model=\"connectionOption.scheme\" label=\"https\">Https</el-radio>\n- </section>\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>\n- <span v-if=\"connectionOption.dbType=='ElasticSearch'\">URL</span>\n- <span v-if=\"connectionOption.dbType!='ElasticSearch'\">Host</span>\n+ <span>URL</span>\n</label>\n- <input class=\"w-64 field__input\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n+ <input class=\"field__input\" style=\"width:28rem\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n</div>\n</section>\n<section class=\"mb-2\">\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType!='Redis'\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\" v-if=\"connectionOption.dbType!='ElasticSearch'\">*</span>Username</label>\n+ <section class=\"mb-2\">\n+ <label class=\"font-bold mr-5 inline-block w-36\">Basic Auth(Optional)</label>\n+ <el-radio v-model=\"connectionOption.esAuth\" label=\"account\">Account</el-radio>\n+ <el-radio v-model=\"connectionOption.esAuth\" label=\"token\">Token</el-radio>\n+ </section>\n+ </section>\n+ <section class=\"mb-2\" v-if=\"connectionOption.esAuth=='account'\">\n+ <div class=\"inline-block mr-10\" >\n+ <label class=\"font-bold mr-5 inline-block w-32\">Username</label>\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\" v-if=\"connectionOption.dbType!='ElasticSearch'\">*</span>Password</label>\n+ <label class=\"font-bold mr-5 inline-block w-32\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n+ <section class=\"mb-2\">\n+ <div class=\"inline-block mr-10\" v-if=\"connectionOption.esAuth=='token'\">\n+ <label class=\"font-bold mr-5 inline-block w-32\">Token</label>\n+ <input class=\"field__input\" style=\"width:40rem\" placeholder=\"Basic Auth Token. e.g Bearer <token>\" required v-model=\"connectionOption.esToken\" />\n+ </div>\n+ </section>\n<div class=\"inline-block mr-10\">\n<label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n<input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "@@ -162,10 +162,10 @@ export default {\nencrypt: true,\nconnectionUrl: \"\",\nsrv: false,\n-\n+ esAuth:'account',\nglobal: true,\nkey: null,\n- scheme: \"http\",\n+ // scheme: \"http\",\ntimezone: \"+00:00\",\nssh: {\nhost: \"\",\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Es support auth token and account.
141,908
27.07.2021 15:45:39
-28,800
03000efc3b1c49a68a09f6d53ed7495bb54d3bc4
Adapter es ssh tunnel.
[ { "change_type": "MODIFY", "old_path": "src/model/interface/node.ts", "new_path": "src/model/interface/node.ts", "diff": "@@ -86,6 +86,10 @@ export abstract class Node extends vscode.TreeItem implements CopyAble {\npublic scheme: string;\npublic esAuth: string;\npublic esToken: string;\n+ /**\n+ * using when ssh tunnel\n+ */\n+ public esUrl: string;\n/**\n* encoding, ftp only\n" }, { "change_type": "MODIFY", "old_path": "src/service/connect/esConnection.ts", "new_path": "src/service/connect/esConnection.ts", "diff": "@@ -9,7 +9,7 @@ export class EsConnection extends IConnection {\nprivate conneted: boolean;\nconstructor(private opt: Node) {\nsuper()\n- this.url = opt.usingSSH ? `${opt.host}:${opt.port}` : `${opt.host}`\n+ this.url = opt.esUrl || opt.host\nif (!this.url.match(/^(http|https):/)) {\nthis.url = `${opt.scheme || \"http\"}://${this.url}`;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/service/tunnel/sshTunnelService.ts", "new_path": "src/service/tunnel/sshTunnelService.ts", "diff": "@@ -91,10 +91,19 @@ export class SSHTunnelService {\nprivate adapterES(node: Node, config: any) {\nif (node.dbType == DatabaseType.ES) {\n- const split = node.host.split(\":\");\n- let splitIndex = split[0]?.match(/^(http|https):/) ? 1 : 0;\n- config.dstHost = split[splitIndex]\n- config.dstPort = parseInt(split[++splitIndex] || '80')\n+ let url = node.host;\n+ url = url.replace(/^(http|https):\\/\\//i, '')\n+ if (url.includes(\":\")) {\n+ const split = url.split(\":\");\n+ config.dstHost = split[0]\n+ const portStr = split[1]?.match(/^\\d+/)[0]\n+ config.dstPort = parseInt(portStr)\n+ node.esUrl = node.host.replace(config.dstHost, '127.0.0.1').replace(config.dstPort, config.localPort)\n+ } else {\n+ config.dstHost = url.split(\"/\")[0]\n+ config.dstPort = '80'\n+ node.esUrl = node.host.replace(config.dstHost, '127.0.0.1')\n+ }\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "<section class=\"mb-2\">\n<section class=\"mb-2\">\n<label class=\"font-bold mr-5 inline-block w-36\">Basic Auth(Optional)</label>\n+ <el-radio v-model=\"connectionOption.esAuth\" label=\"none\">Not Auth</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"account\">Account</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"token\">Token</el-radio>\n</section>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "@@ -162,7 +162,7 @@ export default {\nencrypt: true,\nconnectionUrl: \"\",\nsrv: false,\n- esAuth:'account',\n+ esAuth:'none',\nglobal: true,\nkey: null,\n// scheme: \"http\",\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Adapter es ssh tunnel.
141,908
27.07.2021 16:41:01
-28,800
6d8dd515e2ec2fc00f8f14fab216d496cae99c6f
Fix open struct sync fail.
[ { "change_type": "MODIFY", "old_path": "src/service/diff/diffService.ts", "new_path": "src/service/diff/diffService.ts", "diff": "@@ -12,6 +12,7 @@ import { QueryUnit } from \"../queryUnit\";\nimport { SchemaNode } from \"@/model/database/schemaNode\";\nimport { UserGroup } from \"@/model/database/userGroup\";\nimport { TableGroup } from \"@/model/main/tableGroup\";\n+import { InfoNode } from \"@/model/other/infoNode\";\nexport class DiffService {\nstartDiff(provider: DbTreeDataProvider) {\n@@ -26,7 +27,11 @@ export class DiffService {\nconst nodes = (await provider.getConnectionNodes())\nlet databaseList = {}\nfor (const node of nodes) {\n+ try {\ndatabaseList[node.uid] = (await node.getChildren()).filter(dbNode => !(dbNode instanceof UserGroup))\n+ } catch (error) {\n+ databaseList[node.uid] = [new InfoNode(\"Load fail.\")]\n+ }\n}\nconst data = { nodes: NodeUtil.removeParent(nodes), databaseList: NodeUtil.removeParent(databaseList) };\nhandler.emit('structDiffData', data)\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix open struct sync fail.
141,908
27.07.2021 16:53:07
-28,800
613d8a8a6f730cb98fabec53f8dc695ba3aa89d9
Struct sync add data loading state.
[ { "change_type": "MODIFY", "old_path": "src/vue/structDiff/index.vue", "new_path": "src/vue/structDiff/index.vue", "diff": "<div class=\"opt-panel\">\n<el-form>\n<el-form-item label-width=\"80px\" label=\"Target\">\n- <el-select v-model=\"option.from.connection\" @change=\"clearFrom\">\n+ <el-select v-model=\"option.from.connection\" @change=\"clearFrom\" :loading=\"loadingConnection\">\n<el-option :label=\"node.label\" :value=\"node.uid\" :key=\"node.uid\" v-for=\"node in initData.nodes\"></el-option>\n</el-select>\n</el-form-item>\n<el-form-item label-width=\"80px\" label=\"database\">\n- <el-select v-model=\"option.from.database\" @change=\"(db)=>changeActive(db,true)\">\n+ <el-select v-model=\"option.from.database\" @change=\"(db)=>changeActive(db,true)\" :loading=\"loadingConnection\">\n<el-option :label=\"db.label\" :value=\"db.label\" :key=\"db.label\" v-for=\"db in initData.databaseList[option.from.connection]\"></el-option>\n</el-select>\n</el-form-item>\n<div class=\"opt-panel\">\n<el-form>\n<el-form-item label-width=\"90px\" label=\"Sync From\">\n- <el-select v-model=\"option.to.connection\" @change=\"clearTo\">\n+ <el-select v-model=\"option.to.connection\" @change=\"clearTo\" :loading=\"loadingConnection\">\n<el-option :label=\"node.label\" :value=\"node.uid\" :key=\"node.uid\" v-for=\"node in initData.nodes\" ></el-option>\n</el-select>\n</el-form-item>\n<el-form-item label-width=\"90px\" label=\"database\" >\n- <el-select v-model=\"option.to.database\" @change=\"(db)=>changeActive(db,false)\">\n+ <el-select v-model=\"option.to.database\" @change=\"(db)=>changeActive(db,false)\" :loading=\"loadingConnection\">\n<el-option :label=\"db.label\" :value=\"db.label\" :key=\"db.label\" v-for=\"db in initData.databaseList[option.to.connection]\" ></el-option>\n</el-select>\n</el-form-item>\n@@ -52,6 +52,7 @@ export default {\nmixins: [inject],\ndata() {\nreturn {\n+ loadingConnection:true,\ninitData: { nodes: [], databaseList: {} },\noption: { from: { connection: null, database: null,db:null }, to: {db:null} },\nloading: { compare: false, sync: false },\n@@ -60,8 +61,8 @@ export default {\n},\nmounted() {\nthis.on(\"structDiffData\", (data) => {\n- console.log(123123);\nthis.initData = data;\n+ this.loadingConnection=false;\n})\n.on(\"compareResult\", (compareResult) => {\nthis.compareResult = compareResult;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Struct sync add data loading state.
141,908
27.07.2021 16:53:33
-28,800
1975e2cdad6eb57df786d4abb38170418e5e240d
Version 3.9.8.
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "# CHANGELOG\n+# 3.9.8 2021-7-27\n+\n+- Support special ssl ca certificate.\n+- Hover info add action to query table data.\n+- Fix complection bug.\n+- ElasticSearch support connect with token or account.\n+- Support connect by native ssh command.\n+- Fix open struct sync fail.\n+\n# 3.9.6 2021-7-22\n- Add hover to run selected sql.\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"name\": \"vscode-mysql-client2\",\n\"displayName\": \"MySQL\",\n\"description\": \"Database Client for vscode\",\n- \"version\": \"3.9.6\",\n+ \"version\": \"3.9.8\",\n\"publisher\": \"cweijan\",\n\"icon\": \"resources/logo.png\",\n\"engines\": {\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Version 3.9.8.
141,914
06.04.2022 23:44:06
14,400
b30d68765912681a0bdf1758faa490305f6e19c2
fixed typo - pluralization
[ { "change_type": "MODIFY", "old_path": "src/model/main/viewGroup.ts", "new_path": "src/model/main/viewGroup.ts", "diff": "@@ -32,7 +32,7 @@ export class ViewGroup extends Node {\nreturn new ViewNode(table, this);\n});\nif (tableNodes.length == 0) {\n- tableNodes = [new InfoNode(\"This schema has no view\")];\n+ tableNodes = [new InfoNode(\"This schema has no views\")];\n}\nthis.setChildCache(tableNodes);\nreturn tableNodes;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
fixed typo - pluralization
141,902
14.10.2022 00:31:26
-28,800
767a68cfa88c9cbdcebbd9f45465217c32c5e4aa
Bring the required tick after label
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "<div>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n<span>URL</span>\n+ <span class=\"mr-1 text-red-600\">*</span>\n</label>\n- <input class=\"field__input\" style=\"width:28rem\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n+ <input\n+ class=\"field__input\"\n+ style=\"width: 28rem\"\n+ placeholder=\"The host of connection\"\n+ required\n+ v-model=\"connectionOption.host\"\n+ />\n</div>\n</section>\n<section class=\"mb-2\">\n<section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-36\">Basic Auth(Optional)</label>\n+ <label class=\"inline-block mr-5 font-bold w-36\">Basic Auth(Optional)</label>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"none\">Not Auth</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"account\">Account</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"token\">Token</el-radio>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.esAuth == 'account'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Username</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Username</label>\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Password</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.esAuth == 'token'\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Token</label>\n- <input class=\"field__input\" style=\"width:40rem\" placeholder=\"Basic Auth Token. e.g Bearer <token>\" required v-model=\"connectionOption.esToken\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Token</label>\n+ <input\n+ class=\"field__input\"\n+ style=\"width: 40rem\"\n+ placeholder=\"Basic Auth Token. e.g Bearer <token>\"\n+ required\n+ v-model=\"connectionOption.esToken\"\n+ />\n</div>\n</section>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">ConnectTimeout</label>\n<input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n</div>\n</div>\n@@ -45,5 +58,4 @@ export default {\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SQLServer.vue", "new_path": "src/vue/connect/component/SQLServer.vue", "diff": "<div>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType == 'SqlServer'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Instance Name</label>\n- <input class=\"w-64 field__input\" placeholder=\"Connection named instance\" title=\"The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.(no default)\" v-model=\"connectionOption.instanceName\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Instance Name</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Connection named instance\"\n+ title=\"The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.(no default)\"\n+ v-model=\"connectionOption.instanceName\"\n+ />\n</div>\n- <span>\n- (If instance name is specified, the port config is ignored)\n- </span>\n+ <span> (If instance name is specified, the port config is ignored) </span>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType == 'SqlServer'\">\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType == 'SqlServer'\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Auth Type</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Auth Type</label>\n<el-select v-model=\"connectionOption.authType\">\n<el-option :label=\"'default'\" value=\"default\"></el-option>\n<el-option :label=\"'ntlm(Windows Auth)'\" value=\"ntlm\"></el-option>\n</el-select>\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-18\">Encrypt</label>\n+ <label class=\"inline-block mr-5 font-bold w-18\">Encrypt</label>\n<el-switch v-model=\"connectionOption.encrypt\"></el-switch>\n</div>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType == 'SqlServer' && connectionOption.authType == 'ntlm'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Domain</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n+ Domain\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" placeholder=\"Domain\" v-model=\"connectionOption.domain\" />\n</div>\n</section>\n@@ -42,5 +48,4 @@ export default {\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SSH.vue", "new_path": "src/vue/connect/component/SSH.vue", "diff": "<div>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Host</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">\n+ SSH Host\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Host\" required v-model=\"connectionOption.ssh.host\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Port</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSH Port\" required type=\"number\" v-model=\"connectionOption.ssh.port\" />\n+ <label class=\"inline-block mr-5 font-bold w-28\">\n+ SSH Port\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"SSH Port\"\n+ required\n+ type=\"number\"\n+ v-model=\"connectionOption.ssh.port\"\n+ />\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\"><span class=\"text-red-600 mr-1\">*</span>SSH Username</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">\n+ SSH Username\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Username\" required v-model=\"connectionOption.ssh.username\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SSH Cipher</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">SSH Cipher</label>\n<el-select v-model=\"connectionOption.ssh.algorithms.cipher[0]\" placeholder=\"Default\">\n<el-option value=\"aes128-cbc\">aes128-cbc</el-option>\n<el-option value=\"aes192-cbc\">aes192-cbc</el-option>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType == 'SSH'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Show Hidden File</label>\n<el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n</div>\n</section>\n<section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Type</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">Type</label>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"password\">Password</el-radio>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"privateKey\">Private Key</el-radio>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"native\">Native SSH</el-radio>\n<div v-if=\"connectionOption.ssh.type == 'password'\">\n<section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Password</label>\n- <input class=\"w-64 field__input\" placeholder=\"Password\" required type=\"password\" v-model=\"connectionOption.ssh.password\" />\n+ <label class=\"inline-block mr-5 font-bold w-28\">Password</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Password\"\n+ required\n+ type=\"password\"\n+ v-model=\"connectionOption.ssh.password\"\n+ />\n</section>\n</div>\n<div v-else>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Private Key Path</label>\n- <input class=\"w-52 field__input\" placeholder=\"Private Key Path\" v-model=\"connectionOption.ssh.privateKeyPath\" />\n+ <label class=\"inline-block mr-5 font-bold w-28\">Private Key Path</label>\n+ <input\n+ class=\"w-52 field__input\"\n+ placeholder=\"Private Key Path\"\n+ v-model=\"connectionOption.ssh.privateKeyPath\"\n+ />\n<button @click=\"choose('privateKey')\" class=\"w-12\">Choose</button>\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Passphrase</label>\n- <input class=\"w-64 field__input\" placeholder=\"Passphrase\" type=\"passphrase\" v-model=\"connectionOption.ssh.passphrase\" />\n+ <label class=\"inline-block mr-5 font-bold w-28\">Passphrase</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Passphrase\"\n+ type=\"passphrase\"\n+ v-model=\"connectionOption.ssh.passphrase\"\n+ />\n</div>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.ssh.type == 'native'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">Waiting Time</label>\n- <input class=\"w-64 field__input\" placeholder=\"Waiting time for ssh command.\" v-model=\"connectionOption.ssh.watingTime\" />\n+ <label class=\"inline-block mr-5 font-bold w-28\">Waiting Time</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Waiting time for ssh command.\"\n+ v-model=\"connectionOption.ssh.watingTime\"\n+ />\n</div>\n</section>\n</div>\n@@ -79,5 +113,4 @@ export default {\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<template>\n- <div class=\"connect-container flex flex-col mx-auto\">\n+ <div class=\"flex flex-col mx-auto connect-container\">\n<h1 class=\"py-4 text-2xl\">Connect to Database Server</h1>\n<blockquote class=\"p-3 mb-2 panel error\" v-if=\"connect.error\">\n<section class=\"panel__text\">\n- <div class=\"font-bold mr-5 inline-block w-32\">Connection error!</div>\n- <span v-text=\"connect.errorMessage\"></span>\n+ <div class=\"inline-block w-32 mr-5 font-bold\">Connection error!</div>\n+ <span>{{ connect.errorMessage }}</span>\n</section>\n</blockquote>\n<blockquote class=\"p-3 mb-2 panel success\" v-if=\"connect.success\">\n<section class=\"panel__text\">\n- <div class=\"font-bold mr-5 inline-block w-36\">Success!</div>\n- <span v-text=\"connect.successMessage\"></span>\n+ <div class=\"inline-block mr-5 font-bold w-36\">Success!</div>\n+ <span>\n+ {{ connect.successMessage }}\n+ </span>\n</section>\n</blockquote>\n<section class=\"mb-2\">\n- <label class=\"font-bold mr-5 inline-block \">Connection Name</label>\n+ <label class=\"inline-block mr-5 font-bold\">Connection Name</label>\n<input class=\"w-1/4 field__input\" placeholder=\"Connection name\" v-model=\"connectionOption.name\" />\n- <label class=\"font-bold ml-4 mr-5 inline-block \">Connection Target</label>\n+ <label class=\"inline-block ml-4 mr-5 font-bold\">Connection Target</label>\n<el-radio v-model=\"connectionOption.global\" :label=\"true\"> Global </el-radio>\n<el-radio v-model=\"connectionOption.global\" :label=\"false\"> Current Workspace </el-radio>\n</section>\n<section class=\"mb-2\">\n<label class=\"block font-bold\">Database Type</label>\n<ul class=\"tab\">\n- <li class=\"tab__item \" :class=\"{'tab__item--active':supportDatabase==connectionOption.dbType}\" v-for=\"supportDatabase in supportDatabases\" :key=\"supportDatabase\" @click=\"connectionOption.dbType=supportDatabase\">\n+ <li\n+ class=\"tab__item\"\n+ :class=\"{ 'tab__item--active': supportDatabase == connectionOption.dbType }\"\n+ v-for=\"supportDatabase in supportDatabases\"\n+ :key=\"supportDatabase\"\n+ @click=\"connectionOption.dbType = supportDatabase\"\n+ >\n{{ supportDatabase }}\n</li>\n</ul>\n</section>\n<ElasticSearch v-if=\"connectionOption.dbType == 'ElasticSearch'\" :connectionOption=\"connectionOption\" />\n- <SQLite v-else-if=\"connectionOption.dbType=='SQLite'\" :connectionOption=\"connectionOption\" :sqliteState=\"sqliteState\" @install=\"installSqlite\" />\n+ <SQLite\n+ v-else-if=\"connectionOption.dbType == 'SQLite'\"\n+ :connectionOption=\"connectionOption\"\n+ :sqliteState=\"sqliteState\"\n+ @install=\"installSqlite\"\n+ />\n<SSH v-else-if=\"connectionOption.dbType == 'SSH'\" :connectionOption=\"connectionOption\" />\n<template v-else>\n-\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n<span>Host</span>\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n- <input class=\"w-64 field__input\" placeholder=\"The host of connection\" required v-model=\"connectionOption.host\" />\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"The host of connection\"\n+ required\n+ v-model=\"connectionOption.host\"\n+ />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Port</label>\n- <input class=\"w-64 field__input\" placeholder=\"The port of connection\" required type=\"number\" v-model=\"connectionOption.port\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n+ Port\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n+ </label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"The port of connection\"\n+ required\n+ type=\"number\"\n+ v-model=\"connectionOption.port\"\n+ />\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Username</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n+ Username\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Password</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n+ Password\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n<section class=\"mb-2\" v-if=\"connectionOption.dbType != 'FTP' && connectionOption.dbType != 'MongoDB'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Databases</label>\n- <input class=\"w-64 field__input\" placeholder=\"Special connection database\" v-model=\"connectionOption.database\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Databases</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Special connection database\"\n+ v-model=\"connectionOption.database\"\n+ />\n</div>\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Include Databases</label>\n- <input class=\"w-64 field__input\" placeholder=\"Example: mysql,information_schema\" v-model=\"connectionOption.includeDatabases\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Include Databases</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"Example: mysql,information_schema\"\n+ v-model=\"connectionOption.includeDatabases\"\n+ />\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">ConnectTimeout</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">ConnectTimeout</label>\n<input class=\"w-64 field__input\" placeholder=\"5000\" required v-model=\"connectionOption.connectTimeout\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">RequestTimeout</label>\n- <input class=\"w-64 field__input\" placeholder=\"10000\" required type=\"number\" v-model=\"connectionOption.requestTimeout\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">RequestTimeout</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"10000\"\n+ required\n+ type=\"number\"\n+ v-model=\"connectionOption.requestTimeout\"\n+ />\n</div>\n</section>\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.dbType == 'MySQL'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Timezone</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Timezone</label>\n<input class=\"w-64 field__input\" placeholder=\"+HH:MM\" v-model=\"connectionOption.timezone\" />\n</div>\n</section>\n<label class=\"mr-2 font-bold\">SSH Tunnel</label>\n<el-switch v-model=\"connectionOption.usingSSH\"></el-switch>\n</div>\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType=='MySQL' || connectionOption.dbType=='PostgreSQL' || connectionOption.dbType=='MongoDB' || connectionOption.dbType=='Redis' \">\n- <label class=\"font-bold mr-5 inline-block w-18\">Use SSL</label>\n+ <div\n+ class=\"inline-block mr-10\"\n+ v-if=\"\n+ connectionOption.dbType == 'MySQL' ||\n+ connectionOption.dbType == 'PostgreSQL' ||\n+ connectionOption.dbType == 'MongoDB' ||\n+ connectionOption.dbType == 'Redis'\n+ \"\n+ >\n+ <label class=\"inline-block mr-5 font-bold w-18\">Use SSL</label>\n<el-switch v-model=\"connectionOption.useSSL\"></el-switch>\n</div>\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.useConnectionString\">\n<div class=\"flex w-full mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Connection String</label>\n- <input class=\"w-4/5 field__input\" placeholder=\"e.g mongodb+srv://username:password@server-url/admin\" v-model=\"connectionOption.connectionUrl\" />\n+ <input\n+ class=\"w-4/5 field__input\"\n+ placeholder=\"e.g mongodb+srv://username:password@server-url/admin\"\n+ v-model=\"connectionOption.connectionUrl\"\n+ />\n</div>\n</section>\n<SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH\" />\n<div>\n- <button class=\"button button--primary w-28 inline mr-4\" @click=\"tryConnect\" v-loading=\"connect.loading\">Connect</button>\n- <button class=\"button button--primary w-28 inline\" @click=\"close\">Close</button>\n+ <button class=\"inline mr-4 button button--primary w-28\" @click=\"tryConnect\" v-loading=\"connect.loading\">\n+ Connect\n+ </button>\n+ <button class=\"inline button button--primary w-28\" @click=\"close\">Close</button>\n</div>\n</div>\n</template>\n@@ -162,7 +223,7 @@ export default {\nencrypt: true,\nconnectionUrl: \"\",\nsrv: false,\n- esAuth:'none',\n+ esAuth: \"none\",\nglobal: true,\nkey: null,\n// scheme: \"http\",\n@@ -270,15 +331,7 @@ export default {\nfilters[\"SQLiteDb\"] = [\"db\"];\nbreak;\ncase \"privateKey\":\n- filters[\"PrivateKey\"] = [\n- \"key\",\n- \"cer\",\n- \"crt\",\n- \"der\",\n- \"pub\",\n- \"pem\",\n- \"pk\",\n- ];\n+ filters[\"PrivateKey\"] = [\"key\", \"cer\", \"crt\", \"der\", \"pub\", \"pem\", \"pk\"];\nbreak;\n}\nfilters[\"File\"] = [\"*\"];\n" }, { "change_type": "MODIFY", "old_path": "src/vue/design/InfoPanel.vue", "new_path": "src/vue/design/InfoPanel.vue", "diff": "<div class=\"ml-4\">\n<div class=\"mb-3\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-14\"><span class=\"text-red-600 mr-1\">*</span>Table</label>\n+ <label class=\"inline-block mr-5 font-bold w-14\">\n+ Table\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" required v-model=\"table.name\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\"><span class=\"text-red-600 mr-1\">*</span>Comment</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">\n+ Comment\n+ <span class=\"mr-1 text-red-600\">*</span>\n+ </label>\n<input class=\"w-64 field__input\" v-model=\"table.comment\" />\n</div>\n<el-button @click=\"rename\" type=\"success\">Update</el-button>\n@@ -57,10 +63,7 @@ export default {\ncreateIndex() {\nthis.index.loading = true;\nthis.execute(\n- `ALTER TABLE ${wrapByDb(\n- this.designData.table,\n- this.designData.dbType\n- )} ADD ${this.index.type} (${wrapByDb(\n+ `ALTER TABLE ${wrapByDb(this.designData.table, this.designData.dbType)} ADD ${this.index.type} (${wrapByDb(\nthis.index.column,\nthis.designData.dbType\n)})`\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Bring the required tick after label Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
14.10.2022 00:47:02
-28,800
cd5fbda763268d9f61950758e1a303bb367ffda7
Submit using form instead; Improve grammar; Remove required tick from password field, since it can be empty
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<template>\n- <div class=\"flex flex-col mx-auto connect-container\">\n+ <form @submit.prevent=\"tryConnect\" class=\"flex flex-col mx-auto connect-container\">\n<h1 class=\"py-4 text-2xl\">Connect to Database Server</h1>\n<blockquote class=\"p-3 mb-2 panel error\" v-if=\"connect.error\">\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n<div class=\"inline-block mr-10\">\n- <label class=\"inline-block w-32 mr-5 font-bold\">\n- Password\n- <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n- </label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"inline-block w-32 mr-5 font-bold\">ConnectTimeout</label>\n- <input class=\"w-64 field__input\" placeholder=\"5000\" required v-model=\"connectionOption.connectTimeout\" />\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Connection Timeout</label>\n+ <input class=\"w-64 field__input\" placeholder=\"5000\" v-model=\"connectionOption.connectTimeout\" />\n</div>\n<div class=\"inline-block mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Request Timeout</label>\n<input\nclass=\"w-64 field__input\"\nplaceholder=\"10000\"\n- required\ntype=\"number\"\nv-model=\"connectionOption.requestTimeout\"\n/>\n<SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH\" />\n<div>\n- <button class=\"inline mr-4 button button--primary w-28\" @click=\"tryConnect\" v-loading=\"connect.loading\">\n- Connect\n- </button>\n+ <button class=\"inline mr-4 button button--primary w-28\" type=\"submit\" v-loading=\"connect.loading\">Connect</button>\n<button class=\"inline button button--primary w-28\" @click=\"close\">Close</button>\n</div>\n- </div>\n+ </form>\n</template>\n<script>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Submit using form instead; Improve grammar; Remove required tick from password field, since it can be empty Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
14.10.2022 00:58:59
-28,800
9fa92aacd74be060b23f9c68bad8a2069d1bf42f
Don't need to listen to press key enter anymore
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</div>\n</section>\n- <SQLServer :connectionOption=\"connectionOption\" v-if=\"connectionOption.dbType == 'SqlServer'\" />\n+ <SQLServer :connectionOption=\"connectionOption\" v-if=\"connectionOption.dbType == 'SQL Server'\" />\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n@@ -239,7 +239,7 @@ export default {\nsupportDatabases: [\n\"MySQL\",\n\"PostgreSQL\",\n- \"SqlServer\",\n+ \"SQL Server\",\n\"SQLite\",\n\"MongoDB\",\n\"Redis\",\n@@ -298,11 +298,6 @@ export default {\nthis.connectionOption.isGlobal = this.connectionOption.global;\n});\nvscodeEvent.emit(\"route-\" + this.$route.name);\n- window.onkeydown = (e) => {\n- if (e.key == \"Enter\" && e.target.tagName == \"INPUT\") {\n- this.tryConnect();\n- }\n- };\n},\ndestroyed() {\nvscodeEvent.destroy();\n@@ -360,7 +355,7 @@ export default {\nthis.connectionOption.user = \"system\";\nthis.connectionOption.port = 1521;\nbreak;\n- case \"SqlServer\":\n+ case \"SQL Server\":\nthis.connectionOption.user = \"sa\";\nthis.connectionOption.encrypt = true;\nthis.connectionOption.port = 1433;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Don't need to listen to press key enter anymore Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
14.10.2022 22:23:49
-28,800
44e8a08e786cd86fadf7e8295f5e878d8005d970
Added tooltip to required field's label
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "<div class=\"inline-block mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">\n<span>URL</span>\n- <span class=\"mr-1 text-red-600\">*</span>\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input\nclass=\"field__input\"\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SSH.vue", "new_path": "src/vue/connect/component/SSH.vue", "diff": "<div class=\"inline-block mr-10\">\n<label class=\"inline-block mr-5 font-bold w-28\">\nSSH Host\n- <span class=\"mr-1 text-red-600\">*</span>\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Host\" required v-model=\"connectionOption.ssh.host\" />\n</div>\n<div class=\"inline-block mr-10\">\n<label class=\"inline-block mr-5 font-bold w-28\">\nSSH Port\n- <span class=\"mr-1 text-red-600\">*</span>\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input\nclass=\"w-64 field__input\"\n<div class=\"inline-block mr-10\">\n<label class=\"inline-block mr-5 font-bold w-28\">\nSSH Username\n- <span class=\"mr-1 text-red-600\">*</span>\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Username\" required v-model=\"connectionOption.ssh.username\" />\n</div>\n<div v-if=\"connectionOption.ssh.type == 'password'\">\n<section class=\"mb-2\">\n- <label class=\"inline-block mr-5 font-bold w-28\">Password</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">\n+ Password\n+ <span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n+ </label>\n<input\nclass=\"w-64 field__input\"\nplaceholder=\"Password\"\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Added tooltip to required field's label Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 01:11:26
-28,800
587bf755315693fb389f4fbc49bb800d1800c573
Consistent spacing between fields
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "<template>\n- <div>\n+ <div class=\"mt-5\">\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">\n<el-radio v-model=\"connectionOption.esAuth\" label=\"token\">Token</el-radio>\n</section>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.esAuth == 'account'\">\n- <div class=\"inline-block mr-10\">\n+ <section v-if=\"connectionOption.esAuth == 'account'\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Username</label>\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.esAuth == 'token'\">\n+ <section class=\"inline-block mb-2 mr-10\" v-if=\"connectionOption.esAuth == 'token'\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Token</label>\n<input\nclass=\"field__input\"\nrequired\nv-model=\"connectionOption.esToken\"\n/>\n- </div>\n</section>\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block w-32 mr-5 font-bold\">ConnectTimeout</label>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Connection Timeout</label>\n<input class=\"w-64 field__input\" placeholder=\"2000\" required v-model=\"connectionOption.connectTimeout\" />\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/FTP.vue", "new_path": "src/vue/connect/component/FTP.vue", "diff": "<template>\n<div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Encoding</label>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Encoding</label>\n<input class=\"w-64 field__input\" placeholder=\"UTF8\" required v-model=\"connectionOption.encoding\" />\n</div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Show Hidden File</label>\n+ <div class=\"block mb-2 mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Show Hidden File</label>\n<el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n</div>\n</div>\n@@ -17,5 +17,4 @@ export default {\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SQLite.vue", "new_path": "src/vue/connect/component/SQLite.vue", "diff": "<template>\n- <div>\n- <div>\n+ <div class=\"mt-5\">\n<section class=\"mb-2\" v-if=\"!sqliteState\">\n- <div class=\"font-bold mr-5 inline-block w-1/4\">\n+ <div class=\"inline-block w-1/4 mr-5 font-bold\">\n<el-alert title=\"sqlite not installed\" type=\"warning\" show-icon />\n</div>\n- <div class=\"font-bold mr-5 inline-block w-36\">\n- <button class=\"button button--primary w-128 inline\" @click=\"install\">Install Sqlite</button>\n+ <div class=\"inline-block mr-5 font-bold w-36\">\n+ <button class=\"inline button button--primary w-128\" @click=\"install\">Install Sqlite</button>\n</div>\n</section>\n<section class=\"mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-28\">SQLite File Path</label>\n+ <label class=\"inline-block mr-5 font-bold w-28\">SQLite File Path</label>\n<input class=\"w-80 field__input\" placeholder=\"SQLite File Path\" v-model=\"connectionOption.dbPath\" />\n- <button class=\"button button--primary w-128 inline\" @click=\"choose('sqlite')\">Choose Database File</button>\n+ <button class=\"inline button button--primary w-128\" @click=\"choose('sqlite')\">Choose Database File</button>\n</div>\n</section>\n</div>\n- </div>\n</template>\n<script>\n@@ -25,11 +23,10 @@ export default {\nprops: [\"connectionOption\", \"sqliteState\"],\nmethods: {\ninstall() {\n- this.$emit(\"installSqlite\")\n- }\n- }\n+ this.$emit(\"installSqlite\");\n+ },\n+ },\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SSH.vue", "new_path": "src/vue/connect/component/SSH.vue", "diff": "<template>\n- <div>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">\n+ <div class=\"mt-5\">\n+ <section>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">\nSSH Host\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Host\" required v-model=\"connectionOption.ssh.host\" />\n</div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">\nSSH Port\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n</div>\n</section>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">\n+ <section>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">\nSSH Username\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input class=\"w-64 field__input\" placeholder=\"SSH Username\" required v-model=\"connectionOption.ssh.username\" />\n</div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">SSH Cipher</label>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">SSH Cipher</label>\n<el-select v-model=\"connectionOption.ssh.algorithms.cipher[0]\" placeholder=\"Default\">\n<el-option value=\"aes128-cbc\">aes128-cbc</el-option>\n<el-option value=\"aes192-cbc\">aes192-cbc</el-option>\n</div>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType == 'SSH'\">\n- <div class=\"inline-block mr-10\">\n+ <section v-if=\"connectionOption.dbType == 'SSH'\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Show Hidden File</label>\n<el-switch v-model=\"connectionOption.showHidden\"></el-switch>\n</div>\n</section>\n<section class=\"mb-2\">\n- <label class=\"inline-block mr-5 font-bold w-28\">Type</label>\n+ <label class=\"inline-block font-bold mr-9 w-28\">Type</label>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"password\">Password</el-radio>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"privateKey\">Private Key</el-radio>\n<el-radio v-model=\"connectionOption.ssh.type\" label=\"native\">Native SSH</el-radio>\n</section>\n- <div v-if=\"connectionOption.ssh.type == 'password'\">\n- <section class=\"mb-2\">\n- <label class=\"inline-block mr-5 font-bold w-28\">\n+ <div v-if=\"connectionOption.ssh.type == 'password'\" class=\"mb-2\">\n+ <section>\n+ <label class=\"inline-block font-bold mr-9 w-28\">\nPassword\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n/>\n</section>\n</div>\n- <div v-else>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">Private Key Path</label>\n+ <div v-else class=\"mb-2\">\n+ <section>\n+ <div class=\"inline-block mb-2 mr-8\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">Private Key Path</label>\n<input\n- class=\"w-52 field__input\"\n+ class=\"w-50 field__input\"\nplaceholder=\"Private Key Path\"\nv-model=\"connectionOption.ssh.privateKeyPath\"\n/>\n- <button @click=\"choose('privateKey')\" class=\"w-12\">Choose</button>\n+ <button @click=\"choose('privateKey')\" class=\"w-12 ml-1\">Choose</button>\n</div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">Passphrase</label>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block font-bold mr-9 w-28\">Passphrase</label>\n<input\nclass=\"w-64 field__input\"\nplaceholder=\"Passphrase\"\n/>\n</div>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.ssh.type == 'native'\">\n+ <section v-if=\"connectionOption.ssh.type == 'native'\">\n<div class=\"inline-block mr-10\">\n- <label class=\"inline-block mr-5 font-bold w-28\">Waiting Time</label>\n+ <label class=\"inline-block font-bold mr-9 w-28\">Waiting Time</label>\n<input\nclass=\"w-64 field__input\"\nplaceholder=\"Waiting time for ssh command.\"\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SSL.vue", "new_path": "src/vue/connect/component/SSL.vue", "diff": "<div>\n<section class=\"flex items-center mb-2\">\n<div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">CA Certificate</label>\n+ <label class=\"inline-block w-32 mr-5 font-bold\">CA Certificate</label>\n<input class=\"w-64 field__input\" placeholder=\"SSL CA Certificate Path\" v-model=\"connectionOption.caPath\" />\n</div>\n</section>\n- <section class=\"flex items-center mb-2\">\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Client Cert</label>\n- <input class=\"w-64 field__input\" placeholder=\"SSL Client Certificate Path\" v-model=\"connectionOption.clientCertPath\" />\n+ <section class=\"flex flex-wrap items-center\">\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Client Cert</label>\n+ <input\n+ class=\"w-64 field__input\"\n+ placeholder=\"SSL Client Certificate Path\"\n+ v-model=\"connectionOption.clientCertPath\"\n+ />\n</div>\n- <div class=\"inline-block mr-10\">\n- <label class=\"font-bold mr-5 inline-block w-32\">Client Key</label>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block w-32 mr-5 font-bold\">Client Key</label>\n<input class=\"w-64 field__input\" placeholder=\"SSL Client Key Path\" v-model=\"connectionOption.clientKeyPath\" />\n</div>\n</section>\n@@ -25,5 +29,4 @@ export default {\n};\n</script>\n-<style>\n-</style>\n\\ No newline at end of file\n+<style></style>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</section>\n</blockquote>\n- <section class=\"mb-2\">\n+ <section>\n<label class=\"inline-block mr-5 font-bold\">Connection Name</label>\n<input class=\"w-1/4 field__input\" placeholder=\"Connection name\" v-model=\"connectionOption.name\" />\n<label class=\"inline-block ml-4 mr-5 font-bold\">Connection Target</label>\n<el-radio v-model=\"connectionOption.global\" :label=\"false\"> Current Workspace </el-radio>\n</section>\n- <section class=\"mb-2\">\n+ <section>\n<label class=\"block font-bold\">Database Type</label>\n<ul class=\"tab\">\n<li\n<SSH v-else-if=\"connectionOption.dbType == 'SSH'\" :connectionOption=\"connectionOption\" />\n<template v-else>\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n+ <section class=\"mt-5\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">\n<span>Host</span>\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\nv-model=\"connectionOption.host\"\n/>\n</div>\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">\nPort\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n<SQLServer :connectionOption=\"connectionOption\" v-if=\"connectionOption.dbType == 'SQL Server'\" />\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n+ <section>\n+ <div class=\"inline-block mb-2 mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n<label class=\"inline-block w-32 mr-5 font-bold\">\nUsername\n<span class=\"mr-1 text-red-600\" title=\"required\">*</span>\n</label>\n<input class=\"w-64 field__input\" placeholder=\"Username\" required v-model=\"connectionOption.user\" />\n</div>\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Password</label>\n<input class=\"w-64 field__input\" placeholder=\"Password\" type=\"password\" v-model=\"connectionOption.password\" />\n</div>\n</section>\n- <section class=\"mb-2\" v-if=\"connectionOption.dbType != 'FTP' && connectionOption.dbType != 'MongoDB'\">\n- <div class=\"inline-block mr-10\">\n+ <section v-if=\"connectionOption.dbType != 'FTP' && connectionOption.dbType != 'MongoDB'\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Databases</label>\n<input\nclass=\"w-64 field__input\"\nv-model=\"connectionOption.database\"\n/>\n</div>\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n+ <div class=\"inline-block mb-2 mr-10\" v-if=\"connectionOption.dbType != 'Redis'\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Include Databases</label>\n<input\nclass=\"w-64 field__input\"\n<FTP v-if=\"connectionOption.dbType == 'FTP'\" :connectionOption=\"connectionOption\" />\n- <section class=\"mb-2\">\n- <div class=\"inline-block mr-10\">\n+ <section>\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Connection Timeout</label>\n<input class=\"w-64 field__input\" placeholder=\"5000\" v-model=\"connectionOption.connectTimeout\" />\n</div>\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Request Timeout</label>\n<input\nclass=\"w-64 field__input\"\n</section>\n<section class=\"flex items-center mb-2\" v-if=\"connectionOption.dbType == 'MySQL'\">\n- <div class=\"inline-block mr-10\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Timezone</label>\n<input class=\"w-64 field__input\" placeholder=\"+HH:MM\" v-model=\"connectionOption.timezone\" />\n</div>\n<SSL :connectionOption=\"connectionOption\" v-if=\"connectionOption.useSSL\" />\n<SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH\" />\n- <div>\n+ <div class=\"mt-2\">\n<button class=\"inline mr-4 button button--primary w-28\" type=\"submit\" v-loading=\"connect.loading\">Connect</button>\n<button class=\"inline button button--primary w-28\" @click=\"close\">Close</button>\n</div>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Consistent spacing between fields Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 15:33:49
-28,800
f9f64045ac236253b1e17b9016620bea0283d5d9
Improve spacing on connection name and connection type
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</section>\n</blockquote>\n- <section>\n+ <section class=\"flex flex-wrap items-center\">\n+ <div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block mr-5 font-bold\">Connection Name</label>\n- <input class=\"w-1/4 field__input\" placeholder=\"Connection name\" v-model=\"connectionOption.name\" />\n- <label class=\"inline-block ml-4 mr-5 font-bold\">Connection Target</label>\n+ <input\n+ class=\"field__input\"\n+ style=\"min-width: 400px\"\n+ placeholder=\"Connection name\"\n+ v-model=\"connectionOption.name\"\n+ />\n+ </div>\n+ <div class=\"inline-block mb-2 mr-10\">\n+ <label class=\"inline-block mr-5 font-bold\">Connection Target</label>\n+ <div class=\"inline-flex items-center\">\n<el-radio v-model=\"connectionOption.global\" :label=\"true\"> Global </el-radio>\n<el-radio v-model=\"connectionOption.global\" :label=\"false\"> Current Workspace </el-radio>\n+ </div>\n+ </div>\n</section>\n- <section>\n+ <section class=\"mt-5\">\n<label class=\"block font-bold\">Database Type</label>\n<ul class=\"tab\">\n<li\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Improve spacing on connection name and connection type Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 15:52:25
-28,800
3c4dae01ef51487d5770c052055fcfc34c1921b5
Move margin to each fields from the parent Since the parent is possible to still there when fields itself not there
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "<section class=\"mt-5\">\n<label class=\"block font-bold\">Database Type</label>\n- <ul class=\"tab\">\n+ <ul class=\"flex-wrap tab\">\n<li\nclass=\"tab__item\"\n:class=\"{ 'tab__item--active': supportDatabase == connectionOption.dbType }\"\n</section>\n</template>\n- <section class=\"flex items-center mb-2\">\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType != 'SSH' && connectionOption.dbType != 'SQLite'\">\n+ <section class=\"flex items-center\">\n+ <div\n+ class=\"inline-block mb-2 mr-10\"\n+ v-if=\"connectionOption.dbType != 'SSH' && connectionOption.dbType != 'SQLite'\"\n+ >\n<label class=\"mr-2 font-bold\">SSH Tunnel</label>\n<el-switch v-model=\"connectionOption.usingSSH\"></el-switch>\n</div>\n<div\n- class=\"inline-block mr-10\"\n+ class=\"inline-block mb-2 mr-10\"\nv-if=\"\nconnectionOption.dbType == 'MySQL' ||\nconnectionOption.dbType == 'PostgreSQL' ||\n<label class=\"inline-block mr-5 font-bold w-18\">Use SSL</label>\n<el-switch v-model=\"connectionOption.useSSL\"></el-switch>\n</div>\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n+ <div class=\"inline-block mb-2 mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n<label class=\"inline-block mr-5 font-bold w-18\">SRV Record</label>\n<el-switch v-model=\"connectionOption.srv\"></el-switch>\n</div>\n- <div class=\"inline-block mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n+ <div class=\"inline-block mb-2 mr-10\" v-if=\"connectionOption.dbType === 'MongoDB'\">\n<label class=\"inline-block mr-5 font-bold w-18\">Use Connection String</label>\n<el-switch v-model=\"connectionOption.useConnectionString\"></el-switch>\n</div>\n</section>\n- <section class=\"flex items-center mb-2\" v-if=\"connectionOption.useConnectionString\">\n- <div class=\"flex w-full mr-10\">\n+ <section class=\"flex items-center\" v-if=\"connectionOption.useConnectionString\">\n+ <div class=\"flex w-full mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Connection String</label>\n<input\nclass=\"w-4/5 field__input\"\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Move margin to each fields from the parent Since the parent is possible to still there when fields itself not there Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 15:55:44
-28,800
f92671ceb66a58c3c4612ec7927779e0abf7b39e
Remove unecesarry double wrapper
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/component/ElasticSearch.vue", "new_path": "src/vue/connect/component/ElasticSearch.vue", "diff": "/>\n</div>\n</section>\n- <section class=\"mb-2\">\n<section class=\"mb-2\">\n<label class=\"inline-block mr-5 font-bold w-36\">Basic Auth(Optional)</label>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"none\">Not Auth</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"account\">Account</el-radio>\n<el-radio v-model=\"connectionOption.esAuth\" label=\"token\">Token</el-radio>\n</section>\n- </section>\n<section v-if=\"connectionOption.esAuth == 'account'\">\n<div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block w-32 mr-5 font-bold\">Username</label>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Remove unecesarry double wrapper Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 16:07:16
-28,800
c76b2e76efd1c82e46f00b815e2a9ef31a158c30
Fix duplicate ssh field
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</section>\n<SSL :connectionOption=\"connectionOption\" v-if=\"connectionOption.useSSL\" />\n- <SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH\" />\n+ <SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH && connectionOption.dbType != 'SSH'\" />\n<div class=\"mt-2\">\n<button class=\"inline mr-4 button button--primary w-28\" type=\"submit\" v-loading=\"connect.loading\">Connect</button>\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix duplicate ssh field Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 16:17:40
-28,800
fc4d3e6ef5625145b6e31a78d91a2c34b5247034
Only show SSL Fields` on each connection type that have the `Use SSL` option
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "</div>\n</section>\n- <SSL :connectionOption=\"connectionOption\" v-if=\"connectionOption.useSSL\" />\n+ <SSL\n+ :connectionOption=\"connectionOption\"\n+ v-if=\"\n+ connectionOption.useSSL &&\n+ ['MySQL', 'PostgreSQL', 'MongoDB', 'Redis', 'ElasticSearch'].includes(connectionOption.dbType)\n+ \"\n+ />\n<SSH :connectionOption=\"connectionOption\" v-if=\"connectionOption.usingSSH && connectionOption.dbType != 'SSH'\" />\n<div class=\"mt-2\">\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Only show SSL Fields` on each connection type that have the `Use SSL` option Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 16:35:30
-28,800
5a9cbebcdc49494176952337cc32bb3249c572c9
Fix issue when choose file for sqlite db and choose file for ssh cert
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SQLite.vue", "new_path": "src/vue/connect/component/SQLite.vue", "diff": "<div class=\"inline-block mr-10\">\n<label class=\"inline-block mr-5 font-bold w-28\">SQLite File Path</label>\n<input class=\"w-80 field__input\" placeholder=\"SQLite File Path\" v-model=\"connectionOption.dbPath\" />\n- <button class=\"inline button button--primary w-128\" @click=\"choose('sqlite')\">Choose Database File</button>\n+ <button class=\"inline button button--primary w-128\" type=\"button\" @click=\"() => $emit('choose')\">\n+ Choose Database File\n+ </button>\n</div>\n</section>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/component/SSH.vue", "new_path": "src/vue/connect/component/SSH.vue", "diff": "placeholder=\"Private Key Path\"\nv-model=\"connectionOption.ssh.privateKeyPath\"\n/>\n- <button @click=\"choose('privateKey')\" class=\"w-12 ml-1\">Choose</button>\n+ <button @click=\"() => $emit('choose')\" type=\"button\" class=\"w-12 ml-1\">Choose</button>\n</div>\n<div class=\"inline-block mb-2 mr-10\">\n<label class=\"inline-block font-bold mr-9 w-28\">Passphrase</label>\n" }, { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "v-else-if=\"connectionOption.dbType == 'SQLite'\"\n:connectionOption=\"connectionOption\"\n:sqliteState=\"sqliteState\"\n+ @choose=\"choose('sqlite')\"\n@install=\"installSqlite\"\n/>\n- <SSH v-else-if=\"connectionOption.dbType == 'SSH'\" :connectionOption=\"connectionOption\" />\n+ <SSH\n+ v-else-if=\"connectionOption.dbType == 'SSH'\"\n+ :connectionOption=\"connectionOption\"\n+ @choose=\"choose('privateKey')\"\n+ />\n<template v-else>\n<section class=\"mt-5\">\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Fix issue when choose file for sqlite db and choose file for ssh cert Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
141,902
15.10.2022 16:39:45
-28,800
97325c34c8484e5f2c3bb97e1d8c727ac62ce4f9
Bring back `SqlServer`
[ { "change_type": "MODIFY", "old_path": "src/vue/connect/index.vue", "new_path": "src/vue/connect/index.vue", "diff": "@@ -264,7 +264,7 @@ export default {\nsupportDatabases: [\n\"MySQL\",\n\"PostgreSQL\",\n- \"SQL Server\",\n+ \"SqlServer\",\n\"SQLite\",\n\"MongoDB\",\n\"Redis\",\n@@ -380,7 +380,7 @@ export default {\nthis.connectionOption.user = \"system\";\nthis.connectionOption.port = 1521;\nbreak;\n- case \"SQL Server\":\n+ case \"SqlServer\":\nthis.connectionOption.user = \"sa\";\nthis.connectionOption.encrypt = true;\nthis.connectionOption.port = 1433;\n" } ]
TypeScript
MIT License
cweijan/vscode-database-client
Bring back `SqlServer` Signed-off-by: Don Alfons Nisnoni <donnisnoni@outlook.com>
254,874
15.01.2020 14:56:13
-3,600
f3b6b32f9130b78b44f16b79f8551544a0d7134a
feat(certificate): use 4096 as default key size and use PKCS1 encoding
[ { "change_type": "MODIFY", "old_path": "controllers/harbor/components/registry/certificates.go", "new_path": "controllers/harbor/components/registry/certificates.go", "diff": "@@ -14,6 +14,7 @@ import (\nconst (\ndefaultKeyAlgorithm = certv1.RSAKeyAlgorithm\n+ defaultKeySize = 4096\n)\ntype certificateEncryption struct {\n@@ -28,6 +29,7 @@ func (r *Registry) GetCertificates(ctx context.Context) []*certv1.Certificate {\nurl := r.harbor.Spec.PublicURL\nencryption := &certificateEncryption{\n+ KeySize: defaultKeySize,\nKeyAlgorithm: defaultKeyAlgorithm,\n}\n@@ -61,7 +63,8 @@ func (r *Registry) GetCertificates(ctx context.Context) []*certv1.Certificate {\nSecretName: r.harbor.NormalizeComponentName(containerregistryv1alpha1.CertificateName),\nKeySize: encryption.KeySize,\nKeyAlgorithm: encryption.KeyAlgorithm,\n- KeyEncoding: certv1.PKCS8, // TODO check that Harbor & registry Handle this format\n+ // https://github.com/goharbor/harbor/blob/ba4764c61d7da76f584f808f7d16b017db576fb4/src/jobservice/generateCerts.sh#L24-L26\n+ KeyEncoding: certv1.PKCS1,\nDNSNames: []string{url},\nIssuerRef: r.harbor.Spec.CertificateIssuerRef,\n},\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(certificate): use 4096 as default key size and use PKCS1 encoding Signed-off-by: Jeremie Monsinjon <jeremie.monsinjon@corp.ovh.com>
254,874
15.01.2020 14:59:44
-3,600
0cf31d222d68ea7859db8cdb9df14f2e3a5100f2
fix(token-url): remove double https scheme
[ { "change_type": "MODIFY", "old_path": "controllers/harbor/components/registry/deployments.go", "new_path": "controllers/harbor/components/registry/deployments.go", "diff": "@@ -185,10 +185,10 @@ func (r *Registry) GetDeployments(ctx context.Context) []*appsv1.Deployment { //\nValue: \"\",\n}, {\nName: \"REGISTRY_HTTP_HOST\",\n- Value: fmt.Sprintf(\"https://%s\", r.harbor.Spec.PublicURL),\n+ Value: r.harbor.Spec.PublicURL,\n}, {\nName: \"REGISTRY_AUTH_TOKEN_REALM\",\n- Value: fmt.Sprintf(\"https://%s/service/token\", r.harbor.Spec.PublicURL),\n+ Value: fmt.Sprintf(\"%s/service/token\", r.harbor.Spec.PublicURL),\n}, {\nName: \"REGISTRY_NOTIFICATION_ENDPOINTS_0_URL\",\nValue: r.harbor.NormalizeComponentName(containerregistryv1alpha1.CoreName),\n@@ -246,10 +246,10 @@ func (r *Registry) GetDeployments(ctx context.Context) []*appsv1.Deployment { //\nEnv: []corev1.EnvVar{\n{\nName: \"REGISTRY_HTTP_HOST\",\n- Value: fmt.Sprintf(\"https://%s\", r.harbor.Spec.PublicURL),\n+ Value: r.harbor.Spec.PublicURL,\n}, {\nName: \"REGISTRY_AUTH_TOKEN_REALM\",\n- Value: fmt.Sprintf(\"https://%s/service/token\", r.harbor.Spec.PublicURL),\n+ Value: fmt.Sprintf(\"%s/service/token\", r.harbor.Spec.PublicURL),\n}, {\nName: \"REGISTRY_NOTIFICATION_ENDPOINTS_0_URL\",\nValue: r.harbor.NormalizeComponentName(containerregistryv1alpha1.CoreName),\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(token-url): remove double https scheme Signed-off-by: Jeremie Monsinjon <jeremie.monsinjon@corp.ovh.com>
254,874
15.01.2020 18:09:37
-3,600
3783d697ee108a92b5473e46724a659e1d55bf1e
fix(events): fix harbor-core url to send notifications from registry
[ { "change_type": "MODIFY", "old_path": "assets/templates/registry/config.yml", "new_path": "assets/templates/registry/config.yml", "diff": "@@ -22,10 +22,10 @@ health:\nthreshold: 3\nnotifications:\nendpoints:\n- - name: harbor\n+ - name: harbor-core\ndisabled: false\ntimeout: 3000ms\n- url: {{ printf \"http://%s/service/notifications\" env.Getenv \"CORE_HOSTNAME\" | quote }}\n+ url: \"http://{{ env.Getenv \"CORE_HOSTNAME\" }}/service/notifications\"\nthreshold: 5\nbackoff: 1s\nauth:\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(events): fix harbor-core url to send notifications from registry Signed-off-by: Jeremie Monsinjon <jeremie.monsinjon@corp.ovh.com>
254,874
31.01.2020 15:23:51
-3,600
426be1777510d4049795f8972125dcb1fb92fb75
fix(harbor-core) Modify harbor core config file path management + gomplate issues
[ { "change_type": "MODIFY", "old_path": "assets/templates/chartmuseum/config.yaml", "new_path": "assets/templates/chartmuseum/config.yaml", "diff": "-{{- /* https://github.com/helm/chartmuseum#configuration */ }}\n-{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/chartserver/env.jinja */ }}\n+{{- /* https://github.com/helm/chartmuseum#configuration */ -}}\n+{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/chartserver/env.jinja */ -}}\nallow.overwrite: true\nauth.anonymous.get: false\n" }, { "change_type": "MODIFY", "old_path": "assets/templates/clair/config.yaml", "new_path": "assets/templates/clair/config.yaml", "diff": "-{{ /* https://github.com/coreos/clair/blob/master/config.yaml.sample */ }}\n-{{ /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/clair/config.yaml.jinja */ }}\n+{{ /* https://github.com/coreos/clair/blob/master/config.yaml.sample */ -}}\n+{{ /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/clair/config.yaml.jinja */ -}}\nclair:\ndatabase:\ntype: pgsql\n" }, { "change_type": "MODIFY", "old_path": "assets/templates/core/app.conf", "new_path": "assets/templates/core/app.conf", "diff": "-{{- /* https://github.com/goharbor/harbor/blob/master/docs/1.10/install-config/configure-yml-file.md */ }}\n+{{- /* https://github.com/goharbor/harbor/blob/master/docs/1.10/install-config/configure-yml-file.md */ -}}\nappname = Harbor\nrunmode = prod\nenablegzip = true\n" }, { "change_type": "MODIFY", "old_path": "assets/templates/jobservice/config.yaml", "new_path": "assets/templates/jobservice/config.yaml", "diff": "-{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/jobservice/config.yml.jinja */ }}\n+{{- /* https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/jobservice/config.yml.jinja */ -}}\nprotocol: \"http\"\nport: {{ env.Getenv \"PORT\" }}\n" }, { "change_type": "MODIFY", "old_path": "controllers/harbor/components/harbor-core/configs.go", "new_path": "controllers/harbor/components/harbor-core/configs.go", "diff": "@@ -5,6 +5,7 @@ import (\n\"crypto/sha256\"\n\"fmt\"\n\"io/ioutil\"\n+ \"path\"\n\"strconv\"\n\"strings\"\n\"sync\"\n@@ -65,7 +66,7 @@ func (c *HarborCore) GetConfigMaps(ctx context.Context) []*corev1.ConfigMap { //\n// https://github.com/goharbor/harbor/blob/master/make/photon/prepare/templates/core/env.jinja\nData: map[string]string{\n- \"CONFIG_PATH\": coreConfigPath,\n+ \"CONFIG_PATH\": path.Join(coreConfigPath, configFileName),\n\"AUTH_MODE\": \"db_auth\",\n\"CFG_EXPIRATION\": \"5\",\n" }, { "change_type": "MODIFY", "old_path": "controllers/harbor/components/harbor-core/deployments.go", "new_path": "controllers/harbor/components/harbor-core/deployments.go", "diff": "@@ -25,8 +25,9 @@ var (\nconst (\ninitImage = \"hairyhenderson/gomplate\"\n- coreConfigPath = \"/etc/core/\"\n+ coreConfigPath = \"/etc/core\"\nkeyFileName = \"key\"\n+ configFileName = \"app.conf\"\nport = 8080 // https://github.com/goharbor/harbor/blob/2fb1cc89d9ef9313842cc68b4b7c36be73681505/src/common/const.go#L127\nhealthCheckPeriod = 90 * time.Second\n@@ -346,22 +347,22 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {\n{\nName: \"config\",\nReadOnly: true,\n- MountPath: coreConfigPath,\n- SubPath: \"app.conf\",\n+ MountPath: path.Join(coreConfigPath, configFileName),\n+ SubPath: configFileName,\n}, {\nName: \"secret-key\",\nReadOnly: true,\n- MountPath: \"/etc/core/\" + keyFileName,\n+ MountPath: path.Join(coreConfigPath, keyFileName),\nSubPath: keyFileName,\n}, {\nName: \"certificate\",\nReadOnly: true,\n- MountPath: \"/etc/core/private_key.pem\",\n+ MountPath: path.Join(coreConfigPath, \"private_key.pem\"),\nSubPath: \"tls.key\",\n}, {\nName: \"psc\",\nReadOnly: false,\n- MountPath: \"/etc/core/token\",\n+ MountPath: path.Join(coreConfigPath, \"token\"),\n},\n},\n},\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(harbor-core) Modify harbor core config file path management + gomplate issues Signed-off-by: Jeremie Monsinjon <jeremie.monsinjon@corp.ovh.com>
254,872
07.02.2020 14:38:17
-3,600
d1e2cff48df5ecb3698f786f5b1c531380eb03fc
fix(makefile) Use kustomize install script instead of downloading tar
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -248,13 +248,8 @@ endif\nkustomize:\nifeq (, $(shell which kustomize))\n# https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md\n- curl -sSL https://api.github.com/repos/kubernetes-sigs/kustomize/releases/latest \\\n- | grep browser_download \\\n- | grep $(shell go env GOOS) \\\n- | cut -d '\"' -f 4 \\\n- | xargs curl -sSL \\\n- | tar -xz -C /tmp/\n- mv /tmp/kustomize $(KUSTOMIZE)\n+ curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/04bfb3e94d0a4b740dcb426c23018cb041c8398d/hack/install_kustomize.sh | bash\n+ mv ./kustomize $(KUSTOMIZE)\nchmod u+x $(KUSTOMIZE)\nKUSTOMIZE=$(GOBIN)/kustomize\nelse\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(makefile) Use kustomize install script instead of downloading tar Signed-off-by: Sebastien Jardin <sebastien.jardin@corp.ovh.com>
254,872
21.02.2020 15:24:14
-3,600
0ba4cabf6fe7ba5a68ed9c5f9ff1a07945b79ae6
add(harbor-core) Add configstore loading variable from env
[ { "change_type": "MODIFY", "old_path": "config/manager/patches-configuration.yaml", "new_path": "config/manager/patches-configuration.yaml", "diff": "@@ -8,6 +8,9 @@ spec:\nspec:\ncontainers:\n- name: manager\n+ env:\n+ - name: 'CONFIGURATION_FROM'\n+ value: 'env:'\nenvFrom:\n- configMapRef:\nname: operator-config\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
add(harbor-core) Add configstore loading variable from env Signed-off-by: Sebastien Jardin <sebastien.jardin@ovhcloud.com>
254,893
11.03.2020 10:07:31
-28,800
a5de59d816a54e785f368ce5d26390d988188df3
docs(readme): add warning message in the readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "# Harbor Operator\n+**ATTENTIONS: THIS PROJECT IS STILL UNDER DEVELOPMENT AND NOT STABLE YET.**\n+\n## Why an Harbor Operator\n[Harbor](https://github.com/goharbor/harbor/) is a very active project, composed on numerous stateful and stateless sub-projects and dependencies.\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
docs(readme): add warning message in the readme
254,893
11.03.2020 10:29:49
-28,800
7fc751f1ba8677e1749c760cea93d2b5b8441d6a
fix(sample): update the sample yaml to align with latest spec
[ { "change_type": "MODIFY", "old_path": "config/samples/goharbor_v1alpha1_harbor.yaml", "new_path": "config/samples/goharbor_v1alpha1_harbor.yaml", "diff": "@@ -11,9 +11,9 @@ spec:\ncore:\ndatabaseSecret: core-database\nimage: \"goharbor/harbor-core:v1.10.0\"\n- registryCtl:\n- image: \"goharbor/harbor-registryctl:v1.10.0\"\nregistry:\n+ controller:\n+ image: \"goharbor/harbor-registryctl:v1.10.0\"\nstorageSecret: registry-storage\ncacheSecret: registry-cache\nimage: goharbor/registry-photon:v2.7.1-patch-2819-2553-v1.10.0\n@@ -39,7 +39,8 @@ spec:\nimage: goharbor/chartmuseum-photon:v0.9.0-v1.10.0\nnotary:\npublicURL: 'https://{{ env.Getenv \"NOTARY_DOMAIN\" }}'\n- notaryDBMigratorImage: jmonsinjon/notary-db-migrator:v0.6.1\n+ dbMigrator:\n+ image: jmonsinjon/notary-db-migrator:v0.6.1\nserver:\ndatabaseSecret: notary-server-database\nimage: goharbor/notary-server-photon:v0.6.1-v1.10.0\n" }, { "change_type": "MODIFY", "old_path": "config/samples/kustomization.yaml", "new_path": "config/samples/kustomization.yaml", "diff": "@@ -24,6 +24,6 @@ secretGenerator:\n- namespace=harbor.scanner.clair:store\nresources:\n- - containerregistry_v1alpha1_harbor.yaml\n+ - goharbor_v1alpha1_harbor.yam\n- certificate.yaml\n- requirements.tmpl\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(sample): update the sample yaml to align with latest spec Signed-off-by: Steven Zou <szou@vmware.com>
254,875
12.03.2020 16:19:22
-28,800
0db44183819b6521f216c6edfb71c29474024ce3
fix make install-dependencies error
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -141,7 +141,7 @@ install-dependencies: helm\n$(HELM) get notes registry-cache \\\n|| $(HELM) install registry-cache stable/redis-ha\n$(HELM) get notes nginx \\\n- || $(HELM) install nginx stable/nginx-ingress \\\n+ || $(HELM) install nginx stable/nginx-ingress\nkubectl apply -f config/samples/notary-ingress-service.yaml\n# Install local certificate\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix make install-dependencies error Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
12.03.2020 16:35:36
-28,800
098a99b0ffccb6fd7f4428d56570e90060d27634
change the default controller image name
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "# Image URL to use all building/pushing image targets\n-IMG ?= controller:latest\n+IMG ?= goharbor/harbor-operator:dev\nSHELL = /bin/sh\n" }, { "change_type": "MODIFY", "old_path": "config/manager/manager.yaml", "new_path": "config/manager/manager.yaml", "diff": "@@ -20,7 +20,7 @@ spec:\n- /manager\nargs:\n- --enable-leader-election\n- image: controller:latest\n+ image: goharbor/harbor-operator:dev\nname: manager\nresources:\nlimits:\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
change the default controller image name Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
14.03.2020 16:18:59
-28,800
b21fdd4eac96e45b81e4a8f130059052a8c77a89
remove proxy-body-size limit from nginx-ingress
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -141,7 +141,7 @@ install-dependencies: helm\n$(HELM) get notes registry-cache \\\n|| $(HELM) install registry-cache stable/redis-ha\n$(HELM) get notes nginx \\\n- || $(HELM) install nginx stable/nginx-ingress\n+ || $(HELM) install nginx stable/nginx-ingress --set-string controller.config.proxy-body-size=0\nkubectl apply -f config/samples/notary-ingress-service.yaml\n# Install local certificate\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
remove proxy-body-size limit from nginx-ingress Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
19.03.2020 23:08:05
-28,800
2cde954f2889d2cd614b618f720df291799c6102
feat(doc) add some installation notes
[ { "change_type": "MODIFY", "old_path": "docs/installation.md", "new_path": "docs/installation.md", "diff": "@@ -74,3 +74,65 @@ Kubernetes API running (see [Supported platforms](https://github.com/goharbor/ha\n```bash\nkubectl get secret \"$(kubectl get harbor harbor-sample -o jsonpath='{.spec.adminPasswordSecret}')\" -o jsonpath='{.data.password}' | base64 --decode\n```\n+\n+## Some notes\n+\n+### using on KIND k8s with NodePort\n+\n+Reference [kind ingress](https://kind.sigs.k8s.io/docs/user/ingress/)\n+\n+1. create cluster with at multi worker nodes and export port on 1 node\n+\n+ ```bash\n+ cat <<EOF | kind create cluster --config=-\n+ kind: Cluster\n+ apiVersion: kind.x-k8s.io/v1alpha4\n+ nodes:\n+ - role: control-plane\n+ kubeadmConfigPatches:\n+ - |\n+ kind: InitConfiguration\n+ nodeRegistration:\n+ kubeletExtraArgs:\n+ node-labels: \"ingress-ready=true\"\n+ authorization-mode: \"AlwaysAllow\"\n+ extraPortMappings:\n+ - containerPort: 80\n+ hostPort: 80\n+ protocol: TCP\n+ - containerPort: 443\n+ hostPort: 443\n+ protocol: TCP\n+ - role: worker\n+ - role: worker\n+ - role: worker\n+ EOF\n+ ```\n+\n+2. install nginx-ingress with NodePort\n+\n+ ```bash\n+ helm install nginx stable/nginx-ingress --set-string controller.config.proxy-body-size=0 --set controller.service.type=NodePort\n+ ```\n+\n+3. patch nginx-ingress to use special node\n+\n+ ```bash\n+ kubectl patch deployments nginx-nginx-ingress-controller -p '{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx-ingress-controller\",\"ports\":[{\"containerPort\":80,\"hostPort\":80},{\"containerPort\":443,\"hostPort\":443}]}],\"nodeSelector\":{\"ingress-ready\":\"true\"},\"tolerations\":[{\"key\":\"node-role.kubernetes.io/master\",\"operator\":\"Equal\",\"effect\":\"NoSchedule\"}]}}}}'\n+ ```\n+\n+### install the cert\n+\n+1. get the cert name\n+\n+ ```bash\n+ kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}'\n+ ```\n+\n+2. install cert for docker\n+\n+ ```bash\n+ kubectl get secret \"$(kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}')\" -o jsonpath='{.data.ca\\.crt}' \\\n+ | base64 --decode \\\n+ | sudo tee \"/etc/docker/certs.d/$LBAAS_DOMAIN/ca.crt\"\n+ ```\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(doc) add some installation notes Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,893
30.03.2020 11:08:33
-28,800
212fa0558680d4891bc78c53ab76b311fb828668
docs[authors]: remove the author file The copyrights declaration is not valid after donated to `goharbor` namespace which is governed by following CNCF guidelines.
[ { "change_type": "DELETE", "old_path": "AUTHORS", "new_path": null, "diff": "-# This is the official list of <PROJECT> authors for copyright purposes.\n-# This file is distinct from the CONTRIBUTORS files\n-# and it lists the copyright holders only.\n-\n-# Names should be added to this file as one of\n-# Organization's name\n-# Individual's name <submission email address>\n-# Individual's name <submission email address> <email2> <emailN>\n-# See CONTRIBUTORS for the meaning of multiple email addresses.\n-\n-# Please keep the list sorted.\n-\n-OVH SAS\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
docs[authors]: remove the author file The copyrights declaration is not valid after donated to `goharbor` namespace which is governed by following CNCF guidelines.
254,859
03.04.2020 15:20:35
-7,200
7a982cb64b9da58a4195cddab07c6a8543afca92
fix(docs) Typo in readme
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -51,7 +51,7 @@ Following components are optional:\n### Delete the stack\n-When deleting the Harbor resource, all linked components are deleted. With two arbor resources, the right components are deleted and components of the other Harbor are not changed.\n+When deleting the Harbor resource, all linked components are deleted. With two Harbor resources, the right components are deleted and components of the other Harbor are not changed.\n### Adding/Removing a component\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(docs) Typo in readme Signed-off-by: Philippe Scorsolini <pscorso93@gmail.com>
254,875
25.03.2020 21:29:19
-28,800
e2c254251ae31621f6972f43d612647d6532c273
feat(doc) a step-by-step install guide on KIND k8s
[ { "change_type": "ADD", "old_path": null, "new_path": "docs/install-with-kind-k8s.md", "diff": "+# Installation in KIND k8s\n+\n+- OS ubuntu 18.04, 8G mem 4CPU\n+\n+- install docker\n+\n+ ```bash\n+ apt install docker.io\n+ ```\n+\n+- install kind\n+\n+ ```bash\n+ curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64\n+ ```\n+\n+- install kubectl\n+\n+ ```bash\n+ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl\n+ ```\n+\n+- create kind cluster\n+\n+ ```bash\n+ cat <<EOF | kind create cluster --name mine --config=-\n+ kind: Cluster\n+ apiVersion: kind.x-k8s.io/v1alpha4\n+ nodes:\n+ - role: control-plane\n+ kubeadmConfigPatches:\n+ - |\n+ kind: InitConfiguration\n+ nodeRegistration:\n+ kubeletExtraArgs:\n+ node-labels: \"ingress-ready=true\"\n+ authorization-mode: \"AlwaysAllow\"\n+ extraPortMappings:\n+ - containerPort: 80\n+ hostPort: 80\n+ protocol: TCP\n+ - containerPort: 443\n+ hostPort: 443\n+ protocol: TCP\n+ - role: worker\n+ - role: worker\n+ - role: worker\n+ EOF\n+ ```\n+\n+- install make golang-go npm helm gofmt golangci-lint kube-apiserver kubebuilder kubectl kustomize pkger etcd\n+\n+ ```bash\n+ sudo apt install make npm -y\n+\n+ curl https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz | tar xzv\n+ export PATH=~/go/bin:$PATH\n+\n+ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash\n+\n+ npm install gomplate;sudo cp node_modules/gomplate/node_modules/.bin/gomplate /usr/local/bin/gomplate\n+\n+ cd harbor-operator\n+ make dev-tools\n+ ```\n+\n+- install cert-manager\n+\n+ ```bash\n+ helm repo add jetstack https://charts.jetstack.io\n+ helm repo add bitnami https://charts.bitnami.com/bitnami\n+ helm repo add dandydev https://dandydeveloper.github.io/charts\n+\n+ helm repo update\n+\n+ kubectl create namespace cert-manager\n+\n+ helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v0.13.1\n+ ```\n+\n+- install harbor-operator-system\n+\n+ ```bash\n+ kubectl create namespace harbor-operator-system\n+ make deploy\n+ ```\n+\n+- install nginx-ingess with nodeport\n+\n+ ```bash\n+ helm install nginx stable/nginx-ingress --set-string controller.config.proxy-body-size=0 --set controller.service.type=NodePort\n+\n+ kubectl patch deployments nginx-nginx-ingress-controller -p '{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx-ingress-controller\",\"ports\":[{\"containerPort\":80,\"hostPort\":80},{\"containerPort\":443,\"hostPort\":443}]}],\"nodeSelector\":{\"ingress-ready\":\"true\"},\"tolerations\":[{\"key\":\"node-role.kubernetes.io/master\",\"operator\":\"Equal\",\"effect\":\"NoSchedule\"}]}}}}'\n+ ```\n+\n+ below command not work yet\n+\n+ ```bash\n+ helm install nginx stable/nginx-ingress \\\n+ --set-string 'controller.config.proxy-body-size'=0 \\\n+ --set-string 'controller.nodeSelector.ingress-ready'=true \\\n+ --set 'controller.service.type'=NodePort \\\n+ --set 'controller.tolerations[0].key'=node-role.kubernetes.io/master \\\n+ --set 'controller.tolerations[0].operator'=Equal \\\n+ --set 'controller.tolerations[0].effect'=NoSchedule\n+ ```\n+\n+- install redis database\n+\n+ ```bash\n+ make install-dependencies\n+ ```\n+\n+- install harbor\n+\n+ ```bash\n+ IP=`hostname -I|awk '{print $1}'`\n+ export LBAAS_DOMAIN=harbor.$IP.xip.io \\\n+ NOTARY_DOMAIN=harbor.$IP.xip.io \\\n+ CORE_DATABASE_SECRET=$(kubectl get secret core-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) \\\n+ CLAIR_DATABASE_SECRET=$(kubectl get secret clair-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) \\\n+ NOTARY_SERVER_DATABASE_SECRET=$(kubectl get secret notary-server-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) \\\n+ NOTARY_SIGNER_DATABASE_SECRET=$(kubectl get secret notary-signer-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) ; \\\n+ kubectl kustomize config/samples | gomplate | kubectl apply -f -\n+ ```\n+\n+- export self-sign cert\n+\n+ ```bash\n+ sudo mkdir -p /etc/docker/certs.d/$LBAAS_DOMAIN\n+\n+ kubectl get secret \"$(kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}')\" -o jsonpath='{.data.ca\\.crt}' \\\n+ | base64 --decode \\\n+ | sudo tee \"/etc/docker/certs.d/$LBAAS_DOMAIN/ca.crt\"\n+ ```\n+\n+- push image\n+\n+ ```bash\n+ docker login $LBAAS_DOMAIN -u admin -p $(whoami)\n+\n+ docker tag busybox $LBAAS_DOMAIN/library/testbusybox\n+\n+ docker push $LBAAS_DOMAIN/library/testbusybox\n+ ```\n+\n+- clean\n+\n+ ```bash\n+ kind delete cluster --name mine\n+ ```\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(doc) a step-by-step install guide on KIND k8s Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
31.03.2020 16:33:56
-28,800
e2c26945143c0041cccc6bdc767bf8a8597093f3
feat(cicd) enable goreleaser
[ { "change_type": "MODIFY", "old_path": ".dockerignore", "new_path": ".dockerignore", "diff": "@@ -32,3 +32,6 @@ config/webhook/manifests.yaml\n## Pkger autogenerated files\npkged.go\n+\n+## goreleaser\n+dist/\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/workflows/goreleaser.yml", "diff": "+on:\n+ push:\n+ tags:\n+ - 'v*'\n+\n+jobs:\n+ goreleaser:\n+ runs-on: ubuntu-latest\n+ steps:\n+ -\n+ name: Checkout\n+ uses: actions/checkout@v2\n+ -\n+ name: Unshallow\n+ # required for the changelog to work correctly\n+ run: git fetch --prune --unshallow\n+ -\n+ name: Set up Go\n+ uses: actions/setup-go@v1\n+ with:\n+ go-version: 1.13\n+ -\n+ name: prepare changelog\n+ run: |\n+ tag=${{ github.ref }}\n+ tag=${tag##*/}\n+ cat <<EOF | tee /tmp/release.txt\n+ ## Docker images\n+\n+ - \\`docker pull goharbor/harbor-operator:$tag\\`\n+ EOF\n+ -\n+ name: Run GoReleaser\n+ uses: goreleaser/goreleaser-action@v1\n+ with:\n+ version: v0.129.0\n+ args: release --rm-dist --release-footer /tmp/release.txt\n+ env:\n+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/tests.yml", "new_path": ".github/workflows/tests.yml", "diff": "@@ -2,6 +2,8 @@ name: Tests\non:\npush:\n+ branches:\n+ - '**'\npull_request:\nbranches:\n- master\n" }, { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -29,3 +29,6 @@ pkged.go\n## Mac file\n.DS_Store\n+\n+## goreleaser\n+dist/\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".goreleaser.yml", "diff": "+before:\n+ hooks:\n+ - make generate\n+builds:\n+- env:\n+ - CGO_ENABLED=0\n+ binary: manager\n+ goos:\n+ - linux\n+ goarch:\n+ - amd64\n+changelog:\n+ sort: asc\n+ filters:\n+ exclude:\n+ - '^docs'\n+ - '^test'\n+ - '^feat'\n+ - '^chore'\n+ - '^Merge '\n+ - '[Ty]ypo'\n+release:\n+ draft: true\n" }, { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -35,6 +35,10 @@ dev-tools: \\\nmarkdownlint \\\npkger\n+release: goreleaser\n+ # export GITHUB_TOKEN=...\n+ $(GORELEASER) release --rm-dist\n+\n#####################\n# Packaging #\n#####################\n@@ -250,8 +254,8 @@ kustomize:\nifeq (, $(shell which kustomize))\n# https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md\ncurl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/04bfb3e94d0a4b740dcb426c23018cb041c8398d/hack/install_kustomize.sh | bash\n- mv ./kustomize $(KUSTOMIZE)\n- chmod u+x $(KUSTOMIZE)\n+ mv ./kustomize $(GOBIN)\n+ chmod u+x $(GOBIN)/kustomize\nKUSTOMIZE=$(GOBIN)/kustomize\nelse\nKUSTOMIZE=$(shell which kustomize)\n@@ -277,3 +281,14 @@ HELM=helm-not-found\nelse\nHELM=$(shell which helm)\nendif\n+\n+# find or download goreleaser\n+goreleaser:\n+ifeq (, $(shell which goreleaser))\n+ curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh \\\n+ | sh -s v0.129.0\n+ mv ./bin/goreleaser $(GOBIN)\n+GORELEASER=$(GOBIN)/goreleaser\n+else\n+GORELEASER=$(shell which goreleaser)\n+endif\n" }, { "change_type": "MODIFY", "old_path": "go.sum", "new_path": "go.sum", "diff": "@@ -105,6 +105,7 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV\ngithub.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=\ngithub.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM=\ngithub.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=\n+github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=\ngithub.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=\ngithub.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=\ngithub.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=\n@@ -258,6 +259,7 @@ github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBv\ngithub.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=\ngithub.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=\ngithub.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\n+github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=\ngithub.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=\ngithub.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=\n@@ -411,6 +413,7 @@ github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzu\ngithub.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\ngithub.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=\ngithub.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\n+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=\ngithub.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=\ngithub.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=\ngithub.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\n@@ -451,6 +454,7 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/\ngo.uber.org/zap v0.0.0-20180814183419-67bc79d13d15/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\ngo.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=\ngo.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\n+go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=\ngo.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\ngolang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(cicd) enable goreleaser Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,893
17.04.2020 11:17:41
-28,800
8d0b2721ae52ecee6f85fe90c5d8d09e211d2ed0
fix(readme):fix broken link of installation guide fix issue
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -64,7 +64,7 @@ It is possible to add and delete ChartMuseum, Notary and Clair by editing the Ha\n## Installation\n-See [install documentation](https://github.com/goharbor/harbor-operator/blob/master/docs/installation.md).\n+See [install documentation](https://github.com/goharbor/harbor-operator/blob/master/docs/installation/installation.md).\n## Compatibility\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(readme):fix broken link of installation guide fix issue #50
254,893
17.04.2020 11:54:53
-28,800
7aa3d0532f5ccc4f9dc05c3d2df5b6703d6d84ab
chore(readme): add community section also add replication workgroup link
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -84,7 +84,12 @@ Generate resources using `make generate`\n## Development\n-Follow the [Development guide](https://github.com/goharbor/harbor-operator/blob/master/docs/development.md) to start on the project.\n+Now, this project is maintained and developed by the [Harbor operator workgroup](https://github.com/goharbor/community/blob/master/workgroups/wg-operator/README.md). If you're willing to join the group and do contributions to operator project, welcome to [contact us](#community). Follow the [Development guide](https://github.com/goharbor/harbor-operator/blob/master/docs/development.md) to start on the project.\n+\n+## Community\n+\n+* Slack channel `#harbor-operator-dev` at [CNCF Workspace](https://slack.cncf.io)\n+* Send mail to Harbor dev mail group: harbor-dev@lists.cncf.io\n## Additional documentation\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
chore(readme): add community section - also add replication workgroup link
254,893
17.04.2020 12:08:07
-28,800
3361cb24f0c9d8cf45d5387766d719ae7f777661
chore(issues):add github issue templates
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/ISSUE_TEMPLATE/bug_report.md", "diff": "+---\n+name: Bug report\n+about: Create a report to help us improve\n+---\n+\n+If you are reporting a problem, please make sure the following information are provided:\n+\n+**Expected behavior and actual behavior:**\n+A clear and concise description of what you expected to happen and what's the actual behavior. If applicable, add screenshots to help explain your problem.\n+\n+**Steps to reproduce the problem:**\n+Please provide the steps to reproduce this problem.\n+\n+**Versions:**\n+Please specify the versions of following systems.\n+\n+- harbor operator version: [x.y.z]\n+- harbor version: [x.y.z]\n+- kubernetes version: [x.y.z]\n+\n+**Additional context:**\n+\n+- **Harbor dependent services:**\n+ - Context info of postgreSQL\n+ - Context info of Redis\n+ - Context info of storage\n+- **Log files:** Collect logs and attach them here if have.\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/ISSUE_TEMPLATE/issue.md", "diff": "+---\n+name: Issue\n+about: Talk about other harbor operator related things\n+\n+---\n+\n+What can we help you?\n" }, { "change_type": "ADD", "old_path": null, "new_path": ".github/ISSUE_TEMPLATE/proposal.md", "diff": "+---\n+name: Proposal\n+about: Suggest an idea for this project\n+\n+---\n+\n+**Is your feature request related to a problem? Please describe.**\n+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n+\n+**Describe the solution you'd like**\n+A clear and concise description of what you want to happen.\n+\n+**Describe the main design/architecture of your solution**\n+A clear and concise description of what does your solution look like. Rich text and diagrams are preferred.\n+\n+**Describe the development plan you've considered**\n+A clear and concise description of the plan to make the solution ready. It can include a development timeline, resource estimation, and other related things.\n+\n+**Additional context**\n+Add any other context or screenshots about the feature request here.\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
chore(issues):add github issue templates Signed-off-by: Steven Zou <szou@vmware.com>
254,893
17.04.2020 12:14:47
-28,800
8382b8ee14f77be56f2d2a9abaf019f5551363d5
fix(readme):fix doc lint issues
[ { "change_type": "MODIFY", "old_path": ".github/ISSUE_TEMPLATE/bug_report.md", "new_path": ".github/ISSUE_TEMPLATE/bug_report.md", "diff": "@@ -17,6 +17,7 @@ Please specify the versions of following systems.\n- harbor operator version: [x.y.z]\n- harbor version: [x.y.z]\n- kubernetes version: [x.y.z]\n+- Any additional relevant versions such as CertManager\n**Additional context:**\n@@ -25,3 +26,4 @@ Please specify the versions of following systems.\n- Context info of Redis\n- Context info of storage\n- **Log files:** Collect logs and attach them here if have.\n+- **Kubernetes:** How Kubernetes access was provided (what cloud provider, service-account configuration, ...).\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -88,8 +88,8 @@ Now, this project is maintained and developed by the [Harbor operator workgroup]\n## Community\n-* Slack channel `#harbor-operator-dev` at [CNCF Workspace](https://slack.cncf.io)\n-* Send mail to Harbor dev mail group: harbor-dev@lists.cncf.io\n+- Slack channel `#harbor-operator-dev` at [CNCF Workspace](https://slack.cncf.io)\n+- Send mail to Harbor dev mail group: harbor-dev@lists.cncf.io\n## Additional documentation\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(readme):fix doc lint issues Signed-off-by: Steven Zou <szou@vmware.com>
254,865
21.07.2020 20:57:37
-28,800
7bbe9e56bdc7ad89434306f057f60c69a2c85de7
fix(ingress): resolve 413(Too Large Entity) error when push large image. add annotation to unlimit the size of http request body. CLOSES
[ { "change_type": "MODIFY", "old_path": "controllers/harbor/components/registry/ingresses.go", "new_path": "controllers/harbor/components/registry/ingresses.go", "diff": "@@ -44,6 +44,10 @@ func (r *Registry) GetIngresses(ctx context.Context) []*netv1.Ingress { // nolin\n\"harbor\": harborName,\n\"operator\": operatorName,\n},\n+ Annotations: map[string]string{\n+ // resolve 413(Too Large Entity) error when push large image. It only works for NGINX ingress.\n+ \"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\",\n+ },\n},\nSpec: netv1.IngressSpec{\nTLS: tls,\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(ingress): resolve 413(Too Large Entity) error when push large image. add annotation to unlimit the size of http request body. CLOSES #63
254,878
19.07.2020 19:49:16
-28,800
d1c003502d52713ad3e17a9c7a71cb4c20ab12ff
redirect exposed
[ { "change_type": "MODIFY", "old_path": "api/v1alpha1/harbor_types.go", "new_path": "api/v1alpha1/harbor_types.go", "diff": "@@ -147,6 +147,9 @@ type RegistryComponent struct {\n// +optional\nCacheSecret string `json:\"cacheSecret,omitempty\"`\n+\n+ // +optional\n+ DisableRedirect bool `json:\"disableRedirect,omitempty\"`\n}\ntype RegistryControllerComponent struct {\n" }, { "change_type": "MODIFY", "old_path": "assets/templates/registry/config.yaml", "new_path": "assets/templates/registry/config.yaml", "diff": "@@ -76,7 +76,7 @@ storage:\ndelete:\nenabled: true\nredirect:\n- disable: false\n+ disable: {{ env.Getenv \"STORAGE_DISABLE_REDIRECT\" }}\ncache:\nblobdescriptor: {{ if gt ( len $redisUrl ) 0 -}} redis {{- else -}} inmemory {{- end }}\nmaintenance:\n" }, { "change_type": "MODIFY", "old_path": "controllers/harbor/components/registry/deployments.go", "new_path": "controllers/harbor/components/registry/deployments.go", "diff": "@@ -4,6 +4,7 @@ import (\n\"context\"\n\"fmt\"\n\"path\"\n+ \"strconv\"\nappsv1 \"k8s.io/api/apps/v1\"\ncorev1 \"k8s.io/api/core/v1\"\n@@ -150,6 +151,9 @@ func (r *Registry) GetDeployments(ctx context.Context) []*appsv1.Deployment { //\n},\nEnv: []corev1.EnvVar{\n{\n+ Name: \"STORAGE_DISABLE_REDIRECT\",\n+ Value: strconv.FormatBool(r.harbor.Spec.Components.Registry.DisableRedirect),\n+ }, {\nName: \"STORAGE_CONFIG\",\nValue: \"/opt/configuration/storage\",\n}, {\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
redirect exposed Signed-off-by: xiaoyang zhu <zhuxiaoyang1996@gmail.com>
254,870
14.08.2020 17:24:57
-28,800
06ab3a780169f35588f140ab37593da77ebb5a21
fix(core): fix missing `_REDIS_URL` env of harbror-core Fix missing `_REDIS_URL` env of harbror-core Fixes
[ { "change_type": "MODIFY", "old_path": "api/v1alpha1/harbor_secret_format.go", "new_path": "api/v1alpha1/harbor_secret_format.go", "diff": "@@ -37,6 +37,8 @@ const (\nHarborCoreDatabaseNameKey = \"database\"\nHarborCoreDatabaseUserKey = \"username\"\nHarborCoreDatabasePasswordKey = \"password\"\n+ // ipaddress:port[,weight,password,database_index]\n+ HarborCoreURLKey = \"url\"\n)\nconst (\n" }, { "change_type": "MODIFY", "old_path": "api/v1alpha1/harbor_types.go", "new_path": "api/v1alpha1/harbor_types.go", "diff": "@@ -131,6 +131,9 @@ type CoreComponent struct {\n// +kubebuilder:validation:Required\nDatabaseSecret string `json:\"databaseSecret\"`\n+\n+ // +kubebuilder:validation:Required\n+ CacheSecret string `json:\"cacheSecret\"`\n}\ntype PortalComponent struct {\n" }, { "change_type": "MODIFY", "old_path": "config/manager/manager.yaml", "new_path": "config/manager/manager.yaml", "diff": "@@ -24,9 +24,9 @@ spec:\nname: manager\nresources:\nlimits:\n- cpu: 100m\n- memory: 30Mi\n+ cpu: 1000m\n+ memory: 300Mi\nrequests:\n- cpu: 100m\n- memory: 20Mi\n+ cpu: 500m\n+ memory: 200Mi\nterminationGracePeriodSeconds: 10\n" }, { "change_type": "MODIFY", "old_path": "controllers/harbor/components/harbor-core/deployments.go", "new_path": "controllers/harbor/components/harbor-core/deployments.go", "diff": "@@ -40,6 +40,7 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {\ncacheEnv := corev1.EnvVar{\nName: \"_REDIS_URL_REG\",\n}\n+\nif len(c.harbor.Spec.Components.Registry.CacheSecret) > 0 {\ncacheEnv.ValueFrom = &corev1.EnvVarSource{\nSecretKeyRef: &corev1.SecretKeySelector{\n@@ -52,6 +53,22 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {\n}\n}\n+ coreURLEnv := corev1.EnvVar{\n+ Name: \"_REDIS_URL\",\n+ }\n+\n+ if len(c.harbor.Spec.Components.Core.CacheSecret) > 0 {\n+ coreURLEnv.ValueFrom = &corev1.EnvVarSource{\n+ SecretKeyRef: &corev1.SecretKeySelector{\n+ Key: goharborv1alpha1.HarborCoreURLKey,\n+ Optional: &varTrue,\n+ LocalObjectReference: corev1.LocalObjectReference{\n+ Name: c.harbor.Spec.Components.Registry.CacheSecret,\n+ },\n+ },\n+ }\n+ }\n+\nreturn []*appsv1.Deployment{\n{\nObjectMeta: metav1.ObjectMeta{\n@@ -327,6 +344,7 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {\n},\n},\ncacheEnv,\n+ coreURLEnv,\n},\nEnvFrom: []corev1.EnvFromSource{\n{\n" }, { "change_type": "MODIFY", "old_path": "main.go", "new_path": "main.go", "diff": "@@ -4,14 +4,13 @@ import (\n\"os\"\n\"github.com/go-logr/logr\"\n+ harbor1alpha1 \"github.com/goharbor/harbor-operator/api/v1alpha1\"\n\"github.com/ovh/configstore\"\n_ \"k8s.io/client-go/plugin/pkg/client/auth/gcp\"\nctrl \"sigs.k8s.io/controller-runtime\"\n\"sigs.k8s.io/controller-runtime/pkg/log/zap\"\n// +kubebuilder:scaffold:imports\n-\n- goharborv1alpha1 \"github.com/goharbor/harbor-operator/api/v1alpha1\"\n\"github.com/goharbor/harbor-operator/pkg/controllers/harbor\"\n\"github.com/goharbor/harbor-operator/pkg/factories/logger\"\n\"github.com/goharbor/harbor-operator/pkg/manager\"\n@@ -82,7 +81,7 @@ func main() {\nos.Exit(exitCodeFailure)\n}\n- if err := (&goharborv1alpha1.Harbor{}).SetupWebhookWithManager(mgr); err != nil {\n+ if err := (&harbor1alpha1.Harbor{}).SetupWebhookWithManager(mgr); err != nil {\nsetupLog.Error(err, \"unable to create webhook\", \"webhook\", \"Harbor\")\nos.Exit(exitCodeFailure)\n}\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(core): fix missing `_REDIS_URL` env of harbror-core Fix missing `_REDIS_URL` env of harbror-core Fixes #76 Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
254,870
18.08.2020 00:24:35
-28,800
c07521c17c4075c7ec66be7ff23d93951f57fd9b
fix(bug): fix core wrong cacheSecret Fix core wrong cacheSecret
[ { "change_type": "MODIFY", "old_path": "config/manager/kustomization.yaml", "new_path": "config/manager/kustomization.yaml", "diff": "@@ -3,8 +3,8 @@ kind: Kustomization\nimages:\n- name: controller\n- newName: controller\n- newTag: latest\n+ newName: goharbor/harbor-operator\n+ newTag: dev\nconfigMapGenerator:\n- literals:\n" }, { "change_type": "MODIFY", "old_path": "controllers/harbor/components/harbor-core/deployments.go", "new_path": "controllers/harbor/components/harbor-core/deployments.go", "diff": "@@ -63,7 +63,7 @@ func (c *HarborCore) GetDeployments(ctx context.Context) []*appsv1.Deployment {\nKey: goharborv1alpha1.HarborCoreURLKey,\nOptional: &varTrue,\nLocalObjectReference: corev1.LocalObjectReference{\n- Name: c.harbor.Spec.Components.Registry.CacheSecret,\n+ Name: c.harbor.Spec.Components.Core.CacheSecret,\n},\n},\n}\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(bug): fix core wrong cacheSecret Fix core wrong cacheSecret Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
254,863
26.08.2020 11:36:09
-3,600
9036fcaba93a82e27deb68e40d6282a290e2fb35
specify secret type when creating it
[ { "change_type": "MODIFY", "old_path": "docs/installation/database-installation.md", "new_path": "docs/installation/database-installation.md", "diff": "@@ -37,7 +37,7 @@ Please repeat following steps for each components requiring a database: `clair`,\n3. Create the computed secret with correct keys (see [`api/v1alpha1/harbor_secret_format.go`](../../api/v1alpha1/harbor_secret_format.go))\n```bash\n- kubectl create secret \"$COMPONENT-database\" \\\n+ kubectl create secret generic \"$COMPONENT-database\" \\\n--from-literal host=\"$COMPONENT-database-postgresql\" \\\n--from-literal port='5432' \\\n--from-literal database='postgres' \\\n" }, { "change_type": "MODIFY", "old_path": "docs/installation/redis-installation.md", "new_path": "docs/installation/redis-installation.md", "diff": "@@ -32,7 +32,7 @@ Please repeat following steps for each components requiring a redis: `chartmuseu\n2. Create the computed secret with correct keys (see [`api/v1alpha1/harbor_secret_format.go`](../../api/v1alpha1/harbor_secret_format.go))\n```bash\n- kubectl create secret \"$COMPONENT-redis\" \\\n+ kubectl create secret generic \"$COMPONENT-redis\" \\\n--from-literal url=\"redis://${COMPONENT}-redis-master-0:6379/0\" \\\n--from-literal namespace=''\n```\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
specify secret type when creating it Signed-off-by: Simon Weald <glitchcrab-github@simonweald.com>
254,883
23.07.2020 18:16:04
-7,200
4162aa1be483e17200b4cdbc8985cf28aa119bd1
fix(kubebuilder): Fix port minimum values for kubebuilder
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "new_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "diff": "@@ -728,14 +728,14 @@ type HarborExposeNodePortPortsSpec struct {\ntype HarborExposeNodePortPortsHTTPSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=80\n// The service port Harbor listens on when serving with HTTP\nPort int32 `json:\"port,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=30002\n// The node port Harbor listens on when serving with HTTP\nNodePort int32 `json:\"nodePort,omitempty\"`\n@@ -744,14 +744,14 @@ type HarborExposeNodePortPortsHTTPSpec struct {\ntype HarborExposeNodePortPortsHTTPSSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=443\n// The service port Harbor listens on when serving with HTTPS\nPort int32 `json:\"port,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=30003\n// The node port Harbor listens on when serving with HTTPS\nNodePort int32 `json:\"nodePort,omitempty\"`\n@@ -760,14 +760,14 @@ type HarborExposeNodePortPortsHTTPSSpec struct {\ntype HarborExposeNodePortPortsNotarySpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=4443\n// The service port Notary listens on\nPort int32 `json:\"port,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=30004\n// The node port Notary listens on\nNodePort int32 `json:\"nodePort,omitempty\"`\n@@ -786,21 +786,21 @@ type HarborExposeClusterIPSpec struct {\ntype HarborExposePortsSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=80\n// The service port Harbor listens on when serving with HTTP.\nHTTPPort int32 `json:\"httpPort,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=443\n// The service port Harbor listens on when serving with HTTPS.\nHTTPSPort int32 `json:\"httpsPort,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:validation:ExclusiveMaximum=true\n+ // +kubebuilder:validation:ExclusiveMinimum=true\n// +kubebuilder:default=4443\n// The service port Notary listens on.\n// Only needed when notary is enabled.\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(kubebuilder): Fix port minimum values for kubebuilder Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,883
23.07.2020 18:17:23
-7,200
980324e2c6482d3dc642f9a4c7c8af06f597496f
fix(kubebuilder): Fix some integers where the value 0 should be accepted for kubebuilder
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/chartmuseum_types.go", "new_path": "apis/goharbor.io/v1alpha2/chartmuseum_types.go", "diff": "@@ -80,7 +80,7 @@ type ChartMuseumServerSpec struct {\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=20971520\n// Max size of post body (in bytes)\n- MaxUploadSize int64 `json:\"maxUploadSize,omitempty\"`\n+ MaxUploadSize *int64 `json:\"maxUploadSize,omitempty\"`\n// +kubebuilder:validation:Optional\n// Value to set in the Access-Control-Allow-Origin HTTP header\n@@ -136,7 +136,7 @@ type ChartMuseumChartStorageSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// Maximum number of objects allowed in storage (per tenant)\n- MaxStorageObjects int64 `json:\"maxStorageObject,omitempty\"`\n+ MaxStorageObjects *int64 `json:\"maxStorageObject,omitempty\"`\n}\ntype ChartMuseumChartStorageDriverSpec struct {\n@@ -241,7 +241,7 @@ type ChartMuseumChartIndexSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// Parallel scan limit for the repo indexer\n- ParallelLimit int32 `json:\"parallelLimit,omitempty\"`\n+ ParallelLimit *int32 `json:\"parallelLimit,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/component.go", "new_path": "apis/goharbor.io/v1alpha2/component.go", "diff": "@@ -62,7 +62,7 @@ type ComponentStatus struct {\n// Current number of pods.\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- Replicas int32 `json:\"replicas\"`\n+ Replicas *int32 `json:\"replicas\"`\n// Conditions list of extracted conditions from Resource\n// +listType:map\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/core_types.go", "new_path": "apis/goharbor.io/v1alpha2/core_types.go", "diff": "@@ -137,12 +137,12 @@ type CoreDatabaseSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=50\n- MaxIdleConnections int32 `json:\"maxIdleConnections,omitempty\"`\n+ MaxIdleConnections *int32 `json:\"maxIdleConnections,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=100\n- MaxOpenConnections int32 `json:\"maxOpenConnections,omitempty\"`\n+ MaxOpenConnections *int32 `json:\"maxOpenConnections,omitempty\"`\n// +kubebuilder:validation:Required\n// +kubebuilder:validation:Pattern=\"[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\"\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/registry_types.go", "new_path": "apis/goharbor.io/v1alpha2/registry_types.go", "diff": "@@ -133,12 +133,12 @@ type RegistryRedisPoolSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=3\n- MaxIdle int32 `json:\"maxIdle,omitempty\"`\n+ MaxIdle *int32 `json:\"maxIdle,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=5\n- MaxActive int32 `json:\"maxActive,omitempty\"`\n+ MaxActive *int32 `json:\"maxActive,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n@@ -327,7 +327,7 @@ type RegistryHealthStorageDriverSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=3\n- Threshold int32 `json:\"threshold,omitempty\"`\n+ Threshold *int32 `json:\"threshold,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n@@ -371,12 +371,12 @@ type RegistryHealthHTTPSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=3\n- Threshold int32 `json:\"threshold,omitempty\"`\n+ Threshold *int32 `json:\"threshold,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=200\n- StatusCode int32 `json:\"statuscode,omitempty\"`\n+ StatusCode *int32 `json:\"statuscode,omitempty\"`\n}\ntype RegistryHealthTCPSpec struct {\n@@ -399,7 +399,7 @@ type RegistryHealthTCPSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=3\n- Threshold int32 `json:\"threshold,omitempty\"`\n+ Threshold *int32 `json:\"threshold,omitempty\"`\n}\ntype RegistryNotificationsSpec struct {\n@@ -439,7 +439,7 @@ type RegistryNotificationEndpointSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n// +kubebuilder:default=3\n- Threshold int32 `json:\"threshold,omitempty\"`\n+ Threshold *int32 `json:\"threshold,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "diff": "@@ -95,6 +95,11 @@ func (in *ChartMuseumCacheSpec) DeepCopy() *ChartMuseumCacheSpec {\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *ChartMuseumChartIndexSpec) DeepCopyInto(out *ChartMuseumChartIndexSpec) {\n*out = *in\n+ if in.ParallelLimit != nil {\n+ in, out := &in.ParallelLimit, &out.ParallelLimit\n+ *out = new(int32)\n+ **out = **in\n+ }\nif in.StorageTimestampTolerance != nil {\nin, out := &in.StorageTimestampTolerance, &out.StorageTimestampTolerance\n*out = new(v1.Duration)\n@@ -236,6 +241,11 @@ func (in *ChartMuseumChartStorageDriverSpec) DeepCopy() *ChartMuseumChartStorage\nfunc (in *ChartMuseumChartStorageSpec) DeepCopyInto(out *ChartMuseumChartStorageSpec) {\n*out = *in\nin.ChartMuseumChartStorageDriverSpec.DeepCopyInto(&out.ChartMuseumChartStorageDriverSpec)\n+ if in.MaxStorageObjects != nil {\n+ in, out := &in.MaxStorageObjects, &out.MaxStorageObjects\n+ *out = new(int64)\n+ **out = **in\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChartMuseumChartStorageSpec.\n@@ -384,6 +394,11 @@ func (in *ChartMuseumServerSpec) DeepCopyInto(out *ChartMuseumServerSpec) {\n*out = new(v1.Duration)\n**out = **in\n}\n+ if in.MaxUploadSize != nil {\n+ in, out := &in.MaxUploadSize, &out.MaxUploadSize\n+ *out = new(int64)\n+ **out = **in\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChartMuseumServerSpec.\n@@ -580,6 +595,11 @@ func (in *ComponentSpec) DeepCopy() *ComponentSpec {\nfunc (in *ComponentStatus) DeepCopyInto(out *ComponentStatus) {\n*out = *in\nout.Operator = in.Operator\n+ if in.Replicas != nil {\n+ in, out := &in.Replicas, &out.Replicas\n+ *out = new(int32)\n+ **out = **in\n+ }\nif in.Conditions != nil {\nin, out := &in.Conditions, &out.Conditions\n*out = make([]Condition, len(*in))\n@@ -891,6 +911,16 @@ func (in *CoreConfig) DeepCopy() *CoreConfig {\nfunc (in *CoreDatabaseSpec) DeepCopyInto(out *CoreDatabaseSpec) {\n*out = *in\nout.OpacifiedDSN = in.OpacifiedDSN\n+ if in.MaxIdleConnections != nil {\n+ in, out := &in.MaxIdleConnections, &out.MaxIdleConnections\n+ *out = new(int32)\n+ **out = **in\n+ }\n+ if in.MaxOpenConnections != nil {\n+ in, out := &in.MaxOpenConnections, &out.MaxOpenConnections\n+ *out = new(int32)\n+ **out = **in\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoreDatabaseSpec.\n@@ -1029,7 +1059,7 @@ func (in *CoreSpec) DeepCopyInto(out *CoreSpec) {\n(*in).DeepCopyInto(*out)\n}\nout.Log = in.Log\n- out.Database = in.Database\n+ in.Database.DeepCopyInto(&out.Database)\nin.Redis.DeepCopyInto(&out.Redis)\nif in.ConfigExpiration != nil {\nin, out := &in.ConfigExpiration, &out.ConfigExpiration\n@@ -2848,6 +2878,16 @@ func (in *RegistryHealthHTTPSpec) DeepCopyInto(out *RegistryHealthHTTPSpec) {\n*out = new(v1.Duration)\n**out = **in\n}\n+ if in.Threshold != nil {\n+ in, out := &in.Threshold, &out.Threshold\n+ *out = new(int32)\n+ **out = **in\n+ }\n+ if in.StatusCode != nil {\n+ in, out := &in.StatusCode, &out.StatusCode\n+ *out = new(int32)\n+ **out = **in\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryHealthHTTPSpec.\n@@ -2900,6 +2940,11 @@ func (in *RegistryHealthSpec) DeepCopy() *RegistryHealthSpec {\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *RegistryHealthStorageDriverSpec) DeepCopyInto(out *RegistryHealthStorageDriverSpec) {\n*out = *in\n+ if in.Threshold != nil {\n+ in, out := &in.Threshold, &out.Threshold\n+ *out = new(int32)\n+ **out = **in\n+ }\nif in.Interval != nil {\nin, out := &in.Interval, &out.Interval\n*out = new(v1.Duration)\n@@ -2930,6 +2975,11 @@ func (in *RegistryHealthTCPSpec) DeepCopyInto(out *RegistryHealthTCPSpec) {\n*out = new(v1.Duration)\n**out = **in\n}\n+ if in.Threshold != nil {\n+ in, out := &in.Threshold, &out.Threshold\n+ *out = new(int32)\n+ **out = **in\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistryHealthTCPSpec.\n@@ -3097,6 +3147,11 @@ func (in *RegistryNotificationEndpointIgnoreSpec) DeepCopy() *RegistryNotificati\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *RegistryNotificationEndpointSpec) DeepCopyInto(out *RegistryNotificationEndpointSpec) {\n*out = *in\n+ if in.Threshold != nil {\n+ in, out := &in.Threshold, &out.Threshold\n+ *out = new(int32)\n+ **out = **in\n+ }\nif in.Timeout != nil {\nin, out := &in.Timeout, &out.Timeout\n*out = new(v1.Duration)\n@@ -3201,6 +3256,16 @@ func (in *RegistryProxySpec) DeepCopy() *RegistryProxySpec {\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *RegistryRedisPoolSpec) DeepCopyInto(out *RegistryRedisPoolSpec) {\n*out = *in\n+ if in.MaxIdle != nil {\n+ in, out := &in.MaxIdle, &out.MaxIdle\n+ *out = new(int32)\n+ **out = **in\n+ }\n+ if in.MaxActive != nil {\n+ in, out := &in.MaxActive, &out.MaxActive\n+ *out = new(int32)\n+ **out = **in\n+ }\nif in.IdleTimeout != nil {\nin, out := &in.IdleTimeout, &out.IdleTimeout\n*out = new(v1.Duration)\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/chartmuseum.go", "new_path": "controllers/goharbor/harbor/chartmuseum.go", "diff": "@@ -108,6 +108,8 @@ func (r *Reconciler) GetChartMuseum(ctx context.Context, harbor *goharborv1alpha\n}\npublicURL.Path += \"/chartrepo\"\n+ maxStorageObjects := int64(0)\n+ parallelLimit := int32(0)\nreturn &goharborv1alpha2.ChartMuseum{\nObjectMeta: metav1.ObjectMeta{\n@@ -127,10 +129,10 @@ func (r *Reconciler) GetChartMuseum(ctx context.Context, harbor *goharborv1alpha\nAllowOvewrite: &varTrue,\nStorage: goharborv1alpha2.ChartMuseumChartStorageSpec{\nChartMuseumChartStorageDriverSpec: harbor.Spec.Persistence.ImageChartStorage.ChartMuseum(),\n- MaxStorageObjects: 0,\n+ MaxStorageObjects: &maxStorageObjects,\n},\nIndex: goharborv1alpha2.ChartMuseumChartIndexSpec{\n- ParallelLimit: 0,\n+ ParallelLimit: &parallelLimit,\n},\nURL: publicURL.String(),\n},\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(kubebuilder): Fix some integers where the value 0 should be accepted for kubebuilder Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,883
27.07.2020 16:27:22
-7,200
f9c6367f9ad431cdefe18a15b815bb03b779d3fd
fix(component): Remove Replicas default value to fix the `make sample` command
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/component.go", "new_path": "apis/goharbor.io/v1alpha2/component.go", "diff": "@@ -10,7 +10,6 @@ import (\ntype ComponentSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Minimum=0\n- // +kubebuilder:default=1\n// Replicas is the number of desired replicas.\n// This is a pointer to distinguish between explicit zero and unspecified.\n// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(component): Remove Replicas default value to fix the `make sample` command Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,883
27.07.2020 16:28:20
-7,200
04bb0a1468af7ea21c2dca60419cfda632f68d4b
chore(apis): Remove protobuf annotations
[ { "change_type": "MODIFY", "old_path": "apis/meta/v1alpha1/component.go", "new_path": "apis/meta/v1alpha1/component.go", "diff": "@@ -53,19 +53,19 @@ type ComponentSpec struct {\n// Replicas is the number of desired replicas.\n// This is a pointer to distinguish between explicit zero and unspecified.\n// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller\n- Replicas *int32 `json:\"replicas,omitempty\" protobuf:\"varint,1,opt,name=replicas\"`\n+ Replicas *int32 `json:\"replicas,omitempty\"`\n// +kubebuilder:validation:Optional\n// ServiceAccountName is the name of the ServiceAccount to use to run this component.\n// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/\n- ServiceAccountName string `json:\"serviceAccountName,omitempty\" protobuf:\"bytes,8,opt,name=serviceAccountName\"`\n+ ServiceAccountName string `json:\"serviceAccountName,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Enum={\"Always\",\"Never\",\"IfNotPresent\"}\n// +kubebuilder:default=\"IfNotPresent\"\n// Image pull policy.\n// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images\n- ImagePullPolicy corev1.PullPolicy `json:\"imagePullPolicy,omitempty\" protobuf:\"bytes,14,opt,name=imagePullPolicy,casttype=PullPolicy\"`\n+ ImagePullPolicy corev1.PullPolicy `json:\"imagePullPolicy,omitempty\"`\n// +kubebuilder:validation:Optional\n// +listType:map\n@@ -76,17 +76,17 @@ type ComponentSpec struct {\n// NodeSelector is a selector which must be true for the component to fit on a node.\n// Selector which must match a node's labels for the pod to be scheduled on that node.\n// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/\n- NodeSelector map[string]string `json:\"nodeSelector,omitempty\" protobuf:\"bytes,7,rep,name=nodeSelector\"`\n+ NodeSelector map[string]string `json:\"nodeSelector,omitempty\"`\n// +kubebuilder:validation:Optional\n// If specified, the pod's tolerations.\n- Tolerations []corev1.Toleration `json:\"tolerations,omitempty\" protobuf:\"bytes,22,opt,name=tolerations\"`\n+ Tolerations []corev1.Toleration `json:\"tolerations,omitempty\"`\n// +kubebuilder:validation:Optional\n// Compute Resources required by this component.\n// Cannot be updated.\n// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/\n- Resources corev1.ResourceRequirements `json:\"resources,omitempty\" protobuf:\"bytes,8,opt,name=resources\"`\n+ Resources corev1.ResourceRequirements `json:\"resources,omitempty\"`\n}\n// +kubebuilder:validation:Type=object\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
chore(apis): Remove protobuf annotations Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,892
08.07.2020 10:44:02
-7,200
c0df2bd1d43ac43598156aff83a5ce76875e049e
Add trivy deployment
[ { "change_type": "MODIFY", "old_path": "config-dev.yml", "new_path": "config-dev.yml", "diff": "\"leaderElectionID\": \"harbor-operator-election-leader\",\n\"leaderElectionNamespace\": \"default\"\n}\n+- key: portal-controller-disabled\n+ value: true\n+- key: registry-controller-disabled\n+ value: true\n+- key: registryctl-controller-disabled\n+ value: true\n+- key: jobservice-controller-disabled\n+ value: true\n+- key: chartmuseum-controller-disabled\n+ value: true\n+- key: notary-server-controller-disabled\n+ value: true\n+- key: notary-signer-controller-disabled\n+ value: true\n+- key: core-controller-disabled\n+ value: true\n+- key: harbor-controller-disabled\n+ value: true\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "config/crd/kustomization.yaml", "new_path": "config/crd/kustomization.yaml", "diff": "@@ -11,6 +11,7 @@ resources:\n- bases/goharbor.io_portals.yaml\n- bases/goharbor.io_registries.yaml\n- bases/goharbor.io_registrycontrollers.yaml\n+- bases/goharbor.io_trivies.yaml\n# +kubebuilder:scaffold:crdkustomizeresource\npatchesStrategicMerge:\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/samples/trivy/goharbor_v1alpha2_trivy.yaml", "diff": "+apiVersion: goharbor.io/v1alpha2\n+kind: Trivy\n+metadata:\n+ name: sample\n+spec:\n+ cache:\n+ redis:\n+ dsn: \"redis://harbor-redis-master:6379/5\"\n+ passwordRef: harbor-redis\n+ server: {}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/samples/trivy/kustomization.yaml", "diff": "+apiVersion: kustomize.config.k8s.io/v1beta1\n+kind: Kustomization\n+commonLabels:\n+ sample: \"true\"\n+\n+secretGenerator:\n+- name: trivy\n+ literals:\n+ - htpasswd=harbor_registry_user:$2y$10$9L4Tc0DJbFFMB6RdSCunrOpTHdwhid4ktBJmLD00bYgqkkGOvll3m\n+\n+resources:\n+- goharbor_v1alpha2_trivy.yaml\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/configs.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+ \"strconv\"\n+ \"strings\"\n+\n+ corev1 \"k8s.io/api/core/v1\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+)\n+\n+func (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.ConfigMap, error) {\n+ name := r.NormalizeName(ctx, trivy.GetName())\n+ namespace := trivy.GetNamespace()\n+\n+ return &corev1.ConfigMap{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: namespace,\n+ },\n+ // populate\n+ Data: map[string]string{\n+ \"SCANNER_LOG_LEVEL\": trivy.Spec.Log.LogLevel,\n+ \"SCANNER_API_SERVER_ADDR\": trivy.Spec.Server.Address,\n+ \"SCANNER_API_SERVER_TLS_CERTIFICATE\": trivy.Spec.Server.HTTPS.CertificateRef,\n+ \"SCANNER_API_SERVER_TLS_KEY\": trivy.Spec.Server.HTTPS.KeyRef,\n+ \"SCANNER_API_SERVER_CLIENT_CAS\": trivy.Spec.Server.HTTPS.ClientCas,\n+ \"SCANNER_API_SERVER_READ_TIMEOUT\": trivy.Spec.Server.ReadTimeout.Duration.String(),\n+ \"SCANNER_API_SERVER_WRITE_TIMEOUT\": trivy.Spec.Server.WriteTimeout.Duration.String(),\n+ \"SCANNER_API_SERVER_IDLE_TIMEOUT\": trivy.Spec.Server.IdleTimeout.Duration.String(),\n+ \"SCANNER_TRIVY_CACHE_DIR\": trivy.Spec.Server.CacheDir,\n+ \"SCANNER_TRIVY_REPORTS_DIR\": trivy.Spec.Server.ReportsDir,\n+ \"SCANNER_TRIVY_DEBUG_MODE\": strconv.FormatBool(trivy.Spec.Server.DebugMode),\n+ \"SCANNER_TRIVY_VULN_TYPE\": strings.Join(trivy.Spec.Server.VulnType, \",\"),\n+ \"SCANNER_TRIVY_SEVERITY\": strings.Join(trivy.Spec.Server.Severity, \",\"),\n+ \"SCANNER_TRIVY_IGNORE_UNFIXED\": strconv.FormatBool(trivy.Spec.Server.IgnoreUnfixed),\n+ \"SCANNER_TRIVY_SKIP_UPDATE\": strconv.FormatBool(trivy.Spec.Server.SkipUpdate),\n+ \"SCANNER_TRIVY_GITHUB_TOKEN\": trivy.Spec.Server.GithubToken,\n+ \"SCANNER_TRIVY_INSECURE\": strconv.FormatBool(trivy.Spec.Server.Insecure),\n+ \"SCANNER_STORE_REDIS_NAMESPACE\": trivy.Spec.Cache.Redis.DSN,\n+ \"SCANNER_STORE_REDIS_SCAN_JOB_TTL\": trivy.Spec.Cache.RedisScanJobTTL.Duration.String(),\n+ \"SCANNER_JOB_QUEUE_REDIS_NAMESPACE\": trivy.Spec.Cache.QueueRedisNamespace,\n+ \"SCANNER_JOB_QUEUE_WORKER_CONCURRENCY\": strconv.Itoa(trivy.Spec.Cache.QueueWorkerConcurrency),\n+ \"SCANNER_REDIS_POOL_MAX_ACTIVE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxActive),\n+ \"SCANNER_REDIS_POOL_MAX_IDLE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxIdle),\n+ \"SCANNER_REDIS_POOL_IDLE_TIMEOUT\": trivy.Spec.Cache.PoolIdleTimeout.Duration.String(),\n+ \"SCANNER_REDIS_POOL_CONNECTION_TIMEOUT\": trivy.Spec.Cache.PoolConnectionTimeout.Duration.String(),\n+ \"SCANNER_REDIS_POOL_READ_TIMEOUT\": trivy.Spec.Cache.PoolReadTimeout.Duration.String(),\n+ \"SCANNER_REDIS_POOL_WRITE_TIMEOUT\": trivy.Spec.Cache.PoolWriteTimeout.Duration.String(),\n+ },\n+ }, nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+\n+ appsv1 \"k8s.io/api/apps/v1\"\n+ corev1 \"k8s.io/api/core/v1\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"k8s.io/apimachinery/pkg/util/intstr\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/pkg/errors\"\n+)\n+\n+var (\n+ varFalse = false\n+ varTrue = true\n+)\n+\n+const (\n+ HealthPath = \"/health\"\n+ port = 8080 // https://github.com/helm/chartmuseum/blob/969515a51413e1f1840fb99509401aa3c63deccd/pkg/config/vars.go#L135\n+ CacheVolumeName = \"cache\"\n+ CacheVolumePath = \"/home/scanner/.cache/trivy\"\n+ ReportsVolumeName = \"reports\"\n+ ReportsVolumePath = \"/home/scanner/.cache/reports\"\n+)\n+\n+func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*appsv1.Deployment, error) { // nolint:funlen\n+ image, err := r.GetImage(ctx)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"cannot get image\")\n+ }\n+\n+ name := r.NormalizeName(ctx, trivy.GetName())\n+ namespace := trivy.GetNamespace()\n+\n+ volumes := []corev1.Volume{\n+ {\n+ Name: CacheVolumeName,\n+ VolumeSource: corev1.VolumeSource{\n+ EmptyDir: &corev1.EmptyDirVolumeSource{},\n+ },\n+ },\n+ {\n+ Name: ReportsVolumeName,\n+ VolumeSource: corev1.VolumeSource{\n+ EmptyDir: &corev1.EmptyDirVolumeSource{},\n+ },\n+ },\n+ }\n+\n+ volumesMount := []corev1.VolumeMount{\n+ {\n+ Name: CacheVolumeName,\n+ MountPath: CacheVolumePath,\n+ },\n+ {\n+ Name: ReportsVolumeName,\n+ MountPath: ReportsVolumePath,\n+ },\n+ }\n+\n+ envFroms := []corev1.EnvFromSource{\n+ {\n+ ConfigMapRef: &corev1.ConfigMapEnvSource{\n+ LocalObjectReference: corev1.LocalObjectReference{\n+ Name: name,\n+ },\n+ },\n+ },\n+ {\n+ SecretRef: &corev1.SecretEnvSource{\n+ LocalObjectReference: corev1.LocalObjectReference{\n+ Name: name,\n+ },\n+ },\n+ },\n+ }\n+\n+ return &appsv1.Deployment{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: namespace,\n+ },\n+ Spec: appsv1.DeploymentSpec{\n+ Selector: &metav1.LabelSelector{\n+ MatchLabels: map[string]string{\n+ r.Label(\"name\"): name,\n+ r.Label(\"namespace\"): namespace,\n+ },\n+ },\n+ Replicas: trivy.Spec.Replicas,\n+ Template: corev1.PodTemplateSpec{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Labels: map[string]string{\n+ r.Label(\"name\"): name,\n+ r.Label(\"namespace\"): namespace,\n+ },\n+ },\n+ Spec: corev1.PodSpec{\n+ NodeSelector: trivy.Spec.NodeSelector,\n+ AutomountServiceAccountToken: &varFalse,\n+ Volumes: volumes,\n+\n+ Containers: []corev1.Container{\n+ {\n+ Name: \"trivy\",\n+ Image: image,\n+ Ports: []corev1.ContainerPort{\n+ {\n+ ContainerPort: port,\n+ },\n+ },\n+\n+ EnvFrom: envFroms,\n+\n+ VolumeMounts: volumesMount,\n+\n+ LivenessProbe: &corev1.Probe{\n+ Handler: corev1.Handler{\n+ HTTPGet: &corev1.HTTPGetAction{\n+ Path: HealthPath,\n+ Port: intstr.FromInt(port),\n+ },\n+ },\n+ },\n+ ReadinessProbe: &corev1.Probe{\n+ Handler: corev1.Handler{\n+ HTTPGet: &corev1.HTTPGetAction{\n+ Path: HealthPath,\n+ Port: intstr.FromInt(port),\n+ },\n+ },\n+ },\n+ },\n+ },\n+ },\n+ },\n+ },\n+ }, nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/image.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/ovh/configstore\"\n+)\n+\n+func (r *Reconciler) GetImage(ctx context.Context) (string, error) {\n+ image, err := r.ConfigStore.GetItemValue(ConfigImageKey)\n+ if err != nil {\n+ if _, ok := err.(configstore.ErrItemNotFound); !ok {\n+ return \"\", err\n+ }\n+\n+ image = DefaultImage\n+ }\n+\n+ return image, nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/resources.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/pkg/errors\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ serrors \"github.com/goharbor/harbor-operator/pkg/controller/errors\"\n+ \"github.com/goharbor/harbor-operator/pkg/resources\"\n+)\n+\n+func (r *Reconciler) NewEmpty(_ context.Context) resources.Resource {\n+ return &goharborv1alpha2.Trivy{}\n+}\n+\n+func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resource) error {\n+ trivy, ok := resource.(*goharborv1alpha2.Trivy)\n+ if !ok {\n+ return serrors.UnrecoverrableError(errors.Errorf(\"%+v\", resource), serrors.OperatorReason, \"unable to add resource\")\n+ }\n+\n+ service, err := r.GetService(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get service\")\n+ }\n+\n+ _, err = r.Controller.AddServiceToManage(ctx, service)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add service %s\", service.GetName())\n+ }\n+\n+ configMap, err := r.GetConfigMap(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get configMap\")\n+ }\n+\n+ configMapResource, err := r.Controller.AddConfigMapToManage(ctx, configMap)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add configMap %s\", configMap.GetName())\n+ }\n+\n+ secret, err := r.GetSecret(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get configMap\")\n+ }\n+\n+ secretResource, err := r.Controller.AddSecretToManage(ctx, secret)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add configMap %s\", configMap.GetName())\n+ }\n+\n+ deployment, err := r.GetDeployment(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get deployment\")\n+ }\n+\n+ _, err = r.Controller.AddDeploymentToManage(ctx, deployment, configMapResource, secretResource)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add deployment %s\", deployment.GetName())\n+ }\n+\n+ return nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/secrets.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+\n+ corev1 \"k8s.io/api/core/v1\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"k8s.io/apimachinery/pkg/types\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/pkg/errors\"\n+)\n+\n+func (r *Reconciler) GetSecret(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.Secret, error) {\n+ name := r.NormalizeName(ctx, trivy.GetName())\n+ namespace := trivy.GetNamespace()\n+ var redisPassword string\n+\n+ if trivy.Spec.Cache.Redis.PasswordRef != \"\" {\n+ var passwordSecret corev1.Secret\n+\n+ err := r.Client.Get(ctx, types.NamespacedName{\n+ Namespace: namespace,\n+ Name: trivy.Spec.Cache.Redis.PasswordRef,\n+ }, &passwordSecret)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"cannot get redis password\")\n+ }\n+\n+ password, ok := passwordSecret.Data[goharborv1alpha2.RedisPasswordKey]\n+ if !ok {\n+ return nil, errors.Errorf(\"%s not found in secret %s\", goharborv1alpha2.RedisPasswordKey, trivy.Spec.Cache.Redis.PasswordRef)\n+ }\n+\n+ redisPassword = string(password)\n+ }\n+\n+ redisDSN, err := trivy.Spec.Cache.Redis.GetDSN(redisPassword)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"cannot get redis DSN\")\n+ }\n+\n+ return &corev1.Secret{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: namespace,\n+ },\n+ StringData: map[string]string{\n+ \"SCANNER_REDIS_URL\": redisDSN.String(),\n+ },\n+ }, nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/services.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+\n+ corev1 \"k8s.io/api/core/v1\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"k8s.io/apimachinery/pkg/util/intstr\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+)\n+\n+const (\n+ PublicPort = 80\n+)\n+\n+func (r *Reconciler) GetService(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.Service, error) {\n+ name := r.NormalizeName(ctx, trivy.GetName())\n+ namespace := trivy.GetNamespace()\n+\n+ return &corev1.Service{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: namespace,\n+ },\n+ Spec: corev1.ServiceSpec{\n+ Ports: []corev1.ServicePort{\n+ {\n+ Port: PublicPort,\n+ TargetPort: intstr.FromInt(port),\n+ },\n+ },\n+ Selector: map[string]string{\n+ r.Label(\"name\"): name,\n+ r.Label(\"namespace\"): namespace,\n+ },\n+ },\n+ }, nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy/trivy.go", "diff": "+package trivy\n+\n+import (\n+ \"context\"\n+ \"time\"\n+\n+ certv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\n+ \"github.com/ovh/configstore\"\n+ \"github.com/pkg/errors\"\n+ appsv1 \"k8s.io/api/apps/v1\"\n+ corev1 \"k8s.io/api/core/v1\"\n+ ctrl \"sigs.k8s.io/controller-runtime\"\n+ \"sigs.k8s.io/controller-runtime/pkg/controller\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/config\"\n+ commonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n+ \"github.com/goharbor/harbor-operator/pkg/event-filter/class\"\n+)\n+\n+const (\n+ DefaultRequeueWait = 2 * time.Second\n+ ConfigImageKey = \"docker-image\"\n+ DefaultImage = \"goharbor/trivy-adapter-photon:v2.0.1\"\n+)\n+\n+// Reconciler reconciles a Trivy object.\n+type Reconciler struct {\n+ *commonCtrl.Controller\n+}\n+\n+func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\n+ err := r.Controller.SetupWithManager(ctx, mgr)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot setup common controller\")\n+ }\n+\n+ className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get harbor class\")\n+ }\n+\n+ concurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get concurrent reconcile\")\n+ }\n+\n+ return ctrl.NewControllerManagedBy(mgr).\n+ WithEventFilter(&class.Filter{\n+ ClassName: className,\n+ }).\n+ For(&goharborv1alpha2.Trivy{}).\n+ Owns(&appsv1.Deployment{}).\n+ Owns(&certv1.Certificate{}).\n+ Owns(&corev1.ConfigMap{}).\n+ Owns(&corev1.Secret{}).\n+ Owns(&corev1.Service{}).\n+ WithOptions(controller.Options{\n+ MaxConcurrentReconciles: int(concurrentReconcile),\n+ }).\n+ Complete(r)\n+}\n+\n+func New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n+\n+ r := &Reconciler{}\n+\n+ r.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n+\n+ return r, nil\n+}\n" }, { "change_type": "MODIFY", "old_path": "pkg/setup/controllers.go", "new_path": "pkg/setup/controllers.go", "diff": "@@ -18,6 +18,7 @@ import (\n\"github.com/goharbor/harbor-operator/controllers/goharbor/portal\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/registry\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/registryctl\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/trivy\"\n\"github.com/goharbor/harbor-operator/pkg/config\"\ncommonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n)\n@@ -36,6 +37,7 @@ var controllersBuilder = map[controllers.Controller]func(context.Context, string\ncontrollers.RegistryController: registryctl.New,\ncontrollers.Portal: portal.New,\ncontrollers.ChartMuseum: chartmuseum.New,\n+ controllers.Trivy: trivy.New,\n}\ntype ControllerFactory func(context.Context, string, string, *configstore.Store) (commonCtrl.Reconciler, error)\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
Add trivy deployment Signed-off-by: Antoine Blondeau <antoine@blondeau.me>
254,869
22.07.2020 15:41:42
-7,200
5b45e5b424938fcdb868c75e431e51e6275aa143
feat(trivy): Enable Trivy deployment on harbor-operator
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/errors.go", "new_path": "apis/goharbor.io/v1alpha2/errors.go", "diff": "@@ -8,4 +8,6 @@ var (\nErrNoMigrationConfiguration = errors.New(\"no migration source configuration\")\nErr2MigrationConfiguration = errors.New(\"only 1 migration source can be configured\")\n+\n+ ErrWrongURLFormat = errors.New(\"wrong url format\")\n)\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "new_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "diff": "package v1alpha2\nimport (\n+ \"regexp\"\n+\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+\n+ harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n)\n// +genclient\n@@ -23,7 +27,7 @@ type Trivy struct {\nSpec TrivySpec `json:\"spec,omitempty\"`\n- Status ComponentStatus `json:\"status,omitempty\"`\n+ Status harbormetav1.ComponentStatus `json:\"status,omitempty\"`\n}\n// +kubebuilder:object:root=true\n@@ -31,12 +35,13 @@ type Trivy struct {\ntype TrivyList struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ListMeta `json:\"metadata,omitempty\"`\n+\nItems []Trivy `json:\"items\"`\n}\n// TrivySpec defines the desired state of Trivy.\ntype TrivySpec struct {\n- ComponentSpec `json:\",inline\"`\n+ harbormetav1.ComponentSpec `json:\",inline\"`\n// +kubebuilder:validation:Optional\nLog TrivyLogSpec `json:\"log,omitempty\"`\n@@ -96,18 +101,14 @@ type TrivyServerSpec struct {\nDebugMode bool `json:\"debugMode,omitempty\"`\n// +kubebuilder:validation:Optional\n- // TODO +kubebuilder:validation:Enum={\"os\",\"library\"}\n- // +kubebuilder:default={\"os\",\"library\"}\n// Comma-separated list of vulnerability types.\n// Possible values are os and library.\n- VulnType []string `json:\"vulnType,omitempty\"`\n+ VulnType []TrivyServerVulnerabilityType `json:\"vulnType,omitempty\"`\n// +kubebuilder:validation:Optional\n- // TODO +kubebuilder:validation:Enum={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n- // +kubebuilder:default={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n// Comma-separated list of vulnerabilities\n// severities to be displayed\n- Severity []string `json:\"severity,omitempty\"`\n+ Severity []TrivyServerSeverityType `json:\"severity,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=false\n@@ -143,13 +144,32 @@ type TrivyServerSpec struct {\nNoProxy []string `json:\"noProxy,omitempty\"`\n}\n+// +kubebuilder:validation:Enum={\"os\",\"library\"}\n+// +kubebuilder:default={\"os\",\"library\"}\n+type TrivyServerVulnerabilityType string\n+\n+// +kubebuilder:validation:Enum={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n+// +kubebuilder:default={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n+type TrivyServerSeverityType string\n+\n+func (r *TrivyServerSpec) Validate() map[string]error {\n+ errors := make(map[string]error, 0)\n+\n+ if len(r.NoProxy) > 0 {\n+ for _, url := range r.NoProxy {\n+ matched, err := regexp.MatchString(\"https?://.+\", url)\n+ if err != nil || !matched {\n+ errors[\"NoProxy\"] = ErrWrongURLFormat\n+ }\n+ }\n+ }\n+\n+ return errors\n+}\n+\ntype TrivyLogSpec struct {\n// +kubebuilder:validation:Optional\n- // +kubebuilder:default=\"info\"\n- // +kubebuilder:validation:Enum={\"trace\",\"debug\",\"info\",\"warn\",\"warning\",\"error\",\"fatal\",\"panic\"}\n- // The standard logger logs entries\n- // with that level or anything above it.\n- LogLevel string `json:\"logLevel\"`\n+ Level harbormetav1.TrivyLogLevel `json:\"level,omitempty\"`\n}\ntype TrivyHTTPSSpec struct {\n@@ -170,7 +190,7 @@ type TrivyHTTPSSpec struct {\ntype TrivyCacheSpec struct {\n// +kubebuilder:validation:Required\n// Redis cache store\n- Redis *OpacifiedDSN `json:\"redis,omitempty\"`\n+ Redis harbormetav1.RedisConnection `json:\"redis,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=\"harbor.scanner.trivy:store\"\n" }, { "change_type": "ADD", "old_path": null, "new_path": "apis/goharbor.io/v1alpha2/trivy_webhook.go", "diff": "+package v1alpha2\n+\n+import (\n+ \"context\"\n+ apierrors \"k8s.io/apimachinery/pkg/api/errors\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+ \"k8s.io/apimachinery/pkg/runtime/schema\"\n+ \"k8s.io/apimachinery/pkg/util/validation/field\"\n+ ctrl \"sigs.k8s.io/controller-runtime\"\n+ logf \"sigs.k8s.io/controller-runtime/pkg/log\"\n+ \"sigs.k8s.io/controller-runtime/pkg/webhook\"\n+)\n+\n+// log is for logging in this package.\n+var trivyLog = logf.Log.WithName(\"trivy-resource\")\n+\n+func (r *Trivy) SetupWebhookWithManager(ctx context.Context, mgr ctrl.Manager) error {\n+ return ctrl.NewWebhookManagedBy(mgr).\n+ For(r).\n+ Complete()\n+}\n+\n+// +kubebuilder:webhook:verbs=create;update,path=/validate-goharbor-io-v1alpha2-trivy,mutating=false,failurePolicy=fail,groups=goharbor.io,resources=trivies,versions=v1alpha2,name=mtrivy.kb.io\n+\n+var _ webhook.Validator = &Trivy{}\n+\n+// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.\n+func (r *Trivy) ValidateCreate() error {\n+ registrylog.Info(\"validate create\", \"name\", r.Name)\n+\n+ return r.Validate()\n+}\n+\n+// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.\n+func (r *Trivy) ValidateUpdate(old runtime.Object) error {\n+ registrylog.Info(\"validate update\", \"name\", r.Name)\n+\n+ return r.Validate()\n+}\n+\n+// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.\n+func (r *Trivy) ValidateDelete() error {\n+ registrylog.Info(\"validate delete\", \"name\", r.Name)\n+\n+ return nil\n+}\n+\n+func (r *Trivy) Validate() error {\n+ var allErrs field.ErrorList\n+\n+ errs := r.Spec.Server.Validate()\n+ if len(errs) == 0 {\n+ return nil\n+ }\n+\n+ for fieldName, err := range errs {\n+ allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"server\").Child(fieldName), r.Spec.Server, err.Error()))\n+ }\n+\n+ return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: \"Trivy\"}, r.Name, allErrs)\n+}\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "diff": "@@ -3197,6 +3197,74 @@ func (in *RegistryValidationSpec) DeepCopy() *RegistryValidationSpec {\nreturn out\n}\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *Trivy) DeepCopyInto(out *Trivy) {\n+ *out = *in\n+ out.TypeMeta = in.TypeMeta\n+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n+ in.Spec.DeepCopyInto(&out.Spec)\n+ in.Status.DeepCopyInto(&out.Status)\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trivy.\n+func (in *Trivy) DeepCopy() *Trivy {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(Trivy)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.\n+func (in *Trivy) DeepCopyObject() runtime.Object {\n+ if c := in.DeepCopy(); c != nil {\n+ return c\n+ }\n+ return nil\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivyCacheSpec) DeepCopyInto(out *TrivyCacheSpec) {\n+ *out = *in\n+ out.Redis = in.Redis\n+ if in.RedisScanJobTTL != nil {\n+ in, out := &in.RedisScanJobTTL, &out.RedisScanJobTTL\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.PoolIdleTimeout != nil {\n+ in, out := &in.PoolIdleTimeout, &out.PoolIdleTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.PoolConnectionTimeout != nil {\n+ in, out := &in.PoolConnectionTimeout, &out.PoolConnectionTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.PoolReadTimeout != nil {\n+ in, out := &in.PoolReadTimeout, &out.PoolReadTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.PoolWriteTimeout != nil {\n+ in, out := &in.PoolWriteTimeout, &out.PoolWriteTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyCacheSpec.\n+func (in *TrivyCacheSpec) DeepCopy() *TrivyCacheSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivyCacheSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *TrivyComponentSpec) DeepCopyInto(out *TrivyComponentSpec) {\n*out = *in\n@@ -3212,3 +3280,130 @@ func (in *TrivyComponentSpec) DeepCopy() *TrivyComponentSpec {\nin.DeepCopyInto(out)\nreturn out\n}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivyHTTPSSpec) DeepCopyInto(out *TrivyHTTPSSpec) {\n+ *out = *in\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyHTTPSSpec.\n+func (in *TrivyHTTPSSpec) DeepCopy() *TrivyHTTPSSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivyHTTPSSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivyList) DeepCopyInto(out *TrivyList) {\n+ *out = *in\n+ out.TypeMeta = in.TypeMeta\n+ in.ListMeta.DeepCopyInto(&out.ListMeta)\n+ if in.Items != nil {\n+ in, out := &in.Items, &out.Items\n+ *out = make([]Trivy, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyList.\n+func (in *TrivyList) DeepCopy() *TrivyList {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivyList)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.\n+func (in *TrivyList) DeepCopyObject() runtime.Object {\n+ if c := in.DeepCopy(); c != nil {\n+ return c\n+ }\n+ return nil\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivyLogSpec) DeepCopyInto(out *TrivyLogSpec) {\n+ *out = *in\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyLogSpec.\n+func (in *TrivyLogSpec) DeepCopy() *TrivyLogSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivyLogSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivyServerSpec) DeepCopyInto(out *TrivyServerSpec) {\n+ *out = *in\n+ out.HTTPS = in.HTTPS\n+ if in.ReadTimeout != nil {\n+ in, out := &in.ReadTimeout, &out.ReadTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.WriteTimeout != nil {\n+ in, out := &in.WriteTimeout, &out.WriteTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.IdleTimeout != nil {\n+ in, out := &in.IdleTimeout, &out.IdleTimeout\n+ *out = new(v1.Duration)\n+ **out = **in\n+ }\n+ if in.VulnType != nil {\n+ in, out := &in.VulnType, &out.VulnType\n+ *out = make([]TrivyServerVulnerabilityType, len(*in))\n+ copy(*out, *in)\n+ }\n+ if in.Severity != nil {\n+ in, out := &in.Severity, &out.Severity\n+ *out = make([]TrivyServerSeverityType, len(*in))\n+ copy(*out, *in)\n+ }\n+ if in.NoProxy != nil {\n+ in, out := &in.NoProxy, &out.NoProxy\n+ *out = make([]string, len(*in))\n+ copy(*out, *in)\n+ }\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyServerSpec.\n+func (in *TrivyServerSpec) DeepCopy() *TrivyServerSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivyServerSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *TrivySpec) DeepCopyInto(out *TrivySpec) {\n+ *out = *in\n+ in.ComponentSpec.DeepCopyInto(&out.ComponentSpec)\n+ out.Log = in.Log\n+ in.Server.DeepCopyInto(&out.Server)\n+ in.Cache.DeepCopyInto(&out.Cache)\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivySpec.\n+func (in *TrivySpec) DeepCopy() *TrivySpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(TrivySpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n" }, { "change_type": "MODIFY", "old_path": "apis/meta/v1alpha1/logs.go", "new_path": "apis/meta/v1alpha1/logs.go", "diff": "@@ -170,3 +170,36 @@ func (l HarborLogLevel) Notary() NotaryLogLevel {\nreturn NotaryFatal\n}\n}\n+\n+// +kubebuilder:validation:Type=string\n+// +kubebuilder:validation:Enum={\"debug\",\"info\",\"warning\",\"error\",\"fatal\",\"panic\"}\n+// +kubebuilder:default=\"info\"\n+// TrivyLogLevel is the log level for Trivy.\n+type TrivyLogLevel string\n+\n+const (\n+ TrivyDebug TrivyLogLevel = \"debug\"\n+ TrivyInfo TrivyLogLevel = \"info\"\n+ TrivyWarning TrivyLogLevel = \"warning\"\n+ TrivyError TrivyLogLevel = \"error\"\n+ TrivyFatal TrivyLogLevel = \"fatal\"\n+ TrivyPanic TrivyLogLevel = \"panic\"\n+ TrivyDefaultLevel TrivyLogLevel = TrivyInfo\n+)\n+\n+func (l HarborLogLevel) Trivy() TrivyLogLevel {\n+ switch l {\n+ default:\n+ return TrivyDefaultLevel\n+ case HarborDebug:\n+ return TrivyDebug\n+ case HarborInfo:\n+ return TrivyInfo\n+ case HarborWarning:\n+ return TrivyWarning\n+ case HarborError:\n+ return TrivyError\n+ case HarborFatal:\n+ return TrivyFatal\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "config-dev.yml", "new_path": "config-dev.yml", "diff": "}\n- key: portal-controller-disabled\nvalue: true\n+- key: trivy-controller-disabled\n+ value: true\n- key: registry-controller-disabled\nvalue: true\n- key: registryctl-controller-disabled\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/controller_test.go", "new_path": "controllers/goharbor/controller_test.go", "diff": "@@ -90,7 +90,6 @@ var _ = DescribeTable(\n}\nExpect(k8sClient.Get(ctx, key, resource)).To(Succeed(), \"resource should still be accessible\")\n-\nEventually(resourceController.GetStatusFunc(ctx, key), timeouts...).\nShould(MatchFields(IgnoreExtras, Fields{\n\"ObservedGeneration\": BeEquivalentTo(resource.GetGeneration()),\n@@ -121,6 +120,7 @@ var _ = DescribeTable(\nEntry(\"Registry\", newRegistryController(), time.Minute, 5*time.Second),\nEntry(\"RegistryCtl\", newRegistryCtlController(), 2*time.Minute, 5*time.Second),\nEntry(\"ChartMuseum\", newChartMuseumController(), time.Minute, 5*time.Second),\n+ Entry(\"Trivy\", newTrivyController(), time.Minute, 5*time.Second),\nEntry(\"NotaryServer\", newNotaryServerController(), time.Minute, 5*time.Second),\nEntry(\"NotarySigner\", newNotarySignerController(), time.Minute, 5*time.Second),\nEntry(\"Core\", newCoreController(), time.Minute, 5*time.Second),\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/configs.go", "new_path": "controllers/goharbor/trivy/configs.go", "diff": "@@ -2,8 +2,10 @@ package trivy\nimport (\n\"context\"\n+ \"fmt\"\n\"strconv\"\n- \"strings\"\n+\n+ \"github.com/pkg/errors\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n@@ -11,6 +13,23 @@ import (\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n)\n+func (r *Reconciler) AddConfigMap(ctx context.Context, trivy *goharborv1alpha2.Trivy) error {\n+ // Forge the ConfigMap resource\n+ cm, err := r.GetConfigMap(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get config map\")\n+ }\n+\n+ // Add config map to reconciler controller\n+ _, err = r.Controller.AddConfigMapToManage(ctx, cm)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot manage config map %s\", cm.GetName())\n+ }\n+\n+ return nil\n+}\n+\n+// Get the config map linked to the trivy deployment\nfunc (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.ConfigMap, error) {\nname := r.NormalizeName(ctx, trivy.GetName())\nnamespace := trivy.GetNamespace()\n@@ -20,9 +39,10 @@ func (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.T\nName: name,\nNamespace: namespace,\n},\n- // populate\n+\nData: map[string]string{\n- \"SCANNER_LOG_LEVEL\": trivy.Spec.Log.LogLevel,\n+ \"SCANNER_LOG_LEVEL\": string(trivy.Spec.Log.Level),\n+\n\"SCANNER_API_SERVER_ADDR\": trivy.Spec.Server.Address,\n\"SCANNER_API_SERVER_TLS_CERTIFICATE\": trivy.Spec.Server.HTTPS.CertificateRef,\n\"SCANNER_API_SERVER_TLS_KEY\": trivy.Spec.Server.HTTPS.KeyRef,\n@@ -30,25 +50,59 @@ func (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.T\n\"SCANNER_API_SERVER_READ_TIMEOUT\": trivy.Spec.Server.ReadTimeout.Duration.String(),\n\"SCANNER_API_SERVER_WRITE_TIMEOUT\": trivy.Spec.Server.WriteTimeout.Duration.String(),\n\"SCANNER_API_SERVER_IDLE_TIMEOUT\": trivy.Spec.Server.IdleTimeout.Duration.String(),\n+\n\"SCANNER_TRIVY_CACHE_DIR\": trivy.Spec.Server.CacheDir,\n\"SCANNER_TRIVY_REPORTS_DIR\": trivy.Spec.Server.ReportsDir,\n\"SCANNER_TRIVY_DEBUG_MODE\": strconv.FormatBool(trivy.Spec.Server.DebugMode),\n- \"SCANNER_TRIVY_VULN_TYPE\": strings.Join(trivy.Spec.Server.VulnType, \",\"),\n- \"SCANNER_TRIVY_SEVERITY\": strings.Join(trivy.Spec.Server.Severity, \",\"),\n+ \"SCANNER_TRIVY_VULN_TYPE\": GetVulnerabilities(trivy.Spec.Server.VulnType),\n+ \"SCANNER_TRIVY_SEVERITY\": GetSeverities(trivy.Spec.Server.Severity),\n\"SCANNER_TRIVY_IGNORE_UNFIXED\": strconv.FormatBool(trivy.Spec.Server.IgnoreUnfixed),\n\"SCANNER_TRIVY_SKIP_UPDATE\": strconv.FormatBool(trivy.Spec.Server.SkipUpdate),\n\"SCANNER_TRIVY_GITHUB_TOKEN\": trivy.Spec.Server.GithubToken,\n\"SCANNER_TRIVY_INSECURE\": strconv.FormatBool(trivy.Spec.Server.Insecure),\n- \"SCANNER_STORE_REDIS_NAMESPACE\": trivy.Spec.Cache.Redis.DSN,\n+\n+ \"SCANNER_STORE_REDIS_NAMESPACE\": trivy.Spec.Cache.RedisNamespace,\n\"SCANNER_STORE_REDIS_SCAN_JOB_TTL\": trivy.Spec.Cache.RedisScanJobTTL.Duration.String(),\n+\n\"SCANNER_JOB_QUEUE_REDIS_NAMESPACE\": trivy.Spec.Cache.QueueRedisNamespace,\n\"SCANNER_JOB_QUEUE_WORKER_CONCURRENCY\": strconv.Itoa(trivy.Spec.Cache.QueueWorkerConcurrency),\n- \"SCANNER_REDIS_POOL_MAX_ACTIVE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxActive),\n- \"SCANNER_REDIS_POOL_MAX_IDLE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxIdle),\n+\n\"SCANNER_REDIS_POOL_IDLE_TIMEOUT\": trivy.Spec.Cache.PoolIdleTimeout.Duration.String(),\n\"SCANNER_REDIS_POOL_CONNECTION_TIMEOUT\": trivy.Spec.Cache.PoolConnectionTimeout.Duration.String(),\n\"SCANNER_REDIS_POOL_READ_TIMEOUT\": trivy.Spec.Cache.PoolReadTimeout.Duration.String(),\n\"SCANNER_REDIS_POOL_WRITE_TIMEOUT\": trivy.Spec.Cache.PoolWriteTimeout.Duration.String(),\n+ \"SCANNER_REDIS_POOL_MAX_ACTIVE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxActive),\n+ \"SCANNER_REDIS_POOL_MAX_IDLE\": strconv.Itoa(trivy.Spec.Cache.PoolMaxIdle),\n},\n}, nil\n}\n+\n+// Explode array of vulnerabilities type into a string separated by commas\n+func GetVulnerabilities(vulnType []goharborv1alpha2.TrivyServerVulnerabilityType) string {\n+ vulnerabilities := \"\"\n+\n+ for index, v := range vulnType {\n+ if index == 0 {\n+ vulnerabilities = string(v)\n+ } else {\n+ vulnerabilities = fmt.Sprintf(\"%s,%s\", vulnerabilities, v)\n+ }\n+ }\n+\n+ return vulnerabilities\n+}\n+\n+// Explode array of severities type into a string separated by commas\n+func GetSeverities(sevType []goharborv1alpha2.TrivyServerSeverityType) string {\n+ severities := \"\"\n+\n+ for index, s := range sevType {\n+ if index == 0 {\n+ severities = string(s)\n+ } else {\n+ severities = fmt.Sprintf(\"%s,%s\", severities, s)\n+ }\n+ }\n+\n+ return severities\n+}\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -18,7 +18,9 @@ var (\n)\nconst (\n- HealthPath = \"/health\"\n+ ContainerName = \"trivy\"\n+ LivenessProbe = \"/probe/healthy\"\n+ ReadinessProbe = \"/probe/ready\"\nport = 8080 // https://github.com/helm/chartmuseum/blob/969515a51413e1f1840fb99509401aa3c63deccd/pkg/config/vars.go#L135\nCacheVolumeName = \"cache\"\nCacheVolumePath = \"/home/scanner/.cache/trivy\"\n@@ -26,15 +28,31 @@ const (\nReportsVolumePath = \"/home/scanner/.cache/reports\"\n)\n-func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*appsv1.Deployment, error) { // nolint:funlen\n- image, err := r.GetImage(ctx)\n+func (r *Reconciler) AddDeployment(ctx context.Context, trivy *goharborv1alpha2.Trivy) error {\n+ // Forge the deploy resource\n+ deploy, err := r.GetDeployment(ctx, trivy)\nif err != nil {\n- return nil, errors.Wrap(err, \"cannot get image\")\n+ return errors.Wrap(err, \"cannot get deployment\")\n+ }\n+\n+ // Add deploy to reconciler controller\n+ _, err = r.Controller.AddDeploymentToManage(ctx, deploy)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot manage deploy %s\", deploy.GetName())\n+ }\n+\n+ return nil\n}\n+func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*appsv1.Deployment, error) { // nolint:funlen\nname := r.NormalizeName(ctx, trivy.GetName())\nnamespace := trivy.GetNamespace()\n+ image, err := r.GetImage(ctx)\n+ if err != nil {\n+ return nil, errors.Wrapf(err, \"cannot get image for deploy: %s\", name)\n+ }\n+\nvolumes := []corev1.Volume{\n{\nName: CacheVolumeName,\n@@ -105,7 +123,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nContainers: []corev1.Container{\n{\n- Name: \"trivy\",\n+ Name: ContainerName,\nImage: image,\nPorts: []corev1.ContainerPort{\n{\n@@ -114,13 +132,12 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\n},\nEnvFrom: envFroms,\n-\nVolumeMounts: volumesMount,\nLivenessProbe: &corev1.Probe{\nHandler: corev1.Handler{\nHTTPGet: &corev1.HTTPGetAction{\n- Path: HealthPath,\n+ Path: LivenessProbe,\nPort: intstr.FromInt(port),\n},\n},\n@@ -128,7 +145,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nReadinessProbe: &corev1.Probe{\nHandler: corev1.Handler{\nHTTPGet: &corev1.HTTPGetAction{\n- Path: HealthPath,\n+ Path: ReadinessProbe,\nPort: intstr.FromInt(port),\n},\n},\n" }, { "change_type": "RENAME", "old_path": "controllers/goharbor/trivy/image.go", "new_path": "controllers/goharbor/trivy/images.go", "diff": "" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/resources.go", "new_path": "controllers/goharbor/trivy/resources.go", "diff": "@@ -2,7 +2,6 @@ package trivy\nimport (\n\"context\"\n-\n\"github.com/pkg/errors\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -15,49 +14,34 @@ func (r *Reconciler) NewEmpty(_ context.Context) resources.Resource {\n}\nfunc (r *Reconciler) AddResources(ctx context.Context, resource resources.Resource) error {\n+ // Fetch the trivy resources definition\ntrivy, ok := resource.(*goharborv1alpha2.Trivy)\nif !ok {\nreturn serrors.UnrecoverrableError(errors.Errorf(\"%+v\", resource), serrors.OperatorReason, \"unable to add resource\")\n}\n- service, err := r.GetService(ctx, trivy)\n- if err != nil {\n- return errors.Wrap(err, \"cannot get service\")\n- }\n-\n- _, err = r.Controller.AddServiceToManage(ctx, service)\n- if err != nil {\n- return errors.Wrapf(err, \"cannot add service %s\", service.GetName())\n- }\n-\n- configMap, err := r.GetConfigMap(ctx, trivy)\n- if err != nil {\n- return errors.Wrap(err, \"cannot get configMap\")\n- }\n-\n- configMapResource, err := r.Controller.AddConfigMapToManage(ctx, configMap)\n- if err != nil {\n- return errors.Wrapf(err, \"cannot add configMap %s\", configMap.GetName())\n- }\n-\n- secret, err := r.GetSecret(ctx, trivy)\n+ // Add Trivy service resources with a public port for Trivy deployment\n+ err := r.AddService(ctx, trivy)\nif err != nil {\n- return errors.Wrap(err, \"cannot get configMap\")\n+ return errors.Wrap(err, \"cannot add service\")\n}\n- secretResource, err := r.Controller.AddSecretToManage(ctx, secret)\n+ // Add Trivy config map resources with all Trivy custom definition\n+ err = r.AddConfigMap(ctx, trivy)\nif err != nil {\n- return errors.Wrapf(err, \"cannot add configMap %s\", configMap.GetName())\n+ return errors.Wrap(err, \"cannot add config map\")\n}\n- deployment, err := r.GetDeployment(ctx, trivy)\n+ // Add Trivy secret resources with creds for Redis\n+ err = r.AddSecret(ctx, trivy)\nif err != nil {\n- return errors.Wrap(err, \"cannot get deployment\")\n+ return errors.Wrap(err, \"cannot add secret\")\n}\n- _, err = r.Controller.AddDeploymentToManage(ctx, deployment, configMapResource, secretResource)\n+ // Add Trivy deployment and volumes resources\n+ err = r.AddDeployment(ctx, trivy)\nif err != nil {\n- return errors.Wrapf(err, \"cannot add deployment %s\", deployment.GetName())\n+ return errors.Wrap(err, \"cannot add deployment\")\n}\nreturn nil\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/secrets.go", "new_path": "controllers/goharbor/trivy/secrets.go", "diff": "@@ -8,13 +8,31 @@ import (\n\"k8s.io/apimachinery/pkg/types\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n\"github.com/pkg/errors\"\n)\n+func (r *Reconciler) AddSecret(ctx context.Context, trivy *goharborv1alpha2.Trivy) error {\n+ // Forge the secret resource\n+ secret, err := r.GetSecret(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get secret\")\n+ }\n+\n+ // Add secret to reconciler controller\n+ _, err = r.Controller.AddSecretToManage(ctx, secret)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot manage secret %s\", secret.GetName())\n+ }\n+\n+ return nil\n+}\n+\nfunc (r *Reconciler) GetSecret(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.Secret, error) {\n+ var redisPassword string\n+\nname := r.NormalizeName(ctx, trivy.GetName())\nnamespace := trivy.GetNamespace()\n- var redisPassword string\nif trivy.Spec.Cache.Redis.PasswordRef != \"\" {\nvar passwordSecret corev1.Secret\n@@ -27,18 +45,15 @@ func (r *Reconciler) GetSecret(ctx context.Context, trivy *goharborv1alpha2.Triv\nreturn nil, errors.Wrap(err, \"cannot get redis password\")\n}\n- password, ok := passwordSecret.Data[goharborv1alpha2.RedisPasswordKey]\n+ password, ok := passwordSecret.Data[harbormetav1.RedisPasswordKey]\nif !ok {\n- return nil, errors.Errorf(\"%s not found in secret %s\", goharborv1alpha2.RedisPasswordKey, trivy.Spec.Cache.Redis.PasswordRef)\n+ return nil, errors.Errorf(\"%s not found in secret %s\", harbormetav1.RedisPasswordKey, trivy.Spec.Cache.Redis.PasswordRef)\n}\nredisPassword = string(password)\n}\n- redisDSN, err := trivy.Spec.Cache.Redis.GetDSN(redisPassword)\n- if err != nil {\n- return nil, errors.Wrap(err, \"cannot get redis DSN\")\n- }\n+ redisDSN := trivy.Spec.Cache.Redis.GetDSN(redisPassword)\nreturn &corev1.Secret{\nObjectMeta: metav1.ObjectMeta{\n@@ -47,6 +62,7 @@ func (r *Reconciler) GetSecret(ctx context.Context, trivy *goharborv1alpha2.Triv\n},\nStringData: map[string]string{\n\"SCANNER_REDIS_URL\": redisDSN.String(),\n+ \"SCANNER_JOB_QUEUE_REDIS_URL\": redisDSN.String(),\n},\n}, nil\n}\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/services.go", "new_path": "controllers/goharbor/trivy/services.go", "diff": "@@ -3,6 +3,8 @@ package trivy\nimport (\n\"context\"\n+ \"github.com/pkg/errors\"\n+\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/util/intstr\"\n@@ -14,6 +16,22 @@ const (\nPublicPort = 80\n)\n+func (r *Reconciler) AddService(ctx context.Context, trivy *goharborv1alpha2.Trivy) error {\n+ // Forge the service resource\n+ service, err := r.GetService(ctx, trivy)\n+ if err != nil {\n+ return errors.Wrap(err, \"cannot get service\")\n+ }\n+\n+ // Add service to reconciler controller\n+ _, err = r.Controller.AddServiceToManage(ctx, service)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot manage service %s\", service.GetName())\n+ }\n+\n+ return nil\n+}\n+\nfunc (r *Reconciler) GetService(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.Service, error) {\nname := r.NormalizeName(ctx, trivy.GetName())\nnamespace := trivy.GetNamespace()\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/trivy.go", "new_path": "controllers/goharbor/trivy/trivy.go", "diff": "@@ -4,15 +4,15 @@ import (\n\"context\"\n\"time\"\n- certv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\n\"github.com/ovh/configstore\"\n\"github.com/pkg/errors\"\n+\n+ certv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\nappsv1 \"k8s.io/api/apps/v1\"\ncorev1 \"k8s.io/api/core/v1\"\nctrl \"sigs.k8s.io/controller-runtime\"\n\"sigs.k8s.io/controller-runtime/pkg/controller\"\n- goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/config\"\ncommonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n\"github.com/goharbor/harbor-operator/pkg/event-filter/class\"\n@@ -49,7 +49,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nWithEventFilter(&class.Filter{\nClassName: className,\n}).\n- For(&goharborv1alpha2.Trivy{}).\n+ For(r.NewEmpty(ctx)).\nOwns(&appsv1.Deployment{}).\nOwns(&certv1.Certificate{}).\nOwns(&corev1.ConfigMap{}).\n@@ -62,7 +62,6 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\n}\nfunc New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n-\nr := &Reconciler{}\nr.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/trivy_test.go", "diff": "+/*\n+Copyright 2019 The Kubernetes Authors.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package goharbor_test\n+\n+import (\n+ \"context\"\n+\n+ . \"github.com/onsi/gomega\"\n+\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"sigs.k8s.io/controller-runtime/pkg/client\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n+)\n+\n+func newTrivyController() controllerTest {\n+ return controllerTest{\n+ Setup: setupValidTrivy,\n+ Update: updateTrivy,\n+ GetStatusFunc: getTrivyStatusFunc,\n+ }\n+}\n+\n+func setupValidTrivy(ctx context.Context, ns string) (Resource, client.ObjectKey) {\n+ var replicas int32 = 1\n+\n+ name := newName(\"trivy\")\n+ trivy := &goharborv1alpha2.Trivy{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: ns,\n+ },\n+\n+ Spec: goharborv1alpha2.TrivySpec{\n+ ComponentSpec: harbormetav1.ComponentSpec{\n+ Replicas: &replicas,\n+ },\n+\n+ Server: goharborv1alpha2.TrivyServerSpec{\n+ Address: \":8080\",\n+ CacheDir: \"/home/scanner/.cache/trivy\",\n+ ReportsDir: \"/home/scanner/.cache/reports\",\n+ },\n+\n+ Cache: goharborv1alpha2.TrivyCacheSpec{\n+ Redis: harbormetav1.RedisConnection{\n+ RedisHostSpec: harbormetav1.RedisHostSpec{\n+ Host: \"10.2.1.14\",\n+ Port: 6379,\n+ },\n+ Database: 5,\n+ },\n+ },\n+\n+ Log: goharborv1alpha2.TrivyLogSpec{\n+ Level: harbormetav1.TrivyDefaultLevel,\n+ },\n+ },\n+ }\n+\n+ Expect(k8sClient.Create(ctx, trivy)).To(Succeed())\n+\n+ return trivy, client.ObjectKey{\n+ Name: name,\n+ Namespace: ns,\n+ }\n+}\n+\n+func updateTrivy(ctx context.Context, object Resource) {\n+ trivy, ok := object.(*goharborv1alpha2.Trivy)\n+ Expect(ok).To(BeTrue())\n+\n+ var replicas int32 = 1\n+\n+ if trivy.Spec.Replicas != nil {\n+ replicas = *trivy.Spec.Replicas + 1\n+ }\n+\n+ trivy.Spec.Replicas = &replicas\n+}\n+\n+func getTrivyStatusFunc(ctx context.Context, key client.ObjectKey) func() harbormetav1.ComponentStatus {\n+ return func() harbormetav1.ComponentStatus {\n+ var trivy goharborv1alpha2.Trivy\n+\n+ err := k8sClient.Get(ctx, key, &trivy)\n+\n+ Expect(err).ToNot(HaveOccurred())\n+\n+ return trivy.Status\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "pkg/setup/webhooks.go", "new_path": "pkg/setup/webhooks.go", "diff": "@@ -20,6 +20,7 @@ var webhooksBuilder = map[controllers.Controller]WebHook{\ncontrollers.Registry: &goharborv1alpha2.Registry{},\ncontrollers.NotaryServer: &goharborv1alpha2.NotaryServer{},\ncontrollers.NotarySigner: &goharborv1alpha2.NotarySigner{},\n+ controllers.Trivy: &goharborv1alpha2.Trivy{},\n}\ntype WebHook interface {\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(trivy): Enable Trivy deployment on harbor-operator Signed-off-by: Pierrick Gicquelais <pierrick.gicquelais@epitech.eu>
254,883
22.07.2020 16:43:53
-7,200
683a1cfe11615f2715b85320994a45ef4c1b4bb4
fix(config-dev): Remove debug configurations
[ { "change_type": "MODIFY", "old_path": "config-dev.yml", "new_path": "config-dev.yml", "diff": "\"leaderElectionID\": \"harbor-operator-election-leader\",\n\"leaderElectionNamespace\": \"default\"\n}\n-- key: portal-controller-disabled\n- value: true\n-- key: trivy-controller-disabled\n- value: true\n-- key: registry-controller-disabled\n- value: true\n-- key: registryctl-controller-disabled\n- value: true\n-- key: jobservice-controller-disabled\n- value: true\n-- key: chartmuseum-controller-disabled\n- value: true\n-- key: notary-server-controller-disabled\n- value: true\n-- key: notary-signer-controller-disabled\n- value: true\n-- key: core-controller-disabled\n- value: true\n-- key: harbor-controller-disabled\n- value: true\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(config-dev): Remove debug configurations Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,883
22.07.2020 17:11:04
-7,200
e46f8c6e35d8a2e98c782442b25bcd936c881a9f
feat(README): Mention trivy in README fix(apis): Fix some duplicated comments chore(trivy): Lint files
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -57,6 +57,7 @@ Following components are optional:\n- ChartMuseum\n- Notary\n- Clair\n+- Trivy\n### Delete the stack\n@@ -64,7 +65,7 @@ When deleting the Harbor resource, all linked components are deleted. With two H\n### Adding/Removing a component\n-It is possible to add and delete ChartMuseum, Notary and Clair by editing the Harbor resource.\n+It is possible to add and delete ChartMuseum, Notary, Clair and Trivy by editing the Harbor resource.\n### Future features\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/chartmuseum_types.go", "new_path": "apis/goharbor.io/v1alpha2/chartmuseum_types.go", "diff": "@@ -16,9 +16,9 @@ import (\n// +resource:path=chartmuseum\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// ChartMuseum is the Schema for the registries API.\n+// ChartMuseum is the Schema for the ChartMuseum API.\ntype ChartMuseum struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/core_types.go", "new_path": "apis/goharbor.io/v1alpha2/core_types.go", "diff": "@@ -16,9 +16,9 @@ import (\n// +resource:path=core\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// Core is the Schema for the registries API.\n+// Core is the Schema for the Core API.\ntype Core struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/jobservice_types.go", "new_path": "apis/goharbor.io/v1alpha2/jobservice_types.go", "diff": "@@ -19,9 +19,9 @@ import (\n// +resource:path=jobservice\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// JobService is the Schema for the registries API.\n+// JobService is the Schema for the JobService API.\ntype JobService struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/notaryserver_types.go", "new_path": "apis/goharbor.io/v1alpha2/notaryserver_types.go", "diff": "@@ -17,9 +17,9 @@ import (\n// +resource:path=notaryserver\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// NotaryServer is the Schema for the registries API.\n+// NotaryServer is the Schema for the NotaryServer API.\ntype NotaryServer struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/notarysigner_types.go", "new_path": "apis/goharbor.io/v1alpha2/notarysigner_types.go", "diff": "@@ -17,9 +17,9 @@ const NotarySignerAPIPort = 7899\n// +resource:path=notarysigner\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// NotarySigner is the Schema for the registries API.\n+// NotarySigner is the Schema for the NotarySigner API.\ntype NotarySigner struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/portal_types.go", "new_path": "apis/goharbor.io/v1alpha2/portal_types.go", "diff": "@@ -15,7 +15,7 @@ import (\n// +resource:path=portal\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n// Portal is the Schema for the portals API.\ntype Portal struct {\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/registry_types.go", "new_path": "apis/goharbor.io/v1alpha2/registry_types.go", "diff": "@@ -23,7 +23,7 @@ const (\n// +kubebuilder:subresource:status\n// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n// Registry is the Schema for the registries API.\ntype Registry struct {\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/registryctl_types.go", "new_path": "apis/goharbor.io/v1alpha2/registryctl_types.go", "diff": "@@ -26,9 +26,9 @@ const (\n// +resource:path=registrycontroller\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// RegistryController is the Schema for the registries API.\n+// RegistryController is the Schema for the RegistryController API.\ntype RegistryController struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "new_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "diff": "@@ -18,9 +18,9 @@ import (\n// +resource:path=trivy\n// +kubebuilder:subresource:status\n// +kubebuilder:resource:categories=\"goharbor\"\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=5\n+// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver version\",priority=5\n// +kubebuilder:printcolumn:name=\"Replicas\",type=string,JSONPath=`.spec.replicas`,description=\"The number of replicas\",priority=0\n-// Trivy is the Schema for the registries API.\n+// Trivy is the Schema for the Trivy API.\ntype Trivy struct {\nmetav1.TypeMeta `json:\",inline\"`\nmetav1.ObjectMeta `json:\"metadata,omitempty\"`\n@@ -95,11 +95,6 @@ type TrivyServerSpec struct {\n// Trivy reports directory\nReportsDir string `json:\"reportsDir,omitempty\"`\n- // +kubebuilder:validation:Optional\n- // +kubebuilder:default=false\n- // The flag to enable or disable Trivy debug mode\n- DebugMode bool `json:\"debugMode,omitempty\"`\n-\n// +kubebuilder:validation:Optional\n// Comma-separated list of vulnerability types.\n// Possible values are os and library.\n@@ -117,18 +112,23 @@ type TrivyServerSpec struct {\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=false\n- // The flag to enable or disable Trivy DB downloads from GitHub\n- SkipUpdate bool `json:\"skipUpdate,omitempty\"`\n+ // The flag to enable or disable Trivy debug mode\n+ DebugMode bool `json:\"debugMode,omitempty\"`\n// +kubebuilder:validation:Optional\n- // The GitHub access token to download Trivy DB (see GitHub rate limiting)\n- GithubToken string `json:\"githubToken,omitempty\"`\n+ // +kubebuilder:default=false\n+ // The flag to enable or disable Trivy DB downloads from GitHub\n+ SkipUpdate bool `json:\"skipUpdate,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=false\n// The flag to skip verifying registry certificate\nInsecure bool `json:\"insecure,omitempty\"`\n+ // +kubebuilder:validation:Optional\n+ // The GitHub access token to download Trivy DB (see GitHub rate limiting)\n+ GithubToken string `json:\"githubToken,omitempty\"`\n+\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Pattern=\"http?://.+\"\n// The URL of the HTTP proxy server\n@@ -146,20 +146,25 @@ type TrivyServerSpec struct {\n// +kubebuilder:validation:Enum={\"os\",\"library\"}\n// +kubebuilder:default={\"os\",\"library\"}\n+// TrivyServerVulnerabilityType represents a CVE vulnerability type for trivy.\ntype TrivyServerVulnerabilityType string\n// +kubebuilder:validation:Enum={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n// +kubebuilder:default={\"UNKNOWN\",\"LOW\",\"MEDIUM\",\"HIGH\",\"CRITICAL\"}\n+// TrivyServerSeverityType represents a CVE severity type for trivy.\ntype TrivyServerSeverityType string\n+var trivyURLValidationRegexp = regexp.MustCompile(`https?://.+`)\n+\nfunc (r *TrivyServerSpec) Validate() map[string]error {\n- errors := make(map[string]error, 0)\n+ errors := map[string]error{}\nif len(r.NoProxy) > 0 {\nfor _, url := range r.NoProxy {\n- matched, err := regexp.MatchString(\"https?://.+\", url)\n- if err != nil || !matched {\n+ matched := trivyURLValidationRegexp.MatchString(url)\n+ if !matched {\nerrors[\"NoProxy\"] = ErrWrongURLFormat\n+ break\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/trivy_webhook.go", "new_path": "apis/goharbor.io/v1alpha2/trivy_webhook.go", "diff": "@@ -2,6 +2,7 @@ package v1alpha2\nimport (\n\"context\"\n+\napierrors \"k8s.io/apimachinery/pkg/api/errors\"\n\"k8s.io/apimachinery/pkg/runtime\"\n\"k8s.io/apimachinery/pkg/runtime/schema\"\n@@ -26,21 +27,21 @@ var _ webhook.Validator = &Trivy{}\n// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.\nfunc (r *Trivy) ValidateCreate() error {\n- registrylog.Info(\"validate create\", \"name\", r.Name)\n+ trivyLog.Info(\"validate create\", \"name\", r.Name)\nreturn r.Validate()\n}\n// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.\nfunc (r *Trivy) ValidateUpdate(old runtime.Object) error {\n- registrylog.Info(\"validate update\", \"name\", r.Name)\n+ trivyLog.Info(\"validate update\", \"name\", r.Name)\nreturn r.Validate()\n}\n// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.\nfunc (r *Trivy) ValidateDelete() error {\n- registrylog.Info(\"validate delete\", \"name\", r.Name)\n+ trivyLog.Info(\"validate delete\", \"name\", r.Name)\nreturn nil\n}\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/configs.go", "new_path": "controllers/goharbor/trivy/configs.go", "diff": "@@ -29,7 +29,7 @@ func (r *Reconciler) AddConfigMap(ctx context.Context, trivy *goharborv1alpha2.T\nreturn nil\n}\n-// Get the config map linked to the trivy deployment\n+// Get the config map linked to the trivy deployment.\nfunc (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.Trivy) (*corev1.ConfigMap, error) {\nname := r.NormalizeName(ctx, trivy.GetName())\nnamespace := trivy.GetNamespace()\n@@ -77,7 +77,7 @@ func (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.T\n}, nil\n}\n-// Explode array of vulnerabilities type into a string separated by commas\n+// Explode array of vulnerabilities type into a string separated by commas.\nfunc GetVulnerabilities(vulnType []goharborv1alpha2.TrivyServerVulnerabilityType) string {\nvulnerabilities := \"\"\n@@ -92,7 +92,7 @@ func GetVulnerabilities(vulnType []goharborv1alpha2.TrivyServerVulnerabilityType\nreturn vulnerabilities\n}\n-// Explode array of severities type into a string separated by commas\n+// Explode array of severities type into a string separated by commas.\nfunc GetSeverities(sevType []goharborv1alpha2.TrivyServerSeverityType) string {\nseverities := \"\"\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -14,7 +14,6 @@ import (\nvar (\nvarFalse = false\n- varTrue = true\n)\nconst (\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/resources.go", "new_path": "controllers/goharbor/trivy/resources.go", "diff": "@@ -2,11 +2,11 @@ package trivy\nimport (\n\"context\"\n- \"github.com/pkg/errors\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\nserrors \"github.com/goharbor/harbor-operator/pkg/controller/errors\"\n\"github.com/goharbor/harbor-operator/pkg/resources\"\n+ \"github.com/pkg/errors\"\n)\nfunc (r *Reconciler) NewEmpty(_ context.Context) resources.Resource {\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(README): Mention trivy in README fix(apis): Fix some duplicated comments chore(trivy): Lint files Signed-off-by: Xavier Duthil <xavier.duthil@ovhcloud.com>
254,877
11.08.2020 10:31:38
-7,200
319e3e191b7418ffa188784b3d50f7e8c9c2ee2e
Deploy Trivy with an Harbor object
[ { "change_type": "ADD", "old_path": null, "new_path": "config/samples/harbor-full/harbor_trivy_patch.yaml", "diff": "+apiVersion: goharbor.io/v1alpha2\n+kind: Harbor\n+metadata:\n+ name: sample\n+spec:\n+ trivy: {}\n" }, { "change_type": "MODIFY", "old_path": "config/samples/harbor-full/kustomization.yaml", "new_path": "config/samples/harbor-full/kustomization.yaml", "diff": "@@ -12,3 +12,4 @@ bases:\npatchesStrategicMerge:\n- harbor_chartmuseum_patch.yaml\n- harbor_notary_patch.yaml\n+- harbor_trivy_patch.yaml\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/resources.go", "new_path": "controllers/goharbor/harbor/resources.go", "diff": "@@ -96,6 +96,11 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\nreturn errors.Wrapf(err, \"cannot add %s\", controllers.NotarySigner)\n}\n+ _, err = r.AddTrivy(ctx, harbor)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add %s\", controllers.Trivy)\n+ }\n+\n_, err = r.AddCoreIngress(ctx, harbor, core, portal, registry)\nif err != nil {\nreturn errors.Wrapf(err, \"cannot add %s ingress\", controllers.Core)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "controllers/goharbor/harbor/trivy.go", "diff": "+package harbor\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/pkg/errors\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n+ \"github.com/goharbor/harbor-operator/pkg/graph\"\n+)\n+\n+type Trivy graph.Resource\n+\n+func (r *Reconciler) AddTrivy(ctx context.Context, harbor *goharborv1alpha2.Harbor) (Trivy, error) {\n+ if harbor.Spec.Trivy == nil {\n+ return nil, nil\n+ }\n+\n+ trivy, err := r.GetTrivy(ctx, harbor)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"get\")\n+ }\n+\n+ trivyRes, err := r.AddBasicResource(ctx, trivy)\n+\n+ return Trivy(trivyRes), errors.Wrap(err, \"add\")\n+}\n+\n+func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harbor) (*goharborv1alpha2.Trivy, error) {\n+ name := r.NormalizeName(ctx, harbor.GetName())\n+ namespace := harbor.GetNamespace()\n+\n+ redisDSN := harbor.Spec.RedisDSN(harbormetav1.TrivyRedis)\n+\n+ return &goharborv1alpha2.Trivy{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: name,\n+ Namespace: namespace,\n+ },\n+ Spec: goharborv1alpha2.TrivySpec{\n+ ComponentSpec: harbor.Spec.Trivy.ComponentSpec,\n+ Cache: goharborv1alpha2.TrivyCacheSpec{\n+ Redis: redisDSN,\n+ },\n+ },\n+ }, nil\n+}\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
Deploy Trivy with an Harbor object Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
11.08.2020 14:56:48
-7,200
3d19a71e955933f6e8cbfeedae8fe612a7966379
Add TLS certificate
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "new_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "diff": "@@ -231,6 +231,7 @@ type ChartMuseumComponentSpec struct {\ntype TrivyComponentSpec struct {\nharbormetav1.ComponentSpec `json:\",inline\"`\n+ SkipUpdate bool `json:\"skipUpdate,omitempty\"`\n}\ntype HarborStorageImageChartStorageSpec struct {\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "new_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "diff": "@@ -56,7 +56,7 @@ type TrivySpec struct {\ntype TrivyServerSpec struct {\n// +kubebuilder:validation:Optional\n- HTTPS TrivyHTTPSSpec `json:\"https,omitempty\"`\n+ TLS *harbormetav1.ComponentsTLSSpec `json:\"tls,omitempty\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n@@ -177,21 +177,6 @@ type TrivyLogSpec struct {\nLevel harbormetav1.TrivyLogLevel `json:\"level,omitempty\"`\n}\n-type TrivyHTTPSSpec struct {\n- // +kubebuilder:validation:Optionnal\n- // Reference to secret containing tls certificate\n- CertificateRef string `json:\"certificateRef\"`\n-\n- // +kubebuilder:validation:Optionnal\n- // Reference to secret containing tls key\n- KeyRef string `json:\"keyRef\"`\n-\n- // +kubebuilder:validation:Optionnal\n- // A list of absolute paths to x509 root certificate authorities\n- // that the api use if required to verify a client certificate\n- ClientCas string `json:\"clientCasList\"`\n-}\n-\ntype TrivyCacheSpec struct {\n// +kubebuilder:validation:Required\n// Redis cache store\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "diff": "@@ -3281,21 +3281,6 @@ func (in *TrivyComponentSpec) DeepCopy() *TrivyComponentSpec {\nreturn out\n}\n-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n-func (in *TrivyHTTPSSpec) DeepCopyInto(out *TrivyHTTPSSpec) {\n- *out = *in\n-}\n-\n-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrivyHTTPSSpec.\n-func (in *TrivyHTTPSSpec) DeepCopy() *TrivyHTTPSSpec {\n- if in == nil {\n- return nil\n- }\n- out := new(TrivyHTTPSSpec)\n- in.DeepCopyInto(out)\n- return out\n-}\n-\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *TrivyList) DeepCopyInto(out *TrivyList) {\n*out = *in\n@@ -3346,7 +3331,11 @@ func (in *TrivyLogSpec) DeepCopy() *TrivyLogSpec {\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *TrivyServerSpec) DeepCopyInto(out *TrivyServerSpec) {\n*out = *in\n- out.HTTPS = in.HTTPS\n+ if in.TLS != nil {\n+ in, out := &in.TLS, &out.TLS\n+ *out = new(v1alpha1.ComponentsTLSSpec)\n+ **out = **in\n+ }\nif in.ReadTimeout != nil {\nin, out := &in.ReadTimeout, &out.ReadTimeout\n*out = new(v1.Duration)\n" }, { "change_type": "MODIFY", "old_path": "apis/meta/v1alpha1/tls.go", "new_path": "apis/meta/v1alpha1/tls.go", "diff": "@@ -14,7 +14,7 @@ const (\nRegistryTLS = ComponentWithTLS(RegistryComponent)\nRegistryControllerTLS = ComponentWithTLS(RegistryControllerComponent)\nNotaryServerTLS = ComponentWithTLS(NotaryServerComponent)\n- ClairTLS = ComponentWithTLS(ClairComponent)\n+ TrivyTLS = ComponentWithTLS(TrivyComponent)\n)\nfunc (r ComponentWithTLS) String() string {\n" }, { "change_type": "MODIFY", "old_path": "config/samples/harbor-full/harbor_trivy_patch.yaml", "new_path": "config/samples/harbor-full/harbor_trivy_patch.yaml", "diff": "@@ -3,4 +3,5 @@ kind: Harbor\nmetadata:\nname: sample\nspec:\n- trivy: {}\n+ trivy:\n+ skipUpdate: true\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/resources.go", "new_path": "controllers/goharbor/harbor/resources.go", "diff": "@@ -56,6 +56,11 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\nreturn errors.Wrapf(err, \"cannot add %s configuration\", controllers.NotaryServer)\n}\n+ trivyCertificate, err := r.AddTrivyConfigurations(ctx, harbor, internalTLSIssuer)\n+ if err != nil {\n+ return errors.Wrapf(err, \"cannot add %s configuration\", controllers.Trivy)\n+ }\n+\nregistry, err := r.AddRegistry(ctx, harbor, registryCertificate, registryAuthSecret, registryHTTPSecret)\nif err != nil {\nreturn errors.Wrapf(err, \"cannot add %s\", controllers.Registry)\n@@ -96,7 +101,7 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\nreturn errors.Wrapf(err, \"cannot add %s\", controllers.NotarySigner)\n}\n- _, err = r.AddTrivy(ctx, harbor)\n+ _, err = r.AddTrivy(ctx, harbor, trivyCertificate)\nif err != nil {\nreturn errors.Wrapf(err, \"cannot add %s\", controllers.Trivy)\n}\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/trivy.go", "new_path": "controllers/goharbor/harbor/trivy.go", "diff": "@@ -11,9 +11,38 @@ import (\n\"github.com/goharbor/harbor-operator/pkg/graph\"\n)\n+func (r *Reconciler) AddTrivyConfigurations(ctx context.Context, harbor *goharborv1alpha2.Harbor, tlsIssuer InternalTLSIssuer) (TrivyInternalCertificate, error) {\n+ if harbor.Spec.Trivy == nil {\n+ return nil, nil\n+ }\n+\n+ certificate, err := r.AddTrivyInternalCertificate(ctx, harbor, tlsIssuer)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"certificate\")\n+ }\n+\n+ return certificate, nil\n+}\n+\n+type TrivyInternalCertificate graph.Resource\n+\n+func (r *Reconciler) AddTrivyInternalCertificate(ctx context.Context, harbor *goharborv1alpha2.Harbor, tlsIssuer InternalTLSIssuer) (TrivyInternalCertificate, error) {\n+ cert, err := r.GetInternalTLSCertificate(ctx, harbor, harbormetav1.TrivyTLS)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"get\")\n+ }\n+\n+ certRes, err := r.Controller.AddCertificateToManage(ctx, cert, tlsIssuer)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"add\")\n+ }\n+\n+ return TrivyInternalCertificate(certRes), nil\n+}\n+\ntype Trivy graph.Resource\n-func (r *Reconciler) AddTrivy(ctx context.Context, harbor *goharborv1alpha2.Harbor) (Trivy, error) {\n+func (r *Reconciler) AddTrivy(ctx context.Context, harbor *goharborv1alpha2.Harbor, certificate TrivyInternalCertificate) (Trivy, error) {\nif harbor.Spec.Trivy == nil {\nreturn nil, nil\n}\n@@ -23,7 +52,7 @@ func (r *Reconciler) AddTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nreturn nil, errors.Wrap(err, \"get\")\n}\n- trivyRes, err := r.AddBasicResource(ctx, trivy)\n+ trivyRes, err := r.AddBasicResource(ctx, trivy, certificate)\nreturn Trivy(trivyRes), errors.Wrap(err, \"add\")\n}\n@@ -34,6 +63,10 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nredisDSN := harbor.Spec.RedisDSN(harbormetav1.TrivyRedis)\n+ skipUpdate := harbor.Spec.Trivy.SkipUpdate\n+\n+ tls := harbor.Spec.InternalTLS.GetComponentTLSSpec(r.GetInternalTLSCertificateSecretName(ctx, harbor, harbormetav1.TrivyTLS))\n+\nreturn &goharborv1alpha2.Trivy{\nObjectMeta: metav1.ObjectMeta{\nName: name,\n@@ -44,6 +77,10 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nCache: goharborv1alpha2.TrivyCacheSpec{\nRedis: redisDSN,\n},\n+ Server: goharborv1alpha2.TrivyServerSpec{\n+ TLS: tls,\n+ SkipUpdate: skipUpdate,\n+ },\n},\n}, nil\n}\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/configs.go", "new_path": "controllers/goharbor/trivy/configs.go", "diff": "@@ -44,9 +44,9 @@ func (r *Reconciler) GetConfigMap(ctx context.Context, trivy *goharborv1alpha2.T\n\"SCANNER_LOG_LEVEL\": string(trivy.Spec.Log.Level),\n\"SCANNER_API_SERVER_ADDR\": trivy.Spec.Server.Address,\n- \"SCANNER_API_SERVER_TLS_CERTIFICATE\": trivy.Spec.Server.HTTPS.CertificateRef,\n- \"SCANNER_API_SERVER_TLS_KEY\": trivy.Spec.Server.HTTPS.KeyRef,\n- \"SCANNER_API_SERVER_CLIENT_CAS\": trivy.Spec.Server.HTTPS.ClientCas,\n+ \"SCANNER_API_SERVER_TLS_CERTIFICATE\": \"/etc/harbor/ssl/tls.crt\",\n+ \"SCANNER_API_SERVER_TLS_KEY\": \"/etc/harbor/ssl/tls.key\",\n+ \"SCANNER_API_SERVER_CLIENT_CAS\": \"/etc/harbor/ssl/ca.crt\",\n\"SCANNER_API_SERVER_READ_TIMEOUT\": trivy.Spec.Server.ReadTimeout.Duration.String(),\n\"SCANNER_API_SERVER_WRITE_TIMEOUT\": trivy.Spec.Server.WriteTimeout.Duration.String(),\n\"SCANNER_API_SERVER_IDLE_TIMEOUT\": trivy.Spec.Server.IdleTimeout.Duration.String(),\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -25,6 +25,8 @@ const (\nCacheVolumePath = \"/home/scanner/.cache/trivy\"\nReportsVolumeName = \"reports\"\nReportsVolumePath = \"/home/scanner/.cache/reports\"\n+ InternalCertificatesVolumeName = \"internal-certificates\"\n+ InternalCertificatesPath = \"/etc/harbor/ssl\"\n)\nfunc (r *Reconciler) AddDeployment(ctx context.Context, trivy *goharborv1alpha2.Trivy) error {\n@@ -65,6 +67,14 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nEmptyDir: &corev1.EmptyDirVolumeSource{},\n},\n},\n+ {\n+ Name: InternalCertificatesVolumeName,\n+ VolumeSource: corev1.VolumeSource{\n+ Secret: &corev1.SecretVolumeSource{\n+ SecretName: trivy.Spec.Server.TLS.CertificateRef,\n+ },\n+ },\n+ },\n}\nvolumesMount := []corev1.VolumeMount{\n@@ -76,6 +86,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nName: ReportsVolumeName,\nMountPath: ReportsVolumePath,\n},\n+ {\n+ Name: InternalCertificatesVolumeName,\n+ MountPath: InternalCertificatesPath,\n+ ReadOnly: true,\n+ },\n}\nenvFroms := []corev1.EnvFromSource{\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
Add TLS certificate Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
11.08.2020 15:20:52
-7,200
dd2bb1866cabebd5985536614b089017ff96eda0
feat(trivy) Add Github token
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "new_path": "apis/goharbor.io/v1alpha2/harbor_types.go", "diff": "@@ -232,6 +232,7 @@ type ChartMuseumComponentSpec struct {\ntype TrivyComponentSpec struct {\nharbormetav1.ComponentSpec `json:\",inline\"`\nSkipUpdate bool `json:\"skipUpdate,omitempty\"`\n+ GithubToken string `json:\"githubToken,omitempty\"`\n}\ntype HarborStorageImageChartStorageSpec struct {\n" }, { "change_type": "MODIFY", "old_path": "config/samples/harbor-full/harbor_trivy_patch.yaml", "new_path": "config/samples/harbor-full/harbor_trivy_patch.yaml", "diff": "@@ -5,3 +5,4 @@ metadata:\nspec:\ntrivy:\nskipUpdate: true\n+ githubToken: \"GITHUB-TOKEN\"\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/trivy.go", "new_path": "controllers/goharbor/harbor/trivy.go", "diff": "@@ -64,6 +64,7 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nredisDSN := harbor.Spec.RedisDSN(harbormetav1.TrivyRedis)\nskipUpdate := harbor.Spec.Trivy.SkipUpdate\n+ githubToken := harbor.Spec.Trivy.GithubToken\ntls := harbor.Spec.InternalTLS.GetComponentTLSSpec(r.GetInternalTLSCertificateSecretName(ctx, harbor, harbormetav1.TrivyTLS))\n@@ -80,6 +81,7 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nServer: goharborv1alpha2.TrivyServerSpec{\nTLS: tls,\nSkipUpdate: skipUpdate,\n+ GithubToken: githubToken,\n},\n},\n}, nil\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -2,11 +2,11 @@ package trivy\nimport (\n\"context\"\n+ \"strconv\"\nappsv1 \"k8s.io/api/apps/v1\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n- \"k8s.io/apimachinery/pkg/util/intstr\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/pkg/errors\"\n@@ -150,17 +150,32 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nLivenessProbe: &corev1.Probe{\nHandler: corev1.Handler{\n- HTTPGet: &corev1.HTTPGetAction{\n- Path: LivenessProbe,\n- Port: intstr.FromInt(port),\n+ Exec: &corev1.ExecAction{\n+ Command: []string{\n+ \"curl\",\n+ \"-k\",\n+ \"--cacert\",\n+ InternalCertificatesPath + \"/ca.crt\",\n+ \"--key\",\n+ InternalCertificatesPath + \"/tls.key\",\n+ \"--cert\", InternalCertificatesPath + \"/tls.crt\",\n+ \"https://localhost:\" + strconv.Itoa(port) + LivenessProbe},\n},\n},\n},\nReadinessProbe: &corev1.Probe{\nHandler: corev1.Handler{\n- HTTPGet: &corev1.HTTPGetAction{\n- Path: ReadinessProbe,\n- Port: intstr.FromInt(port),\n+ Exec: &corev1.ExecAction{\n+ Command: []string{\n+ \"curl\",\n+ \"-k\",\n+ \"--cacert\",\n+ InternalCertificatesPath + \"/ca.crt\",\n+ \"--key\",\n+ InternalCertificatesPath + \"/tls.key\",\n+ \"--cert\",\n+ InternalCertificatesPath + \"/tls.crt\",\n+ \"https://localhost:\" + strconv.Itoa(port) + ReadinessProbe},\n},\n},\n},\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(trivy) Add Github token Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
18.08.2020 16:16:00
-7,200
238b21b37c199217ade26a7bb4643f1085b93164
fix(trivy) Remove default client CA
[ { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -127,10 +127,6 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nReadOnly: true,\n})\n- cas := append(trivy.Spec.Server.ClientCertificateAuthorityRefs,\n- path.Join(InternalCertificatesPath, corev1.ServiceAccountRootCAKey),\n- )\n-\nenvs = append(envs, corev1.EnvVar{\nName: \"SCANNER_API_SERVER_TLS_CERTIFICATE\",\nValue: path.Join(InternalCertificatesPath, corev1.TLSCertKey),\n@@ -139,7 +135,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nValue: path.Join(InternalCertificatesPath, corev1.TLSPrivateKeyKey),\n}, corev1.EnvVar{\nName: \"SCANNER_API_SERVER_CLIENT_CAS\",\n- Value: strings.Join(cas, \",\"),\n+ Value: strings.Join(trivy.Spec.Server.ClientCertificateAuthorityRefs, \",\"),\n})\naddress = fmt.Sprintf(\":%d\", httpsPort)\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(trivy) Remove default client CA Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
27.08.2020 16:23:05
-7,200
db80076a166d469e8210b59e1877b055f8671746
fix(trivy) Add SCANNER_STORE_REDIS_URL environment variable
[ { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/secrets.go", "new_path": "controllers/goharbor/trivy/secrets.go", "diff": "@@ -62,6 +62,7 @@ func (r *Reconciler) GetSecret(ctx context.Context, trivy *goharborv1alpha2.Triv\nStringData: map[string]string{\n\"SCANNER_REDIS_URL\": redisDSN.String(),\n\"SCANNER_JOB_QUEUE_REDIS_URL\": redisDSN.String(),\n+ \"SCANNER_STORE_REDIS_URL\": redisDSN.String(),\n},\n}, nil\n}\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(trivy) Add SCANNER_STORE_REDIS_URL environment variable Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
27.08.2020 16:26:37
-7,200
0409a7dfa8c2ed65591617eb47a122856309f8d1
fix(trivy) Add SecurityContext FSGroup for reports folder
[ { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -20,6 +20,7 @@ import (\nvar (\nvarFalse = false\n+ trivyUid = int64(10000)\n)\nconst (\n@@ -171,6 +172,10 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &trivyUid,\n+ },\n+\nContainers: []corev1.Container{{\nName: ContainerName,\nImage: image,\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(trivy) Add SecurityContext FSGroup for reports folder Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
27.08.2020 16:29:02
-7,200
7850d1506b1a443d12b41e300ff9fb9e45819c39
fix(trivy) Add external certificate authorities
[ { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "new_path": "apis/goharbor.io/v1alpha2/trivy_types.go", "diff": "@@ -82,6 +82,9 @@ type TrivyServerSpec struct {\n// +kubebuilder:validation:Optional\nClientCertificateAuthorityRefs []string `json:\"clientCertificateAuthorityRefs,omitempty\"`\n+ // +kubebuilder:validation:Optional\n+ TokenServiceCertificateAuthorityRefs []string `json:\"tokenServiceCertificateAuthorityRefs,omitempty\"`\n+\n// +kubebuilder:validation:Optional\n// +kubebuilder:validation:Type=\"string\"\n// +kubebuilder:default=\"15s\"\n" }, { "change_type": "MODIFY", "old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go", "diff": "@@ -3423,6 +3423,11 @@ func (in *TrivyServerSpec) DeepCopyInto(out *TrivyServerSpec) {\n*out = make([]string, len(*in))\ncopy(*out, *in)\n}\n+ if in.TokenServiceCertificateAuthorityRefs != nil {\n+ in, out := &in.TokenServiceCertificateAuthorityRefs, &out.TokenServiceCertificateAuthorityRefs\n+ *out = make([]string, len(*in))\n+ copy(*out, *in)\n+ }\nif in.ReadTimeout != nil {\nin, out := &in.ReadTimeout, &out.ReadTimeout\n*out = new(v1.Duration)\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/crds/trivies.yaml", "new_path": "charts/harbor-operator/crds/trivies.yaml", "diff": "@@ -259,6 +259,10 @@ spec:\nrequired:\n- certificateRef\ntype: object\n+ tokenServiceCertificateAuthorityRefs:\n+ items:\n+ type: string\n+ type: array\nwriteTimeout:\ndefault: 15s\ndescription: Socket timeout\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/trivy.go", "new_path": "controllers/goharbor/harbor/trivy.go", "diff": "@@ -130,6 +130,7 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\n},\nServer: goharborv1alpha2.TrivyServerSpec{\nTLS: tls,\n+ TokenServiceCertificateAuthorityRefs: []string{harbor.Spec.Expose.Core.TLS.CertificateRef},\n},\nUpdate: goharborv1alpha2.TrivyUpdateSpec{\nSkip: harbor.Spec.Trivy.SkipUpdate,\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/trivy/deployments.go", "new_path": "controllers/goharbor/trivy/deployments.go", "diff": "@@ -32,7 +32,9 @@ const (\nReportsVolumeName = \"reports\"\nReportsVolumePath = \"/home/scanner/.cache/reports\"\nInternalCertificatesVolumeName = \"internal-certificates\"\n+ InternalCertificateAuthorityDirectory = \"/harbor_cust_cert\"\nInternalCertificatesPath = \"/etc/harbor/ssl\"\n+ PublicCertificatesVolumeName = \"public-certificates\"\n)\nconst (\n@@ -81,6 +83,27 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nMountPath: CacheVolumePath,\nReadOnly: false,\n}}\n+\n+ for i, ref := range trivy.Spec.Server.TokenServiceCertificateAuthorityRefs {\n+ volumeName := fmt.Sprintf(\"%s-%d\", PublicCertificatesVolumeName, i)\n+\n+ volumes = append(volumes, corev1.Volume{\n+ Name: volumeName,\n+ VolumeSource: corev1.VolumeSource{\n+ Secret: &corev1.SecretVolumeSource{\n+ SecretName: ref,\n+ },\n+ },\n+ })\n+\n+ volumesMount = append(volumesMount, corev1.VolumeMount{\n+ Name: volumeName,\n+ MountPath: path.Join(InternalCertificateAuthorityDirectory, fmt.Sprintf(\"%d-%s\", i, corev1.ServiceAccountRootCAKey)),\n+ ReadOnly: true,\n+ SubPath: corev1.ServiceAccountRootCAKey,\n+ })\n+ }\n+\nenvs := []corev1.EnvVar{}\nenvFroms := []corev1.EnvFromSource{{\nConfigMapRef: &corev1.ConfigMapEnvSource{\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(trivy) Add external certificate authorities Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
07.09.2020 14:32:00
-7,200
a12feaca69fe84a337c0cf9da5bf910ac1ea8fc1
fix(helm chart) mount configuration templates
[ { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/configmap.yaml", "new_path": "charts/harbor-operator/templates/configmap.yaml", "diff": "@@ -5,4 +5,8 @@ metadata:\nlabels:\n{{- include \"chart.labels\" . | nindent 4 }}\ndata:\n- {{- (.Files.Glob \"../assets/*\").AsConfig | indent 2 }}\n+ {{- $files := .Files }}\n+ {{- range $path, $_ := .Files.Glob \"assets/*\" }}\n+ {{ base $path }}: |-\n+ {{- $files.Get $path | nindent 4 }}\n+ {{- end }}\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/deployment.yaml", "new_path": "charts/harbor-operator/templates/deployment.yaml", "diff": "@@ -70,11 +70,17 @@ spec:\n- mountPath: /tmp/k8s-webhook-server/serving-certs\nname: certificates\nreadOnly: true\n+ - mountPath: /etc/harbor-operator\n+ name: configuration-templates\n+ readOnly: true\nvolumes:\n- name: certificates\nsecret:\ndefaultMode: 420\nsecretName: '{{ include \"chart.fullname\" . }}-certificate'\n+ - name: configuration-templates\n+ configMap:\n+ name: '{{ include \"chart.fullname\" . }}'\n{{- with .Values.nodeSelector }}\nnodeSelector:\n{{- toYaml . | nindent 8 }}\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/tests/test.yaml", "new_path": "charts/harbor-operator/templates/tests/test.yaml", "diff": "@@ -132,7 +132,7 @@ metadata:\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\nname: '{{ include \"chart.fullname\" . }}-harbor-operator-test-postgresql'\nspec:\nports:\n@@ -157,7 +157,7 @@ metadata:\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\nname: '{{ include \"chart.fullname\" . }}-harbor-operator-test-postgresql-headless'\nspec:\nclusterIP: None\n@@ -182,7 +182,7 @@ metadata:\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\nname: '{{ include \"chart.fullname\" . }}-harbor-operator-test-postgresql'\nspec:\nreplicas: 1\n@@ -203,7 +203,7 @@ spec:\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\nrole: master\nname: harbor-operator-test-postgresql\nspec:\n" }, { "change_type": "MODIFY", "old_path": "config/helm/tests/postgresql/helm.yaml", "new_path": "config/helm/tests/postgresql/helm.yaml", "diff": "@@ -7,7 +7,7 @@ metadata:\nname: harbor-operator-test-postgresql-headless\nlabels:\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\nspec:\n@@ -28,7 +28,7 @@ metadata:\nname: harbor-operator-test-postgresql\nlabels:\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\nannotations:\n@@ -50,7 +50,7 @@ metadata:\nname: harbor-operator-test-postgresql\nlabels:\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\nannotations:\n@@ -69,7 +69,7 @@ spec:\nname: harbor-operator-test-postgresql\nlabels:\napp.kubernetes.io/name: postgresql\n- helm.sh/chart: postgresql-9.3.3\n+ helm.sh/chart: postgresql-9.4.0\napp.kubernetes.io/instance: harbor-operator-test\napp.kubernetes.io/managed-by: Helm\nrole: master\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/notaryserver/notaryserver.go", "new_path": "controllers/goharbor/notaryserver/notaryserver.go", "diff": "@@ -23,7 +23,7 @@ const (\nconst (\nConfigTemplatePathKey = \"template-path\"\n- DefaultConfigTemplatePath = \"/etc/harbor-operator/notary-server-config.json.tmpl\"\n+ DefaultConfigTemplatePath = \"/etc/harbor-operator/notaryserver-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\nDefaultImage = \"goharbor/notary-server-photon:v2.0.0\"\n" }, { "change_type": "MODIFY", "old_path": "controllers/goharbor/notarysigner/notarysigner.go", "new_path": "controllers/goharbor/notarysigner/notarysigner.go", "diff": "@@ -20,7 +20,7 @@ import (\nconst (\nDefaultRequeueWait = 2 * time.Second\nConfigTemplatePathKey = \"template-path\"\n- DefaultConfigTemplatePath = \"/etc/harbor-operator/notary-signer-config.json.tmpl\"\n+ DefaultConfigTemplatePath = \"/etc/harbor-operator/notarysigner-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\nDefaultImage = \"goharbor/notary-signer-photon:v2.0.0\"\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(helm chart) mount configuration templates Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
07.09.2020 15:46:41
-7,200
5aea75758aab8e9d065fc52c11dbce9347fa145c
fix(Makefile) Set kustomize build reoder legacy
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -247,14 +247,14 @@ DO_NOT_EDIT := Code generated by make. DO NOT EDIT.\n$(CHART_CRDS_PATH)/$(CRD_GROUP)_%.yaml: kustomize config/crd/bases $(wildcard config/crd/*) $(wildcard config/helm/crds/*) $(wildcard config/crd/patches/*)\nmkdir -p $(CHART_CRDS_PATH)\necho '# $(DO_NOT_EDIT)' > $(CHART_CRDS_PATH)/$*.yaml\n- $(KUSTOMIZE) build config/helm/crds | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/crds | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'metadata.name=$*\\.$(subst .,\\.,$(CRD_GROUP))' \\\n>> $(CHART_CRDS_PATH)/$*.yaml\n.PHONY: $(CHART_TESTS_PATH)/test.yaml\n$(CHART_TESTS_PATH)/test.yaml: kustomize config/tests/postgresql/helm.yaml $(wildcard config/helm/tests/*) $(wildcard config/samples/harbor-full/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TESTS_PATH)/test.yaml\n- $(KUSTOMIZE) build 'config/helm/tests' \\\n+ $(KUSTOMIZE) build --reorder legacy 'config/helm/tests' \\\n>> $(CHART_TESTS_PATH)/test.yaml\n.PHONY: config/tests/postgresql/helm.yaml\n@@ -269,7 +269,7 @@ config/tests/postgresql/helm.yaml: helm\n$(CHART_TEMPLATE_PATH)/role.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/role.yaml\necho '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/role.yaml\n- $(KUSTOMIZE) build config/helm/rbac | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/rbac | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=Role' | \\\n$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRole' | \\\n$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=RoleBinding' \\\n@@ -279,7 +279,7 @@ $(CHART_TEMPLATE_PATH)/role.yaml: kustomize config/rbac $(wildcard config/helm/r\n$(CHART_TEMPLATE_PATH)/clusterrole.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/clusterrole.yaml\necho '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrole.yaml\n- $(KUSTOMIZE) build config/helm/rbac | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/rbac | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRole' | \\\n$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' \\\n>> $(CHART_TEMPLATE_PATH)/clusterrole.yaml\n@@ -288,7 +288,7 @@ $(CHART_TEMPLATE_PATH)/clusterrole.yaml: kustomize config/rbac $(wildcard config\n$(CHART_TEMPLATE_PATH)/rolebinding.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/rolebinding.yaml\necho '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/rolebinding.yaml\n- $(KUSTOMIZE) build config/helm/rbac | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/rbac | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=RoleBinding' | \\\n$(KUSTOMIZE) cfg grep --annotate=false --invert-match 'kind=ClusterRoleBinding' \\\n>> $(CHART_TEMPLATE_PATH)/rolebinding.yaml\n@@ -297,7 +297,7 @@ $(CHART_TEMPLATE_PATH)/rolebinding.yaml: kustomize config/rbac $(wildcard config\n$(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml: kustomize config/rbac $(wildcard config/helm/rbac/*) $(wildcard config/rbac/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml\necho '{{- if .Values.rbac.create }}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml\n- $(KUSTOMIZE) build config/helm/rbac | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/rbac | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=ClusterRoleBinding' \\\n>> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml\necho '{{- end -}}' >> $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml\n@@ -305,27 +305,27 @@ $(CHART_TEMPLATE_PATH)/clusterrolebinding.yaml: kustomize config/rbac $(wildcard\n$(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml: kustomize config/webhook $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml\n- $(KUSTOMIZE) build config/helm/webhook | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/webhook | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=ValidatingWebhookConfiguration' | \\\nsed \"s/'\\({{.*}}\\)'/\\1/g\" \\\n>> $(CHART_TEMPLATE_PATH)/validatingwebhookconfiguration.yaml\n$(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml: kustomize config/webhook $(wildcard config/helm/webhook/*) $(wildcard config/webhook/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml\n- $(KUSTOMIZE) build config/helm/webhook | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/webhook | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=MutatingWebhookConfiguration' | \\\nsed \"s/'\\({{.*}}\\)'/\\1/g\" \\\n>> $(CHART_TEMPLATE_PATH)/mutatingwebhookconfiguration.yaml\n$(CHART_TEMPLATE_PATH)/certificate.yaml: kustomize config/certmanager $(wildcard config/helm/certmanager/*) $(wildcard config/certmanager/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/certificate.yaml\n- $(KUSTOMIZE) build config/helm/certificate | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/certificate | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=Certificate' \\\n>> $(CHART_TEMPLATE_PATH)/certificate.yaml\n$(CHART_TEMPLATE_PATH)/issuer.yaml: kustomize config/certmanager $(wildcard config/helm/certmanager/*) $(wildcard config/certmanager/*)\necho '# $(DO_NOT_EDIT)' > $(CHART_TEMPLATE_PATH)/issuer.yaml\n- $(KUSTOMIZE) build config/helm/certificate | \\\n+ $(KUSTOMIZE) build --reorder legacy config/helm/certificate | \\\n$(KUSTOMIZE) cfg grep --annotate=false 'kind=Issuer' \\\n>> $(CHART_TEMPLATE_PATH)/issuer.yaml\n@@ -369,7 +369,7 @@ go-generate: controller-gen stringer\n# Deploy RBAC in the configured Kubernetes cluster in ~/.kube/config\n.PHONY: deploy-rbac\ndeploy-rbac: go-generate kustomize\n- $(KUSTOMIZE) build config/rbac \\\n+ $(KUSTOMIZE) build --reorder legacy config/rbac \\\n| kubectl apply --validate=false -f -\n.PHONY: sample\n@@ -377,7 +377,7 @@ sample: sample-harbor\n.PHONY: sample-database\nsample-database: kustomize\n- $(KUSTOMIZE) build 'config/samples/database' \\\n+ $(KUSTOMIZE) build --reorder legacy 'config/samples/database' \\\n| kubectl apply -f -\n.PHONY: sample-github-secret\n@@ -394,7 +394,7 @@ sample-github-secret:\n.PHONY: sample-%\nsample-%: kustomize postgresql sample-github-secret\n- $(KUSTOMIZE) build 'config/samples/$*' \\\n+ $(KUSTOMIZE) build --reorder legacy 'config/samples/$*' \\\n| kubectl apply -f -\nkubectl get goharbor\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/tests/test.yaml", "new_path": "charts/harbor-operator/templates/tests/test.yaml", "diff": "@@ -117,7 +117,7 @@ metadata:\napp.kubernetes.io/managed-by: \"\"\nhelm.sh/chart: \"\"\nhelm.sh/hook: test\n- name: '{{ include \"chart.fullname\" . }}-test-postgresql'\n+ name: '{{ include \"chart.fullname\" . }}-test-postgresql-67tt569477'\ntype: Opaque\n---\napiVersion: v1\n@@ -223,7 +223,7 @@ spec:\nvalueFrom:\nsecretKeyRef:\nkey: postgresql-password\n- name: '{{ include \"chart.fullname\" . }}-test-postgresql'\n+ name: '{{ include \"chart.fullname\" . }}-test-postgresql-67tt569477'\n- name: POSTGRESQL_ENABLE_LDAP\nvalue: \"no\"\n- name: POSTGRESQL_ENABLE_TLS\n@@ -431,79 +431,3 @@ spec:\nclaimName: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-cache'\nreportsPersistentVolume:\nclaimName: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-reports'\n----\n-apiVersion: v1\n-kind: PersistentVolumeClaim\n-metadata:\n- annotations:\n- app.kubernetes.io/instance: \"\"\n- app.kubernetes.io/managed-by: \"\"\n- helm.sh/chart: \"\"\n- helm.sh/hook: test\n- labels:\n- sample: \"true\"\n- name: '{{ include \"chart.fullname\" . }}-sample-harbor-chart'\n-spec:\n- accessModes:\n- - ReadWriteOnce\n- resources:\n- requests:\n- storage: 5Gi\n- volumeMode: Filesystem\n----\n-apiVersion: v1\n-kind: PersistentVolumeClaim\n-metadata:\n- annotations:\n- app.kubernetes.io/instance: \"\"\n- app.kubernetes.io/managed-by: \"\"\n- helm.sh/chart: \"\"\n- helm.sh/hook: test\n- labels:\n- sample: \"true\"\n- name: '{{ include \"chart.fullname\" . }}-sample-harbor-registry'\n-spec:\n- accessModes:\n- - ReadWriteOnce\n- resources:\n- requests:\n- storage: 5Gi\n- volumeMode: Filesystem\n----\n-apiVersion: v1\n-kind: PersistentVolumeClaim\n-metadata:\n- annotations:\n- app.kubernetes.io/instance: \"\"\n- app.kubernetes.io/managed-by: \"\"\n- helm.sh/chart: \"\"\n- helm.sh/hook: test\n- labels:\n- sample: \"true\"\n- name: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-cache'\n-spec:\n- accessModes:\n- - ReadWriteOnce\n- resources:\n- requests:\n- storage: 5Gi\n- volumeMode: Filesystem\n----\n-apiVersion: v1\n-kind: PersistentVolumeClaim\n-metadata:\n- annotations:\n- app.kubernetes.io/instance: \"\"\n- app.kubernetes.io/managed-by: \"\"\n- helm.sh/chart: \"\"\n- helm.sh/hook: test\n- labels:\n- sample: \"true\"\n- name: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-reports'\n-spec:\n- accessModes:\n- - ReadWriteOnce\n- resources:\n- requests:\n- storage: 5Gi\n- volumeMode: Filesystem\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(Makefile) Set kustomize build reoder legacy Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,877
07.09.2020 15:55:09
-7,200
1f7f69cf7f33fe89c0bec0636135d14868a5dfbb
fix(Helm Chart) Use latest Kustomize version
[ { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/tests/test.yaml", "new_path": "charts/harbor-operator/templates/tests/test.yaml", "diff": "@@ -170,6 +170,82 @@ spec:\napp.kubernetes.io/name: postgresql\ntype: ClusterIP\n---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ annotations:\n+ app.kubernetes.io/instance: \"\"\n+ app.kubernetes.io/managed-by: \"\"\n+ helm.sh/chart: \"\"\n+ helm.sh/hook: test\n+ labels:\n+ sample: \"true\"\n+ name: '{{ include \"chart.fullname\" . }}-sample-harbor-chart'\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 5Gi\n+ volumeMode: Filesystem\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ annotations:\n+ app.kubernetes.io/instance: \"\"\n+ app.kubernetes.io/managed-by: \"\"\n+ helm.sh/chart: \"\"\n+ helm.sh/hook: test\n+ labels:\n+ sample: \"true\"\n+ name: '{{ include \"chart.fullname\" . }}-sample-harbor-registry'\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 5Gi\n+ volumeMode: Filesystem\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ annotations:\n+ app.kubernetes.io/instance: \"\"\n+ app.kubernetes.io/managed-by: \"\"\n+ helm.sh/chart: \"\"\n+ helm.sh/hook: test\n+ labels:\n+ sample: \"true\"\n+ name: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-cache'\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 5Gi\n+ volumeMode: Filesystem\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ annotations:\n+ app.kubernetes.io/instance: \"\"\n+ app.kubernetes.io/managed-by: \"\"\n+ helm.sh/chart: \"\"\n+ helm.sh/hook: test\n+ labels:\n+ sample: \"true\"\n+ name: '{{ include \"chart.fullname\" . }}-sample-harbor-trivy-reports'\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 5Gi\n+ volumeMode: Filesystem\n+---\napiVersion: apps/v1\nkind: StatefulSet\nmetadata:\n@@ -387,6 +463,7 @@ metadata:\nsample: \"true\"\nname: '{{ include \"chart.fullname\" . }}-sample'\nspec:\n+ chartmuseum: {}\ncore:\ntokenIssuer:\nkind: Issuer\n@@ -420,10 +497,12 @@ spec:\nenabled: true\nnotary:\nmigrationEnabled: true\n+ portal: {}\nredis:\nhost: harbor-redis-master\npasswordRef: harbor-redis\nport: 6379\n+ registry: {}\ntrivy:\nskipUpdate: false\ntrivyStorage:\n" }, { "change_type": "MODIFY", "old_path": "config/helm/tests/kustomization.yaml", "new_path": "config/helm/tests/kustomization.yaml", "diff": "-generatorOptions:\n- disableNameSuffixHash: true\n-\nnamePrefix: '{{ include \"chart.fullname\" . }}-'\ncommonAnnotations:\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(Helm Chart) Use latest Kustomize version Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
254,875
16.10.2020 18:06:45
-28,800
3775109496ef9f90d2699ee1e1b43e84157f7028
feat(doc) start merge harbor-cluster-operator
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "# Harbor Operator\n**ATTENTIONS: THIS PROJECT IS STILL UNDER DEVELOPMENT AND NOT STABLE YET.**\n+**ATTENTIONS: WE USE THIS BRANCH TO MERGE HARBOR-CLUSTER-OPERATOR AND HARBOR-OPERATOR.**\n## Why an Harbor Operator\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(doc) start merge harbor-cluster-operator Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
23.10.2020 15:47:52
-28,800
abd9b2c000812d3633e26a1295d7e1be7a0afe24
feat(ci) fix helm-install target
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -118,7 +118,7 @@ release-test: goreleaser\nCHART_RELEASE_NAME ?= harbor-operator\nCHART_HARBOR_CLASS ?=\n-helm-install: helm $(CHARTS_DIRECTORY)/harbor-operator-$(RELEASE_VERSION).tgz\n+helm-install: helm helm-generate\n$(HELM) upgrade --install $(CHART_RELEASE_NAME) $(CHARTS_DIRECTORY)/harbor-operator-$(RELEASE_VERSION).tgz \\\n--set-string image.repository=\"$(shell echo $(IMG) | sed 's/:.*//')\" \\\n--set-string image.tag=\"$(shell echo $(IMG) | sed 's/.*://')\" \\\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(ci) fix helm-install target Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
26.10.2020 10:17:08
-28,800
0158f4e6432d5fdca028a1efe208181c41774e80
fix(helm) Certificate issue for validation webhook
[ { "change_type": "MODIFY", "old_path": ".github/workflows/build-dev.yml", "new_path": ".github/workflows/build-dev.yml", "diff": "@@ -4,6 +4,7 @@ on:\npush:\nbranches:\n- master\n+ - release-*\njobs:\ndocker:\n" }, { "change_type": "MODIFY", "old_path": ".github/workflows/tests.yml", "new_path": ".github/workflows/tests.yml", "diff": "@@ -7,6 +7,7 @@ on:\npull_request:\nbranches:\n- master\n+ - release-*\njobs:\n# Dockerfile tests\n" }, { "change_type": "MODIFY", "old_path": "config/helm/webhook/kustomization.yaml", "new_path": "config/helm/webhook/kustomization.yaml", "diff": "@@ -7,7 +7,7 @@ generatorOptions:\ncommonAnnotations:\n# Trick so kustomize does not split the annotation value\n- cert-manager.io/cluster-issuer: '{{.Release.Namespace}}/{{. | include \"chart.fullname\"}}'\n+ cert-manager.io/inject-ca-from: '{{.Release.Namespace}}/{{. | include \"chart.fullname\"}}-serving-cert'\npatchesStrategicMerge:\n- validatingwebhook_endpoint_patch.yaml\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(helm) Certificate issue for validation webhook Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
26.10.2020 22:20:58
-28,800
cbe764c722cf663f1038fc7ea40d1a8852c2b14d
fix(core) admin password wrong
[ { "change_type": "MODIFY", "old_path": "controllers/goharbor/harbor/core.go", "new_path": "controllers/goharbor/harbor/core.go", "diff": "@@ -166,6 +166,10 @@ const (\n)\nfunc (r *Reconciler) GetCoreAdminPassword(ctx context.Context, harbor *goharborv1alpha2.Harbor) (*corev1.Secret, error) {\n+ if len(harbor.Spec.HarborAdminPasswordRef) > 0 {\n+ return nil, nil\n+ }\n+\nname := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"admin-password\")\nnamespace := harbor.GetNamespace()\n@@ -355,7 +359,11 @@ func (r *Reconciler) GetCore(ctx context.Context, harbor *goharborv1alpha2.Harbo\n}\n}\n- adminPasswordRef := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"admin-password\")\n+ adminPasswordRef := harbor.Spec.HarborAdminPasswordRef\n+ if len(adminPasswordRef) == 0 {\n+ adminPasswordRef = r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"admin-password\")\n+ }\n+\ncoreSecretRef := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"secret\")\nencryptionKeyRef := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"encryptionkey\")\ncsrfRef := r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"csrf\")\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(core) admin password wrong Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
27.10.2020 15:54:53
-28,800
e7030bdbd97f6d867faf505eca090934c7cd32ab
fix(chart) condition ingress.enable not working
[ { "change_type": "MODIFY", "old_path": "charts/harbor-operator/Chart.yaml", "new_path": "charts/harbor-operator/Chart.yaml", "diff": "@@ -30,9 +30,9 @@ dependencies:\n- name: nginx-ingress\nrepository: https://kubernetes-charts.storage.googleapis.com\nversion: 1.41.2\n- condition: ingressController.enabled, global.ingressController.enabled\n+ condition: ingress.enabled, global.ingress.enabled\ntags:\n- - ingressController\n+ - ingress\n- name: prometheus-operator\nrepository: https://kubernetes-charts.storage.googleapis.com\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(chart) condition ingress.enable not working Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
27.10.2020 12:53:55
-28,800
eba322d0b5ba4c9abb2790e04449bf51fd49fcf8
feat(doc) update installation document
[ { "change_type": "DELETE", "old_path": "docs/install-with-kind-k8s.md", "new_path": null, "diff": "-# Installation in KIND k8s\n-\n-- OS ubuntu 18.04, 8G mem 4CPU\n-\n-- install docker\n-\n- ```bash\n- apt install docker.io\n- ```\n-\n-- install kind\n-\n- ```bash\n- curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64\n- ```\n-\n-- install kubectl\n-\n- ```bash\n- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl\n- ```\n-\n-- create kind cluster\n-\n- ```bash\n- cat <<EOF | kind create cluster --name mine --config=-\n- kind: Cluster\n- apiVersion: kind.x-k8s.io/v1alpha4\n- nodes:\n- - role: control-plane\n- kubeadmConfigPatches:\n- - |\n- kind: InitConfiguration\n- nodeRegistration:\n- kubeletExtraArgs:\n- node-labels: \"ingress-ready=true\"\n- authorization-mode: \"AlwaysAllow\"\n- extraPortMappings:\n- - containerPort: 80\n- hostPort: 80\n- protocol: TCP\n- - containerPort: 443\n- hostPort: 443\n- protocol: TCP\n- - role: worker\n- - role: worker\n- - role: worker\n- EOF\n- ```\n-\n-- install make golang-go npm helm gofmt golangci-lint kube-apiserver kubebuilder kubectl kustomize pkger etcd\n-\n- ```bash\n- sudo apt install make npm -y\n-\n- curl https://dl.google.com/go/go1.14.1.linux-amd64.tar.gz | tar xzv\n- export PATH=~/go/bin:$PATH\n-\n- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash\n-\n- cd harbor-operator\n- make dev-tools\n- ```\n-\n-- install cert-manager\n-\n- ```bash\n- helm repo add jetstack https://charts.jetstack.io\n- helm repo add bitnami https://charts.bitnami.com/bitnami\n-\n- helm repo update\n-\n- kubectl create namespace cert-manager\n-\n- helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v0.13.1\n- ```\n-\n-- install harbor-operator-system\n-\n- ```bash\n- kubectl create namespace harbor-operator-system\n- make deploy\n- ```\n-\n-- install nginx-ingess with nodeport\n-\n- ```bash\n- helm install nginx stable/nginx-ingress --set-string controller.config.proxy-body-size=0 --set controller.service.type=NodePort\n-\n- kubectl patch deployments nginx-nginx-ingress-controller -p '{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"nginx-ingress-controller\",\"ports\":[{\"containerPort\":80,\"hostPort\":80},{\"containerPort\":443,\"hostPort\":443}]}],\"nodeSelector\":{\"ingress-ready\":\"true\"},\"tolerations\":[{\"key\":\"node-role.kubernetes.io/master\",\"operator\":\"Equal\",\"effect\":\"NoSchedule\"}]}}}}'\n- ```\n-\n- below command not work yet\n-\n- ```bash\n- helm install nginx stable/nginx-ingress \\\n- --set-string 'controller.config.proxy-body-size'=0 \\\n- --set-string 'controller.nodeSelector.ingress-ready'=true \\\n- --set 'controller.service.type'=NodePort \\\n- --set 'controller.tolerations[0].key'=node-role.kubernetes.io/master \\\n- --set 'controller.tolerations[0].operator'=Equal \\\n- --set 'controller.tolerations[0].effect'=NoSchedule\n- ```\n-\n-- install redis database\n-\n- ```bash\n- make install-dependencies\n- ```\n-\n-- install harbor\n-\n- ```bash\n- IP=\"$(hostname -I|awk '{print $1}')\"\n- export LBAAS_DOMAIN=\"harbor.$IP.xip.io\" \\\n- NOTARY_DOMAIN=\"harbor.$IP.xip.io\" \\\n- CORE_DATABASE_SECRET=\"$(kubectl get secret core-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode)\" \\\n- CLAIR_DATABASE_SECRET=\"$(kubectl get secret clair-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode)\" \\\n- NOTARY_SERVER_DATABASE_SECRET=\"$(kubectl get secret notary-server-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode)\" \\\n- NOTARY_SIGNER_DATABASE_SECRET=\"$(kubectl get secret notary-signer-database-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode)\" ; \\\n- kubectl kustomize config/samples | gomplate | kubectl apply -f -\n- ```\n-\n-- export self-sign cert\n-\n- ```bash\n- sudo mkdir -p \"/etc/docker/certs.d/$LBAAS_DOMAIN\"\n-\n- kubectl get secret \"$(kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}')\" -o jsonpath='{.data.ca\\.crt}' \\\n- | base64 --decode \\\n- | sudo tee \"/etc/docker/certs.d/$LBAAS_DOMAIN/ca.crt\"\n- ```\n-\n-- push image\n-\n- ```bash\n- docker login \"$LBAAS_DOMAIN\" -u admin -p $(whoami)\n-\n- docker tag busybox \"$LBAAS_DOMAIN/library/testbusybox\"\n-\n- docker push \"$LBAAS_DOMAIN/library/testbusybox\"\n- ```\n-\n-- clean\n-\n- ```bash\n- kind delete cluster --name mine\n- ```\n" }, { "change_type": "MODIFY", "old_path": "docs/installation/installation.md", "new_path": "docs/installation/installation.md", "diff": "@@ -6,7 +6,7 @@ Kubernetes API running (see [Supported platforms](https://github.com/goharbor/ha\n### Minimal\n-1. [CertManager](https://docs.cert-manager.io) (version >= 1.11) and an [issuer](https://cert-manager.io/docs/configuration/selfsigned/).\n+1. [CertManager](https://docs.cert-manager.io) (version >= 0.12) and an [issuer](https://cert-manager.io/docs/configuration/selfsigned/).\n2. Redis for Job Service (such as [Redis HA Helm chart](https://github.com/bitnami/charts/tree/master/bitnami/redis)).\n3. Core database (such as [PostgreSQL Helm chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql)).\n4. Registry storage backend (such as any S3 compatible object storage).\n@@ -33,25 +33,16 @@ Kubernetes API running (see [Supported platforms](https://github.com/goharbor/ha\nmake docker-push IMG=the.registry/goharbor/harbor-operator:dev\n```\n-3. Deploy requirements.\n- The following command deploys [databases](./database-installation.md)\n- and [redis](./redis-installation.md) needed to run a harbor.\n+3. Deploy the operator.\n```bash\n- make install-dependencies\n+ make helm-install IMG=the.registry/goharbor/harbor-operator:dev\n```\n-4. Deploy the application into new namespace\n+4. Ensure the pod harbor-operator-controller-manager-xxx is running\n```bash\n- kubectl create namespace harbor-operator-system\n- make deploy\n- ```\n-\n-5. Ensure the operator is running\n-\n- ```bash\n- kubectl get po -n harbor-operator-system\n+ kubectl get pod\n```\n## Deploy the sample\n@@ -72,11 +63,11 @@ Kubernetes API running (see [Supported platforms](https://github.com/goharbor/ha\n| base64 --decode\n```\n-3. Access to Portal with the publicURL `kubectl get harbor harbor-sample -o jsonpath='{.spec.publicURL}'.\n+3. Access to Portal with the publicURL `kubectl get harbor sample -o jsonpath='{.spec.externalURL}''.\nConnect with the admin user and with the following password.\n```bash\n- kubectl get secret \"$(kubectl get harbor harbor-sample -o jsonpath='{.spec.adminPasswordSecret}')\" -o jsonpath='{.data.password}' \\\n+ kubectl get secret \"$(kubectl get harbor sample -o jsonpath='{.spec.harborAdminPasswordRef}')\" -o jsonpath='{.data.secret}' \\\n| base64 --decode\n```\n@@ -85,65 +76,3 @@ Few customizations are available:\n- [Custom Registry storage](./registry-storage-configuration.md)\n- [Database configuration](./database-installation.md)\n- [Redis configuration](./redis-installation.md)\n-\n-## Some notes\n-\n-### using on KIND k8s with NodePort\n-\n-Reference [kind ingress](https://kind.sigs.k8s.io/docs/user/ingress/)\n-\n-1. create cluster with at multi worker nodes and export port on 1 node\n-\n- ```bash\n- cat <<EOF | kind create cluster --config=-\n- kind: Cluster\n- apiVersion: kind.x-k8s.io/v1alpha4\n- nodes:\n- - role: control-plane\n- kubeadmConfigPatches:\n- - |\n- kind: InitConfiguration\n- nodeRegistration:\n- kubeletExtraArgs:\n- node-labels: \"ingress-ready=true\"\n- authorization-mode: \"AlwaysAllow\"\n- extraPortMappings:\n- - containerPort: 80\n- hostPort: 80\n- protocol: TCP\n- - containerPort: 443\n- hostPort: 443\n- protocol: TCP\n- - role: worker\n- - role: worker\n- - role: worker\n- EOF\n- ```\n-\n-2. install nginx-ingress with NodePort\n-\n- ```bash\n- helm install nginx stable/nginx-ingress \\\n- --set-string 'controller.config.proxy-body-size'=0 \\\n- --set-string 'controller.nodeSelector.ingress-ready'=true \\\n- --set 'controller.service.type'=NodePort \\\n- --set 'controller.tolerations[0].key'=node-role.kubernetes.io/master \\\n- --set 'controller.tolerations[0].operator'=Equal \\\n- --set 'controller.tolerations[0].effect'=NoSchedule\n- ```\n-\n-### install the cert\n-\n-1. get the cert name\n-\n- ```bash\n- kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}'\n- ```\n-\n-2. install cert for docker\n-\n- ```bash\n- kubectl get secret \"$(kubectl get h harbor-sample -o jsonpath='{.spec.tlsSecretName}')\" -o jsonpath='{.data.ca\\.crt}' \\\n- | base64 --decode \\\n- | sudo tee \"/etc/docker/certs.d/$LBAAS_DOMAIN/ca.crt\"\n- ```\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(doc) update installation document Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
23.10.2020 01:01:58
-28,800
71633e58aad1ca14b61883fd4dd11f29ccc1ca91
enhance CI testing 1. install harbor-operator 2. install harbor 3. curl api 4. docker push
[ { "change_type": "MODIFY", "old_path": ".github/workflows/tests.yml", "new_path": ".github/workflows/tests.yml", "diff": "@@ -60,24 +60,23 @@ jobs:\ngo-tests:\nruns-on: ubuntu-latest\nname: K8S v${{ matrix.k8sVersion }} (CM v${{ matrix.certManager }})\n+ env:\n+ KUBECONFIG: /tmp/kubeconfig-microk8s.yaml\n+ USE_EXISTING_CLUSTER: true\nstrategy:\nfail-fast: false\nmatrix:\n# https://github.com/jetstack/cert-manager/tags\ncertManager:\n- - \"0.12.0\"\n- - \"0.13.1\"\n- - \"0.14.3\"\n- \"0.15.2\"\n- \"0.16.1\"\n- - \"1.0.1\"\n+ - \"1.0.3\"\n# https://snapcraft.io/microk8s\nk8sVersion:\n- - \"1.16\"\n- - \"1.17\"\n- # - \"1.18\" # TODO check why Registry and RegistryCtl controllers tests fail\n+ - \"1.18\"\n+ - \"1.19\"\nsteps:\n- uses: actions/setup-go@v2\n@@ -90,30 +89,73 @@ jobs:\nsudo microk8s.start\n# https://microk8s.io/docs/addons\n- sudo microk8s.enable dns\n+ sudo microk8s.enable dns storage ingress registry\n- name: Wait for Kubernetes to be ready\ntimeout-minutes: 15\nrun: |\n+ sudo microk8s.status\nwhile [[ ! $(sudo microk8s.kubectl cluster-info) ]] ; do\necho \"kubernetes not ready yet...\" >&2\nsleep 1\ndone\n+ sudo microk8s.config > \"${KUBECONFIG}\"\n+\n- name: Install CertManager v${{ matrix.certManager }}\nrun: |\n# Try the recet way to install crd or fallback to the old one\nversion='${{ matrix.certManager }}'\nshortVersion=\"${version%.*}\"\n- sudo microk8s.kubectl apply -f \"https://github.com/jetstack/cert-manager/releases/download/v${version}/cert-manager.crds.yaml\" ||\n- sudo microk8s.kubectl apply -f \"https://raw.githubusercontent.com/jetstack/cert-manager/release-${shortVersion}/deploy/manifests/00-crds.yaml\"\n+ set -ex\n+ kubectl apply -f \"https://github.com/jetstack/cert-manager/releases/download/v${version}/cert-manager.yaml\"\n+ kubectl wait --for=condition=Ready pod --all --timeout 300s -n cert-manager\n+\n- uses: actions/checkout@v2\n- name: go tests\nrun: |\n- export KUBECONFIG=\"$(realpath \"$(mktemp kubeconfig.XXXXX)\")\"\n- export USE_EXISTING_CLUSTER=\"true\"\n+ make go-test\n- sudo microk8s.config > \"${KUBECONFIG}\"\n+ - name: build harbor-operator\n+ run: |\n+ make docker-build IMG=localhost:32000/harbor-operator:dev_test\n+ skopeo copy docker-daemon:localhost:32000/harbor-operator:dev_test docker://localhost:32000/harbor-operator:dev_test --tls-verify=false\n+\n+ - name: install harbor-operator\n+ run: |\n+ set -ex\n+ kubectl create ns harbor-operator-ns\n+ cd config/default\n+ kustomize edit set image goharbor/harbor-operator=localhost:32000/harbor-operator:dev_test\n+ kustomize build | kubectl apply -f -\n+\n+ # make helm-install IMG=localhost:32000/harbor-operator:dev_test\n+\n+ kubectl wait --for=condition=Ready pod --all --timeout 300s -n harbor-operator-ns\n+\n+ - name: install harbor\n+ run: |\n+ export GITHUB_TOKEN=xxx\n+ set -ex\n+ make sample\n+ kubectl wait --for=condition=Ready pod --all --timeout 300s || (kubectl get all; exit 1)\n+ kubectl get all\n+\n+ - name: test harbor\n+ run: |\n+ set -ex\n+ echo 127.0.0.1 core.harbor.domain | sudo tee -a /etc/hosts\n+ curl https://core.harbor.domain/api/v2.0/systeminfo -H \"Host: core.harbor.domain\" -i -k\n+ sudo mkdir -p /etc/docker/certs.d/core.harbor.domain\n+ kubectl get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n+ | base64 --decode \\\n+ | sudo tee \"/etc/docker/certs.d/core.harbor.domain/ca.crt\"\n+ # docker login, create image, docker push, docker pull\n+ docker login core.harbor.domain -u admin -p Harbor12345\n+ docker run busybox dd if=/dev/urandom of=test count=10 bs=1MB\n+ DOCKERID=`docker ps -l -q`\n+ docker commit $DOCKERID core.harbor.domain/library/busybox:test\n+ docker push core.harbor.domain/library/busybox:test\n+ docker pull core.harbor.domain/library/busybox:test\n- make go-test\n# Kubernetes\ncrd-kubernetes-resources:\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/values.yaml", "new_path": "charts/harbor-operator/values.yaml", "diff": "@@ -190,7 +190,7 @@ affinity: {}\ncertmanager:\n# certmanager.enabled -- Whether to install cert-manager Helm chart\n- enabled: true\n+ enabled: false\ningress:\n# ingress.enabled -- Whether to install ingress controller Helm chart\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
enhance CI testing 1. install harbor-operator 2. install harbor 3. curl api 4. docker push Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,875
27.10.2020 23:52:46
-28,800
a62495441c70f8bd9f16b0d13f7486c1b2c822f0
use kind cluster
[ { "change_type": "MODIFY", "old_path": ".github/workflows/tests.yml", "new_path": ".github/workflows/tests.yml", "diff": "@@ -61,7 +61,6 @@ jobs:\nruns-on: ubuntu-latest\nname: K8S v${{ matrix.k8sVersion }} (CM v${{ matrix.certManager }})\nenv:\n- KUBECONFIG: /tmp/kubeconfig-microk8s.yaml\nUSE_EXISTING_CLUSTER: true\nstrategy:\n@@ -75,6 +74,7 @@ jobs:\n# https://snapcraft.io/microk8s\nk8sVersion:\n+ - \"1.17\"\n- \"1.18\"\n- \"1.19\"\n@@ -82,32 +82,32 @@ jobs:\n- uses: actions/setup-go@v2\nwith:\ngo-version: 1.14\n+\n- name: Install Kubernetes v${{ matrix.k8sVersion }}\nrun: |\n- sudo snap install microk8s --channel='${{ matrix.k8sVersion }}/stable' --classic\n-\n- sudo microk8s.start\n-\n- # https://microk8s.io/docs/addons\n- sudo microk8s.enable dns storage ingress registry\n- - name: Wait for Kubernetes to be ready\n- timeout-minutes: 15\n- run: |\n- sudo microk8s.status\n- while [[ ! $(sudo microk8s.kubectl cluster-info) ]] ; do\n- echo \"kubernetes not ready yet...\" >&2\n- sleep 1\n- done\n- sudo microk8s.config > \"${KUBECONFIG}\"\n+ which kind || (curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64; sudo install kind /usr/local/bin/)\n+ cat <<EOF | kind create cluster --name harbor --config=-\n+ kind: Cluster\n+ apiVersion: kind.x-k8s.io/v1alpha4\n+ nodes:\n+ - role: control-plane\n+ - role: worker\n+ - role: worker\n+ EOF\n- name: Install CertManager v${{ matrix.certManager }}\nrun: |\n# Try the recet way to install crd or fallback to the old one\nversion='${{ matrix.certManager }}'\n- shortVersion=\"${version%.*}\"\n- set -ex\nkubectl apply -f \"https://github.com/jetstack/cert-manager/releases/download/v${version}/cert-manager.yaml\"\n- kubectl wait --for=condition=Ready pod --all --timeout 300s -n cert-manager\n+ sleep 5\n+ time kubectl -n cert-manager wait --for=condition=Available deployment --all --timeout 300s\n+\n+ - name: Install Ingress\n+ run: |\n+ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.35.0/deploy/static/provider/baremetal/deploy.yaml\n+ sleep 5\n+ time kubectl -n ingress-nginx wait --for=condition=Available deployment --all --timeout 300s\n- uses: actions/checkout@v2\n- name: go tests\n@@ -116,34 +116,58 @@ jobs:\n- name: build harbor-operator\nrun: |\n- make docker-build IMG=localhost:32000/harbor-operator:dev_test\n- skopeo copy docker-daemon:localhost:32000/harbor-operator:dev_test docker://localhost:32000/harbor-operator:dev_test --tls-verify=false\n+ make docker-build IMG=harbor-operator:dev_test\n+ kind load docker-image harbor-operator:dev_test --name harbor\n- name: install harbor-operator\nrun: |\nset -ex\nkubectl create ns harbor-operator-ns\ncd config/default\n- kustomize edit set image goharbor/harbor-operator=localhost:32000/harbor-operator:dev_test\n+ kustomize edit set image goharbor/harbor-operator=harbor-operator:dev_test\nkustomize build | kubectl apply -f -\n- # make helm-install IMG=localhost:32000/harbor-operator:dev_test\n+ # make helm-install IMG=harbor-operator:dev_test\n- kubectl wait --for=condition=Ready pod --all --timeout 300s -n harbor-operator-ns\n+ if ! time kubectl -n harbor-operator-ns wait --for=condition=Available deployment --all --timeout 300s; then\n+ kubectl get all -n harbor-operator-ns\n+ exit 1\n+ fi\n- name: install harbor\nrun: |\nexport GITHUB_TOKEN=xxx\nset -ex\nmake sample\n- kubectl wait --for=condition=Ready pod --all --timeout 300s || (kubectl get all; exit 1)\n+ for i in $(seq 1 6);do\n+ sleep 30\n+ echo $i\n+ kubectl get all\n+ done\n+ if ! time kubectl wait --for=condition=Ready pod --all --timeout 600s ;then\n+ echo install harbor failed\n+ kubectl get all\n+\n+ for n in $(kubectl get po |grep -v Running|grep -v NAME|awk '{print $1}');do\n+ echo describe $n\n+ kubectl describe pod $n\n+ echo show log $n\n+ kubectl log $n || true\n+ done\n+ exit 1\n+ else\nkubectl get all\n+ fi\n+ free -h\n- name: test harbor\nrun: |\nset -ex\n+ sudo kubectl get -n ingress-nginx service/ingress-nginx-controller\n+ sudo kubectl port-forward -n ingress-nginx service/ingress-nginx-controller 443:443 80:80 --address=0.0.0.0 &\n+ sleep 10\necho 127.0.0.1 core.harbor.domain | sudo tee -a /etc/hosts\n- curl https://core.harbor.domain/api/v2.0/systeminfo -H \"Host: core.harbor.domain\" -i -k\n+ curl https://core.harbor.domain/api/v2.0/systeminfo -i -k\nsudo mkdir -p /etc/docker/certs.d/core.harbor.domain\nkubectl get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n| base64 --decode \\\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
use kind cluster Signed-off-by: Ziming Zhang <zziming@vmware.com>
254,865
02.11.2020 20:54:48
-28,800
3a1e84124e3f6432cdf15ca3bcb6328adb04f13e
feat(harborcluster): update HarborCluster api 1. update HarborCluster api 2. add some util pkg
[ { "change_type": "MODIFY", "old_path": "pkg/lcm/lcm.go", "new_path": "pkg/lcm/lcm.go", "diff": "package lcm\nimport (\n- goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n)\n-// This package container interface of harbor cluster service lifecycle manage.\n-\n+// Controller is designed to handle the lifecycle of the related incluster deployed services like psql, redis and minio.\ntype Controller interface {\n- // Provision the new dependent service by the related section of cluster spec.\n- Provision() (*CRStatus, error)\n+ // Apply the changes to the cluster including:\n+ // - creat new if the designed resource is not existing\n+ // - update the resource if the related spec has been changed\n+ // - scale the resources if the replica is changed\n+ //\n+ // Equal to the previous method \"Reconcile()\" of lcm Controller\n+ Apply(spec *v1alpha2.HarborCluster) (*CRStatus, error)\n- // Delete the service\n+ // Delete the related resources if the resource configuration is removed from the spec.\n+ // As we support connecting to the external or incluster provisioned dependent services,\n+ // the dependent service may switch from incluster to external mode and then the incluster\n+ // services may need to be unloaded.\nDelete() (*CRStatus, error)\n- // Scale will get the replicas of components, and update the crd.\n- Scale() (*CRStatus, error)\n-\n- // Scale up\n- ScaleUp(newReplicas uint64) (*CRStatus, error)\n-\n- // Scale down\n- ScaleDown(newReplicas uint64) (*CRStatus, error)\n-\n- // Update the service\n- Update(spec *goharborv1alpha2.HarborCluster) (*CRStatus, error)\n-\n- // More...\n+ // Upgrade the specified resource to the given version.\n+ Upgrade(spec *v1alpha2.HarborCluster) (*CRStatus, error)\n}\ntype CRStatus struct {\n- Condition goharborv1alpha2.HarborClusterCondition `json:\"condition\"`\n+ Condition v1alpha2.HarborClusterCondition `json:\"condition\"`\nProperties Properties `json:\"properties\"`\n}\n// New returns new CRStatus\n-func New(conditionType goharborv1alpha2.HarborClusterConditionType) *CRStatus {\n+func New(conditionType v1alpha2.HarborClusterConditionType) *CRStatus {\nreturn &CRStatus{\n- Condition: goharborv1alpha2.HarborClusterCondition{\n+ Condition: v1alpha2.HarborClusterCondition{\nLastTransitionTime: metav1.Now(),\nType: conditionType,\n},\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
feat(harborcluster): update HarborCluster api 1. update HarborCluster api 2. add some util pkg Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
254,875
27.10.2020 12:15:12
-28,800
982c14a464d720233ef5c46fc6a5d69a1f0fa299
fix(ci) sync charts files
[ { "change_type": "MODIFY", "old_path": ".github/workflows/tests.yml", "new_path": ".github/workflows/tests.yml", "diff": "@@ -261,22 +261,22 @@ jobs:\n- uses: actions/checkout@v2\n- run: make md-lint\n- # Go Releaser\n- release:\n- runs-on: ubuntu-latest\n- name: 'release: snapshot'\n- steps:\n- - uses: actions/setup-go@v2\n- with:\n- go-version: 1.14\n- - uses: actions/checkout@v2\n- - name: Import GPG key\n- id: import_gpg\n- uses: crazy-max/ghaction-import-gpg@v3\n- with:\n- gpg-private-key: \"${{ secrets.GPG_PRIVATE_KEY }}\"\n- passphrase: \"${{ secrets.GPG_PASSPHRASE }}\"\n- - run: make release-test\n- env:\n- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n- GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}\n+# # Go Releaser\n+# release:\n+# runs-on: ubuntu-latest\n+# name: 'release: snapshot'\n+# steps:\n+# - uses: actions/setup-go@v2\n+# with:\n+# go-version: 1.14\n+# - uses: actions/checkout@v2\n+# - name: Import GPG key\n+# id: import_gpg\n+# uses: crazy-max/ghaction-import-gpg@v3\n+# with:\n+# gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}\n+# passphrase: ${{ secrets.GPG_PASSPHRASE }}\n+# - run: make release-test\n+# env:\n+# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n+# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/Chart.lock", "new_path": "charts/harbor-operator/Chart.lock", "diff": "@@ -8,5 +8,5 @@ dependencies:\n- name: prometheus-operator\nrepository: https://kubernetes-charts.storage.googleapis.com\nversion: 9.3.1\n-digest: sha256:3261b9c11d6f571f168f54be82da75881ceb51d87bdb42bbccf673dac9158071\n-generated: \"2020-08-13T10:15:37.616455+02:00\"\n+digest: sha256:88875a9d07921a81170597706256817de4f91941859180332cb0771da2a834d5\n+generated: \"2020-10-29T10:24:26.068098594Z\"\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/README.md", "new_path": "charts/harbor-operator/README.md", "diff": "@@ -16,7 +16,7 @@ Deploy Harbor Operator\n| autoscaling.minReplicas | int | `1` | Minimum conroller replicas |\n| autoscaling.targetCPUUtilizationPercentage | int | `80` | CPU usage target for autoscaling |\n| autoscaling.targetMemoryUtilizationPercentage | int | No target | Memory usage target for autoscaling |\n-| certmanager.enabled | bool | `true` | Whether to install cert-manager Helm chart |\n+| certmanager.enabled | bool | `false` | Whether to install cert-manager Helm chart |\n| deploymentAnnotations | object | `{}` | Additional annotations to add to the controller Deployment |\n| extraEnv | list | `[{\"name\":\"HARBOR_CONTROLLER_MAX_RECONCILE\",\"value\":\"1\"},{\"name\":\"HARBOR_CONTROLLER_WATCH_CHILDREN\",\"value\":\"true\"}]` | Environment variables to inject in controller |\n| fullnameOverride | string | `\"\"` | |\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/deployment.yaml", "new_path": "charts/harbor-operator/templates/deployment.yaml", "diff": "@@ -21,16 +21,16 @@ spec:\ncommand:\n- /manager\nenv:\n- - name: NAMESPACE\n- valueFrom:\n- fieldRef:\n- fieldPath: metadata.namespace\n- name: CONFIGURATION_FROM\nvalue: 'env:'\n- name: CLASSNAME\nvalue: {{ .Values.harborClass | quote }}\n- name: LOG_LEVEL\nvalue: {{ .Values.logLevel | quote }}\n+ - name: NAMESPACE\n+ valueFrom:\n+ fieldRef:\n+ fieldPath: metadata.namespace\nimage: '{{.Values.image.repository}}:{{.Values.image.tag|default .Chart.AppVersion}}'\nimagePullPolicy: {{ .Values.image.pullPolicy | quote }}\nlivenessProbe:\n@@ -39,40 +39,40 @@ spec:\nport: ready\nname: manager\nports:\n- - containerPort: 5000\n- name: ready\n- protocol: TCP\n- containerPort: 9443\nname: webhook-server\nprotocol: TCP\n- containerPort: 8080\nname: metrics\nprotocol: TCP\n+ - containerPort: 5000\n+ name: ready\n+ protocol: TCP\nreadinessProbe:\nhttpGet:\npath: /readyz\nport: ready\nresources: {{- toYaml .Values.resources | nindent 10 }}\nvolumeMounts:\n- - mountPath: /etc/harbor-operator\n- name: configuration-templates\n- readOnly: true\n- mountPath: /tmp/k8s-webhook-server/serving-certs\nname: cert\nreadOnly: true\n+ - mountPath: /etc/harbor-operator\n+ name: configuration-templates\n+ readOnly: true\nnodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }}\nsecurityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }}\nserviceAccountName: {{ include \"chart.serviceAccountName\" . | quote }}\nterminationGracePeriodSeconds: 10\ntolerations: {{- toYaml .Values.tolerations | nindent 8 }}\nvolumes:\n- - configMap:\n- name: '{{ include \"chart.fullname\" . }}-config-template'\n- name: configuration-templates\n- name: cert\nsecret:\ndefaultMode: 420\nsecretName: '{{ include \"chart.fullname\" . }}-certificate'\n+ - configMap:\n+ name: '{{ include \"chart.fullname\" . }}-config-template'\n+ name: configuration-templates\n{{- if not .Values.autoscaling.enabled }}\nreplicas: {{ .Values.replicaCount }}\n{{- end }}\n" }, { "change_type": "MODIFY", "old_path": "charts/harbor-operator/templates/validatingwebhookconfiguration.yaml", "new_path": "charts/harbor-operator/templates/validatingwebhookconfiguration.yaml", "diff": "@@ -3,7 +3,7 @@ apiVersion: admissionregistration.k8s.io/v1beta1\nkind: ValidatingWebhookConfiguration\nmetadata:\nannotations:\n- cert-manager.io/cluster-issuer: '{{.Release.Namespace}}/{{. | include \"chart.fullname\"}}'\n+ cert-manager.io/inject-ca-from: '{{.Release.Namespace}}/{{. | include \"chart.fullname\"}}-serving-cert'\nname: '{{ include \"chart.fullname\" . }}-validating-webhook-configuration'\nwebhooks:\n- clientConfig:\n@@ -47,11 +47,12 @@ webhooks:\n- clientConfig:\ncaBundle: Cg==\nservice:\n- name: '{{ include \"chart.fullname\" . }}-webhook-service'\n+ name: {{ include \"chart.fullname\" . | quote }}\nnamespace: {{ .Release.Namespace | quote }}\n- path: /validate-goharbor-io-v1alpha2-notaryserver\n+ path: /validate-goharbor-io-v1alpha2-registry\n+ port: {{ .Values.service.port }}\nfailurePolicy: Fail\n- name: vnotaryserver.kb.io\n+ name: vregistry.kb.io\nrules:\n- apiGroups:\n- goharbor.io\n@@ -61,15 +62,15 @@ webhooks:\n- CREATE\n- UPDATE\nresources:\n- - notaryservers\n+ - registries\n- clientConfig:\ncaBundle: Cg==\nservice:\nname: '{{ include \"chart.fullname\" . }}-webhook-service'\nnamespace: {{ .Release.Namespace | quote }}\n- path: /validate-goharbor-io-v1alpha2-notarysigner\n+ path: /validate-goharbor-io-v1alpha2-notaryserver\nfailurePolicy: Fail\n- name: vnotarysigner.kb.io\n+ name: vnotaryserver.kb.io\nrules:\n- apiGroups:\n- goharbor.io\n@@ -79,16 +80,15 @@ webhooks:\n- CREATE\n- UPDATE\nresources:\n- - notarysigners\n+ - notaryservers\n- clientConfig:\ncaBundle: Cg==\nservice:\n- name: {{ include \"chart.fullname\" . | quote }}\n+ name: '{{ include \"chart.fullname\" . }}-webhook-service'\nnamespace: {{ .Release.Namespace | quote }}\n- path: /validate-goharbor-io-v1alpha2-registry\n- port: {{ .Values.service.port }}\n+ path: /validate-goharbor-io-v1alpha2-notarysigner\nfailurePolicy: Fail\n- name: vregistry.kb.io\n+ name: vnotarysigner.kb.io\nrules:\n- apiGroups:\n- goharbor.io\n@@ -98,4 +98,4 @@ webhooks:\n- CREATE\n- UPDATE\nresources:\n- - registries\n+ - notarysigners\n" } ]
Go
Apache License 2.0
goharbor/harbor-operator
fix(ci) sync charts files Signed-off-by: Ziming Zhang <zziming@vmware.com>