spring-cloud-dataflow
spring-cloud-dataflow copied to clipboard
How to pass a sensitive information When launching the task through RestCall
Description: Trying to launch a task using Rest call (/tasks/executions - POST). The task is spring boot application and connecting other server, database. app needs many creds to run. While launching task through a rest call, How to pass the values?
Can we think about that we can set the creds for this task in scdf deployment yaml files as secrets? tested this and working for datasource.
Release versions: 2.10.0
@vishnuek If you are using K8S it is best to manage those secrets yourself and your task app can use Spring Cloud Kubernetes to obtain the properties.
I suggest you create something like the following:
@ConfigurationProperties("myapp.second-database")
class NonDefaultDatabaseProperties {
String url;
String secretName;
String secretNamespace;
String driverClassName;
}
@Configuration
@Profile("k8s")
class NonDefaultDatabaseConfiguration {
@Bean("secondDS")
DataSource secondDS(NonDefaultDatabaseProperties databaseProperties, Fabric8SecretsPropertySourceLocator secretsLocator) {
// use secretsLocator.getPropertySource to retrieve a SecretsPropertySource and then retrieve the username and password
// initialise the datasource using databaseProperties and the username and password.
}
}
Use a k8s profile when deploying in Kubernetes and retrieve the 2nd database properties. When you want to use a profile named local then place the properties in application-local.properties in a config folder under the application location.
Closing due to inactivity. If closed in error please let us know.