Skip to content

Commit

Permalink
Merge pull request #12 from sorry-cypress/add-support-to-v1-networking
Browse files Browse the repository at this point in the history
Add networking.k8s.io/v1 support
  • Loading branch information
fsmaia authored Jan 13, 2021
2 parents 56248ba + b0f137f commit 48e1c81
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Lint and Test Charts

on:
on:
pull_request:
branches:
- main
Expand Down Expand Up @@ -42,9 +42,7 @@ jobs:

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: kindest/node:v1.18.8
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --debug --config test.yaml
run: ct install --debug --config test.yaml
2 changes: 1 addition & 1 deletion charts/sorry-cypress/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sorry-cypress
description: A Helm chart for Sorry Cypress
type: application
version: 0.1.11
version: 0.1.12
appVersion: 0.6.1
home: https://sorry-cypress.dev/
sources:
Expand Down
19 changes: 16 additions & 3 deletions charts/sorry-cypress/templates/ingress-api.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{- if .Values.api.ingress.hosts -}}
{{- $v1Networking := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- $fullName := include "sorry-cypress-helm.fullname" . -}}
{{- $svcPort := .Values.api.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- $servicePort := .Values.api.service.port -}}
{{- if $v1Networking }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand Down Expand Up @@ -34,8 +37,18 @@ spec:
- host: {{ .host | quote }}
http:
paths:
{{- if $v1Networking }}
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}-api
port:
number: {{ $servicePort }}
{{- else }}
- backend:
serviceName: {{ $fullName }}-api
servicePort: {{ $svcPort }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}
21 changes: 17 additions & 4 deletions charts/sorry-cypress/templates/ingress-dashboard.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{- if .Values.dashboard.ingress.enabled -}}
{{- $v1Networking := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- $fullName := include "sorry-cypress-helm.fullname" . -}}
{{- $svcPort := .Values.dashboard.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- $servicePort := .Values.dashboard.service.port -}}
{{- if $v1Networking }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand Down Expand Up @@ -34,8 +37,18 @@ spec:
- host: {{ .host | quote }}
http:
paths:
{{- if $v1Networking }}
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}-api
port:
number: {{ $servicePort }}
{{- else }}
- backend:
serviceName: {{ $fullName }}-dashboard
servicePort: {{ $svcPort }}
serviceName: {{ $fullName }}-api
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}
21 changes: 17 additions & 4 deletions charts/sorry-cypress/templates/ingress-director.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{{- if .Values.director.ingress.enabled -}}
{{- $v1Networking := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
{{- $fullName := include "sorry-cypress-helm.fullname" . -}}
{{- $svcPort := .Values.director.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- $servicePort := .Values.director.service.port -}}
{{- if $v1Networking }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
Expand Down Expand Up @@ -34,8 +37,18 @@ spec:
- host: {{ .host | quote }}
http:
paths:
{{- if $v1Networking }}
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}-api
port:
number: {{ $servicePort }}
{{- else }}
- backend:
serviceName: {{ $fullName }}-director
servicePort: {{ $svcPort }}
serviceName: {{ $fullName }}-api
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 48e1c81

Please sign in to comment.