Skip to content

Commit

Permalink
Merge pull request #15 from kuzzleio/feat/webapp-ingress
Browse files Browse the repository at this point in the history
feat(webapp): add ingress resource
  • Loading branch information
rolljee authored Apr 15, 2024
2 parents 1f81e87 + 7c31455 commit 8170a3f
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 31 deletions.
2 changes: 1 addition & 1 deletion charts/webapp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 1.1.0
version: 1.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
66 changes: 36 additions & 30 deletions charts/webapp/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
# webapp

![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.25.1](https://img.shields.io/badge/AppVersion-1.25.1-informational?style=flat-square)
![Version: 1.2.0](https://img.shields.io/badge/Version-1.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.25.1](https://img.shields.io/badge/AppVersion-1.25.1-informational?style=flat-square)

A web application

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| args | list | `[]` | |
| command | list | `[]` | |
| extraEnvs | list | `[]` | |
| fullnameOverride | string | `""` | |
| image.name | string | `"nginx"` | |
| image.pullPolicy | string | `"Always"` | |
| image.tag | string | `"1.25.1"` | |
| imagePullSecrets | list | `[]` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podSecurityContext.fsGroup | int | `1000` | |
| probes.liveness.config.httpGet.path | string | `"/"` | |
| probes.liveness.config.httpGet.port | string | `"http"` | |
| probes.liveness.enable | bool | `true` | |
| probes.readiness.config.httpGet.path | string | `"/"` | |
| probes.readiness.config.httpGet.port | string | `"http"` | |
| probes.readiness.enable | bool | `true` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `80` | |
| service.targetPort | int | `80` | |
| tolerations | list | `[]` | |
| updateStrategy | string | `"RollingUpdate"` | |
| Key | Type | Default | Description |
| ------------------------------------ | ------ | ----------------- | ----------- |
| affinity | object | `{}` | |
| args | list | `[]` | |
| command | list | `[]` | |
| extraEnvs | list | `[]` | |
| fullnameOverride | string | `""` | |
| image.name | string | `"nginx"` | |
| image.pullPolicy | string | `"Always"` | |
| image.tag | string | `"1.25.1"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts | list | `[]` | |
| ingress.tls | list | `[]` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podSecurityContext.fsGroup | int | `1000` | |
| probes.liveness.config.httpGet.path | string | `"/"` | |
| probes.liveness.config.httpGet.port | string | `"http"` | |
| probes.liveness.enable | bool | `true` | |
| probes.readiness.config.httpGet.path | string | `"/"` | |
| probes.readiness.config.httpGet.port | string | `"http"` | |
| probes.readiness.enable | bool | `true` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `80` | |
| service.targetPort | int | `80` | |
| tolerations | list | `[]` | |
| updateStrategy | string | `"RollingUpdate"` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
______________________________________________________________________

Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
61 changes: 61 additions & 0 deletions charts/webapp/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "webapp.fullname" . -}}
{{- $httpPort := .Values.service.port -}}
{{- if and .Values.ingress.className (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.className}}
{{- 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 }}
labels:
{{- include "webapp.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
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: {{ $httpPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $httpPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions charts/webapp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@ nodeSelector: {}
tolerations: []

affinity: {}

# Configuration of the ingress to the HTTP server
ingress:
enabled: false
className: ""
annotations: {}
hosts: []
# - host: kuzzle.example.com
# paths:
# - path: /
# pathType: Prefix
tls: []
# - secretName: my-certificate
# hosts:
# - kuzzle.example.com

0 comments on commit 8170a3f

Please sign in to comment.