That would be `... { metadata: { name: yournameher...
# kubernetes
k
That would be
... { metadata: { name: yournamehere,...
☝️ 1
p
im in python in case this was not obvious . . . and i tried what i thought you meant but it does not work
Copy code
my_namespace = k8s.core.v1.Namespace("mynamespace", { metadata: { name: 'mynamespace'}} )
k
ah, sorry
half a sec
hmm, from my limited knowledge of python, that looks right
what's the error?
p
Copy code
File "./__main__.py", line 216, in <module>
        my_namespace = k8s.core.v1.Namespace("mynamespace", {'name': 'mynamespace'}, opts=eks_opts)
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes/core/v1/Namespace.py", line 127, in __init__
        __self__._internal_init(resource_name, *args, **kwargs)
    TypeError: _internal_init() got multiple values for argument 'opts'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
so im having this problem all over the place in pul;umi, i know what i need to pass, but i cant figure out how to pass it
i got further with :-
Copy code
my_namespace = k8s.core.v1.Namespace("mynamespace", opts=eks_opts, **{ 'metadata': { 'name': 'mynamespace'}} )
k
should it be my_namespace = k8s.core.v1.Namespace("mynamespace", metadata: { name: 'mynamespace'} ) https://www.pulumi.com/docs/reference/pkg/kubernetes/core/v1/namespace/#objectmeta
p
Copy code
Diagnostics:
  kubernetes:core/v1:Namespace (atlassian):
    error: unrecognized resource type (Check): kubernetes:core/v1:Namespace
would you believe `
Copy code
metadata=k8s.meta.v1.ObjectMetaArgs(name="mynamespace")
k
that makes sense Same syntax as scaling_config in https://github.com/pulumi/examples/blob/master/aws-py-eks/__main__.py
til some python 🙂
p
figuring this stuff out is not easy
there arent examples to follow
k
no, theres definitely a learning curve
but it is powerful so that's a tradeoff
p
bah that failed on implementation
Copy code
Diagnostics:
  kubernetes:core/v1:Namespace (mynamespace):
    error: unrecognized resource type (Check): kubernetes:core/v1:Namespace
k
hmm
p
killmenow
ok it works if i dont pass in opts
k
ouch
p
colour me even more confused now
time to take a break… thanks for the help, got me a properly named namespace
k
haha, baby steps and eventually we'll get there 🙂
any time
l
To be honest I tried the Python route and ended up thinking it might be easier to learn some Typescript. It was and the data structures seem like a much better fit for Pulumi: Python: https://github.com/pulumi/examples/blob/master/kubernetes-py-guestbook/simple/__main__.py#L142vs Typescript: https://github.com/pulumi/examples/blob/master/kubernetes-ts-guestbook/simple/index.ts#L87 The autocomplete in vscode is also very good, making filling in parts of those kubernetes structures dead simple. Just a heads up before you head further down that path.