Skip to content

Commit

Permalink
salt: handle edge cases when calling service_configuration salt module
Browse files Browse the repository at this point in the history
Since the introduction of service_configurations, some charts such as prometheus-adapter
and nginx-ingress-controller do not yet implement this functionality but might in future
have configurable service values.

To render all charts, we mandatorily need to pass arguments for `--service-config` and since the
above charts do not yet implement this feature, we should be able to handle them differently.

Now, we pass `unavailable` as the service configmap name such that the module can handle things
else, if we pass `None` an exception will be raised.
  • Loading branch information
Ebaneck committed Apr 21, 2020
1 parent 33bed98 commit a160a9d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions salt/_modules/metalk8s_service_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def get_service_conf(
'Expected a ConfigMap name but got {}'.format(configmap_name)
)

# rendering charts like prometheus-adapter & nginx-ingress-controller
# require the user to pass --service-config arguments but these charts
# don't yet have service configs, so let us handle this case differently
if configmap_name == 'unavailable':
return None

try:
manifest = __salt__[
'metalk8s_kubernetes.get_object'
Expand Down

0 comments on commit a160a9d

Please sign in to comment.