PAASTA-18479: Add list-namespaces tool #3997
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our iam_role configs depend on role owners being able to fill out which k8s namespaces their role is going to be used in in
pod_identity_namespaces
, but paasta normally is figuring out that translation, and users don't usually need to care about this info.This
list-namespaces
tool should just spit out the namespaces their service will be using, in list format to match what our iam_roles module needs.I don't expect people will need to specify the instance/cluster filters at all since roles can be used across those lines, but this command leaves the hard work of filtering on those values to the already-existing
get_instance_configs_for_service
util.The tests already capture most of the list-namespaces specific logic we want, but testing this against some example services seems to also work as expected:
There are also 2 non-list-namespaces changes in here:
NotImplementedError
forget_namespace()
, but by me deleting that override, LongRunningServiceConfig.get_namespace() will use InstanceConfig.get_namespace() which uses INSTANCE_TYPE_TO_K8S_NAMESPACE to return the correct value. I think the exception may not be necessary, as from a search of cases of us catching theNotImplementedError
, we never expect to do $something if it was due toget_namespaces()
throwing this error.get_namespace
on a LongRunningServiceConfig subclass that does not define this method, such as Flink or NRTSearch. However, I didn't find any code that expected to hit an exception when using get_namespace, as they mostly related to secret syncing, which special-case operator namespaces already. In fact, by allowing flink instances to actuallyget_namespace
, we may be able to remove the special-case sync jobs later!get_namespace
method, it seems like we generally want this to come from InstanceConfig anyhow, using default values if no override is specified, so this seems fine.autoscale
cli cmd's help text, so I s/stop/autoscale/ where I found this issue.