[bug] Could not add .dockerconfigjson key inside Secret
gplanchat opened this issue · 5 comments
Hello,
While trying to create a secret programmatically:
$cluster->secret()
->setName('regcred')
->addData('.dockerconfigjson', '{"auths":{"https://example.com/":{"username":"johnpdoe","password":"password","email":"hello@example.com","auth":"qwertyuiopasdfghjklzxcvbnm=="}}}')
->create();
I'm facing the following error:
PHP Fatal error: Uncaught RenokiCo\PhpK8s\Exceptions\KubernetesAPIException: Client error: `POST https://wzb5w7.c1.gra7.k8s.ovh.net/api/v1/namespaces/default/secrets?pretty=1` resulted in a `400 Bad Request` response:
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "Secret in version \"v1\" cannot be handled as a Secret: v1.Secret.Data: base64Codec: invalid input, error found in #10 byte of ...| \"\": {\n |..., bigger context ...| \"apiVersion\": \"v1\",\n \"data\": {\n \"\": {\n \"dockerconfigjson\": \"eyJhdXRocyI6eyJ|...",
"reason": "BadRequest",
"code": 400
}
This is due to the usage of a .dockerconfigjson
key in the K8sSecret::addData
method. The key is then transformed into a data..dockerconfigjson
key wrongly interpreted as a 3-level data path in Illuminate\Support\Array::set
method.
Is there a simple workaround for this?
This issue has been automatically closed because it has not had any recent activity. 😨
Had some little time I couldn't focus on open source. 😅 This is due to the dot notation. The package reads it as ["" => ['dockerconfigjson' => 'your value']]
I'll need some time to come with a workaround for this.
This issue has been automatically closed because it has not had any recent activity. 😨