-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update external URLs if cattle values are provided #1097
Update external URLs if cattle values are provided #1097
Conversation
04e7707
to
650e08c
Compare
externalUrl: "{{ tpl .Values.alertmanager.alertmanagerSpec.externalUrl . }}" | ||
{{- else if and .Values.alertmanager.ingress.enabled .Values.alertmanager.ingress.hosts }} | ||
externalUrl: "http://{{ tpl (index .Values.alertmanager.ingress.hosts 0) . }}{{ .Values.alertmanager.alertmanagerSpec.routePrefix }}" | ||
+{{- else if not (or (kindIs "invalid" .Values.global.cattle.url) (kindIs "invalid" .Values.global.cattle.clusterId)) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kindIs "invalid" {field}
is a nice little hack that allows us to not have to check .Values.global
and .Values.global.cattle
before looking at this field. If .Values.global
or .Values.global.cattle
do not exist, these statements will return true (since it is invalid). It will also return true if they are empty strings.
Credit goes to Masterminds/sprig#53 (comment).
650e08c
to
c839bd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sets the externalURL to the rancher proxy if and only if
.Values.global.cattle.url
and.Values.global.cattle.clusterId
are set.While these will be set magically by default in Rancher 2.5.8 onwards by the dashboard UI, this solution doesn't prevent a user from manually setting these fields to be able to use this in Rancher 2.5.7 or before.