Skip to content

Commit

Permalink
fix: update apiversion for ingress. fixes #75 (#85)
Browse files Browse the repository at this point in the history
* fix: update apiversion for ingress. fixes #75

* fix: update ingress to generate spec based off of APIVersions

* feat: allow specifcation of ingressClassName
  • Loading branch information
Dominic DePasquale authored Oct 27, 2021
1 parent 6117fa1 commit c25a48f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 32 additions & 1 deletion charts/atlantis/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "atlantis.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- $pathType := .Values.ingress.pathType -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta" -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand All @@ -22,6 +25,9 @@ metadata:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
Expand All @@ -33,9 +39,33 @@ spec:
paths:
- path: {{ .Values.ingress.path }}
backend:
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
service:
name: {{ $fullName }}
port:
number: {{ .Values.service.port }}
pathType: {{ .Values.ingress.pathType }}
{{- else -}}
serviceName: {{ $fullName }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{ else }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
pathType: {{ $pathType }}
{{- end }}
{{- end }}
{{- else -}}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
Expand All @@ -48,4 +78,5 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/atlantis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ statefulSet:

ingress:
enabled: true
ingressClassName:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path:
pathType: Prefix
host:
hosts:
- host: chart-example.local
Expand Down

0 comments on commit c25a48f

Please sign in to comment.