This is an automated email from the ASF dual-hosted git repository. nferraro pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit 1e3e504879cdd4da59eab324bc4bf76de41f1120 Author: nicolaferraro <[email protected]> AuthorDate: Tue Jul 6 13:13:13 2021 +0200 CAMEL-16788: workaround to prevent override from system env variables --- cassandra-sink.kamelet.yaml | 14 +++++++------- cassandra-source.kamelet.yaml | 14 +++++++------- file-watch-source.kamelet.yaml | 6 +++--- ftp-sink.kamelet.yaml | 14 +++++++------- ftp-source.kamelet.yaml | 14 +++++++------- ftps-sink.kamelet.yaml | 14 +++++++------- ftps-source.kamelet.yaml | 14 +++++++------- mail-imap-source.kamelet.yaml | 14 +++++++------- mariadb-sink.kamelet.yaml | 6 +++--- mariadb-source.kamelet.yaml | 6 +++--- mysql-sink.kamelet.yaml | 6 +++--- mysql-source.kamelet.yaml | 6 +++--- postgresql-sink.kamelet.yaml | 6 +++--- postgresql-source.kamelet.yaml | 6 +++--- rabbitmq-source.kamelet.yaml | 5 +++-- script/validator/validator.go | 12 +++++++++++- sftp-sink.kamelet.yaml | 14 +++++++------- sftp-source.kamelet.yaml | 14 +++++++------- sqlserver-sink.kamelet.yaml | 6 +++--- sqlserver-source.kamelet.yaml | 6 +++--- ssh-source.kamelet.yaml | 14 +++++++------- 21 files changed, 111 insertions(+), 100 deletions(-) diff --git a/cassandra-sink.kamelet.yaml b/cassandra-sink.kamelet.yaml index 38fac30..54bd09c 100644 --- a/cassandra-sink.kamelet.yaml +++ b/cassandra-sink.kamelet.yaml @@ -18,21 +18,21 @@ spec: This Kamelet expects the body as JSON Array. The content of the JSON Array will be used as input for the CQL Prepared Statement set in the query parameter. required: - - host - - port + - connectionHost + - connectionPort - keyspace - username - password - preparedStatement type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname(s) cassandra server(s). Multiple hosts can be separated by comma. type: string example: localhost - port: - title: Port + connectionPort: + title: Connection Port description: Port number of cassandra server(s) type: string example: 9042 @@ -77,7 +77,7 @@ spec: library: Jackson useList: true - to: - uri: "cql://{{host}}:{{port}}/{{keyspace}}" + uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}" parameters: username: "{{username}}" password: "{{password}}" diff --git a/cassandra-source.kamelet.yaml b/cassandra-source.kamelet.yaml index 7084945..52645f1 100644 --- a/cassandra-source.kamelet.yaml +++ b/cassandra-source.kamelet.yaml @@ -16,21 +16,21 @@ spec: description: |- Query a Cassandra cluster table. required: - - host - - port + - connectionHost + - connectionPort - keyspace - username - password - query type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname(s) cassandra server(s). Multiple hosts can be separated by comma. type: string example: localhost - port: - title: Port + connectionPort: + title: Connection Port description: Port number of cassandra server(s) type: string example: 9042 @@ -73,7 +73,7 @@ spec: - "camel:cassandraql" flow: from: - uri: "cql://{{host}}:{{port}}/{{keyspace}}" + uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}" parameters: username: "{{username}}" password: "{{password}}" diff --git a/file-watch-source.kamelet.yaml b/file-watch-source.kamelet.yaml index 7bbf82d..0bd8029 100644 --- a/file-watch-source.kamelet.yaml +++ b/file-watch-source.kamelet.yaml @@ -16,11 +16,11 @@ spec: description: |- Receive events related to a file or folder. It may require a volume mounting on Kubernetes. required: - - path + - filePath - events type: object properties: - path: + filePath: title: Path to Watch description: Path of file or folder to watch type: string @@ -34,7 +34,7 @@ spec: - "camel:kamelet" flow: from: - uri: "file-watch:{{path}}" + uri: "file-watch:{{filePath}}" parameters: events: "{{events}}" steps: diff --git a/ftp-sink.kamelet.yaml b/ftp-sink.kamelet.yaml index 06e6c0b..9620889 100644 --- a/ftp-sink.kamelet.yaml +++ b/ftp-sink.kamelet.yaml @@ -22,19 +22,19 @@ spec: If the header won't be set the exchange ID will be used as file name. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the FTP server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTP server type: string default: 21 @@ -86,7 +86,7 @@ spec: name: CamelFileName simple: "${header[ce-file]}" - to: - uri: "ftp:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "ftp:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/ftp-source.kamelet.yaml b/ftp-source.kamelet.yaml index 0848b44..4b84170 100644 --- a/ftp-source.kamelet.yaml +++ b/ftp-source.kamelet.yaml @@ -16,19 +16,19 @@ spec: description: |- Receive data from an FTP Server. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the FTP server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTP server type: string default: 21 @@ -74,7 +74,7 @@ spec: - "camel:kamelet" flow: from: - uri: "ftp:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "ftp:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/ftps-sink.kamelet.yaml b/ftps-sink.kamelet.yaml index da3965f..0e24a7a 100644 --- a/ftps-sink.kamelet.yaml +++ b/ftps-sink.kamelet.yaml @@ -22,19 +22,19 @@ spec: If the header won't be set the exchange ID will be used as file name. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the FTP server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTP server type: string default: 21 @@ -86,7 +86,7 @@ spec: name: CamelFileName simple: "${header[ce-file]}" - to: - uri: "ftps:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "ftps:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/ftps-source.kamelet.yaml b/ftps-source.kamelet.yaml index 9452b10..036b92d 100644 --- a/ftps-source.kamelet.yaml +++ b/ftps-source.kamelet.yaml @@ -16,19 +16,19 @@ spec: description: |- Receive data from an FTPS Server. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the FTPS server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTPS server type: string default: 21 @@ -74,7 +74,7 @@ spec: - "camel:kamelet" flow: from: - uri: "ftps:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "ftps:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/mail-imap-source.kamelet.yaml b/mail-imap-source.kamelet.yaml index 7ba673b..38897c4 100644 --- a/mail-imap-source.kamelet.yaml +++ b/mail-imap-source.kamelet.yaml @@ -16,19 +16,19 @@ spec: description: |- Receive unread emails from an IMAP mail server, marking them as read once they are received. required: - - host - - port + - connectionHost + - connectionPort - username - password type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: The IMAP server host type: string example: imap.gmail.com - port: - title: Port + connectionPort: + title: Connection Port description: The IMAP server port type: string default: 993 @@ -59,7 +59,7 @@ spec: - "camel:kamelet" flow: from: - uri: "imaps:{{host}}:{{port}}" + uri: "imaps:{{connectionHost}}:{{connectionPort}}" parameters: username: "{{username}}" password: "{{password}}" diff --git a/mariadb-sink.kamelet.yaml b/mariadb-sink.kamelet.yaml index a20a46d..daf482b 100644 --- a/mariadb-sink.kamelet.yaml +++ b/mariadb-sink.kamelet.yaml @@ -40,8 +40,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 3306 @@ -83,7 +83,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:mariadb://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:mariadb://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'org.mariadb.jdbc.Driver' from: diff --git a/mariadb-source.kamelet.yaml b/mariadb-source.kamelet.yaml index cb29890..f136bea 100644 --- a/mariadb-source.kamelet.yaml +++ b/mariadb-source.kamelet.yaml @@ -32,8 +32,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 3306 @@ -80,7 +80,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:mariadb://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:mariadb://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'org.mariadb.jdbc.Driver' from: diff --git a/mysql-sink.kamelet.yaml b/mysql-sink.kamelet.yaml index 81ee38e..e9dcd2e 100644 --- a/mysql-sink.kamelet.yaml +++ b/mysql-sink.kamelet.yaml @@ -40,8 +40,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 3306 @@ -83,7 +83,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:mysql://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:mysql://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'com.mysql.cj.jdbc.Driver' from: diff --git a/mysql-source.kamelet.yaml b/mysql-source.kamelet.yaml index 345f522..6f5b717 100644 --- a/mysql-source.kamelet.yaml +++ b/mysql-source.kamelet.yaml @@ -32,8 +32,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 3306 @@ -80,7 +80,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:mysql://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:mysql://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'com.mysql.cj.jdbc.Driver' from: diff --git a/postgresql-sink.kamelet.yaml b/postgresql-sink.kamelet.yaml index d435d02..dd3a42c 100644 --- a/postgresql-sink.kamelet.yaml +++ b/postgresql-sink.kamelet.yaml @@ -36,8 +36,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 5432 @@ -80,7 +80,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:postgresql://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:postgresql://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'org.postgresql.Driver' from: diff --git a/postgresql-source.kamelet.yaml b/postgresql-source.kamelet.yaml index 83bf356..d1dd675 100644 --- a/postgresql-source.kamelet.yaml +++ b/postgresql-source.kamelet.yaml @@ -28,8 +28,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 5432 @@ -77,7 +77,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:postgresql://{{serverName}}:{{port}}/{{databaseName}}' + value: 'jdbc:postgresql://{{serverName}}:{{serverPort}}/{{databaseName}}' - key: driverClassName value: 'org.postgresql.Driver' from: diff --git a/rabbitmq-source.kamelet.yaml b/rabbitmq-source.kamelet.yaml index 20e5d3c..c210cd0 100644 --- a/rabbitmq-source.kamelet.yaml +++ b/rabbitmq-source.kamelet.yaml @@ -26,8 +26,8 @@ spec: title: Addresses description: Comma separated list of RabbitMQ broker addresses type: string - port: - title: Port + portNumber: + title: Port Number description: Port of the RabbitMQ server type: string default: 5672 @@ -56,5 +56,6 @@ spec: password: "{{password}}" username: "{{username}}" addresses: "{{addresses}}" + portNumber: "{{portNumber}}" steps: - to: "kamelet:sink" diff --git a/script/validator/validator.go b/script/validator/validator.go index 6e14b3b..4d6ebcf 100644 --- a/script/validator/validator.go +++ b/script/validator/validator.go @@ -26,6 +26,11 @@ import ( "k8s.io/apimachinery/pkg/util/yaml" ) +var ( + // Needed until this is fixed: https://issues.apache.org/jira/browse/CAMEL-16788 + forbiddenParameterNames = []string{"home", "hostname", "language", "lang", "namespace", "path", "podname", "pod-name", "port", "pwd", "shell", "term"} +) + func main() { if len(os.Args) != 2 { println("usage: validator kamelets-path") @@ -62,7 +67,7 @@ func verifyMissingDependencies(kamelets []KameletInfo) (errors []error) { code := camelapiv1.SourceSpec{ DataSpec: camelapiv1.DataSpec{ - Name: "source.yaml", + Name: "source.yaml", Content: string(yamlDslFlow), }, Language: camelapiv1.LanguageYaml, @@ -216,6 +221,11 @@ func verifyParameters(kamelets []KameletInfo) (errors []error) { errors = append(errors, fmt.Errorf("kamelet %q does not contain a definition of type \"object\"", kamelet.Name)) } for k, p := range kamelet.Spec.Definition.Properties { + for _, f := range forbiddenParameterNames { + if strings.EqualFold(k, f) { + errors = append(errors, fmt.Errorf("property name %q is using a reserved keyword in kamelet %q", k, kamelet.Name)) + } + } if p.Type == "" { errors = append(errors, fmt.Errorf("property %q in kamelet %q does not contain type", k, kamelet.Name)) } diff --git a/sftp-sink.kamelet.yaml b/sftp-sink.kamelet.yaml index 8e88037..f5ccb47 100644 --- a/sftp-sink.kamelet.yaml +++ b/sftp-sink.kamelet.yaml @@ -22,19 +22,19 @@ spec: If the header won't be set the exchange ID will be used as file name. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the FTP server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTP server type: string default: 22 @@ -86,7 +86,7 @@ spec: name: CamelFileName simple: "${header[ce-file]}" - to: - uri: "sftp:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "sftp:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/sftp-source.kamelet.yaml b/sftp-source.kamelet.yaml index 65e6e52..3db56c3 100644 --- a/sftp-source.kamelet.yaml +++ b/sftp-source.kamelet.yaml @@ -16,19 +16,19 @@ spec: description: |- Receive data from an SFTP Server. required: - - host - - port + - connectionHost + - connectionPort - username - password - directoryName type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: Hostname of the SFTP server type: string - port: - title: Port + connectionPort: + title: Connection Port description: Port of the FTP server type: string default: 22 @@ -74,7 +74,7 @@ spec: - "camel:kamelet" flow: from: - uri: "sftp:{{username}}@{{host}}:{{port}}/{{directoryName}}" + uri: "sftp:{{username}}@{{connectionHost}}:{{connectionPort}}/{{directoryName}}" parameters: password: "{{password}}" passiveMode: "{{passiveMode}}" diff --git a/sqlserver-sink.kamelet.yaml b/sqlserver-sink.kamelet.yaml index c6aec07..4db5e6b 100644 --- a/sqlserver-sink.kamelet.yaml +++ b/sqlserver-sink.kamelet.yaml @@ -40,8 +40,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 1433 @@ -83,7 +83,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:sqlserver://{{serverName}}:{{port}};databaseName={{databaseName}}' + value: 'jdbc:sqlserver://{{serverName}}:{{serverPort}};databaseName={{databaseName}}' - key: driverClassName value: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' from: diff --git a/sqlserver-source.kamelet.yaml b/sqlserver-source.kamelet.yaml index 2015372..4054976 100644 --- a/sqlserver-source.kamelet.yaml +++ b/sqlserver-source.kamelet.yaml @@ -32,8 +32,8 @@ spec: description: Server Name for the data source type: string example: localhost - port: - title: Port + serverPort: + title: Server Port description: Server Port for the data source type: string default: 1433 @@ -80,7 +80,7 @@ spec: - key: password value: '{{password}}' - key: url - value: 'jdbc:sqlserver://{{serverName}}:{{port}};databaseName={{databaseName}}' + value: 'jdbc:sqlserver://{{serverName}}:{{serverPort}};databaseName={{databaseName}}' - key: driverClassName value: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' from: diff --git a/ssh-source.kamelet.yaml b/ssh-source.kamelet.yaml index b985083..4aaf2d4 100644 --- a/ssh-source.kamelet.yaml +++ b/ssh-source.kamelet.yaml @@ -16,19 +16,19 @@ spec: description: |- Receive data from SSH session. required: - - host - - port + - connectionHost + - connectionPort - username - password - pollCommand type: object properties: - host: - title: Host + connectionHost: + title: Connection Host description: The SSH Host type: string - port: - title: Port + connectionPort: + title: Connection Port description: The SSH Port type: string default: 22 @@ -61,7 +61,7 @@ spec: - "camel:kamelet" flow: from: - uri: "ssh://{{host}}:{{port}}" + uri: "ssh://{{connectionHost}}:{{connectionPort}}" parameters: username: "{{username}}" password: "{{password}}"
