Checklist
Today, every property a provisioner supports is exposed to users when creating a profile. This is because all existing properties can vary from profile to profile. However, there are certain types of properties that should not be exposed to users and should be shared across all profiles that use the provisioner. These types of settings usually need to be set once and do not change frequently.
Provide a way for CDAP administrators to configure provisioner internals that should not be exposed to end users.
The Provisioner interface will be modified to have an initialize method that takes a map of properties. Initialize will be called once when the provisioner is created, and is guaranteed to be called before any other method.
public interface Provisioner { ... /** * Initialize a provisioner with its system properties. * This is called once before any other methods are called. */ void initialize(Map<String, String> systemProperties); } |
This can be used to implement the use cases mentioned earlier in this design.
public class DataprocProvisioner { private Set<String> labels; private boolean useInternalIP; void initialize(Map<String, String> systemProperties) { labels = new HashSet<>(); String systemLabels = systemProperties.get("labels"); if (systemLabels != null) { for (String systemLabel : systemLabels.split(',')) { labels.add(systemLabel); } } useInternalIP = Boolean.valueOf(systemProperties.get("use.internal.ip"); } ... } |
Provisioner system properties are specified in the CDAP configuration file. When instantiating a Provisioner, CDAP will look for any properties in the CConfiguration that are prefixed with 'provisioner.system.properties.<provisioner-name>.'. Anything after the prefix will be used as a property key and the corresponding value will be the property value. For example, if the provisioner above is named 'gcp-dataproc' and cdap-site.xml contains:
<property> <name>provisioner.system.properties.gcp-dataproc.labels</name> <value>prod,finance</value> </property> <property> <name>provisioner.system.properties.gcp-dataproc.use.internal.ip</name> <value>true</value> </property> |
then the 'systemProperties' map in the above code example would have two values: 'labels' = 'prod,finance' and 'use.internal.ip' = 'true'.
Provisioner gets a new initialize method:
public interface Provisioner { ... void initialize(Map<String, String> systemProperties); } |
None
None
None
None
None
None
None
Test ID | Test Description | Expected Results |
---|---|---|
None planned