Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions playbooks/kafka_connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@
pause:
prompt: "Press Enter to Proceed to Next Node. Ctrl + C to Abort"
when: kafka_connect_pause_rolling_deployment|bool

- name: Cleanup Temporary SSL Files
hosts: kafka_connect
gather_facts: false
tags: kafka_connect
environment: "{{ proxy_env }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we give this proxy_env here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

customer can set proxy env vars, hence added it here as well

tasks:
- import_role:
name: variables

- name: Delete temporary keys/certs when keystore and trustore is provided
file:
path: "{{item}}"
state: absent
loop:
- "{{kafka_connect_ca_cert_path}}"
- "{{kafka_connect_cert_path}}"
- "{{kafka_connect_key_path}}"
when: (ssl_provided_keystore_and_truststore | bool)
9 changes: 7 additions & 2 deletions roles/kafka_connect/tasks/deploy_connectors.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Register Kafka Connect Subgroups
set_fact:
subgroups: "{{ ((subgroups | default([])) + hostvars[item].group_names) | difference('kafka_broker, ksql, kafka_connect, kafka_rest, kerberos, ksql, schema_registry, zookeeper, kafka_broker_parallel, ksql_parallel, kafka_connect_parallel, kafka_rest_parallel, kerberos_parallel, ksql_parallel, schema_registry_parallel, zookeeper_parallel, kafka_controller, kafka_controller_parallel') }}"
subgroups: "{{ ((subgroups | default([])) + hostvars[item].group_names) | difference(['kafka_broker', 'ksql', 'kafka_connect', 'kafka_rest', 'kerberos', 'schema_registry', 'zookeeper', 'kafka_broker_parallel', 'ksql_parallel', 'kafka_connect_parallel', 'kafka_rest_parallel', 'kerberos_parallel', 'ksql_parallel', 'schema_registry_parallel', 'zookeeper_parallel', 'kafka_controller', 'kafka_controller_parallel']) }}"
with_items: "{{groups['kafka_connect']}}"

- name: Extract Connect Principal from cert
Expand Down Expand Up @@ -79,6 +79,11 @@
- subgroups|length == 0
run_once: true

- name: Filter subgroups for rolling deployment strategy
set_fact:
filtered_subgroups: "{{ [parent_kafka_connect_cluster_group] if ((kafka_connect_deployment_strategy == 'rolling' or kafka_connect_deployment_strategy == 'serial') and parent_kafka_connect_cluster_group is defined and parent_kafka_connect_cluster_group in subgroups) else subgroups }}"
when: subgroups is defined
Copy link
Member

Choose a reason for hiding this comment

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

is it possible for subgroups to be not defined ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, In case of parallel run and no children structure, there are no subgroups


- name: Register connector configs and remove deleted connectors for Multiple Clusters
confluent.platform.kafka_connectors:
connect_url: "http{% if hostvars[groups[item][0]].kafka_connect_ssl_enabled|default(kafka_connect_ssl_enabled) %}s{% endif %}://{{ hostvars[groups[item][0]] | confluent.platform.resolve_and_format_hostname }}:{{ hostvars[groups[item][0]].kafka_connect_rest_port|default(kafka_connect_rest_port) }}/connectors"
Expand All @@ -89,5 +94,5 @@
client_key: "{% if hostvars[groups[item][0]].kafka_connect_ssl_mutual_auth_enabled|default(kafka_connect_ssl_mutual_auth_enabled) %}{{hostvars[groups[item][0]].kafka_connect_key_path|default(kafka_connect_key_path)}}{% else %}{{none}}{% endif %}"
when: hostvars[groups[item][0]].kafka_connect_connectors is defined
delegate_to: "{{ groups[item][0] }}"
loop: "{{subgroups}}"
loop: "{{ filtered_subgroups | default(subgroups) }}"
Copy link
Member

Choose a reason for hiding this comment

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

is it possible for filtered_subgroups to be not defined ?

run_once: true
11 changes: 1 addition & 10 deletions roles/kafka_connect/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,4 @@

- name: Deploy Connectors
include_tasks: deploy_connectors.yml

- name: Delete temporary keys/certs when keystore and trustore is provided
file:
path: "{{item}}"
state: absent
loop:
- "{{kafka_connect_ca_cert_path}}"
- "{{kafka_connect_cert_path}}"
- "{{kafka_connect_key_path}}"
when: (ssl_provided_keystore_and_truststore | bool)
tags: deploy_connectors
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this tag included here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This would be a helpful feature for customer to be able to skip deploying connectors during their upgrads if they want to.

Copy link
Member

Choose a reason for hiding this comment

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

does this work ?
when we give --tags deploy_connectors does it go inside kafka connect roles tasks main.yml ?