2021-12-21 15:05:08 +00:00
|
|
|
#!/bin/bash -x
|
|
|
|
|
|
|
|
YAML=$1
|
|
|
|
|
|
|
|
# Convert keys
|
|
|
|
yq eval -i '
|
|
|
|
.spec.source.repoURL="https://cdn.zero-downtime.net/charts" |
|
2022-02-01 10:29:02 +00:00
|
|
|
.spec.source.targetRevision="1.21.9-1" |
|
2021-12-21 15:05:08 +00:00
|
|
|
del(.spec.source.helm.parameters)' $YAML
|
|
|
|
|
|
|
|
# Extract values
|
|
|
|
yq eval '.spec.source.helm.values' $1 > _values.yaml
|
|
|
|
|
|
|
|
# Remove kiam and calico from Argo
|
|
|
|
yq eval -i 'del(.calico) | del(.kiam)' _values.yaml
|
|
|
|
|
|
|
|
# Move storage into module
|
|
|
|
yq eval -i '.storage.enabled=true' _values.yaml
|
|
|
|
|
2022-01-24 11:05:54 +00:00
|
|
|
[ $(yq eval 'has("aws-ebs-csi-driver")' _values.yaml) == "true" ] && yq eval -i '.storage.aws-ebs-csi-driver=.aws-ebs-csi-driver' _values.yaml
|
|
|
|
[ $(yq eval 'has("aws-efs-csi-driver")' _values.yaml) == "true" ] && yq eval -i '.storage.aws-efs-csi-driver=.aws-efs-csi-driver' _values.yaml
|
2021-12-21 15:05:08 +00:00
|
|
|
|
|
|
|
# Finally remove old helm apps
|
|
|
|
yq eval -i 'del(.aws-ebs-csi-driver) | del(.aws-efs-csi-driver)' _values.yaml
|
|
|
|
|
|
|
|
# merge _values.yaml back
|
2022-01-24 11:05:54 +00:00
|
|
|
yq eval -Pi '.spec.source.helm.values |= strload("_values.yaml")' $YAML
|
2021-12-21 15:05:08 +00:00
|
|
|
|
|
|
|
rm -f _values.yaml
|