Closed teintuc closed 7 years ago
Thanks, I've merged the upstream change and the referenced PR. Much appreciated.
It seems like this is still an issue. When trying to add a label to a kubernetes_deployement, I'm getting this error thrown on the value of the new label.
For instance, if I update
kubernetes_deployment { "myapp":
ensure => present,
metadata => {
'labels' => {
'app' => 'myapp',
},
...
to
kubernetes_deployment { "myapp":
ensure => present,
metadata => {
'labels' => {
'app' => 'myapp',
'test' => 'puppet',
},
I get Error: undefined method 'keys' for "puppet":String
I've tracked this down to https://github.com/garethr/garethr-kubernetes/blob/master/lib/puppet_x/puppetlabs/swagger/fuzzy_compare.rb#L43
As the function descends into the metadata structure, eventually normalized_should[key][inner_key]
looks like normalized_should[:labels][:test]
, which means the recursive function is called with test_complex_structure('puppet', nil)
and then blows up at https://github.com/garethr/garethr-kubernetes/blob/master/lib/puppet_x/puppetlabs/swagger/fuzzy_compare.rb#L23 when the keys method is called on a String.
@walkamongus can you try our fork here: https://github.com/daysofwonder/garethr-kubernetes or this version with PR #39 applied ?
I think this will fix your issue. Our fork is just all PR open by @teintuc or myself here (or in puppet-swagger) applied.
Note that there's one thing that doesn't yet work for us is removing an annotation.
Thanks @masterzen -- I actually applied the change in #38 and it fixed my issue and additional labels were automatically added to my deployment. I assume this PR is already in your fork as well? I'll switch over if so.
@walkamongus, yes our fork contains this PR but also #34, #38, and #40. We've been using it in production for a few months now if that matters.
Thanks! will try it out!
When applying a second time a simple kube service declaration:
It produces the following error:
The reason is that in our case we have mcollective installed in the same ruby environment (which is the case of puppet AIO). Mcollective uses the stomp gem which also defines a
symbolise_keys
which is not recursive. The keys from sub hashes are not transfomed to symbols which makes the fuzzy comparator unhappy.The quick fix would be to rename the symbolise_key function to something more specific to this project.
Thanks.