I have a ton of helm files, with the structure aligned to comply with Helm2
, i.e. a separate requirements.yaml
file and no type:application
in Chart.yaml
Is there an option in helm-2to3
plugin that automagically places the requirements.yaml
under Chart.yaml
or do I have to write myself a script to do this?
My charts are checked-in to GH btw (not using a helm repo but operating them via GitOps)
edit: After confirmation in answers below that helm-2to3
does not provide that functionality, I ended up using the draft script below (warning: do not use it in production :) ); you can then proceed by a simple find
/xargs
oneliner to remove all requirements.yaml
(or give them an extension of .bak
to keep around for some time).
the chart should of course be run from the root directory of the project where your helm
files are kept.
import os
import time
for root, dirs, files in os.walk(os.path.abspath(".")):
for file in files:
if file == "requirements.yaml":
path = os.path.dirname(os.path.join(root, file))
print(path)
os.chdir(path)
files = [f for f in os.listdir('.') if os.path.isfile(f)]
# print(files)
if "requirements.yaml" in files and "Chart.yaml" in files:
requirements_path = os.path.join(root, file)
print("Doing job in..: ", requirements_path)
chart_path = path + "/Chart.yaml"
print(chart_path)
with open(requirements_path) as req:
r = req.read()
with open(chart_path, 'a') as chr:
chr.write(r)
time.sleep(2)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…