Closed kke closed 5 years ago
wip: Specs pass, but I'm a bit skeptical if it actually really works.
Surprisingly pharos up
passes with this (if you add the recursive-open-struct dependency to pharos),
The Type stuff is not needed if the api/metav1 -stuff is treated like any random resource and the predefined structs are removed, but that will require changing a lot of the specs.
I tested and found that there are issues with this branch.
With the following example code,
I checked with debugger and resources.meta_list
seems to have other attributes in place, expect for resources.meta_list.metadata
which is nil
:
# simplified copy-paste from production code
# throws `undefined method 'resourceVersion' for nil:NilClass (NoMethodError)
resources = K8s::Client.in_cluster_config
.api('my_api')
.resource('lolcats', namespace: 'copypasted')
checkpoint = resources.meta_list.metadata.resourceVersion
resources.watch(timeout: 900, resourceVersion: checkpoint) do |event|
# ...
end
Same code with k8s-client 0.10.1 works / has been working for months with older versions.
Starting to thing the (the metav1-stuff do need the K8s::HashStruct
and K8s::Type
add too much complication, maybe better to just use the RecursiveOpenStruct for everything eventhough it is mutable.attribute
from dry / k8s::type)
Replaced by #147
@pre You can try with #147
Closes #128 (included, merging that will simplify this diff) Closes #125 (included, merging that will simplify this diff) Closes #112 Closes #123
Related to #121
Replace RecursiveOpenStruct, Dry::Struct and Dry::Types with a simple
K8s::HashStruct
andK8s::Type
, thus dropping the dependencies.