Skip to content

Expose modules to support creation of CDP DW Database Catalog and Virtual Warehouses - #19

Closed
raju-saravanan wants to merge 8 commits into
cloudera-labs:develfrom
raju-saravanan:cdw-level-2
Closed

Expose modules to support creation of CDP DW Database Catalog and Virtual Warehouses#19
raju-saravanan wants to merge 8 commits into
cloudera-labs:develfrom
raju-saravanan:cdw-level-2

Conversation

@raju-saravanan

@raju-saravanan raju-saravanan commented Jul 15, 2021

Copy link
Copy Markdown
Contributor

Changes in this PR:

  • Support private load balancers while creating a DW cluster.
  • Support the creation of DW database catalog.
  • Support the creation of DW virtual warehouse.

Changes in this PR are done in conjunction with the following PRs:

Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
cluster_id=dict(required=True, type='str', aliases=['cluster_id']),
dbc_id=dict(required=False, type='str', aliases=['dbc_id']),
vw_type = dict(required=False, type='str', aliases=['vw_type']),
name = dict(required=True, type='str', aliases=['name']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be 'name' with an alias of 'name'

Comment thread plugins/modules/dw_dbc.py Outdated
self.target = self.cdpy.sdk.wait_for_state(
describe_func=self.cdpy.dw.describe_dbc,
params=dict(cluster_id=self.cluster_id,dbc_id=self.name),
state='Running', delay=self.delay, timeout=self.timeout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state should be self.cdpy.sdk.STARTED_STATES

Comment thread plugins/modules/dw_vw.py Outdated
self.target = self.cdpy.sdk.wait_for_state(
describe_func=self.cdpy.dw.delete_vw,
params=dict(cluster_id=self.cluster_id, vw_id=self.name),
state='Running', delay=self.delay, timeout=self.timeout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.cdpy.sdk.STARTED_STATES

Comment thread plugins/modules/dw_vw.py Outdated
self.target = self.cdpy.sdk.wait_for_state(
describe_func=self.cdpy.dw.describe_vw,
params=dict(cluster_id=self.cluster_id, vw_id=self.name),
state='Running', delay=self.delay, timeout=self.timeout

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.cdpy.sdk.STARTED_STATES

@raju-saravanan
raju-saravanan force-pushed the cdw-level-2 branch 2 times, most recently from 7e43f33 to 898d275 Compare July 22, 2021 11:48
Comment thread plugins/modules/dw_vw.py Outdated

@wmudge wmudge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I would like to clarify the module names and return values. In addition, the documentation sections need review, esp. the dw_vw.py module. The contents do not reflect the code, and I suspect the format of applicationConfig, for example, needs updating, too.

Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_dbc.py Outdated
Comment thread plugins/modules/dw_dbc.py Outdated
)

result = DwDbc(module)
output = dict(changed=False, dbcs=result.dbcs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbcs -> data_catalogs

Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
Comment thread plugins/modules/dw_vw.py Outdated
description: Maximum number of available nodes for Virtual Warehouse autoscaling.
type: int
required: False
config:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no config parameter group in the code -- commonConfigs, applicationConfigs, ldapGroups, and enableSSO are all "top level" module parameters in the code. Moreover, the parameters are lowercase with underscores.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, will fix this.

Comment thread plugins/modules/dw_vw.py Outdated
@raju-saravanan
raju-saravanan force-pushed the cdw-level-2 branch 2 times, most recently from 0ac1f4e to a647c61 Compare July 23, 2021 09:55
@raju-saravanan

Copy link
Copy Markdown
Contributor Author

@wmudge : Address your comments, can you take another look ?

@wmudge wmudge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation and module specification sections need alignment and further detail.

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
description: Configurations that are applied to every application in the service.
type: dict
required: False
contains:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required: False
contains:
configBlocks: List of ConfigBlocks for the application.
type: list

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lists require elements, which would be dict in this case, IIRC

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
required: False
content:
description: Contents of a ConfigBlock.
type: obj

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dict

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
contains:
keyValues:
description: Key-value type configurations.
type: obj

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dict

- cloudera.cloud.cdp_auth_options
'''

EXAMPLES = r'''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an example or two of using the various nested configurations?

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
def main():
module = AnsibleModule(
argument_spec=CdpModule.argument_spec(
id=dict(required=False, type='str', default=None),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only use default when necessary. The _get_param() should handle a non-existent parameter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with required -- only needed if True

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
autoscaling_min_nodes=dict(required=False, type='int', default=None),
autoscaling_max_nodes=dict(required=False, type='int', default=None),
common_configs=dict(required=False, type='dict', default=None),
application_configs=dict(required=False, type='dict', default=None),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both common_configs and application_configs need to be expanded to match documentation rules above.

Comment thread plugins/modules/dw_virtual_warehouse.py Outdated
)

result = DwVw(module)
output = dict(changed=False, virtual_warehouses=result.virtual_warehouses)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed is invalid -- this module can make changes.

@raju-saravanan

Copy link
Copy Markdown
Contributor Author

@wmudge : I have expanded the commonConfigs in argument_spec, but applicationConfig have some dynamic keys in the uppermost level so, couldn't expand beyond 'dict'. Eg :

 "applicationConfigs": {
        "das-webapp": {
        "configBlocks": [
           {
               "id": "hive-kerberos-config",
               "format": "TEXT",
               "content": {
                "text": "\n[libdefaults]\n\trenew_lifetime = 7d"
              }
          }
        ] 
      }   
    }

Here "das-webapp" is dynamic key, we can have configs for other services as well.

Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
Signed-off-by: Saravanan Raju <saravanan.footloose@gmail.com>
@wmudge

wmudge commented Oct 6, 2021

Copy link
Copy Markdown
Member

Superseded by #29

@wmudge wmudge closed this Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants