Skip to content

Commit fb4a196

Browse files
authored
Add autoscaling and impala_ha parameters to DW VW module (#145)
Signed-off-by: Jim Enright <[email protected]>
1 parent cebe06e commit fb4a196

File tree

1 file changed

+141
-13
lines changed

1 file changed

+141
-13
lines changed

plugins/modules/dw_virtual_warehouse.py

Lines changed: 141 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,47 @@
7676
- small
7777
- medium
7878
- large
79-
autoscaling_min_nodes:
80-
description: The minimum number of available nodes for Virtual Warehouse autoscaling.
81-
type: int
82-
autoscaling_max_nodes:
83-
description: The maximum number of available nodes for Virtual Warehouse autoscaling.
84-
type: int
79+
autoscaling:
80+
description:
81+
- Auto-scaling configuration for a Virtual Warehouse
82+
type: dict
83+
elements: dict
84+
required: False
85+
suboptions:
86+
min_nodes:
87+
description: The minimum number of available nodes for Virtual Warehouse autoscaling.
88+
type: int
89+
max_nodes:
90+
description: The maximum number of available nodes for Virtual Warehouse autoscaling.
91+
type: int
92+
auto_suspend_timeout_seconds:
93+
description: Auto suspend threshold for Virtual Warehouse.
94+
type: int
95+
disable_auto_suspend:
96+
description: Turn off auto suspend for Virtual Warehouse.
97+
type: bool
98+
hive_desired_free_capacity:
99+
description:
100+
- Set Desired free capacity for Hive Virtual Wearhouses.
101+
- Either I(hive_scale_wait_time_seconds) or I(hive_desired_free_capacity) can be provided.
102+
type: int
103+
hive_scale_wait_time_seconds:
104+
description:
105+
- Set wait time before a scale event happens for Hive Virtual Wearhouses.
106+
- Either I(hive_scale_wait_time_seconds) or I(hive_desired_free_capacity) can be provided.
107+
type: int
108+
impala_scale_down_delay_seconds:
109+
description:
110+
- Scale down threshold in seconds for Impala Virtual Wearhouses.
111+
type: int
112+
impala_scale_up_delay_seconds:
113+
description:
114+
- Scale up threshold in seconds for Impala Virtual Wearhouses.
115+
type: int
116+
pod_config_name:
117+
description:
118+
- Name of the pod configuration.
119+
type: str
85120
common_configs:
86121
description: Configurations that are applied to every application in the Virtual Warehouse service.
87122
type: dict
@@ -155,6 +190,35 @@
155190
json:
156191
description: JSON type configuration.
157192
type: str
193+
impala_ha:
194+
description:
195+
- High Availability settings for a Impala Virtual Warehouse
196+
type: dict
197+
elements: dict
198+
required: False
199+
suboptions:
200+
enable_catalog_high_availability:
201+
description: Enables a backup instance for Impala catalog to ensure high availability.
202+
type: bool
203+
enable_shutdown_of_coordinator:
204+
description:
205+
- Enables a shutdown of the coordinator.
206+
- If Unified Analytics is enabled, then this setting is explicitly disabled and should not be provided.
207+
type: bool
208+
high_availability_mode:
209+
description:
210+
- Set High Availability mode.
211+
type: str
212+
choices:
213+
- ACTIVE_PASSIVE
214+
- ACTIVE_ACTIVE
215+
- DISABLED
216+
num_of_active_coordinators:
217+
description: The number of active coordinators.
218+
type: int
219+
shutdown_of_coordinator_delay_seconds:
220+
description: Delay in seconds before the shutdown of coordinator event happens.
221+
type: int
158222
ldap_groups:
159223
description: LDAP Groupnames to enabled for authentication to the Virtual Warehouse.
160224
type: list
@@ -163,6 +227,15 @@
163227
description: Flag to enable Single Sign-On (SSO) for the Virtual Warehouse.
164228
type: bool
165229
default: False
230+
enable_unified_analytics:
231+
description:
232+
- Flag to enable Unified Analytics for the Virtual Warehouse.
233+
- This can only be specified in the case of Impala Virtual Warehouses.
234+
type: bool
235+
enable_platform_jwt_auth:
236+
description:
237+
- Flag to configure the Virtual Warehouse to support JWTs issues by the CDP JWT token provider.
238+
type: bool
166239
tags:
167240
description: Key-value tags associated with the Virtual Warehouse cloud provider resources.
168241
type: dict
@@ -209,8 +282,9 @@
209282
name: example-virtual-warehouse
210283
type: hive
211284
template: xsmall
212-
autoscaling_min_nodes: 3
213-
autoscaling_max_nodes: 19
285+
autoscaling:
286+
min_nodes: 3
287+
max_nodes: 19
214288
tags:
215289
some_key: "some value"
216290
enable_sso: true
@@ -324,8 +398,6 @@ def __init__(self, module):
324398
self.type = self._get_param('type')
325399
self.name = self._get_param('name')
326400
self.template = self._get_param('template')
327-
self.autoscaling_min_nodes = self._get_param('autoscaling_min_nodes')
328-
self.autoscaling_max_nodes = self._get_param('autoscaling_max_nodes')
329401
self.common_configs = self._get_param('common_configs')
330402
self.application_configs = self._get_param('application_configs')
331403
self.ldap_groups = self._get_param('ldap_groups')
@@ -335,6 +407,24 @@ def __init__(self, module):
335407
self.wait = self._get_param('wait')
336408
self.delay = self._get_param('delay')
337409
self.timeout = self._get_param('timeout')
410+
self.enable_unified_analytics = self._get_param('enable_unified_analytics')
411+
self.enable_platform_jwt_auth = self._get_param('enable_platform_jwt_auth')
412+
# Autoscaling nested parameters
413+
self.autoscaling_min_nodes = self._get_nested_param('autoscaling', 'min_nodes')
414+
self.autoscaling_max_nodes = self._get_nested_param('autoscaling', 'max_nodes')
415+
self.autoscaling_auto_suspend_timeout_seconds = self._get_nested_param('autoscaling', 'auto_suspend_timeout_seconds')
416+
self.autoscaling_disable_auto_suspend = self._get_nested_param('autoscaling', 'disable_auto_suspend')
417+
self.autoscaling_hive_desired_free_capacity = self._get_nested_param('autoscaling', 'hive_desired_free_capacity')
418+
self.autoscaling_hive_scale_wait_time_seconds = self._get_nested_param('autoscaling', 'hive_scale_wait_time_seconds')
419+
self.autoscaling_impala_scale_down_delay_seconds = self._get_nested_param('autoscaling', 'impala_scale_down_delay_seconds')
420+
self.autoscaling_impala_scale_up_delay_seconds = self._get_nested_param('autoscaling', 'impala_scale_up_delay_seconds')
421+
self.autoscaling_pod_config_name = self._get_nested_param('autoscaling', 'pod_config_name')
422+
# impala_ha nested parameters
423+
self.impala_ha_enable_catalog_high_availability = self._get_nested_param('impala_ha', 'enable_catalog_high_availability')
424+
self.impala_ha_enable_shutdown_of_coordinator = self._get_nested_param('impala_ha', 'enable_shutdown_of_coordinator')
425+
self.impala_ha_high_availability_mode = self._get_nested_param('impala_ha', 'high_availability_mode')
426+
self.impala_ha_num_of_active_coordinators = self._get_nested_param('impala_ha', 'num_of_active_coordinators')
427+
self.impala_ha_shutdown_of_coordinator_delay_seconds = self._get_nested_param('impala_ha', 'shutdown_of_coordinator_delay_seconds')
338428

339429
# Initialize return values
340430
self.virtual_warehouse = {}
@@ -407,9 +497,23 @@ def process(self):
407497
template=self.template,
408498
autoscaling_min_cluster=self.autoscaling_min_nodes,
409499
autoscaling_max_cluster=self.autoscaling_max_nodes,
500+
autoscaling_auto_suspend_timeout_seconds=self.autoscaling_auto_suspend_timeout_seconds,
501+
autoscaling_disable_auto_suspend=self.autoscaling_disable_auto_suspend,
502+
autoscaling_hive_desired_free_capacity=self.autoscaling_hive_desired_free_capacity,
503+
autoscaling_hive_scale_wait_time_seconds=self.autoscaling_hive_scale_wait_time_seconds,
504+
autoscaling_impala_scale_down_delay_seconds=self.autoscaling_impala_scale_down_delay_seconds,
505+
autoscaling_impala_scale_up_delay_seconds=self.autoscaling_impala_scale_up_delay_seconds,
506+
autoscaling_pod_config_name=self.autoscaling_pod_config_name,
507+
impala_ha_enable_catalog_high_availability=self.impala_ha_enable_catalog_high_availability,
508+
impala_ha_enable_shutdown_of_coordinator=self.impala_ha_enable_shutdown_of_coordinator,
509+
impala_ha_high_availability_mode=self.impala_ha_high_availability_mode,
510+
impala_ha_num_of_active_coordinators=self.impala_ha_num_of_active_coordinators,
511+
impala_ha_shutdown_of_coordinator_delay_seconds=self.impala_ha_shutdown_of_coordinator_delay_seconds,
410512
common_configs=self.common_configs,
411513
application_configs=self.application_configs,
412514
ldap_groups=self.ldap_groups, enable_sso=self.enable_sso,
515+
enable_unified_analytics=self.enable_unified_analytics,
516+
enable_platform_jwt_auth=self.enable_platform_jwt_auth,
413517
tags=self.tags)
414518
self.changed = True
415519
if self.wait:
@@ -435,8 +539,30 @@ def main():
435539
type=dict(type='str'),
436540
name=dict(type='str'),
437541
template=dict(type='str', choices=['xsmall', 'small', 'medium', 'large']),
438-
autoscaling_min_nodes=dict(type='int'),
439-
autoscaling_max_nodes=dict(type='int'),
542+
autoscaling=dict(
543+
type='dict',
544+
options=dict(
545+
min_nodes=dict(type='int'),
546+
max_nodes=dict(type='int'),
547+
auto_suspend_timeout_seconds=dict(type='int'),
548+
disable_auto_suspend=dict(type='bool'),
549+
hive_desired_free_capacity=dict(type='int'),
550+
hive_scale_wait_time_seconds=dict(type='int'),
551+
impala_scale_down_delay_seconds=dict(type='int'),
552+
impala_scale_up_delay_seconds=dict(type='int'),
553+
pod_config_name=dict(type='str')
554+
)
555+
),
556+
impala_ha=dict(
557+
type='dict',
558+
options=dict(
559+
enable_catalog_high_availability=dict(type='bool'),
560+
enable_shutdown_of_coordinator=dict(type='bool'),
561+
high_availability_mode=dict(type='str', choices=['ACTIVE_PASSIVE', 'ACTIVE_ACTIVE', 'DISABLED']),
562+
num_of_active_coordinators=dict(type='int'),
563+
shutdown_of_coordinator_delay_seconds=dict(type='int')
564+
)
565+
),
440566
common_configs=dict(type='dict', options=dict(
441567
configBlocks=dict(type='list', elements='dict', options=dict(
442568
id=dict(type='str'),
@@ -456,7 +582,9 @@ def main():
456582
state=dict(type='str', choices=['present', 'absent'], default='present'),
457583
wait=dict(type='bool', default=True),
458584
delay=dict(type='int', aliases=['polling_delay'], default=15),
459-
timeout=dict(type='int', aliases=['polling_timeout'], default=3600)
585+
timeout=dict(type='int', aliases=['polling_timeout'], default=3600),
586+
enable_unified_analytics=dict(type='bool'),
587+
enable_platform_jwt_auth=dict(type='bool')
460588
),
461589
required_if=[
462590
['state', 'absent', ['warehouse_id']],

0 commit comments

Comments
 (0)