Skip to content

Commit

Permalink
Merge pull request #29 from adyanth/fr-target-override
Browse files Browse the repository at this point in the history
✨ Allow target override with annotation
  • Loading branch information
adyanth authored Feb 27, 2022
2 parents b846cb1 + 7101a37 commit d537aac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/service_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,13 @@ func (r *ServiceReconciler) configureCloudflare() error {
finalIngresses := make([]UnvalidatedIngressRule, 0, len(services)+1)

for _, service := range services {
targetService := decodeLabel(service.Labels[configServiceLabel], service)
if target, ok := service.Annotations[targetAnnotation]; ok {
targetService = target
}
finalIngresses = append(finalIngresses, UnvalidatedIngressRule{
Hostname: service.Labels[configHostnameLabel],
Service: decodeLabel(service.Labels[configServiceLabel], service),
Service: targetService,
})
}
// Catchall ingress
Expand Down
2 changes: 2 additions & 0 deletions controllers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const (
clusterTunnelAnnotation = "cfargotunnel.com/cluster-tunnel"
// FQDN to create a DNS entry for and route traffic from internet on, defaults to Service name + cloudflare domain
fqdnAnnotation = "cfargotunnel.com/fqdn"
// Target can be used to override the target to send traffic to. Ex: Can be used to point to an ingress rather than the service directly
targetAnnotation = "cfargotunnel.com/target"

// Tunnel properties
isClusterTunnelAnnotation = "cfargotunnel.com/is-cluster-tunnel"
Expand Down

0 comments on commit d537aac

Please sign in to comment.