Skip to content

Commit

Permalink
Merge pull request #27 from dnvgl/feature/virtualservice-regexmatches
Browse files Browse the repository at this point in the history
Feature/virtualservice regexmatches
  • Loading branch information
MichaelMcCoyTech authored Feb 19, 2024
2 parents ae7909a + 77a55fc commit 5b7e42f
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 65 deletions.
2 changes: 1 addition & 1 deletion charts/platform-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.1"
description: Platform service chart
name: platform-service
version: 1.2.4
version: 1.2.5
5 changes: 5 additions & 0 deletions charts/platform-service/templates/virtualservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
gateways:
- {{ required "A valid .Values.gateway.name entry required!" .Values.gateway.name }}
{{- $prefixes := default (list .Values.app) .Values.defaultRouting.urlPrefixes }}
{{- $regexes := .Values.defaultRouting.urlRegexes }}
http:
{{- if .Values.defaultRouting.urlExactMatches }}
- match:
Expand Down Expand Up @@ -110,6 +111,10 @@ spec:
- uri:
prefix: {{ $slashPrefix }}/
{{- end }}
{{- range $regexes }}
- uri:
regex: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.defaultRouting.rewriteUrlPrefix.enabled }}
rewrite:
Expand Down
3 changes: 3 additions & 0 deletions charts/platform-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ defaultRouting:
# list of prefixes for route matching - overrides the default prefix (app)
urlPrefixes:

# list of regexes for route matching
urlRegexes:

# catch-all route - anything not routed elsewhere will be routed here
# When this is used, urlPrefixes are ignored (there should be only catch-all route for this host & gateway)
catchAll: false
Expand Down
5 changes: 5 additions & 0 deletions testing/generate-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ helm template test-release ../charts/platform-service -n test-ns -f values.yaml
--show-only templates/virtualservice.yaml \
> results/vs-exact-matches.yaml

helm template test-release ../charts/platform-service -n test-ns -f values.yaml \
--set defaultRouting.urlRegexes[0]="/api/.*" \
--show-only templates/virtualservice.yaml \
> results/vs-regexPrefixes.yaml

helm template test-release ../charts/platform-service -n test-ns -f values.yaml \
--set opa.enabled=true \
--show-only templates/deployment.yaml \
Expand Down
23 changes: 13 additions & 10 deletions testing/results/base-case.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -49,10 +49,11 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
state: stateful
automountServiceAccountToken: false
---
# Source: platform-service/templates/service.yaml
apiVersion: v1
Expand All @@ -62,7 +63,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -85,7 +86,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -100,7 +101,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -166,6 +167,8 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
Expand All @@ -180,7 +183,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -211,7 +214,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -231,7 +234,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -270,7 +273,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down
25 changes: 14 additions & 11 deletions testing/results/default-image-automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -49,10 +49,11 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
state: stateful
automountServiceAccountToken: false
---
# Source: platform-service/templates/service.yaml
apiVersion: v1
Expand All @@ -62,7 +63,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -85,7 +86,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -100,7 +101,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -166,6 +167,8 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
Expand All @@ -180,7 +183,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -211,7 +214,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -231,7 +234,7 @@ metadata:
spec:
imageRepositoryRef:
name: test
policy:
policy:
numerical:
order: asc
---
Expand All @@ -252,7 +255,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -291,7 +294,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down
17 changes: 11 additions & 6 deletions testing/results/deployment-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -49,7 +49,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -64,7 +64,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -130,12 +130,17 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
secret:
secretName: test-secrets
---
# Source: platform-service/templates/service-account.yaml
automountServiceAccountToken: false
---
# Source: platform-service/templates/authorizationPolicy.yaml
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
Expand All @@ -144,7 +149,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -175,7 +180,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -195,7 +200,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down
6 changes: 4 additions & 2 deletions testing/results/full-image-syntax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -22,7 +22,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -88,6 +88,8 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
Expand Down
6 changes: 4 additions & 2 deletions testing/results/mergeAppMetrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -22,7 +22,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -89,6 +89,8 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
Expand Down
6 changes: 4 additions & 2 deletions testing/results/no-sessman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand All @@ -22,7 +22,7 @@ spec:
labels:
app: test
app.kubernetes.io/name: test
helm.sh/chart: platform-service-1.1.2
helm.sh/chart: platform-service-1.2.4
app.kubernetes.io/instance: test-release
version: v1
state: stateful
Expand Down Expand Up @@ -87,6 +87,8 @@ spec:

resources:
{}
terminationGracePeriodSeconds:
30
volumes:

- name: service-secrets
Expand Down
Loading

0 comments on commit 5b7e42f

Please sign in to comment.