Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #89 from FabianKramm/master
Browse files Browse the repository at this point in the history
improvement: add UPDATE_WEBHOOK and UPDATE_APISERVICE variables
  • Loading branch information
FabianKramm authored Sep 30, 2020
2 parents f7958c0 + 6d734a1 commit ebce0a8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
4 changes: 4 additions & 0 deletions chart/templates/apiserviceservice.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.apiservice }}
{{- if .Values.apiservice.create }}
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
Expand Down Expand Up @@ -29,3 +31,5 @@ spec:
selector:
app: {{ template "kiosk.fullname" . }}
release: {{ .Release.Name }}
{{- end }}
{{- end }}
17 changes: 17 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ spec:
image: "kiosksh/kiosk:{{ .Chart.Version }}"
{{- end }}
name: kiosk
env:
{{- if .Values.webhook }}
{{- if not .Values.webhook.create }}
- name: UPDATE_WEBHOOK
value: "false"
{{- end }}
{{- end }}
{{- if .Values.apiservice }}
{{- if not .Values.apiservice.create }}
- name: UPDATE_APISERVICE
value: "false"
{{- end }}
{{- end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key | quote }}
value: {{ $value | quote }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
Expand Down
4 changes: 4 additions & 0 deletions chart/templates/webhook.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{{- if .Values.webhook }}
{{- if .Values.webhook.create }}
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
name: kiosk
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

replicaCount: 1

env: {}

readinessProbe:
enabled: true

Expand All @@ -22,6 +24,12 @@ kiosk:
memory: 128Mi
cpu: 50m

webhook:
create: true

apiservice:
create: true

serviceAccount:
name: serviceaccount
create: true
Expand Down
21 changes: 13 additions & 8 deletions cmd/kiosk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func main() {
NewClient: blockingcacheclient.NewCacheClient,
Scheme: scheme,
MetricsBindAddress: ":8080",
CertDir: certhelper.WebhookCertFolder,
LeaderElection: false,
Port: 9443,
})
Expand Down Expand Up @@ -194,17 +195,21 @@ func main() {
}()

// setup validatingwebhookconfiguration
err = validatingwebhookconfiguration.EnsureValidatingWebhookConfiguration(context.Background(), mgr.GetClient())
if err != nil {
setupLog.Error(err, "unable to set up validating webhook configuration")
os.Exit(1)
if os.Getenv("UPDATE_WEBHOOK") != "false" {
err = validatingwebhookconfiguration.EnsureValidatingWebhookConfiguration(context.Background(), mgr.GetClient())
if err != nil {
setupLog.Error(err, "unable to set up validating webhook configuration")
os.Exit(1)
}
}

// setup apiservice
err = apiservice.EnsureAPIService(context.Background(), mgr.GetClient())
if err != nil {
setupLog.Error(err, "unable to set up apiservice")
os.Exit(1)
if os.Getenv("UPDATE_APISERVICE") != "false" {
err = apiservice.EnsureAPIService(context.Background(), mgr.GetClient())
if err != nil {
setupLog.Error(err, "unable to set up apiservice")
os.Exit(1)
}
}

// Wait till stopChan is closed
Expand Down

0 comments on commit ebce0a8

Please sign in to comment.