Skip to content

Commit 42c2c93

Browse files
authored
OWLS-103910 - Fix for "helm upgrade" to re-install the webhook if the existing webhook is from the same namespace. (#3611)
1 parent 6208287 commit 42c2c93

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

kubernetes/charts/weblogic-operator/templates/_operator-dep.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ spec:
192192
{{- end }}
193193
---
194194
{{ $chartVersion := .Chart.Version }}
195-
{{ $webhookExists := include "utils.verifyExistingWebhookDeployment" (list $chartVersion) | trim }}
195+
{{ $releaseNamespace := .Release.Namespace }}
196+
{{ $webhookExists := include "utils.verifyExistingWebhookDeployment" (list $chartVersion $releaseNamespace) | trim }}
196197
{{- if and (ne $webhookExists "true") (not .operatorOnly) }}
197198
# webhook does not exist or chart version is newer, create a new webhook
198199
apiVersion: "v1"

kubernetes/charts/weblogic-operator/templates/_utils.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,16 @@ Return true if there's an existing webhook deployment and chart version is less
498498
*/}}
499499
{{- define "utils.verifyExistingWebhookDeployment" -}}
500500
{{- $chartVersion := index . 0 -}}
501+
{{- $releaseNamespace := index . 1 -}}
501502
{{- range $deployment := (lookup "apps/v1" "Deployment" "" "").items }}
502503
{{- if not $deployment.metadata.labels }}
503504
{{- $ignore := set $deployment.metadata "labels" (dict) }}
504505
{{- end }}
505506
{{- if and (eq $deployment.metadata.name "weblogic-operator-webhook") (hasKey $deployment.metadata.labels "weblogic.webhookVersion") }}
506507
{{ $webhookVersion := get $deployment.metadata.labels "weblogic.webhookVersion" }}
508+
{{- if (eq $deployment.metadata.namespace $releaseNamespace) }}
509+
{{- print "false" }}
510+
{{- end -}}
507511
{{- if le $chartVersion $webhookVersion }}
508512
{{- print "true" }}
509513
{{- end -}}

0 commit comments

Comments
 (0)