David Beck
10/19/2022, 5:10 PMKubernetesJob.job_from_file
function to read a yaml file with our full k8s manifest. The function works, however I noticed that we have fields that get overwritten with default values in this call for _shortcut_customizations
in build_job
, specifically the namespace
and image
properties. I know that I can use an infrastructure_override
when setting up the deployment, however there should be option to simply read a yaml file with those fields.Zanie
10/19/2022, 5:12 PMnamespace
and image
to None
?David Beck
10/19/2022, 5:15 PMpydantic.error_wrappers.ValidationError: 2 validation errors for KubernetesJob
image
none is not an allowed value (type=type_error.none.not_allowed)
namespace
none is not an allowed value (type=type_error.none.not_allowed)
Zanie
10/19/2022, 5:19 PMNone
and only set a value for them if they are not present in the manifest (probably the better path forward).David Beck
10/19/2022, 5:20 PMChris Guidry
10/19/2022, 5:23 PMimage
and namespace
be nullable in the same way the other "shortcuts" are. I recall it was tricky because we were trying maintain backwards compatibility for those two attributes.
I feel like allowing None
for those would work, and we can make the shortcut function apply those conditionally just like the othersDavid Beck
10/19/2022, 5:26 PMChris Guidry
10/19/2022, 5:29 PMjob = KubernetesJob.job_from_file(...)
KubernetesJob(
image=job['metadata']['namespace'],
image=job['spec']['template']['spec']['containers'][0]['image']
...,
)
(depending on how the job is structured, naturally)Zanie
10/19/2022, 5:30 PMChris Guidry
10/19/2022, 5:32 PMDavid Beck
10/19/2022, 5:34 PMZanie
10/19/2022, 5:35 PMChris Guidry
10/19/2022, 5:36 PMZanie
10/19/2022, 5:36 PMChris Guidry
10/19/2022, 5:37 PMZanie
10/19/2022, 5:37 PMChris Guidry
10/19/2022, 5:37 PMZanie
10/19/2022, 5:37 PMChris Guidry
10/19/2022, 5:38 PMNone
value today, so the backwards-compatibility story is solidDavid Beck
10/19/2022, 5:53 PMZanie
10/19/2022, 5:54 PMDavid Beck
10/19/2022, 5:55 PMZanie
10/19/2022, 5:56 PMNone
to override our default when we can just peek ourselves.