Documentation
¶
Overview ¶
Package model contains common data structures between the controller and pomerium config reconciler
Package model contains common data structures between the controller and pomerium config reconciler
Index ¶
- Constants
- func IsHTTP01Solver(ingress *networkingv1.Ingress) bool
- type BackendRefChecker
- type Config
- type ExtensionFilter
- type ExtensionFilterKey
- type GatewayConfig
- type GatewayHTTPRouteConfig
- type IngressConfig
- func (ic *IngressConfig) Clone() *IngressConfig
- func (ic *IngressConfig) GetIngressNamespacedName() types.NamespacedName
- func (ic *IngressConfig) GetNamespacedName(name string) types.NamespacedName
- func (ic *IngressConfig) GetServicePortByName(name types.NamespacedName, port string) (int32, error)
- func (ic *IngressConfig) IsAnnotationSet(name string) bool
- func (ic *IngressConfig) IsPathRegex() bool
- func (ic *IngressConfig) IsSSHUpstream() bool
- func (ic *IngressConfig) IsSecureUpstream() bool
- func (ic *IngressConfig) IsTCPUpstream() bool
- func (ic *IngressConfig) IsUDPUpstream() bool
- func (ic *IngressConfig) UseServiceProxy() bool
- type Key
- type Registry
- type SSHSecrets
- type StorageSecrets
- type TLSSecretsMap
- func (m *TLSSecretsMap) Add(entity Key, secret types.NamespacedName)
- func (m *TLSSecretsMap) RemoveEntity(n Key) []types.NamespacedName
- func (m *TLSSecretsMap) Reset()
- func (m *TLSSecretsMap) UpdateConfig(cfg *Config) []types.NamespacedName
- func (m *TLSSecretsMap) UpdateEntity(n Key, newDeps map[types.NamespacedName]struct{}) []types.NamespacedName
- func (m *TLSSecretsMap) UpdateGatewayConfig(cfg *GatewayConfig) []types.NamespacedName
- func (m *TLSSecretsMap) UpdateIngress(ic *IngressConfig) []types.NamespacedName
Constants ¶
const ( // Name allows customizing the human-readable route name Name = "name" // TLSCustomCASecret replaces https://pomerium.io/reference/#tls-custom-certificate-authority //nolint: gosec TLSCustomCASecret = "tls_custom_ca_secret" // TLSClientSecret replaces https://pomerium.io/reference/#tls-client-certificate //nolint: gosec TLSClientSecret = "tls_client_secret" // TLSDownstreamClientCASecret replaces https://pomerium.io/reference/#tls-downstream-client-certificate-authority TLSDownstreamClientCASecret = "tls_downstream_client_ca_secret" // TLSServerName is annotation to override TLS server name TLSServerName = "tls_server_name" // SecureUpstream indicate that service communication should happen over HTTPS SecureUpstream = "secure_upstream" // PathRegex indicates that paths of ImplementationSpecific type should be treated as regular expression PathRegex = "path_regex" // UseServiceProxy will use standard k8s service proxy as upstream, opposed to individual endpoints UseServiceProxy = "service_proxy_upstream" // SSHUpstream indicates this route is for natively-proxied SSH https://www.pomerium.com/docs/capabilities/native-ssh-access SSHUpstream = "ssh_upstream" // TCPUpstream indicates this route is for TCP tunneled over HTTP https://www.pomerium.com/docs/tcp/ TCPUpstream = "tcp_upstream" // UDPUpstream indicates this route is for UDP tunneled over HTTP https://www.pomerium.com/docs/capabilities/udp/ UDPUpstream = "udp_upstream" // SubtleAllowEmptyHost is a required annotation when creating an ingress containing // rules with an empty (catch-all) host, as it can cause unexpected behavior SubtleAllowEmptyHost = "subtle_allow_empty_host" // KubernetesServiceAccountTokenSecret allows k8s service authentication via pomerium //nolint: gosec KubernetesServiceAccountTokenSecret = "kubernetes_service_account_token_secret" // KubernetesServiceAccountTokenSecretKey defines key within the secret that contains token KubernetesServiceAccountTokenSecretKey = "token" // SetRequestHeadersSecret defines a secret to copy request headers from SetRequestHeadersSecret = "set_request_headers_secret" // SetResponseHeadersSecret defines a secret to copy response headers from SetResponseHeadersSecret = "set_response_headers_secret" // StorageConnectionStringKey represents a secret that must be present in the Storage Secret StorageConnectionStringKey = "connection" // CAKey is certificate authority secret key CAKey = "ca.crt" // SSHPrivateKey is the ssh privatekey secret key SSHPrivateKey = "ssh-privatekey" // MCPServer indicates this route is an MCP server without any additional configuration MCPServer = "mcp_server" // MCPClient indicates this route is an MCP client without any additional configuration MCPClient = "mcp_client" // MCPServerMaxRequestBytes sets the maximum request body size for MCP server routes MCPServerMaxRequestBytes = "mcp_server_max_request_bytes" // MCPServerUpstreamOAuth2AuthorizationURLParams sets the OAuth2 authorization url params for MCP server authentication MCPServerUpstreamOAuth2AuthorizationURLParams = "mcp_server_upstream_oauth2_authorization_url_params" // MCPServerUpstreamOAuth2Secret references a secret containing OAuth2 configuration for MCP server upstream authentication MCPServerUpstreamOAuth2Secret = "mcp_server_upstream_oauth2_secret" //nolint: gosec // MCPServerUpstreamOAuth2AuthURL sets the OAuth2 token URL for MCP server upstream authentication MCPServerUpstreamOAuth2AuthURL = "mcp_server_upstream_oauth2_auth_url" // MCPServerUpstreamOAuth2TokenURL sets the OAuth2 token URL for MCP server upstream authentication MCPServerUpstreamOAuth2TokenURL = "mcp_server_upstream_oauth2_token_url" //nolint: gosec // MCPServerUpstreamOAuth2Scopes sets the OAuth2 scopes for MCP server upstream authentication MCPServerUpstreamOAuth2Scopes = "mcp_server_upstream_oauth2_scopes" // MCPServerPath sets the path property for MCP server routes MCPServerPath = "mcp_server_path" // MCPServerAuthorizationServerURL sets the authorization server URL for MCP server upstream OAuth2. // When set, Pomerium uses this URL directly instead of performing RFC 9728 auto-discovery. MCPServerAuthorizationServerURL = "mcp_server_authorization_server_url" // MCPServerUpstreamOAuth2AuthStyle sets the OAuth2 authentication style for upstream token exchange. // Valid values: "in_params" (client credentials in POST body), "in_header" (HTTP Basic Auth). // Defaults to auto-detect when not set. MCPServerUpstreamOAuth2AuthStyle = "mcp_server_upstream_oauth2_auth_style" // MCPServerUpstreamOAuth2ClientIDKey defines the key within the OAuth2 secret that contains the client ID MCPServerUpstreamOAuth2ClientIDKey = "client_id" // MCPServerUpstreamOAuth2ClientSecretKey defines the key within the OAuth2 secret that contains the client secret MCPServerUpstreamOAuth2ClientSecretKey = "client_secret" // IdentityProviderSecret defines a secret to set the idp_client_id and idp_client_secret from. IdentityProviderSecret = "identity_provider_secret" // IdentityProviderClientIDKey is the client id key in the IdentityProviderSecret. IdentityProviderClientIDKey = "client_id" // IdentityProviderClientSecretKey is the client secret key in the IdentityProviderSecret. IdentityProviderClientSecretKey = "client_secret" // UpstreamTunnel sets the upstream tunnel property. UpstreamTunnel = "upstream_tunnel" // UpstreamTunnelSSHPolicy sets the upstream tunnel ssh policy property. UpstreamTunnelSSHPolicy = "upstream_tunnel_ssh_policy" )
Variables ¶
This section is empty.
Functions ¶
func IsHTTP01Solver ¶ added in v0.17.2
func IsHTTP01Solver(ingress *networkingv1.Ingress) bool
IsHTTP01Solver checks if this ingress is marked by the cert-manager as ACME HTTP01 challenge solver, as it need be handled separately namely, publicly accessed and no TLS cert should be required
Types ¶
type BackendRefChecker ¶ added in v0.28.0
type BackendRefChecker interface {
Valid(obj client.Object, r *gateway_v1.BackendRef) bool
}
BackendRefChecker is used to determine which BackendRefs are valid.
type Config ¶ added in v0.18.0
type Config struct {
// Settings define global settings parameters
icsv1.Pomerium
// Secrets are key secrets
Secrets *corev1.Secret
// CASecrets are ca secrets
CASecrets []*corev1.Secret
// Certs are fetched certs from settings.Certificates
Certs map[types.NamespacedName]*corev1.Secret
// RequestParams is a secret from Settings.IdentityProvider.RequestParams
RequestParams *corev1.Secret
// IdpSecret is Settings.IdentityProvider.Secret
IdpSecret *corev1.Secret
// IdpServiceAccount is Settings.IdentityProvider.ServiceAccountFromSecret
IdpServiceAccount *corev1.Secret
// SSHSecrets are secrets related to ssh.
SSHSecrets SSHSecrets
// StorageSecrets represent databroker storage settings
StorageSecrets StorageSecrets
}
Config represents global configuration
type ExtensionFilter ¶ added in v0.28.0
ExtensionFilter represents a custom Pomerium route filter.
type ExtensionFilterKey ¶ added in v0.28.0
ExtensionFilterKey is a look-up key for available custom filters.
type GatewayConfig ¶ added in v0.28.0
type GatewayConfig struct {
Routes []GatewayHTTPRouteConfig
Certificates []*corev1.Secret
ExtensionFilters map[ExtensionFilterKey]ExtensionFilter
}
GatewayConfig represents the entirety of the Gateway-defined configuration.
type GatewayHTTPRouteConfig ¶ added in v0.28.0
type GatewayHTTPRouteConfig struct {
*gateway_v1.HTTPRoute
// Hostnames this route should match. This may differ from the list of Hostnames in the
// HTTPRoute Spec depending on the Gateway configuration. "All" is represented as "*".
Hostnames []gateway_v1.Hostname
// ValidBackendRefs determines which BackendRefs are allowed to be used for route "To" URLs.
ValidBackendRefs BackendRefChecker
// Services is a map of all known services in the cluster.
Services map[types.NamespacedName]*corev1.Service
}
GatewayHTTPRouteConfig represents a single Gateway-defined route together with all objects needed to translate it into Pomerium routes.
type IngressConfig ¶
type IngressConfig struct {
AnnotationPrefix string
*networkingv1.Ingress
Endpoints map[types.NamespacedName]*corev1.Endpoints
Secrets map[types.NamespacedName]*corev1.Secret
Services map[types.NamespacedName]*corev1.Service
}
IngressConfig represents ingress and all other required resources
func (*IngressConfig) Clone ¶
func (ic *IngressConfig) Clone() *IngressConfig
Clone creates a deep copy of the ingress config
func (*IngressConfig) GetIngressNamespacedName ¶ added in v0.17.2
func (ic *IngressConfig) GetIngressNamespacedName() types.NamespacedName
GetIngressNamespacedName returns name of that ingress in a namespaced format
func (*IngressConfig) GetNamespacedName ¶ added in v0.17.2
func (ic *IngressConfig) GetNamespacedName(name string) types.NamespacedName
GetNamespacedName returns namespaced name of a resource
func (*IngressConfig) GetServicePortByName ¶
func (ic *IngressConfig) GetServicePortByName(name types.NamespacedName, port string) (int32, error)
GetServicePortByName returns service named port
func (*IngressConfig) IsAnnotationSet ¶ added in v0.15.3
func (ic *IngressConfig) IsAnnotationSet(name string) bool
IsAnnotationSet checks if a boolean annotation is set to true
func (*IngressConfig) IsPathRegex ¶ added in v0.15.3
func (ic *IngressConfig) IsPathRegex() bool
IsPathRegex returns true if paths in the Ingress spec should be treated as regular expressions
func (*IngressConfig) IsSSHUpstream ¶ added in v0.33.0
func (ic *IngressConfig) IsSSHUpstream() bool
IsSSHUpstream returns true if this route is for natively-proxied SSH https://www.pomerium.com/docs/capabilities/native-ssh-access
func (*IngressConfig) IsSecureUpstream ¶
func (ic *IngressConfig) IsSecureUpstream() bool
IsSecureUpstream returns true if upstream endpoints should be HTTPS
func (*IngressConfig) IsTCPUpstream ¶ added in v0.17.2
func (ic *IngressConfig) IsTCPUpstream() bool
IsTCPUpstream returns true if this route is for TCP tunneled over HTTP https://www.pomerium.com/docs/tcp/
func (*IngressConfig) IsUDPUpstream ¶ added in v0.29.0
func (ic *IngressConfig) IsUDPUpstream() bool
IsUDPUpstream returns true if this route is for UDP tunneled over HTTP https://www.pomerium.com/docs/capabilities/tcp/
func (*IngressConfig) UseServiceProxy ¶ added in v0.16.1
func (ic *IngressConfig) UseServiceProxy() bool
UseServiceProxy disables use of endpoints and would use standard k8s service proxy instead
type Key ¶
type Key struct {
Kind string
types.NamespacedName
}
Key is dependency key
func KeyForObject ¶ added in v0.33.0
KeyForObject returns the Key corresponding to obj.
type Registry ¶
type Registry interface {
// Add registers a dependency between x,y
Add(x, y Key)
// Deps returns list of dependencies given object key has
Deps(x Key) []Key
DepsOfKind(x Key, kind string) []Key
// DeleteCascade deletes key x and also any dependent keys that do not have other dependencies
DeleteCascade(x Key)
}
Registry is used to keep track of dependencies between kubernetes objects i.e. ingress depends on secret and service configurations no dependency subordination is tracked
func NewRegistry ¶
func NewRegistry() Registry
NewRegistry creates an empty registry safe for concurrent use
type SSHSecrets ¶ added in v0.30.0
SSHSecrets is a grouping of ssh-related secrets.
func (SSHSecrets) Validate ¶ added in v0.30.0
func (s SSHSecrets) Validate() error
Validate validates that the ssh secrets are in the expected format.
type StorageSecrets ¶ added in v0.18.0
type StorageSecrets struct {
// Secret contains storage connection string
Secret *corev1.Secret
// TLS contains optional
TLS *corev1.Secret
CA *corev1.Secret
}
StorageSecrets is a convenience grouping of storage-related secrets
func (StorageSecrets) Validate ¶ added in v0.18.0
func (s StorageSecrets) Validate() error
Validate performs basic check of secrets
type TLSSecretsMap ¶ added in v0.33.0
type TLSSecretsMap struct {
// contains filtered or unexported fields
}
TLSSecretsMap tracks dependencies on TLS secrets, in order to know if some modification removes the last dependency on a secret.
func NewTLSSecretsMap ¶ added in v0.33.0
func NewTLSSecretsMap() *TLSSecretsMap
NewTLSSecretsMap returns a new TLSSecretsMap.
func (*TLSSecretsMap) Add ¶ added in v0.33.0
func (m *TLSSecretsMap) Add(entity Key, secret types.NamespacedName)
Add records a dependency from entity to secret.
func (*TLSSecretsMap) RemoveEntity ¶ added in v0.33.0
func (m *TLSSecretsMap) RemoveEntity(n Key) []types.NamespacedName
RemoveEntity updates the secrets map to remove all current dependencies of the given entity and returns the names of any newly-unreferenced secrets.
func (*TLSSecretsMap) Reset ¶ added in v0.33.0
func (m *TLSSecretsMap) Reset()
Reset clears all of the dependencies.
func (*TLSSecretsMap) UpdateConfig ¶ added in v0.33.0
func (m *TLSSecretsMap) UpdateConfig(cfg *Config) []types.NamespacedName
UpdateConfig updates the TLS secret dependencies for cfg and returns the names of any newly-unreferenced secrets.
func (*TLSSecretsMap) UpdateEntity ¶ added in v0.33.0
func (m *TLSSecretsMap) UpdateEntity( n Key, newDeps map[types.NamespacedName]struct{}, ) []types.NamespacedName
UpdateEntity updates the TLS secret dependencies for n and returns the names of any newly-unreferenced secrets.
func (*TLSSecretsMap) UpdateGatewayConfig ¶ added in v0.33.0
func (m *TLSSecretsMap) UpdateGatewayConfig(cfg *GatewayConfig) []types.NamespacedName
UpdateGatewayConfig updates the TLS secret dependencies for cfg and returns the names of any newly-unreferenced secrets.
func (*TLSSecretsMap) UpdateIngress ¶ added in v0.33.0
func (m *TLSSecretsMap) UpdateIngress(ic *IngressConfig) []types.NamespacedName
UpdateIngress updates the TLS secret dependencies for ic and returns the names of any newly-unreferenced secrets.