Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-10306

Views: Ability for a view instance to be associated to a cluster for configuration

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Ability for a view instance to be associated to a cluster for configuration (so the view can have access to cluster config information via view context). This enables the view instance to be configured w/o the admin having to wire-up properties. Whether the view is auto instantiated or instantiated manually, the Ambari Admin should have an option to relate an instance of a cluster to the view instance. This make the cluster config information available to the view so the view can "auto-configure". Therefore, in addition to today's manual configure option, need to add options for picking a cluster in same ambari, or picking remote ambari server to "auto-configure". Based on the configuration option the user chooses, the way the user gets configuration changes. If the user chooses today mode of config, they can use the same ViewContext.getProperties() as they do today. If they choose a local cluster, they need a way to get access to all cluster configurations. For remote cluster, maybe we just provide convenient method way to get rest endpoint to the cluster resource to limit scope? In any of the three cases, the view developer needs to know how he is to get his configurations (custom, local or remote), and have a way to get access via ViewContext. Also, need ability to flag properties as cluster "configuration" or "setting" so the UI can organize properties that can be derived from cluster configuration properties vs. settings props related to the view itself.

      1. AMBARI-10306.patch
        52 kB
        Tom Beerbower

        Issue Links

          Activity

          Hide
          hadoopqa Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12708586/AMBARI-10306.patch
          against trunk revision .

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 7 new or modified test files.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          -1 core tests. The test build failed in ambari-server

          Test results: https://builds.apache.org/job/Ambari-trunk-test-patch/2204//testReport/
          Console output: https://builds.apache.org/job/Ambari-trunk-test-patch/2204//console

          This message is automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12708586/AMBARI-10306.patch against trunk revision . +1 @author . The patch does not contain any @author tags. +1 tests included . The patch appears to include 7 new or modified test files. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. -1 core tests . The test build failed in ambari-server Test results: https://builds.apache.org/job/Ambari-trunk-test-patch/2204//testReport/ Console output: https://builds.apache.org/job/Ambari-trunk-test-patch/2204//console This message is automatically generated.
          Hide
          hadoopqa Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12708591/AMBARI-10306.patch
          against trunk revision .

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 7 new or modified test files.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          -1 core tests. The test build failed in ambari-server

          Test results: https://builds.apache.org/job/Ambari-trunk-test-patch/2205//testReport/
          Console output: https://builds.apache.org/job/Ambari-trunk-test-patch/2205//console

          This message is automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12708591/AMBARI-10306.patch against trunk revision . +1 @author . The patch does not contain any @author tags. +1 tests included . The patch appears to include 7 new or modified test files. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. -1 core tests . The test build failed in ambari-server Test results: https://builds.apache.org/job/Ambari-trunk-test-patch/2205//testReport/ Console output: https://builds.apache.org/job/Ambari-trunk-test-patch/2205//console This message is automatically generated.
          Hide
          tbeerbower Tom Beerbower added a comment -

          Cluster Association Usage

          1. The view developer indicates that a parameter is configurable through cluster association by using the <cluster-config> element in the view descriptor. The cluster configuration is given in the form configuration type/configuration key. For example, ...
              <parameter>
                <name>http-address</name>
                <description>The http-address.</description>
                <cluster-config>hdfs-site/dfs.namenode.http-address</cluster-config>
                <required>false</required>
              </parameter>
            
          2. The API user can see that a parameter is tagged as cluster configuration by looking at the parameters of the view version resource. For example, ...
            {
              "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/MYVIEW/versions/1.0.0/",
              "ViewVersionInfo" : {
                ...
                "cluster_configurable" : true,
                ...
                "parameters" : [
                  {
                    "name" : "http-address",
                    "description" : "The http-address. Defaults to \"default value\".",
                    "label" : null,
                    "placeholder" : null,
                    "defaultValue" : "default value",
                    "clusterConfig" : "hdfs-site/dfs.namenode.http-address",
                    "required" : false,
                    "masked" : false
                  }
                ], ...
            

            Note that the parameter contains a cluster configuration value. Also note that the view version is tagged as "cluster configurable" since it contains at least one parameter that may be configured through association with a cluster.

          3. The view instance may be associated with a cluster instance. This is done by assigning a cluster handle to the view instance. For a local cluster reference (view and cluster managed by the same Ambari server) the cluster handle is simply the unique cluster name. Currently only a local association is supported. The API to set the cluster handle is a POST on a view instance. For example ...
            POST api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1
            
            {
              "ViewInstanceInfo" : {
                "cluster_handle" : "c1"
              }
            }
            
          4. The cluster association can be checked by doing a GET on a view instance. For example ...
            GET api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1
            
            ...
            
            {
              "href" : "http://c6401.ambari.apache.org:8080/api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1",
              "ViewInstanceInfo" : {
                "cluster_handle" : "c1",
                ...
            
          5. Once a cluster association is set on a view instance then the view code accessing the properties should see the cluster-config properties with values from the cluster's configuration. For example, in the view code ...
                ViewContext viewContext;
                ...
                Map<String, String> properties = viewContext.getProperties();
                String httpAddress = properties.get("http-address");
                // httpAddress should come from cluster "c1", configuration "hdfs-site/dfs.namenode.http-address"
            
          6. The view code may also access the cluster configuration directly without assigning it to a view parameter. For example, in the view code ...
                ViewContext viewContext;
                ...
                Map<String, String> properties = viewContext.getProperties();
                Cluster cluster = viewContext.getCluster();
                if (cluster != null) { // view instance is associated with a cluster
                    String httpAddress = cluster.getConfigurationValue("hdfs-site", "dfs.namenode.http-address");
                    // httpAddress should come from cluster "c1", configuration "hdfs-site/dfs.namenode.http-address"
                }
            
          Show
          tbeerbower Tom Beerbower added a comment - Cluster Association Usage The view developer indicates that a parameter is configurable through cluster association by using the <cluster-config> element in the view descriptor. The cluster configuration is given in the form configuration type/configuration key . For example, ... <parameter> <name>http-address</name> <description>The http-address.</description> <cluster-config>hdfs-site/dfs.namenode.http-address</cluster-config> <required> false </required> </parameter> The API user can see that a parameter is tagged as cluster configuration by looking at the parameters of the view version resource. For example, ... { "href" : "http: //c6401.ambari.apache.org:8080/api/v1/views/MYVIEW/versions/1.0.0/" , "ViewVersionInfo" : { ... "cluster_configurable" : true , ... "parameters" : [ { "name" : "http-address" , "description" : "The http-address. Defaults to \" default value\ "." , "label" : null , "placeholder" : null , "defaultValue" : " default value" , "clusterConfig" : "hdfs-site/dfs.namenode.http-address" , "required" : false , "masked" : false } ], ... Note that the parameter contains a cluster configuration value. Also note that the view version is tagged as "cluster configurable" since it contains at least one parameter that may be configured through association with a cluster. The view instance may be associated with a cluster instance. This is done by assigning a cluster handle to the view instance. For a local cluster reference (view and cluster managed by the same Ambari server) the cluster handle is simply the unique cluster name. Currently only a local association is supported. The API to set the cluster handle is a POST on a view instance. For example ... POST api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1 { "ViewInstanceInfo" : { "cluster_handle" : "c1" } } The cluster association can be checked by doing a GET on a view instance. For example ... GET api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1 ... { "href" : "http: //c6401.ambari.apache.org:8080/api/v1/views/MYVIEW/versions/1.0.0/instances/INSTANCE1" , "ViewInstanceInfo" : { "cluster_handle" : "c1" , ... Once a cluster association is set on a view instance then the view code accessing the properties should see the cluster-config properties with values from the cluster's configuration. For example, in the view code ... ViewContext viewContext; ... Map< String , String > properties = viewContext.getProperties(); String httpAddress = properties.get( "http-address" ); // httpAddress should come from cluster "c1" , configuration "hdfs-site/dfs.namenode.http-address" The view code may also access the cluster configuration directly without assigning it to a view parameter. For example, in the view code ... ViewContext viewContext; ... Map< String , String > properties = viewContext.getProperties(); Cluster cluster = viewContext.getCluster(); if (cluster != null ) { // view instance is associated with a cluster String httpAddress = cluster.getConfigurationValue( "hdfs-site" , "dfs.namenode.http-address" ); // httpAddress should come from cluster "c1" , configuration "hdfs-site/dfs.namenode.http-address" }
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Ambari-trunk-Commit #2172 (See https://builds.apache.org/job/Ambari-trunk-Commit/2172/)
          AMBARI-10306 - Views: Ability for a view instance to be associated to a cluster for configuration (tbeerbower) (tbeerbower: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=acdaae986b428b09310c06f08ec42fc98b93d3b4)

          • ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java
          • ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java
          • ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
          • ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java
          • ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
          • ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java
          • ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ParameterConfigTest.java
          • ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java
          • ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java
          • ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
          • ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java
          • ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
          • ambari-views/src/main/java/org/apache/ambari/view/cluster/Cluster.java
          • ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
          • ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
          • ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java
          • ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java
          • ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewParameterEntity.java
          • ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
          • ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ParameterConfig.java
          • ambari-views/src/main/java/org/apache/ambari/view/ViewInstanceDefinition.java
          • ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
          • ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
          • ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
          • ambari-views/src/main/resources/view.xsd
          • ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewEntityTest.java
          • ambari-server/src/test/java/org/apache/ambari/server/view/ViewContextImplTest.java
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Ambari-trunk-Commit #2172 (See https://builds.apache.org/job/Ambari-trunk-Commit/2172/ ) AMBARI-10306 - Views: Ability for a view instance to be associated to a cluster for configuration (tbeerbower) (tbeerbower: http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=acdaae986b428b09310c06f08ec42fc98b93d3b4 ) ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewVersionResourceProvider.java ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql ambari-views/src/main/java/org/apache/ambari/view/ViewContext.java ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ParameterConfigTest.java ambari-server/src/test/java/org/apache/ambari/server/view/configuration/ViewConfigTest.java ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java ambari-views/src/main/java/org/apache/ambari/view/cluster/Cluster.java ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewParameterEntity.java ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql ambari-server/src/main/java/org/apache/ambari/server/view/configuration/ParameterConfig.java ambari-views/src/main/java/org/apache/ambari/view/ViewInstanceDefinition.java ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java ambari-views/src/main/resources/view.xsd ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewEntityTest.java ambari-server/src/test/java/org/apache/ambari/server/view/ViewContextImplTest.java

            People

            • Assignee:
              tbeerbower Tom Beerbower
              Reporter:
              tbeerbower Tom Beerbower
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development