-
Notifications
You must be signed in to change notification settings - Fork 365
[WIP] Allow different public and private DNS hostnames #845
Changes from all commits
a24256d
4f40511
b9f3e86
fbc6296
afe8791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,12 +72,18 @@ | |
| 'ansible_host': ssh_ip_address | ||
| } | ||
|
|
||
| vars['openshift_public_hostname'] = server.name | ||
| if 'private_fqdn' in server.metadata: | ||
| vars['openshift_hostname'] = server.metadata.private_fqdn | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must always be set. Even when the public and private hostnames are equal. If The Adding these two lines should fix it:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deployment works for me with arbitrary hostnames. I removed any dependencies on the host names. As I understood from some folks' comments from related patches, only the |
||
|
|
||
| public_v4 = server.public_v4 or server.private_v4 | ||
| if public_v4: | ||
| vars['public_v4'] = public_v4 | ||
| vars['public_v4'] = server.public_v4 | ||
| vars['openshift_public_ip'] = server.public_v4 | ||
| # TODO(shadower): what about multiple networks? | ||
| if server.private_v4: | ||
| vars['private_v4'] = server.private_v4 | ||
| vars['openshift_ip'] = server.private_v4 | ||
|
|
||
| node_labels = server.metadata.get('node_labels') | ||
| if node_labels: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,14 +11,14 @@ | |
|
|
||
| - name: "Add public master cluster hostname records to the private A records (single master)" | ||
| set_fact: | ||
| private_records: "{{ private_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(full_dns_domain, ''))[:-1], 'ip': hostvars[groups.masters[0]].private_v4 } ] }}" | ||
| private_records: "{{ private_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(openshift_openstack_full_public_dns_domain, ''))[:-1], 'ip': hostvars[groups.masters[0]].private_v4 } ] }}" | ||
| when: | ||
| - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined | ||
| - openstack_num_masters == 1 | ||
|
|
||
| - name: "Add public master cluster hostname records to the private A records (multi-master)" | ||
| set_fact: | ||
| private_records: "{{ private_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(full_dns_domain, ''))[:-1], 'ip': hostvars[groups.lb[0]].private_v4 } ] }}" | ||
| private_records: "{{ private_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(openshift_openstack_full_public_dns_domain, ''))[:-1], 'ip': hostvars[groups.lb[0]].private_v4 } ] }}" | ||
| when: | ||
| - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined | ||
| - openstack_num_masters > 1 | ||
|
|
@@ -28,30 +28,49 @@ | |
| nsupdate_server_private: "{{ external_nsupdate_keys['private']['server'] }}" | ||
| nsupdate_key_secret_private: "{{ external_nsupdate_keys['private']['key_secret'] }}" | ||
| nsupdate_key_algorithm_private: "{{ external_nsupdate_keys['private']['key_algorithm'] }}" | ||
| nsupdate_private_key_name: "{{ external_nsupdate_keys['private']['key_name']|default('private-' + full_dns_domain) }}" | ||
| nsupdate_private_key_name: "{{ external_nsupdate_keys['private']['key_name']|default('private-' + openshift_openstack_full_private_dns_domain) }}" | ||
| when: | ||
| - external_nsupdate_keys is defined | ||
| - external_nsupdate_keys['private'] is defined | ||
|
|
||
| - name: "Set the private DNS server to use the provisioned value" | ||
| set_fact: | ||
| nsupdate_server_private: "{{ hostvars[groups['dns'][0]].public_v4 }}" | ||
| nsupdate_key_secret_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + full_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + full_dns_domain].key_algorithm }}" | ||
| nsupdate_key_secret_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + openshift_openstack_full_private_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + openshift_openstack_full_private_dns_domain].key_algorithm }}" | ||
| when: | ||
| - nsupdate_server_private is undefined | ||
|
|
||
| - name: "Set the private DNS server to use the provisioned value for multiple hostnames" | ||
| set_fact: | ||
| nsupdate_key_secret_private_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + openshift_openstack_full_public_dns_domain].key_secret }}" | ||
| when: | ||
| - openshift_openstack_full_public_dns_domain != openshift_openstack_full_private_dns_domain | ||
|
|
||
| - name: "Generate the private Add section for DNS" | ||
| set_fact: | ||
| private_named_records: | ||
| - view: "private" | ||
| zone: "{{ full_dns_domain }}" | ||
| zone: "{{ openshift_openstack_full_private_dns_domain }}" | ||
| server: "{{ nsupdate_server_private }}" | ||
| key_name: "{{ nsupdate_private_key_name|default('private-' + full_dns_domain) }}" | ||
| key_name: "{{ nsupdate_private_key_name|default('private-' + openshift_openstack_full_private_dns_domain) }}" | ||
| key_secret: "{{ nsupdate_key_secret_private }}" | ||
| key_algorithm: "{{ nsupdate_key_algorithm_private | lower }}" | ||
| entries: "{{ private_records }}" | ||
|
|
||
| - name: "Generate the private for public Add section for DNS" | ||
| set_fact: | ||
| private_named_records: | ||
| - view: "private" | ||
| zone: "{{ openshift_openstack_full_public_dns_domain }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is using the public zone, the DNS servers never receive the entries with the private prefixes. I think this task should say "private" everywhere here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, that is the main point for multiple names resolvable via internal view. Public names should be as well resolved, yet with priv IPs. It doesn't work another way. PTAL the test case in the commit msg, it describes the behavior that matches this code. Firstly, let's adjust the test cases if I understood the thing wrong |
||
| server: "{{ nsupdate_server_private }}" | ||
| key_name: "{{ 'private-' + openshift_openstack_full_public_dns_domain }}" | ||
| key_secret: "{{ nsupdate_key_secret_private_public }}" | ||
| key_algorithm: "{{ nsupdate_key_algorithm_private | lower }}" | ||
| entries: "{{ private_records }}" | ||
| when: | ||
| - openshift_openstack_full_public_dns_domain != openshift_openstack_full_private_dns_domain | ||
|
|
||
| - name: "Generate list of public A records" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': hostvars[item]['ansible_hostname'], 'ip': hostvars[item]['public_v4'] } ] }}" | ||
|
|
@@ -66,23 +85,23 @@ | |
|
|
||
| - name: "Add public master cluster hostname records to the public A records (single master)" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(full_dns_domain, ''))[:-1], 'ip': hostvars[groups.masters[0]].public_v4 } ] }}" | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(openshift_openstack_full_public_dns_domain, ''))[:-1], 'ip': hostvars[groups.masters[0]].public_v4 } ] }}" | ||
| when: | ||
| - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined | ||
| - openstack_num_masters == 1 | ||
| - not use_bastion|bool | ||
|
|
||
| - name: "Add public master cluster hostname records to the public A records (single master behind a bastion)" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(full_dns_domain, ''))[:-1], 'ip': hostvars[groups.bastions[0]].public_v4 } ] }}" | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(openshift_openstack_full_public_dns_domain, ''))[:-1], 'ip': hostvars[groups.bastions[0]].public_v4 } ] }}" | ||
| when: | ||
| - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined | ||
| - openstack_num_masters == 1 | ||
| - use_bastion|bool | ||
|
|
||
| - name: "Add public master cluster hostname records to the public A records (multi-master)" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(full_dns_domain, ''))[:-1], 'ip': hostvars[groups.lb[0]].public_v4 } ] }}" | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': (hostvars[groups.masters[0]].openshift_master_cluster_public_hostname | replace(openshift_openstack_full_public_dns_domain, ''))[:-1], 'ip': hostvars[groups.lb[0]].public_v4 } ] }}" | ||
| when: | ||
| - hostvars[groups.masters[0]].openshift_master_cluster_public_hostname is defined | ||
| - openstack_num_masters > 1 | ||
|
|
@@ -92,26 +111,26 @@ | |
| nsupdate_server_public: "{{ external_nsupdate_keys['public']['server'] }}" | ||
| nsupdate_key_secret_public: "{{ external_nsupdate_keys['public']['key_secret'] }}" | ||
| nsupdate_key_algorithm_public: "{{ external_nsupdate_keys['public']['key_algorithm'] }}" | ||
| nsupdate_public_key_name: "{{ external_nsupdate_keys['public']['key_name']|default('public-' + full_dns_domain) }}" | ||
| nsupdate_public_key_name: "{{ external_nsupdate_keys['public']['key_name']|default('public-' + openshift_openstack_full_public_dns_domain) }}" | ||
| when: | ||
| - external_nsupdate_keys is defined | ||
| - external_nsupdate_keys['public'] is defined | ||
|
|
||
| - name: "Set the public DNS server details to use the provisioned value" | ||
| set_fact: | ||
| nsupdate_server_public: "{{ hostvars[groups['dns'][0]].public_v4 }}" | ||
| nsupdate_key_secret_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + full_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + full_dns_domain].key_algorithm }}" | ||
| nsupdate_key_secret_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + openshift_openstack_full_public_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + openshift_openstack_full_public_dns_domain].key_algorithm }}" | ||
| when: | ||
| - nsupdate_server_public is undefined | ||
|
|
||
| - name: "Generate the public Add section for DNS" | ||
| set_fact: | ||
| public_named_records: | ||
| - view: "public" | ||
| zone: "{{ full_dns_domain }}" | ||
| zone: "{{ openshift_openstack_full_public_dns_domain }}" | ||
| server: "{{ nsupdate_server_public }}" | ||
| key_name: "{{ nsupdate_public_key_name|default('public-' + full_dns_domain) }}" | ||
| key_name: "{{ nsupdate_public_key_name|default('public-' + openshift_openstack_full_public_dns_domain) }}" | ||
| key_secret: "{{ nsupdate_key_secret_public }}" | ||
| key_algorithm: "{{ nsupdate_key_algorithm_public | lower }}" | ||
| entries: "{{ public_records }}" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set a default value so this doesn't break existing users?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it has it at the line 3, transitioned via the line 10