Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@coryfklein
Copy link
Contributor

This PR is an addition above this one. Not sure if this is the most idiomatic way to do this in git or not, as this PR contains PR-10 as well.

The commit for this PR is Add "type" field to Secret

I submitted this PR separate from PR-10 because I was uncertain if there was previous reasoning against including the type member on Kubernetes objects. It is fairly common, yet seems to be absent in Skuber.

For our purposes, we have Kubernetes resources that we need to create that require this property be defined with a specific value.

Cory Klein added 2 commits July 29, 2016 14:17
A Secret has a member:

  data: Map[String, Array[Byte]]

Skuber threw an exception whenever a Secret was serialized or
deserialized when this data member was present because the usage of
formatMaybeEmptyMap did not allow the injection of:

  implicit base64Format: Format[Array[Byte]]

Thus, the byte array was not being serialized and deserialized via the
Base64.decodeBase and Base64.encodeBase64String methods, and whatever it
fell back to resulted in a JsValue being created instead of a JsObject.

After great, albeit failed, effort to get formatMaybeEmptyMap to correctly
use base64Format, I instead created formatMaybeEmptyByteArrayMap which
resolved the problem. I suspect that type erasure may preclude a more
elegant solution, but would love to know if one is possible.

I added unit tests to exercise the problem and solution. Without the
corresponding changes to the json package, the first unit test will
fail.
To closer align this model to the definition in the Kubernetes v1
documentation:

http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_secret
@doriordan
Copy link
Owner

Hi Cory
No specific reason that the type field on Secret was omitted - I am not certain if that field was simply overlooked for the initial implementation in Skuber or whether it was not present because it was only added to Kubernetes in a later version, but I see it is part of the current spec and should be there so thanks for this PR.
For what other Kubernetes kinds do you see a missing 'type' field in Skuber?

@doriordan doriordan merged commit dcfe343 into doriordan:master Jul 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants