Documentation ¶
Index ¶
- Constants
- func ConvertSecretToModel(config *Config, secret *api.Secret) []byte
- func GetRoutablePodList(config *Config, kubeClient *client.Client) (*api.PodList, error)
- func GetRouterSecretList(config *Config, kubeClient *client.Client) (*api.SecretList, error)
- func UpdatePodCacheForEvents(config *Config, cache map[string]*PodWithRoutes, events []watch.Event) bool
- func UpdateSecretCacheForEvents(config *Config, cache map[string][]byte, events []watch.Event) bool
- type Cache
- type Config
- type Incoming
- type Outgoing
- type PodWithRoutes
- type Route
Constants ¶
View Source
const ( // DefaultAPIKeyHeader is the default value for the header used to identify the API Key (X-ROUTING-API-KEY) DefaultAPIKeyHeader = "X-ROUTING-API-KEY" // DefaultAPIKeySecret is the default value for the first portion of the DefaultAPIKeySecretLocation (routing) DefaultAPIKeySecret = "routing" // DefaultAPIKeySecretDataField is the default value for the second portion of the DefaultAPIKeySecretDataField (api-key) DefaultAPIKeySecretDataField = "api-key" // DefaultAPIKeySecretLocation is the default value for the EnvVarAPIKeySecretLocation (routing:api-key) DefaultAPIKeySecretLocation = DefaultAPIKeySecret + ":" + DefaultAPIKeySecretDataField // DefaultHostsAnnotation is the default value for EnvVarHostsAnnotation (routingHosts) DefaultHostsAnnotation = "routingHosts" // DefaultPathsAnnotation is the default value for the EnvVarHostsAnnotation (routingPaths) DefaultPathsAnnotation = "routingPaths" // DefaultPort is the default value for the EnvVarPort (80) DefaultPort = 80 // DefaultRoutableLabelSelector is the default value for EnvVarRoutableLabelSelector (routable=true) DefaultRoutableLabelSelector = "routable=true" // EnvVarAPIKeyHeader Environment variable name for providing the header name used to identify the API Key header EnvVarAPIKeyHeader = "API_KEY_HEADER" // EnvVarAPIKeySecretLocation Environment variable name for providing the location of the secret (name:field) to identify API Key secrets EnvVarAPIKeySecretLocation = "API_KEY_SECRET_LOCATION" // EnvVarHostsAnnotation Environment variable name for providing the name of the hosts annotation EnvVarHostsAnnotation = "HOSTS_ANNOTATION" // EnvVarPathsAnnotation Environment variable name for providing the the name of the paths annotation EnvVarPathsAnnotation = "PATHS_ANNOTATION" // EnvVarPort Environment variable for providing the port nginx should listen on EnvVarPort = "PORT" // EnvVarRoutableLabelSelector Environment variable name for providing the label selector for identifying routable objects EnvVarRoutableLabelSelector = "ROUTABLE_LABEL_SELECTOR" // ErrMsgTmplInvalidAnnotationName is the error message template for an invalid annotation name ErrMsgTmplInvalidAnnotationName = "%s has an invalid annotation name: %s" // ErrMsgTmplInvalidAPIKeySecretLocation is the error message template for invalid API Key Secret location environment variable values ErrMsgTmplInvalidAPIKeySecretLocation = "%s is not in the format of {API_KEY_SECRET_NAME}:{API_KEY_SECRET_DATA_FIELD_NAME}" // ErrMsgTmplInvalidLabelSelector is the error message template for an invalid label selector ErrMsgTmplInvalidLabelSelector = "%s has an invalid label selector: %s\n" // ErrMsgTmplInvalidPort is the error message template for an invalid port ErrMsgTmplInvalidPort = "%s is an invalid port: %s\n" )
Variables ¶
This section is empty.
Functions ¶
func GetRoutablePodList ¶
GetRoutablePodList returns the routable pods list.
func GetRouterSecretList ¶
GetRouterSecretList returns the router secrets.
func UpdatePodCacheForEvents ¶
func UpdatePodCacheForEvents(config *Config, cache map[string]*PodWithRoutes, events []watch.Event) bool
UpdatePodCacheForEvents updates the cache based on the pod events and returns if the changes warrant an nginx restart.
Types ¶
type Cache ¶
type Cache struct { Pods map[string]*PodWithRoutes Secrets map[string][]byte }
Cache is the structure containing the router API Keys and the routable pods cache
type Config ¶
type Config struct { // The header name used to identify the API Key APIKeyHeader string // The secret name used to store the API Key for the namespace APIKeySecret string // The secret data field name to store the API Key for the namespace APIKeySecretDataField string // The name of the annotation used to find hosts to route HostsAnnotation string // The name of the annotation used to find paths to route PathsAnnotation string // The port that nginx will listen on Port int // The label selector used to identify routable objects RoutableLabelSelector labels.Selector }
Config is the structure containing the configuration
func ConfigFromEnv ¶
ConfigFromEnv returns the configuration based on the environment variables and validates the values
type PodWithRoutes ¶
type PodWithRoutes struct { Name string Namespace string Status api.PodPhase AnnotationHash uint64 Routes []*Route }
PodWithRoutes contains a pod and its routes
func ConvertPodToModel ¶
func ConvertPodToModel(config *Config, pod *api.Pod) *PodWithRoutes
Converts a Kubernetes pod model to our model
Click to show internal directories.
Click to hide internal directories.