Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions charts/application-ingress/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: ingress
version: 1.1.1
description: A Helm chart for Ingress
type: application
home: https://github.com/technicaldomain/helm
sources:
- https://github.com/technicaldomain/helm
maintainers:
- email: alex@kharkevich.org
name: Alexander Kharkevich
icon: file://icon.png
appVersion: "1.0"

dependencies:
- name: common
repository: https://technicaldomain.github.io/helm/
version: 2.1.4
Binary file added charts/application-ingress/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions charts/application-ingress/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Manage Ingress in a Simple Way

See [values.yaml](./values.yaml) for more details
65 changes: 65 additions & 0 deletions charts/application-ingress/templates/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{- $fullName := include "common.fullname" . }}
{{- $appLabels := include "common.labels.standard" . -}}
{{- range .Values.services }}
{{- $contextPath := .contextPath }}
{{- $serviceName := .name }}
{{- $servicePort := .port | default 80 }}
{{- $annotations := .annotations }}
{{- $useRewrite := .useRewrite }}
{{- $ingressClass := .ingressClass | default $.Values.ingressClass | default "traefik" }}
{{- /* Define default annotations */}}
{{- $defaultAnnotations := dict }}
{{- if eq $ingressClass "nginx" }}
{{- $_ := set $defaultAnnotations "kubernetes.io/ingress.class" "nginx" }}
{{- $_ := set $defaultAnnotations "nginx.ingress.kubernetes.io/service-upstream" "true" }}
{{- $_ := set $defaultAnnotations "nginx.ingress.kubernetes.io/upstream-vhost" (printf "%s.%s.svc.cluster.local" $serviceName $.Release.Namespace) }}
{{- $_ := set $defaultAnnotations "nginx.ingress.kubernetes.io/use-regex" "true" }}
{{- if (default $useRewrite false) }}
{{- $_ := set $defaultAnnotations "nginx.ingress.kubernetes.io/rewrite-target" "/$2" }}
{{- end }}
{{- else if eq $ingressClass "traefik" }}
{{- $_ := set $defaultAnnotations "kubernetes.io/ingress.class" "traefik" }}
{{- $_ := set $defaultAnnotations "traefik.ingress.kubernetes.io/router.entrypoints" "web" }}
{{- if (default $useRewrite false) }}
{{- $_ := set $defaultAnnotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s-rewrite" $serviceName) }}
{{- end }}
{{- end }}

{{- /* Merge annotations from values file, overriding defaults */}}
{{- $mergedAnnotations := mergeOverwrite $defaultAnnotations $annotations }}

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName}}-{{ $serviceName }}
labels: {{ $appLabels | nindent 4 }}
annotations:
{{- range $key, $value := $mergedAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
tls:
- hosts:
{{- range $.Values.hosts }}
- {{ . | quote }}
{{- end }}
{{- if $.Values.explicitTLS }}
secretName: {{ $.Values.explicitTLS }}
Comment on lines +47 to +48
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicitTLS value is defined as a boolean but used as a secretName. Consider splitting the flag and secret name into separate values (e.g., tls.enabled and tls.secretName) or changing its type to a string.

Suggested change
{{- if $.Values.explicitTLS }}
secretName: {{ $.Values.explicitTLS }}
{{- if $.Values.tls.enabled }}
secretName: {{ $.Values.tls.secretName }}

Copilot uses AI. Check for mistakes.
{{- end }}
rules:
{{- range $.Values.hosts }}
- host: {{ . | quote }}
http:
paths:
{{- range $contextPath }}
- path: {{ . }}
pathType: Prefix
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}
36 changes: 36 additions & 0 deletions charts/application-ingress/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# ingressClass: nginx

solution:
component: ingress

Comment on lines +4 to +6
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The solution.component key is defined in values.yaml but not used in the ingress template. Remove unused values or document its purpose to avoid confusion.

Suggested change
solution:
component: ingress
# Removed unused solution.component key

Copilot uses AI. Check for mistakes.
servicePort: 80

hosts: []
# - "cluster.example.com"

explicitTLS:

services: {}
# - name: serviceA
# port: 8081
# useRewrite: true
# contextPath:
# - /
# - name: serviceB
# ingressClass: nginx
# annotations:
# nginx.ingress.kubernetes.io/proxy-body-size: 100m
# nginx.ingress.kubernetes.io/use-regex: "false"
# contextPath:
# - /serviceB

# use rewrites
# useRewrite: true
# services:
# - name: frontend
# contextPath:
# - ()(/.*)
# - name: api
# contextPath:
# - (/api)(/.*)