hey folks, found something that looks weird. when ...
# python
l
hey folks, found something that looks weird. when using reference to configmap thats being created by pulumi when creating job it fails with:
Copy code
Plan apply failed: Job.batch "dbseed" is invalid: spec.template.spec.containers[0].envFrom[0].configMapRef.name: Invalid value: "develop/baseconfigmap-wwykveez": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. '<http://example.com|example.com>', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
which doesnt make a lot of sense. develop - is the namespace, everything after
/
is real configmap name. this works for deployments, but not for jobs? I can work around with this bad boy:
Copy code
config_map.metadata.apply(
    lambda metadata: metadata['name'].split('/')[-1]
)
but this doesnt look right
i
I’m not sure, is this a Kubernetes thing? enforcing the names of a subdomain?
g
Yeah, that error is coming from the k8s API server.
l
yeah, but the same works for deployments
so i think pulumi is doing some processing on configmap name
i
it is, but it’s not putting the slash in there I don’t think, which I think is what kubernetes is complaining about
it’s putting the random suffix on the end
what’s the code that creates this job?
l
hm, interesting. i noticed something, let me check
i've noticed i'm doing this for deployments:
Copy code
config_map_name = config_map.metadata.apply(lambda resource: resource['name'])
i think this worked for job as well
just passing config_map didnt work
yeah, i think its working like this
sorry for bothering
i
No worries! You can also write
Copy code
config_map.metadata["name"]
instead of doing the explicit apply here, this is just some syntax sugar on top of what you’re doing