From f061e0e012d4c145dfd6928edbf38b620e7d07c4 Mon Sep 17 00:00:00 2001 From: Bobby Brennan Date: Fri, 24 May 2019 10:21:38 -0400 Subject: [PATCH] Fix helm for webhook (#129) * Log all validation attempts * add app selector for helm deployments --- deploy/helm/polaris/templates/_helpers.tpl | 6 ++---- pkg/webhook/validator.go | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/deploy/helm/polaris/templates/_helpers.tpl b/deploy/helm/polaris/templates/_helpers.tpl index d6b75053d..3a0af13ae 100644 --- a/deploy/helm/polaris/templates/_helpers.tpl +++ b/deploy/helm/polaris/templates/_helpers.tpl @@ -35,9 +35,8 @@ Create chart name and version as used by the chart label. Standard labels */}} {{- define "polaris.labels" -}} -{{- if .Values.templateOnly -}} app: {{ include "polaris.name" . }} -{{- else -}} +{{- if not .Values.templateOnly }} app.kubernetes.io/name: {{ include "polaris.name" . }} helm.sh/chart: {{ include "polaris.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} @@ -49,9 +48,8 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} Standard selector */}} {{- define "polaris.selectors" -}} -{{- if .Values.templateOnly -}} app: {{ include "polaris.name" . }} -{{- else -}} +{{- if not .Values.templateOnly }} app.kubernetes.io/name: {{ include "polaris.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} diff --git a/pkg/webhook/validator.go b/pkg/webhook/validator.go index 8454249c1..ab2ebad9c 100644 --- a/pkg/webhook/validator.go +++ b/pkg/webhook/validator.go @@ -109,11 +109,9 @@ func (v *Validator) Handle(ctx context.Context, req types.Request) types.Respons if podResult.Summary.Totals.Errors > 0 { allowed = false - logrus.Infof("%d validation errors found when validating %s", podResult.Summary.Totals.Errors, podResult.Name) - reason = getFailureReason(podResult) } - + logrus.Infof("%d validation errors found when validating %s", podResult.Summary.Totals.Errors, podResult.Name) return admission.ValidationResponse(allowed, reason) }