Skip to content

Commit

Permalink
Merge pull request #40 from kryachkov/main
Browse files Browse the repository at this point in the history
[BUGFIX] Ingress configuration values and schema
  • Loading branch information
nicolastakashi authored Dec 6, 2024
2 parents 6ba41c0 + 6525746 commit 23eb50d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
22 changes: 2 additions & 20 deletions charts/perses/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "perses.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.ingressClassName (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.ingressClassName}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -23,7 +12,7 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ingressClassName (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
{{- if .Values.ingress.tls }}
Expand All @@ -43,19 +32,12 @@ spec:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
49 changes: 34 additions & 15 deletions charts/perses/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,39 @@
"hosts": {
"type": "array",
"items": {
"type": "string"
"type": "object",
"properties": {
"host": {
"type": "string"
},
"paths": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"pathType": {
"type": "string",
"enum": [
"Exact",
"Prefix",
"ImplementationSpecific"
]
}
},
"required": [
"path",
"pathType"
]
}
}
},
"required": [
"host",
"paths"
]
}
},
"ingressClassName": {
Expand All @@ -699,17 +731,6 @@
"annotations": {
"type": "object"
},
"path": {
"type": "string"
},
"pathType": {
"type": "string",
"enum": [
"Exact",
"Prefix",
"ImplementationSpecific"
]
},
"tls": {
"type": "array",
"items": {
Expand All @@ -734,9 +755,7 @@
}
},
"required": [
"hosts",
"path",
"pathType"
"hosts"
]
},
"serviceAccount": {
Expand Down
11 changes: 4 additions & 7 deletions charts/perses/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ ingress:

# -- Default host for the ingress resource
hosts:
- perses.local
- host: perses.local
paths:
- path: /
pathType: Prefix

# -- IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+)
# This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster .
Expand All @@ -204,12 +207,6 @@ ingress:
# ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md
annotations: {}

# -- Ingress path
path: /

# -- Ingress path type
pathType: Prefix

# -- Ingress TLS configuration
tls: []
# - secretName: ingress-cert
Expand Down

0 comments on commit 23eb50d

Please sign in to comment.