vmware-tanzu / asset-relocation-tool-for-kubernetes

A tool for relocating Kubernetes Assets
Other
42 stars 6 forks source link

De-duplicate values file rewrites #75

Open petewall opened 3 years ago

petewall commented 3 years ago

If a chart contains a global image registry value, we could possibly update that value many times, resulting in a strange output:

values.yaml

global:
  imageRegistry: docker.io

image:
  repository: bitnami/wordpress
  tag: 5.7.2-debian-10-r0

metrics:
  repository: pwall/apache-exporter
  tag:  0.8.0-debian-10-r378

running relok8s chart move ... --registry harbor-repo.vmware.com will result in:

Computing relocation...
...
Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com
  .global.imageRegistry: harbor-repo.vmware.com

This is confusing and could lead to uncertainty.

petewall commented 3 years ago

Running with sub-charts, leads to having interleaved repeated rewrites:

Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com
  .image.repository: pwall/wordpress
  .global.imageRegistry: harbor-repo.vmware.com
  .metrics.image.repository: pwall/apache-exporter
  .global.imageRegistry: harbor-repo.vmware.com
  .volumePermissions.image.repository: pwall/bitnami-shell
  .global.imageRegistry: harbor-repo.vmware.com

Changes to be applied to wordpress/charts/mariadb/values.yaml:
  .image.repository: pwall/mariadb

Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com

Changes to be applied to wordpress/charts/mariadb/values.yaml:
  .metrics.image.repository: pwall/mysqld-exporter

Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com

Changes to be applied to wordpress/charts/mariadb/values.yaml:
  .volumePermissions.image.repository: pwall/bitnami-shell

Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com

Changes to be applied to wordpress/charts/memcached/values.yaml:
  .image.repository: pwall/memcached

Changes to be applied to wordpress/values.yaml:
  .global.imageRegistry: harbor-repo.vmware.com

Changes to be applied to wordpress/charts/memcached/values.yaml:
  .metrics.image.repository: pwall/memcached-exporter
Would you like to proceed? (y/N)