limited-knife-15571
08/26/2020, 10:04 PMContainerRegistryDockerCredentials
in python.
https://github.com/pulumi/pulumi-kubernetesx/issues/49#issuecomment-651498775
My code look like that
container_registry = ContainerRegistry.get("source", "hyperwave-research")
registry_creds = pulumi.Output.secret( ContainerRegistryDockerCredentials(
"container-registry-creds", registry_name=container_registry.name).docker_credentials)
def encode_base64_dc(dc):
message_bytes = dc.encode('ascii')
base64_bytes = base64.b64encode(message_bytes)
print(f"===> Docker : {dc}")
print(f"===> Docker Credential : {base64_bytes.decode('utf-8')}")
return base64_bytes.decode("utf-8")
dc = registry_creds.apply(encode_base64_dc)
self.secret = Secret(
"registry-creds-kube-secret",
type="<http://kubernetes.io/dockerconfigjson|kubernetes.io/dockerconfigjson>",
metadata={"namespace": "default", "name": f"registry-{do_registry_name}"},
string_data={".dockerconfigjson": dc},
opts=opts,
)
However whatever I tried, the docker.credential is everytime None. I tried other property of the ContainerRegistryDockerCredentials
and I can confirm I have value like registry_name
```
File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 192, in serialize_property
obj[transformed_key] = await serialize_property(v, deps, input_transformer)
File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 173, in serialize_property
value = await serialize_property(output.future(), deps, input_transformer)
File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/runtime/rpc.py", line 159, in serialize_property
future_return = await asyncio.ensure_future(awaitable)
File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/output.py", line 112, in get_value
val = await self._future
File "/home/dzucker/git/Hyperwave.Infrastructure/venv/lib/python3.8/site-packages/pulumi/output.py", line 174, in run
transformed: Input[U] = func(value)
File "./digitalocean/docker_registry.py", line 42, in print_dc
message_bytes = dc.encode('ascii')
AttributeError: 'NoneType' object has no attribute 'encode'
error: an unhandled error occurred: Program exited with non-zero exit code: 1
I tried other idea that I found from the slack https://pulumi-community.slack.com/archives/C84L4E3N1/p1596457104392200?thread_ts=1596452646.389800&cid=C84L4E3N1 however same result.
Am I doing something ? or could it be they are a mapping error on the python property naming.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by