Welcome to mirror list, hosted at ThFree Co, Russian Federation.

function.go « serverless « serving « internal - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c5d3d179ff4658461219a160cf4cdef9ffb35221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package serverless

import "strings"

// Function represents a Knative service that is going to be invoked by the
// proxied request
type Function struct {
	Name      string // Name is a function name, it includes a "service name" component too
	Domain    string // Domain is a cluster base domain, used to route requests to apropriate service
	Namespace string // Namespace is a kubernetes namespace this function has been deployed to
}

// Host returns a function address that we are going to expose in the `Host:`
// header to make it possible to route a proxied request to appropriate service
// in a Knative cluster
func (f Function) Host() string {
	return strings.Join([]string{f.Name, f.Namespace, f.Domain}, ".")
}