New image parsing pattern that supports "registry"

Added support for new "registry" pattern. Image settings
inside charts can now have the following pattern:

image:
   registry: <str>
   repository: <str>

Test Plan:
PASS: Upload and apply process successfully completed with
tarball changed to new pattern using "registry"
PASS: metrics-server, nginx-ingress-controller, vault and
sts-silicom upload and apply process without "registry"
completed successfully.

Closes-bug: 2019730

Change-Id: Id5cadafedf9b85891700dffcede9b0b09ee64359
Signed-off-by: David Barbosa Bastos <david.barbosabastos@windriver.com>
This commit is contained in:
David Barbosa Bastos 2023-05-15 13:53:21 +00:00
parent c423cd939c
commit 12bb149f92
3 changed files with 33 additions and 1 deletions

View File

@ -3457,6 +3457,10 @@ class AppImageParser(object):
5. image: <str>
imageTag(tag/imagetag): <str>
6. image:
registry: <str>
repository: <str>
:param var_dict: dict
:return: a list of image references
"""
@ -3480,6 +3484,9 @@ class AppImageParser(object):
keys = v.keys()
if 'repository' in keys:
image.update({'repository': v['repository']})
if 'registry' in keys:
image.update({'repository': '{}/{}'.format(
v['registry'], v['repository'])})
if 'tag' in keys:
image.update({'tag': v['tag']})
if image:

View File

@ -25,6 +25,12 @@ image:
repository: docker.elastic.co/elasticsearch/elasticsearch-oss
tag: 7.4.0
metricsServer:
image:
registry: k8s.gcr.io
repository: metrics-server/metrics-server
tag: 0.6.1
extraInitContainers:
limitset:
image: docker.elastic.co/beats/filebeat-oss:7.4.0

View File

@ -90,6 +90,12 @@ IMAGES_RESOURCE = {
'image': {
'tag': '7.4.0',
'repository': 'docker.elastic.co/elasticsearch/elasticsearch-oss'
},
'metricsServer': {
'image': {
'tag': '0.6.1',
'repository': 'k8s.gcr.io/metrics-server/metrics-server'
}
}
}
@ -189,6 +195,12 @@ class TestKubeAppImageParser(base.TestCase):
'image': {
'tag': '7.4.0',
'repository': 'registry.local:9001/docker.elastic.co/elasticsearch/elasticsearch-oss'
},
'metricsServer': {
'image': {
'tag': '0.6.1',
'repository': 'registry.local:9001/k8s.gcr.io/metrics-server/metrics-server'
}
}
}
@ -309,6 +321,12 @@ class TestKubeAppImageParser(base.TestCase):
'image': {
'tag': '7.5.2',
'repository': 'docker.elastic.co/elasticsearch/elasticsearch-oss'
},
'metricsServer': {
'image': {
'tag': '0.6.1',
'repository': 'k8s.gcr.io/metrics-server/metrics-server'
}
}
}
@ -331,7 +349,8 @@ class TestKubeAppImageParser(base.TestCase):
'quay.io/silicom/phc2sys:3.1.1',
'quay.io/silicom/grpc-tsyncd:2.1.2.8',
'quay.io/silicom/gpsd:3.23.1',
'docker.io/starlingx/stx-heat:master-centos-stable-latest'
'docker.io/starlingx/stx-heat:master-centos-stable-latest',
'k8s.gcr.io/metrics-server/metrics-server:0.6.1'
]
download_imgs_list = self.image_parser.generate_download_images_list(