|
| 1 | +{{/* vim: set filetype=mustache: */}} |
| 2 | +{{/* |
| 3 | +Expand the name of the chart. |
| 4 | +*/}} |
| 5 | +{{- define "kruise.name" -}} |
| 6 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 7 | +{{- end -}} |
| 8 | + |
| 9 | +{{/* |
| 10 | +Create a default fully qualified app name. |
| 11 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 12 | +If release name contains chart name it will be used as a full name. |
| 13 | +*/}} |
| 14 | +{{- define "kruise.fullname" -}} |
| 15 | +{{- if .Values.fullnameOverride -}} |
| 16 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 17 | +{{- else -}} |
| 18 | +{{- $name := default .Chart.Name .Values.nameOverride -}} |
| 19 | +{{- if contains $name .Release.Name -}} |
| 20 | +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 21 | +{{- else -}} |
| 22 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 23 | +{{- end -}} |
| 24 | +{{- end -}} |
| 25 | +{{- end -}} |
| 26 | + |
| 27 | +{{/* |
| 28 | +Create chart name and version as used by the chart label. |
| 29 | +*/}} |
| 30 | +{{- define "kruise.chart" -}} |
| 31 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 32 | +{{- end -}} |
| 33 | + |
| 34 | +{{/* |
| 35 | +Lookup existing immutatble resources |
| 36 | +*/}} |
| 37 | +{{- define "webhookServiceSpec" -}} |
| 38 | +{{- $service := lookup "v1" "Service" .Values.installation.namespace "kruise-webhook-service" -}} |
| 39 | +{{- if $service -}} |
| 40 | +{{ if $service.spec.clusterIP -}} |
| 41 | +clusterIP: {{ $service.spec.clusterIP }} |
| 42 | +{{- end }} |
| 43 | +{{ if $service.spec.clusterIPs -}} |
| 44 | +clusterIPs: |
| 45 | + {{ $service.spec.clusterIPs }} |
| 46 | +{{- end }} |
| 47 | +{{ if $service.spec.ipFamilyPolicy -}} |
| 48 | +ipFamilyPolicy: {{ $service.spec.ipFamilyPolicy }} |
| 49 | +{{- end }} |
| 50 | +{{ if $service.spec.ipFamilies -}} |
| 51 | +ipFamilies: |
| 52 | + {{ $service.spec.ipFamilies }} |
| 53 | +{{- end }} |
| 54 | +{{ if $service.spec.type -}} |
| 55 | +type: {{ $service.spec.type }} |
| 56 | +{{- end }} |
| 57 | +{{ if $service.spec.ipFamily -}} |
| 58 | +ipFamily: {{ $service.spec.ipFamily }} |
| 59 | +{{- end }} |
| 60 | +{{- end -}} |
| 61 | +ports: |
| 62 | +- port: 443 |
| 63 | + targetPort: {{ .Values.manager.webhook.port }} |
| 64 | +selector: |
| 65 | + control-plane: controller-manager |
| 66 | +{{- end -}} |
| 67 | + |
| 68 | +{{- define "webhookSecretData" -}} |
| 69 | +{{- $secret := lookup "v1" "Secret" .Values.installation.namespace "kruise-webhook-certs" -}} |
| 70 | +{{- if $secret -}} |
| 71 | +data: |
| 72 | +{{- range $k, $v := $secret.data }} |
| 73 | + {{ $k }}: {{ $v }} |
| 74 | +{{- end }} |
| 75 | +{{- end }} |
| 76 | +{{- end -}} |
| 77 | + |
| 78 | +{{- define "serviceAccountManager" -}} |
| 79 | +{{- $sa := lookup "v1" "ServiceAccount" .Values.installation.namespace "kruise-manager" -}} |
| 80 | +{{- if $sa -}} |
| 81 | +secrets: |
| 82 | +{{- range $v := $sa.secrets }} |
| 83 | +- name: {{ $v.name }} |
| 84 | +{{- end }} |
| 85 | +{{- end }} |
| 86 | +{{- end -}} |
| 87 | + |
| 88 | +{{- define "serviceAccountDaemon" -}} |
| 89 | +{{- $sa := lookup "v1" "ServiceAccount" .Values.installation.namespace "kruise-daemon" -}} |
| 90 | +{{- if $sa -}} |
| 91 | +secrets: |
| 92 | +{{- range $v := $sa.secrets }} |
| 93 | +- name: {{ $v.name }} |
| 94 | +{{- end }} |
| 95 | +{{- end }} |
| 96 | +{{- end -}} |
0 commit comments