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

Add path to service #89

Merged
merged 2 commits into from
Aug 28, 2023
Merged
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
5 changes: 5 additions & 0 deletions api/v1alpha1/tunnelbinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ type TunnelBindingSubjectSpec struct {
//+kubebuilder:validation:Optional
Protocol string `json:"protocol,omitempty"`

// Path specifies a regular expression for to match on the request for http/https services
// If a rule does not specify a path, all paths will be matched.
//+kubebuilder:validation:Optional
Path string `json:"path,omitempty"`

// Target specified where the tunnel should proxy to.
// Defaults to the form of <protocol>://<service.metadata.name>.<service.metadata.namespace>.svc:<port>
//+kubebuilder:validation:Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ spec:
description: NoTlsVerify disables TLS verification for this
service. Only useful if the protocol is HTTPS.
type: boolean
path:
description: Path specifies a regular expression for to match
on the request for http/https services If a rule does not
specify a path, all paths will be matched.
type: string
protocol:
description: Protocol specifies the protocol for the service.
Should be one of http, https, tcp, udp, ssh or rdp. Defaults
Expand Down
2 changes: 1 addition & 1 deletion controllers/tunnelbinding_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ func (r *TunnelBindingReconciler) configureCloudflareDaemon() error {
} else {
targetService = binding.Status.Services[i].Target
}

originRequest := OriginRequestConfig{}
originRequest.NoTLSVerify = &subject.Spec.NoTlsVerify
originRequest.ProxyAddress = &subject.Spec.ProxyAddress
Expand All @@ -588,6 +587,7 @@ func (r *TunnelBindingReconciler) configureCloudflareDaemon() error {
finalIngresses = append(finalIngresses, UnvalidatedIngressRule{
Hostname: binding.Status.Services[i].Hostname,
Service: targetService,
Path: subject.Spec.Path,
adyanth marked this conversation as resolved.
Show resolved Hide resolved
OriginRequest: originRequest,
})
}
Expand Down