-
Notifications
You must be signed in to change notification settings - Fork 208
feature(helm): add gateway api support #903
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
Open
rkferreira
wants to merge
6
commits into
percona:main
Choose a base branch
from
rkferreira:feature/bring-gateway-api-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+275
−6
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
74cbcc0
add gateway api support
rkferreira b1861b8
Apply suggestions from code review
rkferreira b096888
fix misleading copilot review
rkferreira 5797fa2
fix empty and comment
rkferreira f3a795e
more copilot fixes
rkferreira 1138bb8
update readme
rkferreira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| {{- if .Values.gateway.enabled -}} | ||
| {{- $serviceName := .Values.service.name -}} | ||
| {{- $grpcPort := (index $.Values.service.ports 0).port -}} | ||
| {{- $servicePort := (index $.Values.service.ports 0).port -}} | ||
| {{- if gt (len $.Values.service.ports) 1 -}} | ||
| {{- $servicePort = (index $.Values.service.ports 1).port -}} | ||
| {{- end -}} | ||
| {{- $pathType := .Values.gateway.pathType -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ include "pmm.fullname" . }} | ||
| labels: | ||
| {{- include "pmm.labels" . | nindent 4 }} | ||
| {{- with .Values.gateway.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- if empty .Values.gateway.parentRefs }} | ||
| {{- fail "gateway.parentRefs must be set when gateway.enabled=true" }} | ||
| {{- end }} | ||
| parentRefs: | ||
| {{- range .Values.gateway.parentRefs }} | ||
| {{- if empty .name }} | ||
| {{- fail "gateway.parentRefs[*].name must be set when gateway.enabled=true" }} | ||
| {{- end }} | ||
| - name: {{ .name | quote }} | ||
| {{- if .namespace }} | ||
| namespace: {{ .namespace | quote }} | ||
| {{- end }} | ||
| {{- if .sectionName }} | ||
| sectionName: {{ .sectionName | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.gateway.hosts }} | ||
| hostnames: | ||
| {{- range .Values.gateway.hosts }} | ||
| - {{ .host | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{/* HTTPRoute hostnames are route-level, so host paths are aggregated once and applied across listed hostnames. */}} | ||
| {{- $allPaths := list -}} | ||
| {{- range .Values.gateway.hosts }} | ||
| {{- $allPaths = concat $allPaths (default (list) .paths) -}} | ||
| {{- end }} | ||
|
rkferreira marked this conversation as resolved.
|
||
| {{- if empty $allPaths }} | ||
| {{- fail "gateway.hosts[*].paths must contain at least one path when gateway.enabled=true" }} | ||
| {{- end }} | ||
| rules: | ||
| {{- range $allPaths }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ . | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $servicePort }} | ||
| # gRPC paths — configure protocol-level gRPC handling via gateway.annotations | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/agent." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/inventory." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/management." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/server." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| {{- end }} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| {{- if .Values.gateway.enabled -}} | ||
| {{- $serviceName := .Values.service.name -}} | ||
| {{- $grpcPort := (index $.Values.service.ports 0).port -}} | ||
| {{- $servicePort := (index $.Values.service.ports 0).port -}} | ||
| {{- if gt (len $.Values.service.ports) 1 -}} | ||
| {{- $servicePort = (index $.Values.service.ports 1).port -}} | ||
| {{- end -}} | ||
|
rkferreira marked this conversation as resolved.
|
||
| {{- $pathType := .Values.gateway.pathType -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ include "pmm.fullname" . }} | ||
| {{- include "pmm.includeNamespace" . | nindent 2 }} | ||
| labels: | ||
| {{- include "pmm.labels" . | nindent 4 }} | ||
| {{- with .Values.gateway.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- if empty .Values.gateway.parentRefs }} | ||
| {{- fail "gateway.parentRefs must be set when gateway.enabled=true" }} | ||
| {{- end }} | ||
| parentRefs: | ||
| {{- range .Values.gateway.parentRefs }} | ||
| {{- if empty .name }} | ||
| {{- fail "gateway.parentRefs[*].name must be set when gateway.enabled=true" }} | ||
| {{- end }} | ||
| - name: {{ .name | quote }} | ||
| {{- if .namespace }} | ||
| namespace: {{ .namespace | quote }} | ||
| {{- end }} | ||
| {{- if .sectionName }} | ||
| sectionName: {{ .sectionName | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.gateway.hosts }} | ||
| hostnames: | ||
| {{- range .Values.gateway.hosts }} | ||
| - {{ .host | quote }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{/* HTTPRoute hostnames are route-level, so host paths are aggregated once and applied across listed hostnames. */}} | ||
| {{- $allPaths := list -}} | ||
| {{- range .Values.gateway.hosts }} | ||
| {{- $allPaths = concat $allPaths (default (list) .paths) -}} | ||
| {{- end }} | ||
|
rkferreira marked this conversation as resolved.
|
||
| {{- if empty $allPaths }} | ||
| {{- fail "gateway.hosts[*].paths must contain at least one path when gateway.enabled=true" }} | ||
| {{- end }} | ||
| rules: | ||
| {{- range $allPaths }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ . | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }} | ||
| port: {{ $servicePort }} | ||
| # gRPC paths — configure protocol-level gRPC handling via gateway.annotations | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/agent." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/inventory." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/management." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| - matches: | ||
| - path: | ||
| type: {{ $pathType }} | ||
| value: {{ printf "%s/server." . | replace "//" "/" | quote }} | ||
| backendRefs: | ||
| - name: {{ $serviceName }}-grpc | ||
| port: {{ $grpcPort }} | ||
| {{- end }} | ||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.