better-twilight-65145
11/28/2024, 5:39 PMbetter-twilight-65145
11/28/2024, 5:50 PMbetter-twilight-65145
11/28/2024, 5:58 PMmodern-zebra-45309
11/28/2024, 9:47 PMbetter-twilight-65145
11/29/2024, 8:38 AMmodern-zebra-45309
11/29/2024, 8:42 AMkubectl apply
), which you cannot find through labels. What information do you want to use to identify the service? Do you know in which namespace it should be or its name?modern-zebra-45309
11/29/2024, 8:45 AMkubectl
, what would "finding the IP and using it" look like?better-twilight-65145
11/29/2024, 9:01 AMmodern-zebra-45309
11/29/2024, 10:17 AMmodern-zebra-45309
11/29/2024, 10:24 AMdef find_deployment_by_labels(labels: dict[str, str]) -> (str, str):
"""Utility function to find an existing deployment."""
...
return (namespace, name)
dep_namespace, dep_name = find_deployment_by_labels({"internal/app": "my-app", "internal/team": "my-team"})
my_new_secret = k8s.core.v1.Secret("my-new-secret",
metadata={"namespace": dep_namespace,
"name": "my-shiny-new-secret"}
)
Alternatively, you can pass in information as configuration but if you can query it just when the program is running, that's preferable in all cases, I think.modern-zebra-45309
11/29/2024, 10:27 AMmodern-zebra-45309
11/29/2024, 10:30 AMbetter-twilight-65145
11/29/2024, 10:37 AM