Skip to content

Commit 5b2bc00

Browse files
authored
Add DFX example deployment (#73)
* Add example DFX Flow deployment to examples/cdf definition in cloudera-deploy * Add control to DFX Flow deployment to skip during teardown * Add KPI example to DFX Flow example * Update CDF example application.yml to be skipped if not executing the `runtime` runlevel. * Improve application deployment playbook to only attempt Kafka flow deployment when Kafka Datahub is found Signed-off-by: Daniel Chaffelson <chaffelson@gmail.com>
1 parent bac243d commit 5b2bc00

File tree

2 files changed

+80
-12
lines changed

2 files changed

+80
-12
lines changed

examples/cdf/application.yml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,78 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
- name: Coda
17+
- name: Deploy example DFX Flow
1818
hosts: localhost
1919
connection: local
2020
gather_facts: no
2121
become: no
22+
tags: always
2223
tasks:
23-
- name: Deployment results
24-
debug:
25-
msg: Success!
24+
- name: Construct the deployment details
25+
when:
26+
- deployment is undefined
27+
- "'run' in ansible_run_tags"
28+
- "'teardown' not in ansible_run_tags"
29+
ansible.builtin.include_role:
30+
name: cloudera.exe.info
31+
32+
- name: Get CDP workload username for current user
33+
when:
34+
- "'teardown' not in ansible_run_tags"
35+
- "'run' in ansible_run_tags"
36+
cloudera.cloud.iam_user_info:
37+
current_user: yes
38+
register: __iam
39+
40+
- name: Extract Kafka Brokers from Info
41+
when:
42+
- "'teardown' not in ansible_run_tags"
43+
- "'run' in ansible_run_tags"
44+
- "{{ deployment.datahubs | selectattr('workloadType', 'search', 'Streams Messaging') | length > 0 }}"
45+
ansible.builtin.set_fact:
46+
kafka_brokers_fqdns: "{{ deployment.datahubs | selectattr('workloadType', 'search', 'Streams Messaging') | first | json_query(_jq) | first }}"
47+
vars:
48+
_jq: "instanceGroups[?name=='core_broker'].instances[*].fqdn"
49+
50+
- name: Deploy example DFX Flow - Kafka to Kafka
51+
when:
52+
- "'teardown' not in ansible_run_tags"
53+
- "'run' in ansible_run_tags"
54+
- kafka_brokers_fqdns is defined
55+
- kafka_brokers_fqdns | length > 0
56+
cloudera.cloud.df_deployment:
57+
name: "{{ globals.name_prefix }}_ex_kafkatokafka"
58+
df_name: "{{ deployment.environment.environmentName }}"
59+
flow_name: "Kafka to Kafka"
60+
autoscale: yes
61+
autostart_flow: yes
62+
parameter_groups: "{{ parameter_groups }}"
63+
kpis: "{{ kpis }}"
64+
vars:
65+
parameter_groups:
66+
- name: "kafka-to-kafka"
67+
parameters:
68+
- name: "CDP Workload User"
69+
value: "{{ __iam.users[0].workloadUsername }}"
70+
- name: "CDP Workload User Password"
71+
value: "{{ globals.admin_password }}"
72+
- name: "Kafka Broker Endpoint"
73+
value: "{{ kafka_brokers_fqdns | product([':9093']) | map('join') | list | join(',') }}"
74+
- name: "Kafka Consumer Group ID"
75+
value: "ex_cdf_consg0"
76+
- name: "Kafka Destination Topic"
77+
value: "ex_cdf_dest"
78+
- name: "Kafka Producer ID"
79+
value: "_ex_cdf_prodc0"
80+
- name: "Kafka Source Topic"
81+
value: "ex_cdf_source"
82+
kpis:
83+
- metricId: cpuUtilization
84+
alert:
85+
thresholdMoreThan:
86+
unitId: percentage
87+
value: 25
88+
frequencyTolerance:
89+
unit:
90+
id: MINUTES
91+
value: 5

examples/cdf/definition.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# Commented values are shown with the defaults, uncomment and change to override
1818

1919
df:
20+
readyflows:
21+
- flow_name: "Kafka to Kafka"
2022
# min_k8s_nodes: 3
2123
# max_k8s_nodes: 5
2224
# public_loadbalancer: True
@@ -32,11 +34,11 @@ env:
3234
public_endpoint_access: yes
3335
tunnel: yes
3436

35-
#datahub:
36-
# definitions:
37-
# - definition: "Flow Management Light Duty"
38-
# suffix: nifi-dhub
39-
# - definition: "Streams Messaging Light Duty"
40-
# suffix: kafka-dhub
41-
# - definition: "Streaming Analytics Light Duty"
42-
# suffix: flink-dhub
37+
datahub:
38+
definitions:
39+
- definition: "Flow Management Light Duty"
40+
suffix: nifi-dhub
41+
- definition: "Streams Messaging Light Duty"
42+
suffix: kafka-dhub
43+
- definition: "Streaming Analytics Light Duty"
44+
suffix: flink-dhub

0 commit comments

Comments
 (0)