From d93e76d2646875a206833af93ed467e58449a3f4 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 21 Jul 2022 14:10:42 +0200 Subject: [PATCH] Handled the diff error on templates --- app-config/openshift/config-normalise.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app-config/openshift/config-normalise.py b/app-config/openshift/config-normalise.py index e9ea6c70..d409aa7c 100644 --- a/app-config/openshift/config-normalise.py +++ b/app-config/openshift/config-normalise.py @@ -51,6 +51,16 @@ def clean_ephemeral_config(config: dict): for trigger in item['spec'].get('triggers', []): trigger.get('imageChangeParams', {}).pop('lastTriggeredImage', None) + # Drop the tags on ImageStream + if item['kind'] == 'ImageStream': + item['spec'].pop('tags', None) + + # Drop the unnecessary elements on Service + if item['kind'] == 'Service': + item['spec'].pop('internalTrafficPolicy', None) + item['spec'].pop('ipFamilies', None) + item['spec'].pop('ipFamilyPolicy', None) + for label in list(item['metadata'].get('labels', {}).keys()): for prefix in CERN_OKD4_METADATA_LABELS: if label.startswith(prefix): @@ -64,6 +74,17 @@ def clean_ephemeral_config(config: dict): # Remove the empty labels dict if there is nothing left after popping the template item. item['metadata'].pop('labels') + # Fix the configmap single element data structure + if config['kind'] == 'ConfigMap': + config['items'] = [{ + 'apiVersion': config.get('apiVersion', {}), + 'data': config.get('data', {}), + 'kind': config.get('kind', {}), + 'metadata': {'name': 'auth-service'} + }] + config['kind'] = 'List' + config.pop('data', None) + return config