Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated yaml indenting/syntax for ingress virtual service #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
239 changes: 108 additions & 131 deletions src/templates/virtual_services-ingress.ctmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,151 +17,128 @@ metadata:
name: {{ $applicationName }}-ingress
spec:
gateways:
- default-gateway
- default-gateway
hosts:
- {{ $publicDomain }}
- "*.{{ $publicDomain }}"
- {{ $publicDomain }}
- "*.{{ $publicDomain }}"
http:
{{- range $variants := $variants }}
{{- $variant := .Key -}}
{{- if and (ne $variant "master") (not (keyExists (print $configPath "/" $namespace "/versions/" $variant))) }}
{{- if eq $contextRoute "" }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: {{ $variant }}
match:
-
authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant |toLower }})
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: {{ $variant }}
match:
- authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant |toLower }})
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
{{- else }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: {{ $variant }}
match:
-
authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
uri:
regex: ^{{ $contextRoute }}(/.*)?$
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
-
authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
uri:
regex: ^{{ . }}(/.*)?$
{{- end }}
{{- end }}
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
uri:
regex: ^{{ $contextRoute }}(/.*)?$
headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant | toLower }})
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
-
uri:
regex: ^{{ . }}(/.*)?$
headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant | toLower }})
{{- end }}
{{- end }}
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: {{ $variant }}
match:
- authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
uri:
regex: ^{{ $contextRoute }}(/.*)?$
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
- authority:
regex: ({{ $variant }}|{{ $variant |toLower }}).{{ $publicDomain }}
uri:
regex: ^{{ . }}(/.*)?$
{{- end }}
{{- end }}
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- uri:
regex: ^{{ $contextRoute }}(/.*)?$
headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant | toLower }})
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
- uri:
regex: ^{{ . }}(/.*)?$
headers:
x-variant-id:
regex: ({{ $variant }}|{{ $variant | toLower }})
{{- end }}
{{- end }}
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ $variant }}
{{- end }}
{{- end }}
{{- end }}
{{- range tree (print $configPath "/" $namespace "/versions/") }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
uri:
regex: ^{{ $contextRoute }}/{{ .Key }}(/.*)?$
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ .Key }}
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- uri:
regex: ^{{ $contextRoute }}/{{ .Key }}(/.*)?$
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: {{ .Key }}
{{- end }}
{{- if eq $contextRoute "" }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: master
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: master
{{- else }}
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
uri:
regex: ^{{ $contextRoute }}(/.*)?$
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
-
uri:
regex: ^{{ . }}(/.*)?$
{{- end }}
{{- end }}
route:
-
destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: master
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- uri:
regex: ^{{ $contextRoute }}(/.*)?$
{{- if $secondaryRoutes }}
{{- range ($secondaryRoutes | split ",") }}
- uri:
regex: ^{{ . }}(/.*)?$
{{- end }}
{{- end }}
route:
- destination:
host: {{ $applicationName }}.{{ $namespace }}.svc.cluster.local
subset: master
{{- end }}
{{ end }}
{{- end -}}
Expand Down
109 changes: 49 additions & 60 deletions test/expected_outputs/green-proof02/virtual_services-ingress.rendered
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,63 @@ metadata:
name: docx-generator-ingress
spec:
gateways:
- default-gateway
- default-gateway
hosts:
- apps.green.wealthwizards.io
- "*.apps.green.wealthwizards.io"
- apps.green.wealthwizards.io
- "*.apps.green.wealthwizards.io"
http:
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
uri:
regex: ^/docx-generator(/.*)?$
route:
-
destination:
host: docx-generator.green.svc.cluster.local
subset: master
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- uri:
regex: ^/docx-generator(/.*)?$
route:
- destination:
host: docx-generator.green.svc.cluster.local
subset: master
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: income-tax-service-ingress
spec:
gateways:
- default-gateway
- default-gateway
hosts:
- income-tax-service.st.wealthwizards.io
- "*.income-tax-service.st.wealthwizards.io"
- income-tax-service.st.wealthwizards.io
- "*.income-tax-service.st.wealthwizards.io"
http:
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: OPS-3353
match:
-
authority:
regex: (OPS-3353|ops-3353).income-tax-service.st.wealthwizards.io
route:
-
destination:
host: income-tax-service.green.svc.cluster.local
subset: OPS-3353
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
-
headers:
x-variant-id:
regex: (OPS-3353|ops-3353)
route:
-
destination:
host: income-tax-service.green.svc.cluster.local
subset: OPS-3353
-
appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
route:
-
destination:
host: income-tax-service.green.svc.cluster.local
subset: master
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
x-variant-id: OPS-3353
match:
- authority:
regex: (OPS-3353|ops-3353).income-tax-service.st.wealthwizards.io
route:
- destination:
host: income-tax-service.green.svc.cluster.local
subset: OPS-3353
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
match:
- headers:
x-variant-id:
regex: (OPS-3353|ops-3353)
route:
- destination:
host: income-tax-service.green.svc.cluster.local
subset: OPS-3353
- appendHeaders:
x-envoy-max-retries: "5"
x-envoy-retry-on: connect-failure
x-envoy-upstream-rq-timeout-ms: "0"
route:
- destination:
host: income-tax-service.green.svc.cluster.local
subset: master
Loading