Skip to content

Commit

Permalink
Fix helm for webhook (#129)
Browse files Browse the repository at this point in the history
* Log all validation attempts

* add app selector for helm deployments
  • Loading branch information
rbren authored May 24, 2019
1 parent d5b3b6b commit f061e0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions deploy/helm/polaris/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 -}}
Expand Down
4 changes: 1 addition & 3 deletions pkg/webhook/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit f061e0e

Please sign in to comment.