Fix temporary chart directory name for helm 3.9.4
The temporary chart directory created during the Helm overrides generation process now comply with Helm naming rule: chart directories must be lower case letters and numbers only. This ensures that directories created for temporary chart files are compatible with Helm 3.9.4 and beyond. Test Plan: PASS: build-pkgs --clean --all PASS: full AIO-SX deployment PASS: nginx-ingress-controller successfully uploaded/applied PASS: cert-manager successfully uploaded/applied PASS: platform-integ-apps successfully uploaded/applied PASS: oidc-auth-apps successfully uploaded/applied PASS: app-istio successfully uploaded/applied/removed/deleted PASS: app-kubevirt successfully uploaded/applied/removed/deleted PASS: app-oran-o2 successfully uploaded/applied/removed/deleted PASS: app-security-profiles-operator successfully uploaded/applied/removed/deleted PASS: app-sriov-fec-operator successfully uploaded/applied/removed/deleted PASS: app-sts-silicom successfully uploaded/applied/removed/deleted PASS: audit-armada-app successfully uploaded/applied/removed/deleted PASS: metrics-server-armada-app successfully uploaded/applied/removed/deleted PASS: ptp-notification-armada-app successfully uploaded/applied/removed/deleted PASS: snmp-armada-app successfully uploaded/applied/removed/deleted PASS: vault-armada-app successfully uploaded/applied/removed/deleted Story: 2010677 Task: 47758 Signed-off-by: Igor Soares <Igor.PiresSoares@windriver.com> Change-Id: Idba770dcc4b3210320eac0d83088cf311098b339
This commit is contained in:
parent
507e4ca922
commit
25bce7c970
@ -14,6 +14,8 @@ import os
|
||||
import psutil
|
||||
import ruamel.yaml as yaml
|
||||
import tempfile
|
||||
import random
|
||||
import string
|
||||
import threading
|
||||
import zlib
|
||||
|
||||
@ -164,6 +166,23 @@ def delete_helm_release(release, namespace="default", flags=None):
|
||||
timer.cancel()
|
||||
|
||||
|
||||
def create_tmp_chart_dir():
|
||||
""" Create a helm-compatible temporary chart directory
|
||||
|
||||
Chart directory names must have only lower cases letters and
|
||||
numbers in order to be accepted as valid by Helm.
|
||||
|
||||
:returns: full path of the temporary directory created
|
||||
"""
|
||||
|
||||
dir_name = ''.join(random.choices(
|
||||
string.ascii_lowercase + string.digits, k=32))
|
||||
dir_path = os.path.join(tempfile.gettempdir(), dir_name)
|
||||
os.mkdir(dir_path)
|
||||
|
||||
return dir_path
|
||||
|
||||
|
||||
def install_helm_chart_with_dry_run(args=None):
|
||||
"""Simulate a chart install
|
||||
|
||||
@ -183,7 +202,7 @@ def install_helm_chart_with_dry_run(args=None):
|
||||
timer = None
|
||||
try:
|
||||
# Make a temporary directory with a fake chart in it
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
tmpdir = create_tmp_chart_dir()
|
||||
chartfile = tmpdir + '/Chart.yaml'
|
||||
with open(chartfile, 'w') as tmpchart:
|
||||
tmpchart.write('name: mychart\napiVersion: v1\n'
|
||||
|
Loading…
Reference in New Issue
Block a user