Skip to content

Commit

Permalink
Update paasta info for new paasta domains, remove dead dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
jfongatyelp committed Dec 23, 2024
1 parent 1b674cf commit bc8fc5f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
16 changes: 6 additions & 10 deletions paasta_tools/cli/cmds/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,9 @@ def get_deployments_strings(service: str, soa_dir: str) -> List[str]:
)
service_mode = service_config.get_mode()
for cluster in deployments_to_clusters(deployments):
if service_mode == "tcp":
service_port = service_config.get("proxy_port")
if service_mode == "http" or service_mode == "https":
link = PaastaColors.cyan(
"%s://paasta-%s.yelp:%d/" % (service_mode, cluster, service_port)
)
elif service_mode == "http" or service_mode == "https":
link = PaastaColors.cyan(
f"{service_mode}://{service}.paasta-{cluster}.yelp/"
f"{service_mode}://{service}.proxy.{cluster}.paasta/"
)
else:
link = "N/A"
Expand All @@ -111,8 +106,7 @@ def get_deployments_strings(service: str, soa_dir: str) -> List[str]:

def get_dashboard_urls(service):
output = [
" - %s (Sensu Alerts)"
% (PaastaColors.cyan("https://uchiwa.yelpcorp.com/#/events?q=%s" % service))
" - %s (service load y/sl2)" % (PaastaColors.cyan(f"http://y/{service}_load"))
]
return output

Expand All @@ -137,7 +131,9 @@ def get_service_info(service, soa_dir):
% PaastaColors.cyan(get_runbook(service=service, overrides={}, soa_dir=soa_dir))
)
output.append("Git Repo: %s" % git_url)
output.append("Deployed to the following clusters:")
output.append(
"Deployed to the following clusters (with test URLs, where available):"
)
output.extend(get_deployments_strings(service, soa_dir))
if smartstack_endpoints:
output.append("Smartstack endpoint(s):")
Expand Down
4 changes: 2 additions & 2 deletions paasta_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2431,11 +2431,11 @@ def get_resource_pool_settings(self) -> PoolToResourcePoolSettingsDict:

def get_cluster_fqdn_format(self) -> str:
"""Get a format string that constructs a DNS name pointing at the paasta masters in a cluster. This format
string gets one parameter: cluster. Defaults to 'paasta-{cluster:s}.yelp'.
string gets one parameter: cluster. Defaults to '{cluster:s}.paasta'.
:returns: A format string for constructing the FQDN of the masters in a given cluster.
"""
return self.config_dict.get("cluster_fqdn_format", "paasta-{cluster:s}.yelp")
return self.config_dict.get("cluster_fqdn_format", "{cluster:s}.paasta")

def get_paasta_status_version(self) -> str:
"""Get paasta status version string (new | old). Defaults to 'old'.
Expand Down
21 changes: 7 additions & 14 deletions tests/cli/test_cmds_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,20 @@ def test_get_service_info():
assert "Deployed to the following" in actual
assert (
"clusterA (%s)"
% PaastaColors.cyan("http://fake_service.paasta-clusterA.yelp/")
% PaastaColors.cyan("http://fake_service.proxy.clusterA.paasta/")
in actual
)
assert (
"clusterB (%s)"
% PaastaColors.cyan("http://fake_service.paasta-clusterB.yelp/")
% PaastaColors.cyan("http://fake_service.proxy.clusterB.paasta/")
in actual
)
assert "Smartstack endpoint" in actual
assert "http://foo:1234" in actual
assert "tcp://bar:1234" in actual
assert "Dashboard" in actual
assert (
"%s (Sensu Alerts)"
% PaastaColors.cyan("https://uchiwa.yelpcorp.com/#/events?q=fake_service")
"%s (service load y/sl2)" % PaastaColors.cyan("http://y/fake_service_load")
in actual
)
mock_get_team.assert_called_with(
Expand Down Expand Up @@ -135,12 +134,12 @@ def test_get_deployments_strings_default_case_with_smartstack():
actual = info.get_deployments_strings("fake_service", "/fake/soa/dir")
assert (
" - clusterA (%s)"
% PaastaColors.cyan("http://fake_service.paasta-clusterA.yelp/")
% PaastaColors.cyan("http://fake_service.proxy.clusterA.paasta/")
in actual
)
assert (
" - clusterB (%s)"
% PaastaColors.cyan("http://fake_service.paasta-clusterB.yelp/")
% PaastaColors.cyan("http://fake_service.proxy.clusterB.paasta/")
in actual
)

Expand All @@ -156,14 +155,8 @@ def test_get_deployments_strings_protocol_tcp_case():
{"mode": "tcp", "proxy_port": 8080}
)
actual = info.get_deployments_strings("unused", "/fake/soa/dir")
assert (
" - clusterA (%s)" % PaastaColors.cyan("tcp://paasta-clusterA.yelp:8080/")
in actual
)
assert (
" - clusterB (%s)" % PaastaColors.cyan("tcp://paasta-clusterB.yelp:8080/")
in actual
)
assert " - clusterA (N/A)" in actual
assert " - clusterB (N/A)" in actual


def test_get_deployments_strings_non_listening_service():
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_bad_calculate_remote_master(mock_get_by_hostname, system_paasta_config)
mock_get_by_hostname.side_effect = gaierror(42, "bar")
ips, output = utils.calculate_remote_masters("myhost", system_paasta_config)
assert ips == []
assert "ERROR while doing DNS lookup of paasta-myhost.yelp:\nbar\n" in output
assert "ERROR while doing DNS lookup of myhost.paasta:\nbar\n" in output


@patch("socket.gethostbyname_ex", autospec=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def test_SystemPaastaConfig_get_metrics_provider():
def test_SystemPaastaConfig_get_cluster_fqdn_format_default():
fake_config = utils.SystemPaastaConfig({}, "/some/fake/dir")
actual = fake_config.get_cluster_fqdn_format()
expected = "paasta-{cluster:s}.yelp"
expected = "{cluster:s}.paasta"
assert actual == expected


Expand Down

0 comments on commit bc8fc5f

Please sign in to comment.