Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Support customize ssl port #5495

Merged
merged 4 commits into from
May 25, 2021
Merged
Changes from all 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
55 changes: 11 additions & 44 deletions src/pylon/config/pylon.md
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ pylon:
port: 80
uri: "http://master_ip:80"
#ssl:
# port: 443
# # self-sign
# crt_name: xxxxxx
# crt_path: /path/to/xxxxxx
@@ -38,47 +39,13 @@ pylon:

## Table <a name="T_Config"></a>

<table>
<tr>
<td>Data in Configuration File</td>
<td>Data in Cluster Object Model</td>
<td>Data in Jinja2 Template</td>
<td>Data type</td>
</tr>
<tr>
<td>pylon.port</td>
<td>com["pylon"]["port"]</td>
<td>cluster_cfg["pylon"]["port"]</td>
<td>Int</td>
</tr>
<tr>
<td>pylon.uri</td>
<td>com["pylon"]["uri"]</td>
<td>cluster_cfg["pylon"]["uri"]</td>
<td>URL</td>
</tr>
<tr>
<td>pylon.ssl.crt_name</td>
<td>com["pylon"]["ssl"]["crt_name"]</td>
<td>cluster_cfg["pylon"]["ssl"]["crt_name"]</td>
<td>certificate file name</td>
</tr>
<tr>
<td>pylon.ssl.crt_path</td>
<td>com["pylon"]["ssl"]["crt_path"]</td>
<td>cluster_cfg["pylon"]["ssl"]["crt_path"]</td>
<td>the path to certificate file</td>
</tr>
<tr>
<td>pylon.ssl.key_name</td>
<td>com["pylon"]["ssl"]["key_name"]</td>
<td>cluster_cfg["pylon"]["ssl"]["key_name"]</td>
<td>certificate key file name</td>
</tr>
<tr>
<td>pylon.ssl.key_path</td>
<td>com["pylon"]["ssl"]["key_path"]</td>
<td>cluster_cfg["pylon"]["ssl"]["key_path"]</td>
<td>the path to certificate key file</td>
</tr>
</table>
| Data in Configuration File | Data in Cluster Object Model | ata in Jinja2 Template | Data type|
| --- | --- | --- | --- |
| pylon.port | com["pylon"]["port"] | cluster_cfg["pylon"]["port"] | Int |
| pylon.uri | com["pylon"]["uri"] | cluster_cfg["pylon"]["uri"] | URL |
| pylon.ssl.port | com["pylon"]["ssl"]["port"] | cluster_cfg["pylon"]["ssl"]["crt_name"] | Int |
| pylon.ssl.crt_name | com["pylon"]["ssl"]["crt_name"] | cluster_cfg["pylon"]["ssl"]["crt_name"] | certificate file name |
| pylon.ssl.crt_path | com["pylon"]["ssl"]["crt_path"] | cluster_cfg["pylon"]["ssl"]["crt_path"] | the path to certificate file |
| pylon.ssl.key_name | com["pylon"]["ssl"]["key_name"] | cluster_cfg["pylon"]["ssl"]["key_name"] | certificate key file name |
| pylon.ssl.key_path | com["pylon"]["ssl"]["key_path"] | cluster_cfg["pylon"]["ssl"]["key_path"] | the path to certificate key file |

11 changes: 7 additions & 4 deletions src/pylon/config/pylon.py
Original file line number Diff line number Diff line change
@@ -36,11 +36,15 @@ def run(self):
machine_list = self.cluster_configuration['machine-list']
master_ip = [host['hostip'] for host in machine_list if host.get('pai-master') == 'true'][0]
port = self.service_configuration['port']
sslConfig = {'port': 443}
if 'ssl' in self.service_configuration:
sslConfig.update(self.service_configuration['ssl'])
sslPort = sslConfig['port']
uri = 'http://{0}:{1}'.format(master_ip, port)
uriHttps = 'https://{0}'.format(master_ip)
uriHttps = 'https://{0}:{1}'.format(master_ip, sslPort)
if 'domain' in self.service_configuration:
uri = 'http://{0}:{1}'.format(self.service_configuration['domain'], port)
uriHttps = 'https://{0}'.format(self.service_configuration['domain'])
uriHttps = 'https://{0}:{1}'.format(self.service_configuration['domain'], sslPort)

webhdfs_legacy_port = self.service_configuration['webhdfs-legacy-port']
ret = {
@@ -49,8 +53,7 @@ def run(self):
'uri-https': uriHttps,
'webhdfs-legacy-port': webhdfs_legacy_port,
}
if 'ssl' in self.service_configuration:
ret['ssl'] = self.service_configuration['ssl']
ret['ssl'] = sslConfig if sslConfig else None

return ret

1 change: 1 addition & 0 deletions src/pylon/config/pylon.yaml
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ webhdfs-legacy-port: 50070
deploy-service: false

#ssl:
# port: 443
# # self-sign
# crt_name: xxxxxx
# crt_path: /path/to/xxxxxx
4 changes: 3 additions & 1 deletion src/pylon/deploy/pylon.yaml.template
Original file line number Diff line number Diff line change
@@ -97,9 +97,11 @@ spec:
- name: pylon
containerPort: 80
hostPort: {{ cluster_cfg['pylon']['port'] }}
{% if 'ssl' in cluster_cfg['pylon'] %}
- name: pylon-https
containerPort: 443
hostPort: 443
hostPort: {{ cluster_cfg['pylon']['ssl']['port'] }}
{% endif %}
{% if cluster_cfg["cluster"]["common"]["cluster-type"] == "yarn" %}
{% if cluster_cfg['pylon']['webhdfs-legacy-port'] %}
- name: pylon-webhdfs