lib/kubes/compiler/decorator/post.rb in kubes-0.7.7 vs lib/kubes/compiler/decorator/post.rb in kubes-0.7.8

- old
+ new

@@ -14,27 +14,27 @@ def add_hash(item, options={}) # hashable set from previous stack call if options[:hashable_field] && item.is_a?(Hash) field = options[:hashable_field] - value_without_md5 = item[field.key] + value_without_md5 = item[field.target_key] @reset_hashable_field = true unless value_without_md5 if field.hashable? && value_without_md5 md5 = Hashable::Storage.fetch(field.kind, value_without_md5) v = [value_without_md5, md5].compact.join('-') - item[field.key] = v + item[field.target_key] = v end end options[:hashable_field] ||= hashable_field(item) # set for next stack call # Pretty tricky case. Given: # # envFrom: - # - secretRef: - # name: demo-secret - # - configMapRef: - # name: demo-config-map + # - secretRef: <--- wrapper_key + # name: demo-secret <--- target_key is 'name' from wrapper_map[wrapper_key] + # - configMapRef: <--- wrapper_key + # name: demo-config-map <--- target_key is 'name' from wrapper_map[wrapper_key] # # Need to reset the stored hashable_field in the call stack. # Else the field.kind is cached and the md5 look is incorrect # The spec/fixtures/decorators/deployment/both/envFrom.yaml fixture covers this. if @reset_hashable_field @@ -50,22 +50,22 @@ # Returns the nested key name that will be hashable. Examples: # # 1. envFrom example # envFrom: - # - secretRef: - # name: demo-secret + # - secretRef: <--- wrapper_key + # name: demo-secret <--- target_key is 'name' from wrapper_map[wrapper_key] # # 2. valueFrom example # valueFrom: - # secretKeyRef: - # name: demo-secret + # secretKeyRef: <--- wrapper_key + # name: demo-secret <--- target_key is 'name' from wrapper_map[wrapper_key] # key: password # # 3. volumes example # volumes: - # - secret: - # secretName: demo-secret + # - secret: <--- wrapper_key + # secretName: demo-secret <--- target_key is 'name' from wrapper_map[wrapper_key] # # This is useful to capture for the next level of the stack call # def hashable_field(item) return false unless item.is_a?(Hash)