k8s-client 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6021ff799426838c2f3d874b13b2cd2d53ac8298ccfbb983e3ca53943dcfb3be
4
- data.tar.gz: 516330c9bcb21af9221eef99f3304187cde161db1d9f7cc8ec1d9c1a1ac4360f
3
+ metadata.gz: 6e770f7bd940686f59826ca1076d57718c8518dbfeeb754c6a28356c4225548b
4
+ data.tar.gz: 1b5b2a882826ddad99bf9db696dee1520a6bf6098b6ac6bbce0314bef088fb4d
5
5
  SHA512:
6
- metadata.gz: ed9e425df7d635def2d912a4083ac64dd189dc2c644983e162066a2f9b3026b4192a79bcfe64df6f38a35bffc5cc970cb6966ab1e12a4b7a3aadff2aa5a6aa9a
7
- data.tar.gz: ac16a5c433205dc8a9db24d73413d4053c73cc4da9eac09a180e472d96f87c3ce300e32c70079e9b745f6fed18e507609b352b6e3e10e5d9e09235103668fb8e
6
+ metadata.gz: 6f3cf3e36c7a44f50701180ac8b942e1b9f807826fcc806605b245fbac555d797c5c2368f520a6ea25f715863f51bfce2aa2c0c678b52bd94b70020fdef50fc9
7
+ data.tar.gz: 89e5f36e62fe1b89f7ef8d64f6edf31d56a4502d61948bc8592212c584fede337c50c4e4f2ed3c1782b085d41752b541b6414fc15e462a3e05c80ece1c86a773
@@ -3,6 +3,6 @@
3
3
  module K8s
4
4
  class Client
5
5
  # Updated on releases using semver.
6
- VERSION = "0.6.0"
6
+ VERSION = "0.6.1"
7
7
  end
8
8
  end
data/lib/k8s/stack.rb CHANGED
@@ -76,7 +76,7 @@ module K8s
76
76
  labels: { @label => name },
77
77
  annotations: {
78
78
  @checksum_annotation => checksum,
79
- @last_config_annotation => resource.to_json
79
+ @last_config_annotation => Util.recursive_compact(resource.to_h).to_json
80
80
  }
81
81
  }
82
82
  )
data/lib/k8s/util.rb CHANGED
@@ -25,6 +25,20 @@ module K8s
25
25
  args.map{ |arg| value_map[arg] }
26
26
  end
27
27
 
28
+ # Recursive compact for Hash/Array
29
+ #
30
+ # @param hash_or_array [Hash,Array]
31
+ # @return [Hash,Array]
32
+ def self.recursive_compact(hash_or_array)
33
+ p = proc do |*args|
34
+ v = args.last
35
+ v.delete_if(&p) if v.respond_to?(:delete_if) && !v.is_a?(Array)
36
+ v.nil? || v.respond_to?(:empty?) && (v.empty? && (v.is_a?(Hash) || v.is_a?(Array)))
37
+ end
38
+
39
+ hash_or_array.delete_if(&p)
40
+ end
41
+
28
42
  # Produces a set of json-patch operations so that applying
29
43
  # the operations on a, gives you the results of b
30
44
  # Used in correctly patching the Kube resources on stack updates
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k8s-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-19 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon