Skip to content

Commit

Permalink
feat: allow changing cloudflared protocol (#100)
Browse files Browse the repository at this point in the history
* feat: allow changing cloudflared protocol

* feat: validate protocol option values
  • Loading branch information
shebpamm authored Jun 18, 2024
1 parent d314ea4 commit 5e94fb4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions api/v1alpha1/tunnel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ type TunnelSpec struct {
// Tolerations specifies the tolerations to apply to the cloudflared tunnel deployment
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

//+kubebuilder:validation:Optional
//+kubebuilder:validation:Enum={"auto","quic","http2"}
//+kubebuilder:default:="auto"
// Protocol specifies the protocol to use for the tunnel. Defaults to auto. Options are "auto", "quic" and "http2"
Protocol string `json:"protocol,omitempty"`

//+kubebuilder:validation:Optional
//+kubebuilder:default:="http_status:404"
// FallbackTarget speficies the target for requests that do not match an ingress. Defaults to http_status:404
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ spec:
certs as needed to be referred in the service annotation) of the
Root CA to be trusted when sending traffic to HTTPS endpoints
type: string
protocol:
default: auto
description: Protocol specifies the protocol to use for the tunnel.
Defaults to auto. Options are "auto", "quic" and "http2"
enum:
- auto
- quic
- http2
type: string
size:
default: 1
description: Size defines the number of Daemon pods to run for this
Expand Down
9 changes: 9 additions & 0 deletions config/crd/bases/networking.cfargotunnel.com_tunnels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ spec:
certs as needed to be referred in the service annotation) of the
Root CA to be trusted when sending traffic to HTTPS endpoints
type: string
protocol:
default: auto
description: Protocol specifies the protocol to use for the tunnel.
Defaults to auto. Options are "auto", "quic" and "http2"
enum:
- auto
- quic
- http2
type: string
size:
default: 1
description: Size defines the number of Daemon pods to run for this
Expand Down
3 changes: 2 additions & 1 deletion controllers/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ func deploymentForTunnel(r GenericTunnelReconciler) *appsv1.Deployment {
replicas := r.GetTunnel().GetSpec().Size
nodeSelector := nodeSelectorsForTunnel(r.GetTunnel())
tolerations := r.GetTunnel().GetSpec().Tolerations
protocol := r.GetTunnel().GetSpec().Protocol

args := []string{"tunnel", "--config", "/etc/cloudflared/config/config.yaml", "--metrics", "0.0.0.0:2000", "run"}
args := []string{"tunnel", "--protocol", protocol, "--config", "/etc/cloudflared/config/config.yaml", "--metrics", "0.0.0.0:2000", "run"}
volumes := []corev1.Volume{{
Name: "creds",
VolumeSource: corev1.VolumeSource{
Expand Down

0 comments on commit 5e94fb4

Please sign in to comment.