Add kong chart 2.46.0
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
To connect to Kong, please execute the following commands:
|
||||
{{ if contains "LoadBalancer" .Values.proxy.type }}
|
||||
HOST=$(kubectl get svc --namespace {{ template "kong.namespace" . }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
PORT=$(kubectl get svc --namespace {{ template "kong.namespace" . }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.spec.ports[0].port}')
|
||||
{{ else if contains "NodePort" .Values.proxy.type }}HOST=$(kubectl get nodes --namespace {{ template "kong.namespace" . }} -o jsonpath='{.items[0].status.addresses[0].address}')
|
||||
PORT=$(kubectl get svc --namespace {{ template "kong.namespace" . }} {{ template "kong.fullname" . }}-proxy -o jsonpath='{.spec.ports[0].nodePort}')
|
||||
{{ end -}}
|
||||
export PROXY_IP=${HOST}:${PORT}
|
||||
curl $PROXY_IP
|
||||
|
||||
Once installed, please follow along the getting started guide to start using
|
||||
Kong: https://docs.konghq.com/kubernetes-ingress-controller/latest/guides/getting-started/
|
||||
|
||||
{{ $warnings := list -}}
|
||||
|
||||
{{- if (hasKey .Values.ingressController "serviceAccount") -}}
|
||||
{{- if (or (hasKey .Values.ingressController.serviceAccount "name") (hasKey .Values.ingressController.serviceAccount "annotations")) -}}
|
||||
{{- $warnings = append $warnings "you have set either .ingressController.serviceAccount.name or .ingressController.serviceAccount.annotations. These settings have moved to .deployment.serviceAccount.name and .deployment.serviceAccount.annotations. You must move your configuration to the new location in values.yaml" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and .Values.manager.enabled (or .Values.manager.http.enabled .Values.manager.tls.enabled) -}}
|
||||
{{- if not (and .Values.admin.enabled (or .Values.admin.http.enabled .Values.admin.tls.enabled)) -}}
|
||||
{{- $warnings = append $warnings "Kong Manager will not be functional because the Admin API is not enabled. Setting both .admin.enabled and .admin.http.enabled and/or .admin.tls.enabled to true to enable the Admin API over HTTP/TLS." -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and .Values.ingressController.konnect.enabled .Values.ingressController.konnect.runtimeGroupID -}}
|
||||
{{- if not .Values.ingressController.konnect.controlPlaneID -}}
|
||||
{{- $warnings = append $warnings "Please use `.ingressController.konnect.controlPlaneID` instead. `.ingressController.konnect.runtimeGroupID` will be removed in a future release." -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "kong.deprecation-warnings" $warnings -}}
|
||||
|
||||
{{- if .Values.demo -}}
|
||||
|
||||
#############################################################################################
|
||||
##### WARNING: DEMO VALUES USED
|
||||
#############################################################################################
|
||||
|
||||
The values file used has been marked as a demo configuration.
|
||||
It should NOT be used in production without comprehensive review of all settings provided.
|
||||
|
||||
#############################################################################################
|
||||
##### WARNING: DEMO VALUES USED
|
||||
#############################################################################################
|
||||
{{- end -}}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,274 @@
|
||||
{{- if (and .Values.ingressController.admissionWebhook.enabled .Values.ingressController.enabled) }}
|
||||
{{- $certCert := "" -}}
|
||||
{{- $certKey := "" -}}
|
||||
{{- $caCert := "" -}}
|
||||
{{- $caKey := "" -}}
|
||||
{{- if not .Values.ingressController.admissionWebhook.certificate.provided }}
|
||||
{{- $cn := printf "%s.%s.svc" ( include "kong.service.validationWebhook" . ) ( include "kong.namespace" . ) -}}
|
||||
{{- $ca := genCA "kong-admission-ca" 3650 -}}
|
||||
{{- $cert := genSignedCert $cn nil (list $cn) 3650 $ca -}}
|
||||
{{- $certCert = $cert.Cert -}}
|
||||
{{- $certKey = $cert.Key -}}
|
||||
{{- $caCert = $ca.Cert -}}
|
||||
{{- $caKey = $ca.Key -}}
|
||||
|
||||
{{- $caSecret := (lookup "v1" "Secret" (include "kong.namespace" .) (printf "%s-validation-webhook-ca-keypair" (include "kong.fullname" .))) -}}
|
||||
{{- $certSecret := (lookup "v1" "Secret" (include "kong.namespace" .) (printf "%s-validation-webhook-keypair" (include "kong.fullname" .))) -}}
|
||||
{{- if $certSecret }}
|
||||
{{- $certCert = (b64dec (get $certSecret.data "tls.crt")) -}}
|
||||
{{- $certKey = (b64dec (get $certSecret.data "tls.key")) -}}
|
||||
{{- end }}
|
||||
{{- if $caSecret }}
|
||||
{{- $caCert = (b64dec (get $caSecret.data "tls.crt")) -}}
|
||||
{{- $caKey = (b64dec (get $caSecret.data "tls.key")) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
kind: ValidatingWebhookConfiguration
|
||||
{{- if .Capabilities.APIVersions.Has "admissionregistration.k8s.io/v1" }}
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
{{- else }}
|
||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
||||
{{- end }}
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-validations
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- if .Values.ingressController.admissionWebhook.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.ingressController.admissionWebhook.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
webhooks:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
{{- if not .Values.ingressController.admissionWebhook.certificate.provided }}
|
||||
caBundle: {{ b64enc $caCert }}
|
||||
{{- else }}
|
||||
{{- if .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
caBundle: {{ b64enc .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
service:
|
||||
name: {{ template "kong.service.validationWebhook" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
failurePolicy: {{ .Values.ingressController.admissionWebhook.failurePolicy }}
|
||||
matchPolicy: {{ .Values.ingressController.admissionWebhook.matchPolicy }}
|
||||
name: secrets.credentials.validation.ingress-controller.konghq.com
|
||||
{{- with .Values.ingressController.admissionWebhook.namespaceSelector }}
|
||||
namespaceSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingressController.admissionWebhook.timeoutSeconds }}
|
||||
timeoutSeconds: {{ . }}
|
||||
{{- end }}
|
||||
objectSelector:
|
||||
matchExpressions:
|
||||
- key: "konghq.com/credential"
|
||||
operator: "Exists"
|
||||
{{- /* Do not validate Konnect credentials, these are targeted for KGO */}}
|
||||
- key: "konghq.com/credential"
|
||||
operator: "NotIn"
|
||||
values:
|
||||
- "konnect"
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- secrets
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
{{- if not .Values.ingressController.admissionWebhook.certificate.provided }}
|
||||
caBundle: {{ b64enc $caCert }}
|
||||
{{- else }}
|
||||
{{- if .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
caBundle: {{ b64enc .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
service:
|
||||
name: {{ template "kong.service.validationWebhook" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
failurePolicy: {{ .Values.ingressController.admissionWebhook.failurePolicy }}
|
||||
matchPolicy: {{ .Values.ingressController.admissionWebhook.matchPolicy }}
|
||||
name: secrets.plugins.validation.ingress-controller.konghq.com
|
||||
{{- with .Values.ingressController.admissionWebhook.namespaceSelector }}
|
||||
namespaceSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingressController.admissionWebhook.timeoutSeconds }}
|
||||
timeoutSeconds: {{ . }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingressController.admissionWebhook.filterSecrets }}
|
||||
objectSelector:
|
||||
matchExpressions:
|
||||
- key: "konghq.com/validate"
|
||||
operator: "Exists"
|
||||
{{- /* Do not validate Konnect credentials, these are targeted for KGO */}}
|
||||
- key: "konghq.com/credential"
|
||||
operator: "NotIn"
|
||||
values:
|
||||
- "konnect"
|
||||
{{- else }}
|
||||
objectSelector:
|
||||
matchExpressions:
|
||||
- key: owner
|
||||
operator: NotIn
|
||||
values:
|
||||
- helm
|
||||
{{- /* Do not validate Konnect credentials, these are targeted for KGO */}}
|
||||
- key: "konghq.com/credential"
|
||||
operator: "NotIn"
|
||||
values:
|
||||
- "konnect"
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- secrets
|
||||
sideEffects: None
|
||||
- name: validations.kong.konghq.com
|
||||
matchPolicy: {{ .Values.ingressController.admissionWebhook.matchPolicy }}
|
||||
{{- with .Values.ingressController.admissionWebhook.namespaceSelector }}
|
||||
namespaceSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingressController.admissionWebhook.matchConditions }}
|
||||
matchConditions:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingressController.admissionWebhook.objectSelector }}
|
||||
objectSelector:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.ingressController.admissionWebhook.timeoutSeconds }}
|
||||
timeoutSeconds: {{ . }}
|
||||
{{- end }}
|
||||
failurePolicy: {{ .Values.ingressController.admissionWebhook.failurePolicy }}
|
||||
sideEffects: None
|
||||
admissionReviewVersions: ["v1beta1"]
|
||||
rules:
|
||||
- apiGroups:
|
||||
- configuration.konghq.com
|
||||
apiVersions:
|
||||
- '*'
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- kongconsumers
|
||||
- kongplugins
|
||||
{{- if (semverCompare ">= 2.0.4" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- kongclusterplugins
|
||||
{{- end }}
|
||||
{{- if (semverCompare ">= 2.8.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- kongingresses
|
||||
{{- end }}
|
||||
{{- if (semverCompare ">= 3.0.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- apiGroups:
|
||||
- ''
|
||||
apiVersions:
|
||||
- 'v1'
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- services
|
||||
{{- end }}
|
||||
{{- if (semverCompare ">= 2.12.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
apiVersions:
|
||||
- 'v1'
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- ingresses
|
||||
- apiGroups:
|
||||
- gateway.networking.k8s.io
|
||||
apiVersions:
|
||||
- 'v1alpha2'
|
||||
- 'v1beta1'
|
||||
{{- if (semverCompare ">= 3.0.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- 'v1'
|
||||
{{- end }}
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- gateways
|
||||
- httproutes
|
||||
{{- end }}
|
||||
clientConfig:
|
||||
{{- if not .Values.ingressController.admissionWebhook.certificate.provided }}
|
||||
caBundle: {{ b64enc $caCert }}
|
||||
{{- else }}
|
||||
{{- if .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
caBundle: {{ b64enc .Values.ingressController.admissionWebhook.certificate.caBundle }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
service:
|
||||
name: {{ template "kong.service.validationWebhook" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "kong.service.validationWebhook" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- if .Values.ingressController.admissionWebhook.service.labels }}
|
||||
{{- toYaml .Values.ingressController.admissionWebhook.service.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: webhook
|
||||
port: 443
|
||||
protocol: TCP
|
||||
targetPort: webhook
|
||||
selector:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: app
|
||||
{{- if not .Values.ingressController.admissionWebhook.certificate.provided }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-validation-webhook-ca-keypair
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ b64enc $caCert }}
|
||||
tls.key: {{ b64enc $caKey }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-validation-webhook-keypair
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ b64enc $certCert }}
|
||||
tls.key: {{ b64enc $certKey }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,93 @@
|
||||
{{- if and ( .Capabilities.APIVersions.Has "cert-manager.io/v1" ) .Values.certificates.enabled -}}
|
||||
|
||||
{{- $genericCertificateConfig := dict -}}
|
||||
{{- $_ := set $genericCertificateConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $genericCertificateConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $genericCertificateConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $genericCertificateConfig "globalIssuer" .Values.certificates.issuer -}}
|
||||
{{- $_ := set $genericCertificateConfig "globalClusterIssuer" .Values.certificates.clusterIssuer -}}
|
||||
{{- $_ := set $genericCertificateConfig "globalSubject" .Values.certificates.subject -}}
|
||||
{{- $_ := set $genericCertificateConfig "globalPrivateKey" .Values.certificates.privateKey -}}
|
||||
{{- $_ := set $genericCertificateConfig "defaultIssuer" (printf "%s-%s-%s" .Release.Name .Chart.Name "selfsigned-issuer") -}}
|
||||
|
||||
{{- if .Values.certificates.admin.enabled }}
|
||||
{{- $certificateConfig := mustMerge (mustDeepCopy $genericCertificateConfig) .Values.certificates.admin -}}
|
||||
{{- $_ := set $certificateConfig "serviceName" "admin" -}}
|
||||
{{- include "kong.certificate" $certificateConfig -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if (and .Values.certificates.portal.enabled .Values.enterprise.enabled) }}
|
||||
{{- $certificateConfig := mustMerge (mustDeepCopy $genericCertificateConfig) .Values.certificates.portal -}}
|
||||
{{- $_ := set $certificateConfig "serviceName" "portal" -}}
|
||||
{{- include "kong.certificate" $certificateConfig -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.certificates.proxy.enabled }}
|
||||
{{- $certificateConfig := mustMerge (mustDeepCopy $genericCertificateConfig) .Values.certificates.proxy -}}
|
||||
{{- $_ := set $certificateConfig "serviceName" "proxy" -}}
|
||||
{{- include "kong.certificate" $certificateConfig -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.certificates.cluster.enabled }}
|
||||
{{- $certificateConfig := dict -}}
|
||||
{{- $certificateConfig = mustMerge (mustDeepCopy $genericCertificateConfig) .Values.certificates.cluster -}}
|
||||
{{- $_ := set $certificateConfig "serviceName" "cluster" -}}
|
||||
{{- include "kong.certificate" $certificateConfig -}}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- define "kong.certificate" }}
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ .fullName }}-{{ .serviceName }}
|
||||
namespace: {{ .namespace }}
|
||||
labels:
|
||||
{{- .metaLabels | nindent 4 }}
|
||||
spec:
|
||||
secretName: {{ .fullName }}-{{ .serviceName }}-cert
|
||||
commonName: {{ .commonName }}
|
||||
dnsNames:
|
||||
{{- range (append .dnsNames .commonName) }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
renewBefore: 360h0m0s
|
||||
duration: 2160h0m0s
|
||||
{{ if .subject -}}
|
||||
subject:
|
||||
{{- toYaml .subject | nindent 4 }}
|
||||
{{ else if .globalSubject -}}
|
||||
subject:
|
||||
{{- toYaml .globalSubject | nindent 4 }}
|
||||
{{- end }}
|
||||
{{ if .privateKey -}}
|
||||
privateKey:
|
||||
{{- toYaml .privateKey | nindent 4 }}
|
||||
{{ else if .globalPrivateKey -}}
|
||||
privateKey:
|
||||
{{- toYaml .globalPrivateKey | nindent 4 }}
|
||||
{{- end }}
|
||||
{{ if .clusterIssuer -}}
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
name: {{ .clusterIssuer }}
|
||||
kind: ClusterIssuer
|
||||
{{ else if .issuer -}}
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
name: {{ .issuer }}
|
||||
kind: Issuer
|
||||
{{ else if .globalClusterIssuer -}}
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
name: {{ .globalClusterIssuer}}
|
||||
kind: ClusterIssuer
|
||||
{{ else if .globalIssuer -}}
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
name: {{ .globalIssuer }}
|
||||
kind: Issuer
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off")) }}
|
||||
{{- if not (or .Values.dblessConfig.configMap .Values.dblessConfig.secret) }}
|
||||
{{- if .Values.dblessConfig.config }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "kong.dblessConfig.fullname" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
data:
|
||||
kong.yml: | {{- .Values.dblessConfig.config | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,170 @@
|
||||
{{- if and .Values.ingressController.rbac.create .Values.ingressController.enabled -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
- pods
|
||||
- secrets
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
resourceNames:
|
||||
# Defaults to "<election-id>-<ingress-class>"
|
||||
# Here: "<kong-ingress-controller-leader-nginx>-<nginx>"
|
||||
# This has to be adapted if you change either parameter
|
||||
# when launching the nginx-ingress-controller.
|
||||
- "kong-ingress-controller-leader-{{ .Values.ingressController.ingressClass }}-{{ .Values.ingressController.ingressClass }}"
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- create
|
||||
{{- if (semverCompare "< 2.10.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
verbs:
|
||||
- get
|
||||
{{- end }}
|
||||
# Begin KIC 2.x leader permissions
|
||||
- apiGroups:
|
||||
- ""
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- configmaps
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kong.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kong.serviceAccountName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
{{- if eq (len .Values.ingressController.watchNamespaces) 0 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
name: {{ template "kong.fullname" . }}
|
||||
rules:
|
||||
{{ include "kong.kubernetesRBACRules" . }}
|
||||
{{ include "kong.kubernetesRBACClusterRules" . }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kong.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kong.serviceAccountName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
{{- else }}
|
||||
{{- range .Values.ingressController.watchNamespaces }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "kong.metaLabels" $ | nindent 4 }}
|
||||
name: {{ template "kong.fullname" $ }}-{{ . }}
|
||||
namespace: {{ . }}
|
||||
rules:
|
||||
{{ include "kong.kubernetesRBACRules" $ }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" $ }}-{{ . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" $ | nindent 4 }}
|
||||
namespace: {{ . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kong.fullname" $ }}-{{ . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kong.serviceAccountName" $ }}
|
||||
namespace: {{ template "kong.namespace" $ }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
name: {{ template "kong.fullname" . }}
|
||||
rules:
|
||||
{{ include "kong.kubernetesRBACClusterRules" . }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kong.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kong.serviceAccountName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- if and .Values.ingressController.enabled (semverCompare ">= 2.0.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-metrics
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- if .Values.ingressController.labels }}
|
||||
{{- toYaml .Values.ingressController.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: cmetrics
|
||||
port: 10255
|
||||
protocol: TCP
|
||||
targetPort: cmetrics
|
||||
- name: status
|
||||
port: 10254
|
||||
protocol: TCP
|
||||
targetPort: cstatus
|
||||
selector:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: app
|
||||
{{- end }}
|
||||
@@ -0,0 +1,34 @@
|
||||
{{- $installCRDs := false -}}
|
||||
{{- if (hasKey .Values.ingressController "installCRDs") -}}
|
||||
{{/* Explicitly set, honor whatever's set */}}
|
||||
{{- $installCRDs = .Values.ingressController.installCRDs -}}
|
||||
{{- else -}}
|
||||
{{/* Legacy default handling. CRD installation is _not_ enabled, but CRDs are already present
|
||||
and are managed by this release. This release previously relied on the <2.0 default
|
||||
.Values.ingressController.installCRDs=true. The default change would delete CRDs on upgrade,
|
||||
which would cascade delete all associated CRs. This unexpected loss of configuration is bad,
|
||||
so this clause pretends the default didn't change if you have an existing release that relied
|
||||
on it
|
||||
*/}}
|
||||
{{- $kongPluginCRD := false -}}
|
||||
{{- if .Capabilities.APIVersions.Has "apiextensions.k8s.io/v1/CustomResourceDefinition" -}}
|
||||
{{- $kongPluginCRD = (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "kongplugins.configuration.konghq.com") -}}
|
||||
{{- else -}}
|
||||
{{/* TODO: remove the v1beta1 path when we no longer support k8s <1.16 */}}
|
||||
{{- $kongPluginCRD = (lookup "apiextensions.k8s.io/v1beta1" "CustomResourceDefinition" "" "kongplugins.configuration.konghq.com") -}}
|
||||
{{- end -}}
|
||||
{{- if $kongPluginCRD -}}
|
||||
{{- if (hasKey $kongPluginCRD.metadata "annotations") -}}
|
||||
{{- if (eq .Release.Name (get $kongPluginCRD.metadata.annotations "meta.helm.sh/release-name")) -}}
|
||||
{{- $installCRDs = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $installCRDs -}}
|
||||
{{- range $path, $bytes := .Files.Glob "crds/*.yaml" }}
|
||||
{{ $.Files.Get $path }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,314 @@
|
||||
{{- if or .Values.deployment.kong.enabled .Values.ingressController.enabled }}
|
||||
apiVersion: apps/v1
|
||||
{{- if .Values.deployment.daemonset }}
|
||||
kind: DaemonSet
|
||||
{{- else }}
|
||||
kind: Deployment
|
||||
{{- end }}
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: app
|
||||
{{- if .Values.deploymentAnnotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.deploymentAnnotations }}
|
||||
{{ $key }}: {{ include "kong.renderTpl" (dict "value" $value "context" $) | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
{{- if not .Values.deployment.daemonset }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.revisionHistoryLimit }}
|
||||
revisionHistoryLimit: {{ .Values.deployment.revisionHistoryLimit }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "kong.selectorLabels" . | nindent 6 }}
|
||||
{{- if .Values.updateStrategy }}
|
||||
{{- if .Values.deployment.daemonset }}
|
||||
updateStrategy:
|
||||
{{- else }}
|
||||
strategy:
|
||||
{{- end }}
|
||||
{{ toYaml .Values.updateStrategy | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.minReadySeconds }}
|
||||
minReadySeconds: {{ .Values.deployment.minReadySeconds }}
|
||||
{{- end }}
|
||||
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
|
||||
kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
|
||||
{{- end }}
|
||||
{{- if (and (not .Values.ingressController.enabled) (eq .Values.env.database "off" )) }}
|
||||
{{- if .Values.dblessConfig.config }}
|
||||
checksum/dbless.config: {{ toYaml .Values.dblessConfig.config | sha256sum }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.podAnnotations }}
|
||||
{{- range $key, $value := .Values.podAnnotations }}
|
||||
{{ $key }}: {{ include "kong.renderTpl" (dict "value" $value "context" $) | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: app
|
||||
app: {{ template "kong.fullname" . }}
|
||||
{{ $version := semver (include "kong.effectiveVersion" .Values.image) }}
|
||||
version: {{ printf "%d.%d" $version.Major $version.Minor | quote }}
|
||||
{{- if .Values.podLabels }}
|
||||
{{ include "kong.renderTpl" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.deployment.hostname }}
|
||||
hostname: {{ .Values.deployment.hostname }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.hostNetwork }}
|
||||
hostNetwork: true
|
||||
{{- end }}
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: "{{ .Values.priorityClassName }}"
|
||||
{{- end }}
|
||||
{{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
|
||||
serviceAccountName: {{ template "kong.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
|
||||
automountServiceAccountToken: true
|
||||
{{- else }}
|
||||
automountServiceAccountToken: false
|
||||
{{ end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
initContainers:
|
||||
- name: clear-stale-pid
|
||||
image: {{ include "kong.getRepoTag" .Values.image }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 10 }}
|
||||
command:
|
||||
- "rm"
|
||||
- "-vrf"
|
||||
- "$KONG_PREFIX/pids"
|
||||
env:
|
||||
{{- include "kong.env" . | nindent 8 }}
|
||||
{{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
|
||||
volumeMounts:
|
||||
{{- include "kong.volumeMounts" . | nindent 8 }}
|
||||
{{- if .Values.deployment.initContainers }}
|
||||
{{- toYaml .Values.deployment.initContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if (and (not (eq .Values.env.database "off")) .Values.waitImage.enabled) }}
|
||||
{{- include "kong.wait-for-db" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.hostAliases }}
|
||||
hostAliases:
|
||||
{{- toYaml .Values.deployment.hostAliases | nindent 6 }}
|
||||
{{- end}}
|
||||
{{- if .Values.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.dnsPolicy | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{ toYaml .Values.dnsConfig | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.ingressController.enabled }}
|
||||
{{- include "kong.controller-container" . | nindent 6 }}
|
||||
{{ end }}
|
||||
{{- if .Values.deployment.sidecarContainers }}
|
||||
{{- toYaml .Values.deployment.sidecarContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
- name: "proxy"
|
||||
image: {{ include "kong.getRepoTag" .Values.image }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
env:
|
||||
{{- include "kong.no_daemon_env" . | nindent 8 }}
|
||||
{{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
|
||||
lifecycle:
|
||||
{{- toYaml .Values.lifecycle | nindent 10 }}
|
||||
ports:
|
||||
{{- if (and .Values.admin.http.enabled .Values.admin.enabled) }}
|
||||
- name: admin
|
||||
containerPort: {{ .Values.admin.http.containerPort }}
|
||||
{{- if .Values.admin.http.hostPort }}
|
||||
hostPort: {{ .Values.admin.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.admin.tls.enabled .Values.admin.enabled) }}
|
||||
- name: admin-tls
|
||||
containerPort: {{ .Values.admin.tls.containerPort }}
|
||||
{{- if .Values.admin.tls.hostPort }}
|
||||
hostPort: {{ .Values.admin.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.proxy.http.enabled .Values.proxy.enabled) }}
|
||||
- name: proxy
|
||||
containerPort: {{ .Values.proxy.http.containerPort }}
|
||||
{{- if .Values.proxy.http.hostPort }}
|
||||
hostPort: {{ .Values.proxy.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.proxy.tls.enabled .Values.proxy.enabled)}}
|
||||
- name: proxy-tls
|
||||
containerPort: {{ .Values.proxy.tls.containerPort }}
|
||||
{{- if .Values.proxy.tls.hostPort }}
|
||||
hostPort: {{ .Values.proxy.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- range .Values.proxy.stream }}
|
||||
- name: stream{{ if (eq (default "TCP" .protocol) "UDP") }}udp{{ end }}-{{ .containerPort }}
|
||||
containerPort: {{ .containerPort }}
|
||||
{{- if .hostPort }}
|
||||
hostPort: {{ .hostPort }}
|
||||
{{- end}}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- range .Values.udpProxy.stream }}
|
||||
- name: streamudp-{{ .containerPort }}
|
||||
containerPort: {{ .containerPort }}
|
||||
{{- if .hostPort }}
|
||||
hostPort: {{ .hostPort }}
|
||||
{{- end}}
|
||||
protocol: {{ .protocol }}
|
||||
{{- end }}
|
||||
{{- if (and .Values.status.http.enabled .Values.status.enabled)}}
|
||||
- name: status
|
||||
containerPort: {{ .Values.status.http.containerPort }}
|
||||
{{- if .Values.status.http.hostPort }}
|
||||
hostPort: {{ .Values.status.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.status.tls.enabled .Values.status.enabled) }}
|
||||
- name: status-tls
|
||||
containerPort: {{ .Values.status.tls.containerPort }}
|
||||
{{- if .Values.status.tls.hostPort }}
|
||||
hostPort: {{ .Values.status.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.cluster.tls.enabled .Values.cluster.enabled) }}
|
||||
- name: cluster-tls
|
||||
containerPort: {{ .Values.cluster.tls.containerPort }}
|
||||
{{- if .Values.cluster.tls.hostPort }}
|
||||
hostPort: {{ .Values.cluster.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if .Values.enterprise.enabled }}
|
||||
{{- if (and .Values.manager.http.enabled .Values.manager.enabled) }}
|
||||
- name: manager
|
||||
containerPort: {{ .Values.manager.http.containerPort }}
|
||||
{{- if .Values.manager.http.hostPort }}
|
||||
hostPort: {{ .Values.manager.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.manager.tls.enabled .Values.manager.enabled) }}
|
||||
- name: manager-tls
|
||||
containerPort: {{ .Values.manager.tls.containerPort }}
|
||||
{{- if .Values.manager.tls.hostPort }}
|
||||
hostPort: {{ .Values.manager.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.portal.http.enabled .Values.portal.enabled) }}
|
||||
- name: portal
|
||||
containerPort: {{ .Values.portal.http.containerPort }}
|
||||
{{- if .Values.portal.http.hostPort }}
|
||||
hostPort: {{ .Values.portal.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.portal.tls.enabled .Values.portal.enabled) }}
|
||||
- name: portal-tls
|
||||
containerPort: {{ .Values.portal.tls.containerPort }}
|
||||
{{- if .Values.portal.tls.hostPort }}
|
||||
hostPort: {{ .Values.portal.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.portalapi.http.enabled .Values.portalapi.enabled) }}
|
||||
- name: portalapi
|
||||
containerPort: {{ .Values.portalapi.http.containerPort }}
|
||||
{{- if .Values.portalapi.http.hostPort }}
|
||||
hostPort: {{ .Values.portalapi.http.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.portalapi.tls.enabled .Values.portalapi.enabled) }}
|
||||
- name: portalapi-tls
|
||||
containerPort: {{ .Values.portalapi.tls.containerPort }}
|
||||
{{- if .Values.portalapi.tls.hostPort }}
|
||||
hostPort: {{ .Values.portalapi.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- if (and .Values.clustertelemetry.tls.enabled .Values.clustertelemetry.enabled) }}
|
||||
- name: clustert-tls
|
||||
containerPort: {{ .Values.clustertelemetry.tls.containerPort }}
|
||||
{{- if .Values.clustertelemetry.tls.hostPort }}
|
||||
hostPort: {{ .Values.clustertelemetry.tls.hostPort }}
|
||||
{{- end}}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- include "kong.volumeMounts" . | nindent 10 }}
|
||||
{{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 10 }}
|
||||
readinessProbe:
|
||||
{{ include "kong.proxy.compatibleReadiness" . | indent 10 }}
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.livenessProbe | indent 10 }}
|
||||
{{- if .Values.startupProbe }}
|
||||
startupProbe:
|
||||
{{ toYaml .Values.startupProbe | indent 10 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 10 }}
|
||||
{{- end }} {{/* End of Kong container spec */}}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- include "kong.podsecuritycontext" . | nindent 8 }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- include "kong.volumes" . | nindent 8 -}}
|
||||
{{- include "kong.userDefinedVolumes" . | nindent 8 -}}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ range .Values.extraObjects }}
|
||||
---
|
||||
{{ tpl (toYaml .) $ }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: {{ include "kong.autoscalingVersion" . }}
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: "{{ template "kong.fullname" . }}"
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: "{{ template "kong.fullname" . }}"
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
{{- if .Values.autoscaling.behavior }}
|
||||
behavior:
|
||||
{{- toYaml .Values.autoscaling.behavior | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if contains "autoscaling/v2" (include "kong.autoscalingVersion" . ) }}
|
||||
metrics:
|
||||
{{- toYaml .Values.autoscaling.metrics | nindent 4 }}
|
||||
{{- else }}
|
||||
targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage | default 80 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{/* Default to not managing if unsupported or created outside this chart */}}
|
||||
{{- $includeIngressClass := false -}}
|
||||
{{- if .Values.ingressController.enabled -}}
|
||||
{{- if (.Capabilities.APIVersions.Has "networking.k8s.io/v1/IngressClass") -}}
|
||||
{{- with (lookup "networking.k8s.io/v1" "IngressClass" "" .Values.ingressController.ingressClass) -}}
|
||||
{{- if (hasKey .metadata "annotations") -}}
|
||||
{{- if (eq $.Release.Name (get .metadata.annotations "meta.helm.sh/release-name")) -}}
|
||||
{{/* IngressClass exists and is managed by this chart */}}
|
||||
{{- $includeIngressClass = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{/* IngressClass doesn't exist */}}
|
||||
{{- $includeIngressClass = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $includeIngressClass -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: IngressClass
|
||||
metadata:
|
||||
name: {{ .Values.ingressController.ingressClass }}
|
||||
{{- if .Values.ingressController.ingressClassAnnotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.ingressController.ingressClassAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
spec:
|
||||
controller: ingress-controllers.konghq.com/kong
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,100 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if (and .Values.migrations.postUpgrade (not (eq .Values.env.database "off"))) }}
|
||||
# Why is this Job duplicated and not using only helm hooks?
|
||||
# See: https://github.com/helm/charts/pull/7362
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-post-upgrade-migrations
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: post-upgrade-migrations
|
||||
annotations:
|
||||
helm.sh/hook: "post-upgrade"
|
||||
helm.sh/hook-delete-policy: "before-hook-creation"
|
||||
{{- range $key, $value := .Values.migrations.jobAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
backoffLimit: {{ .Values.migrations.backoffLimit }}
|
||||
{{- if .Values.migrations.ttlSecondsAfterFinished }}
|
||||
ttlSecondsAfterFinished: {{ .Values.migrations.ttlSecondsAfterFinished }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
name: {{ template "kong.name" . }}-post-upgrade-migrations
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: post-upgrade-migrations
|
||||
{{- if .Values.migrations.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.migrations.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
|
||||
kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
|
||||
serviceAccountName: {{ template "kong.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
|
||||
automountServiceAccountToken: true
|
||||
{{- else }}
|
||||
automountServiceAccountToken: false
|
||||
{{ end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
|
||||
initContainers:
|
||||
{{- if .Values.deployment.initContainers }}
|
||||
{{- toYaml .Values.deployment.initContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
|
||||
{{- include "kong.wait-for-postgres" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.migrations.sidecarContainers }}
|
||||
{{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
- name: {{ template "kong.name" . }}-post-upgrade-migrations
|
||||
image: {{ include "kong.getRepoTag" .Values.image }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
env:
|
||||
{{- include "kong.no_daemon_env" . | nindent 8 }}
|
||||
{{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
|
||||
args: [ "kong", "migrations", "finish" ]
|
||||
volumeMounts:
|
||||
{{- include "kong.volumeMounts" . | nindent 8 }}
|
||||
{{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
|
||||
resources:
|
||||
{{- toYaml .Values.migrations.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- include "kong.podsecuritycontext" . | nindent 8 }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml .Values.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
volumes:
|
||||
{{- include "kong.volumes" . | nindent 6 -}}
|
||||
{{- include "kong.userDefinedVolumes" . | nindent 6 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,102 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if (and .Values.migrations.preUpgrade (not (eq .Values.env.database "off"))) }}
|
||||
# Why is this Job duplicated and not using only helm hooks?
|
||||
# See: https://github.com/helm/charts/pull/7362
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-pre-upgrade-migrations
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: pre-upgrade-migrations
|
||||
annotations:
|
||||
helm.sh/hook: "pre-upgrade"
|
||||
helm.sh/hook-delete-policy: "before-hook-creation"
|
||||
argocd.argoproj.io/hook: Sync
|
||||
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
||||
{{- range $key, $value := .Values.migrations.jobAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
backoffLimit: {{ .Values.migrations.backoffLimit }}
|
||||
{{- if .Values.migrations.ttlSecondsAfterFinished }}
|
||||
ttlSecondsAfterFinished: {{ .Values.migrations.ttlSecondsAfterFinished }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
name: {{ template "kong.name" . }}-pre-upgrade-migrations
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: pre-upgrade-migrations
|
||||
{{- if .Values.migrations.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.migrations.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
|
||||
kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
|
||||
serviceAccountName: {{ template "kong.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
|
||||
automountServiceAccountToken: true
|
||||
{{- else }}
|
||||
automountServiceAccountToken: false
|
||||
{{ end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
|
||||
initContainers:
|
||||
{{- if .Values.deployment.initContainers }}
|
||||
{{- toYaml .Values.deployment.initContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
|
||||
{{- include "kong.wait-for-postgres" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.migrations.sidecarContainers }}
|
||||
{{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
- name: {{ template "kong.name" . }}-upgrade-migrations
|
||||
image: {{ include "kong.getRepoTag" .Values.image }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
env:
|
||||
{{- include "kong.no_daemon_env" . | nindent 8 }}
|
||||
{{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
|
||||
args: [ "kong", "migrations", "up" ]
|
||||
volumeMounts:
|
||||
{{- include "kong.volumeMounts" . | nindent 8 }}
|
||||
{{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
|
||||
resources:
|
||||
{{- toYaml .Values.migrations.resources| nindent 10 }}
|
||||
securityContext:
|
||||
{{- include "kong.podsecuritycontext" . | nindent 8 }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml .Values.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
volumes:
|
||||
{{- include "kong.volumes" . | nindent 6 -}}
|
||||
{{- include "kong.userDefinedVolumes" . | nindent 6 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,111 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if .Release.IsInstall -}}
|
||||
{{/* .migrations.init isn't normally exposed in values.yaml, since it should
|
||||
generally always run on install--there should never be any reason to
|
||||
disable it, and at worst it's a no-op. However, https://github.com/helm/helm/issues/3308
|
||||
means we cannot use the default function to create a hidden value, hence
|
||||
the workaround with this $runInit variable.
|
||||
*/}}
|
||||
{{- $runInit := true -}}
|
||||
{{- if (hasKey .Values.migrations "init") -}}
|
||||
{{- $runInit = .Values.migrations.init -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (and ($runInit) (not (eq .Values.env.database "off"))) }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-init-migrations
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: init-migrations
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: Sync
|
||||
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
||||
{{- range $key, $value := .Values.migrations.jobAnnotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
backoffLimit: {{ .Values.migrations.backoffLimit }}
|
||||
{{- if .Values.migrations.ttlSecondsAfterFinished }}
|
||||
ttlSecondsAfterFinished: {{ .Values.migrations.ttlSecondsAfterFinished }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
name: {{ template "kong.name" . }}-init-migrations
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: init-migrations
|
||||
{{- if .Values.migrations.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.migrations.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
|
||||
kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
|
||||
serviceAccountName: {{ template "kong.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
|
||||
automountServiceAccountToken: true
|
||||
{{- else }}
|
||||
automountServiceAccountToken: false
|
||||
{{ end }}
|
||||
{{- if .Values.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
|
||||
initContainers:
|
||||
{{- if .Values.deployment.initContainers }}
|
||||
{{- toYaml .Values.deployment.initContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
|
||||
{{- include "kong.wait-for-postgres" . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- if .Values.migrations.sidecarContainers }}
|
||||
{{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
|
||||
{{- end }}
|
||||
- name: {{ template "kong.name" . }}-migrations
|
||||
image: {{ include "kong.getRepoTag" .Values.image }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
env:
|
||||
{{- include "kong.no_daemon_env" . | nindent 8 }}
|
||||
{{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
|
||||
args: [ "kong", "migrations", "bootstrap" ]
|
||||
volumeMounts:
|
||||
{{- include "kong.volumeMounts" . | nindent 8 }}
|
||||
{{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
|
||||
resources:
|
||||
{{- toYaml .Values.migrations.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- include "kong.podsecuritycontext" . | nindent 8 }}
|
||||
{{- if .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml .Values.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml .Values.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml .Values.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
restartPolicy: OnFailure
|
||||
volumes:
|
||||
{{- include "kong.volumes" . | nindent 6 -}}
|
||||
{{- include "kong.userDefinedVolumes" . | nindent 6 -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- if .Values.podDisruptionBudget.enabled }}
|
||||
{{- if and (not .Values.autoscaling.enabled) (le (int .Values.replicaCount) 1) }}
|
||||
{{- fail "Enabling PodDisruptionBudget with replicaCount: 1 and no autoscaling prevents pod restarts during upgrades" }}
|
||||
{{- end }}
|
||||
{{- if and .Values.autoscaling.enabled (le (int .Values.autoscaling.minReplicas) 1) }}
|
||||
{{- fail "Enabling PodDisruptionBudget with autoscaling.minReplicas: 1 prevents pod restarts during upgrades" }}
|
||||
{{- end }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if .Values.podDisruptionBudget.minAvailable }}
|
||||
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
|
||||
{{- end }}
|
||||
{{- if .Values.podDisruptionBudget.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "kong.metaLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: app
|
||||
{{- end }}
|
||||
@@ -0,0 +1,53 @@
|
||||
{{- if and (.Values.podSecurityPolicy.enabled) }}
|
||||
apiVersion: {{ include "kong.policyVersion" . }}
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ template "kong.serviceAccountName" . }}-psp
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- with .Values.podSecurityPolicy.labels }}
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.podSecurityPolicy.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{ .Values.podSecurityPolicy.spec | toYaml | indent 2 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kong.serviceAccountName" . }}-psp
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- policy
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
verbs:
|
||||
- use
|
||||
resourceNames:
|
||||
- {{ template "kong.serviceAccountName" . }}-psp
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kong.serviceAccountName" . }}-psp
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kong.serviceAccountName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: {{ template "kong.serviceAccountName" . }}-psp
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- /* Due to GKE versions (e.g. v1.23.15-gke.1900) we need to handle pre-release part of the version as well.
|
||||
See the related documentation of semver module that Helm depends on for semverCompare:
|
||||
https://github.com/Masterminds/semver#working-with-prerelease-versions
|
||||
Related Helm issue: https://github.com/helm/helm/issues/3810 */}}
|
||||
{{- if and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) (semverCompare "<1.20.0-0" .Capabilities.KubeVersion.Version) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "kong.serviceAccountTokenName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
annotations:
|
||||
kubernetes.io/service-account.name: {{ template "kong.serviceAccountName" . }}
|
||||
type: kubernetes.io/service-account-token
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- if and (or .Values.deployment.kong.enabled .Values.ingressController.enabled) .Values.deployment.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "kong.serviceAccountName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
{{- if .Values.deployment.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.deployment.serviceAccount.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,113 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.admin.enabled (or .Values.admin.http.enabled .Values.admin.tls.enabled) -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.admin -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "admin" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.admin.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "adminApiService.certSecretName" -}}
|
||||
{{- default (printf "%s-admin-api-keypair" (include "kong.fullname" .)) .Values.ingressController.adminApi.tls.client.secretName -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "adminApiService.caSecretName" -}}
|
||||
{{- default (printf "%s-admin-api-ca-keypair" (include "kong.fullname" .)) .Values.ingressController.adminApi.tls.client.caSecretName -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $clientVerifyEnabled := .Values.ingressController.adminApi.tls.client.enabled -}}
|
||||
{{- $clientCertProvided := .Values.ingressController.adminApi.tls.client.certProvided -}}
|
||||
|
||||
{{/* If the client verification is enabled but no secret was provided by the user, let's generate certificates. */ -}}
|
||||
{{- if and $clientVerifyEnabled (not $clientCertProvided) }}
|
||||
{{- $certCert := "" -}}
|
||||
{{- $certKey := "" -}}
|
||||
|
||||
{{- $cn := printf "admin.%s.svc" ( include "kong.namespace" . ) -}}
|
||||
{{- $ca := genCA "admin-api-ca" 3650 -}}
|
||||
{{- $cert := genSignedCert $cn nil (list $cn) 3650 $ca -}}
|
||||
|
||||
{{- $certCert = $cert.Cert -}}
|
||||
{{- $certKey = $cert.Key -}}
|
||||
{{/* Verify whether a secret with a given name already exists. If it does, let's use its cert and key data. */}}
|
||||
{{- $certSecret := (lookup "v1" "Secret" (include "kong.namespace" .) (include "adminApiService.certSecretName" .)) -}}
|
||||
{{- if $certSecret }}
|
||||
{{- $certCert = (b64dec (get $certSecret.data "tls.crt")) -}}
|
||||
{{- $certKey = (b64dec (get $certSecret.data "tls.key")) -}}
|
||||
{{- end }}
|
||||
|
||||
{{- $caCert := $ca.Cert -}}
|
||||
{{- $caKey := $ca.Key -}}
|
||||
{{/* Verify whether a secret with a given name already exists. If it does, let's use its cert and key data. */ -}}
|
||||
{{- $caSecret := (lookup "v1" "Secret" (include "kong.namespace" .) (include "adminApiService.caSecretName" .))}}
|
||||
{{- if $caSecret }}
|
||||
{{- $caCert = (b64dec (get $caSecret.data "tls.crt")) -}}
|
||||
{{- $caKey = (b64dec (get $caSecret.data "tls.key")) -}}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "adminApiService.certSecretName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ b64enc $certCert }}
|
||||
tls.key: {{ b64enc $certKey }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "adminApiService.caSecretName" . }}
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ b64enc $caCert }}
|
||||
tls.key: {{ b64enc $caKey }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Create a CA ConfigMap for Kong. */ -}}
|
||||
{{- $secretProvided := $.Values.admin.tls.client.secretName -}}
|
||||
{{- $bundleProvided := $.Values.admin.tls.client.caBundle -}}
|
||||
|
||||
{{- if or $secretProvided $bundleProvided -}}
|
||||
{{- $cert := "" -}}
|
||||
|
||||
{{- if $secretProvided -}}
|
||||
{{- $certSecret := (lookup "v1" "Secret" (include "kong.namespace" .) $.Values.admin.tls.client.secretName) -}}
|
||||
{{- if $certSecret }}
|
||||
{{- $cert = (b64dec (get $certSecret.data "tls.crt")) -}}
|
||||
{{- else -}}
|
||||
{{- fail (printf "%s/%s secret not found" (include "kong.namespace" .) $.Values.admin.tls.client.secretName) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $bundleProvided -}}
|
||||
{{- $cert = $.Values.admin.tls.client.caBundle -}}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-admin-client-ca
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
data:
|
||||
tls.crt: {{ $cert | quote }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.clustertelemetry.enabled .Values.clustertelemetry.tls.enabled -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.clustertelemetry -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "clustertelemetry" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.clustertelemetry.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.cluster.enabled .Values.cluster.tls.enabled -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.cluster -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "cluster" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.cluster.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.manager.enabled (or .Values.manager.http.enabled .Values.manager.tls.enabled) -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.manager -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "manager" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.manager.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if .Values.enterprise.enabled }}
|
||||
{{- if and .Values.portalapi.enabled (or .Values.portalapi.http.enabled .Values.portalapi.tls.enabled) -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.portalapi -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "portalapi" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.portalapi.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if .Values.enterprise.enabled }}
|
||||
{{- if and .Values.portal.enabled (or .Values.portal.http.enabled .Values.portal.tls.enabled) -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.portal -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "portal" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.portal.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.proxy.enabled (or .Values.proxy.http.enabled .Values.proxy.tls.enabled) -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.proxy -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "proxy" -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{ if .Values.proxy.ingress.enabled }}
|
||||
---
|
||||
{{ include "kong.ingress" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{- if .Values.deployment.kong.enabled }}
|
||||
{{- if and .Values.udpProxy.enabled -}}
|
||||
{{- $serviceConfig := dict -}}
|
||||
{{- $serviceConfig := merge $serviceConfig .Values.udpProxy -}}
|
||||
{{- $_ := set $serviceConfig "ingressVersion" (include "kong.ingressVersion" .) -}}
|
||||
{{- $_ := set $serviceConfig "fullName" (include "kong.fullname" .) -}}
|
||||
{{- $_ := set $serviceConfig "namespace" (include "kong.namespace" .) -}}
|
||||
{{- $_ := set $serviceConfig "metaLabels" (include "kong.metaLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "selectorLabels" (include "kong.selectorLabels" .) -}}
|
||||
{{- $_ := set $serviceConfig "serviceName" "udp-proxy" -}}
|
||||
{{- $_ := set $serviceConfig "tls" (dict "enabled" false) -}}
|
||||
{{- $_ := set $serviceConfig "http" (dict "enabled" false) -}}
|
||||
{{- include "kong.service" $serviceConfig }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,57 @@
|
||||
{{- if and .Values.serviceMonitor.enabled (or (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.serviceMonitor.trustCRDsExist) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}
|
||||
{{- if .Values.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
{{- if .Values.serviceMonitor.labels }}
|
||||
{{ toYaml .Values.serviceMonitor.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
endpoints:
|
||||
- targetPort: status
|
||||
scheme: http
|
||||
{{- if .Values.serviceMonitor.interval }}
|
||||
interval: {{ .Values.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.honorLabels }}
|
||||
honorLabels: true
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.relabelings }}
|
||||
relabelings: {{ toYaml .Values.serviceMonitor.relabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.ingressController.enabled (semverCompare ">= 2.0.0" (include "kong.effectiveVersion" .Values.ingressController.image)) }}
|
||||
- targetPort: cmetrics
|
||||
scheme: http
|
||||
{{- if .Values.serviceMonitor.interval }}
|
||||
interval: {{ .Values.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.honorLabels }}
|
||||
honorLabels: true
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings: {{ toYaml .Values.serviceMonitor.metricRelabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceMonitor.relabelings }}
|
||||
relabelings: {{ toYaml .Values.serviceMonitor.relabelings | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
jobLabel: {{ .Release.Name }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ template "kong.namespace" . }}
|
||||
selector:
|
||||
matchLabels:
|
||||
enable-metrics: "true"
|
||||
{{- include "kong.metaLabels" . | nindent 6 }}
|
||||
{{- if .Values.serviceMonitor.targetLabels }}
|
||||
targetLabels: {{ toYaml .Values.serviceMonitor.targetLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{ if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "kong.fullname" . }}-bash-wait-for-postgres
|
||||
namespace: {{ template "kong.namespace" . }}
|
||||
labels:
|
||||
{{- include "kong.metaLabels" . | nindent 4 }}
|
||||
data:
|
||||
wait.sh: |
|
||||
until timeout 2 bash -c "9<>/dev/tcp/${KONG_PG_HOST}/${KONG_PG_PORT}"
|
||||
do echo "waiting for db - trying ${KONG_PG_HOST}:${KONG_PG_PORT}"
|
||||
sleep 2
|
||||
done
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user