Documentation
¶
Index ¶
- Constants
- func GetKongUpstreamPolicyForServices(s store.Storer, servicesGroup []*corev1.Service) (*kongv1beta1.KongUpstreamPolicy, error)
- func RawConfigToConfiguration(config apiextensionsv1.JSON) (kong.Configuration, error)
- func SecretToConfiguration(s SecretGetter, reference kongv1.SecretValueFromSource, namespace string) (kong.Configuration, error)
- func TranslateKongUpstreamPolicy(policy kongv1beta1.KongUpstreamPolicySpec) *kong.Upstream
- type ACLGroup
- type BasicAuth
- type Certificate
- type Consumer
- type ConsumerGroup
- type HMACAuth
- type JWTAuth
- type KeyAuth
- type KongState
- func (ks *KongState) FillConsumerGroups(_ logr.Logger, s store.Storer)
- func (ks *KongState) FillConsumersAndCredentials(logger logr.Logger, s store.Storer, ...)
- func (ks *KongState) FillIDs(logger logr.Logger)
- func (ks *KongState) FillOverrides(logger logr.Logger, s store.Storer, ...)
- func (ks *KongState) FillPlugins(log logr.Logger, s store.Storer, ...)
- func (ks *KongState) FillUpstreamOverrides(s store.Storer, logger logr.Logger, ...)
- func (ks *KongState) SanitizedCopy() *KongState
- type License
- type MTLSAuth
- type Oauth2Credential
- type Plugin
- type PortDef
- type PortMode
- type Route
- type SecretGetter
- type Service
- type ServiceBackend
- type ServiceBackends
- type Services
- type Target
- type Upstream
Constants ¶
const ( KongHashOnTypeHeader string = "header" KongHashOnTypeCookie string = "cookie" KongHashOnTypeQueryArg string = "query_arg" KongHashOnTypeURICapture string = "uri_capture" )
const ImplicitPort = "implicitPort"
Variables ¶
This section is empty.
Functions ¶
func GetKongUpstreamPolicyForServices ¶
func GetKongUpstreamPolicyForServices(s store.Storer, servicesGroup []*corev1.Service) (*kongv1beta1.KongUpstreamPolicy, error)
GetKongUpstreamPolicyForServices scans all Services in the group to see if their KongUpstreamPolicy is consistent and returns a non-nil KongUpstreamPolicy if it is.
We require either: - all the Services to be configured with the same KongUpstreamPolicy. - none of the Services to be configured with a KongUpstreamPolicy.
If the KongUpstreamPolicy configuration is inconsistent or a configured KongUpstreamPolicy cannot be fetched from the store, an error is returned.
func RawConfigToConfiguration ¶
func RawConfigToConfiguration(config apiextensionsv1.JSON) (kong.Configuration, error)
func SecretToConfiguration ¶
func SecretToConfiguration( s SecretGetter, reference kongv1.SecretValueFromSource, namespace string) ( kong.Configuration, error, )
func TranslateKongUpstreamPolicy ¶
func TranslateKongUpstreamPolicy(policy kongv1beta1.KongUpstreamPolicySpec) *kong.Upstream
TranslateKongUpstreamPolicy translates KongUpstreamPolicySpec to kong.Upstream. It makes assumption that KongUpstreamPolicySpec has been validated on the API level.
Types ¶
type ACLGroup ¶
ACLGroup represents an ACL associated with a consumer. Due to ACL implementation in Kong being similar to credentials, ACLs are treated as credentials, too.
func NewACLGroup ¶
type BasicAuth ¶
BasicAuth represents a basic authentication credential.
func NewBasicAuth ¶
func (*BasicAuth) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type Certificate ¶
type Certificate struct {
kong.Certificate
}
Certificate represents the certificate object in Kong.
func (*Certificate) SanitizedCopy ¶
func (c *Certificate) SanitizedCopy() *Certificate
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type Consumer ¶
type Consumer struct { kong.Consumer Plugins []kong.Plugin ConsumerGroups []kong.ConsumerGroup KeyAuths []*KeyAuth HMACAuths []*HMACAuth JWTAuths []*JWTAuth BasicAuths []*BasicAuth ACLGroups []*ACLGroup Oauth2Creds []*Oauth2Credential MTLSAuths []*MTLSAuth K8sKongConsumer kongv1.KongConsumer }
Consumer holds a Kong consumer and its plugins and credentials.
func (*Consumer) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type ConsumerGroup ¶
type ConsumerGroup struct { kong.ConsumerGroup K8sKongConsumerGroup kongv1beta1.KongConsumerGroup }
ConsumerGroup holds a Kong Consumer.
type HMACAuth ¶
HMACAuth represents a HMAC credential.
func NewHMACAuth ¶
func (*HMACAuth) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type JWTAuth ¶
JWTAuth represents a JWT credential.
func NewJWTAuth ¶
func (*JWTAuth) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type KeyAuth ¶
KeyAuth represents a key-auth credential.
func NewKeyAuth ¶
func (*KeyAuth) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type KongState ¶
type KongState struct { Services []Service Upstreams []Upstream Certificates []Certificate CACertificates []kong.CACertificate Licenses []License Plugins []Plugin Consumers []Consumer ConsumerGroups []ConsumerGroup }
KongState holds the configuration that should be applied to Kong.
func (*KongState) FillConsumerGroups ¶
func (*KongState) FillConsumersAndCredentials ¶
func (*KongState) FillIDs ¶
FillIDs iterates over the KongState and fills in the ID field for each entity that supports the FillID method (these are Service, Route, Consumer and Consumer Group). It makes their IDs deterministic, enabling their correct identification in external systems (e.g. Konnect Analytics).
func (*KongState) FillOverrides ¶
func (*KongState) FillPlugins ¶
func (*KongState) FillUpstreamOverrides ¶
func (*KongState) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type License ¶
License represents the license object in Kong.
func (License) SanitizedCopy ¶
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type Oauth2Credential ¶
type Oauth2Credential struct {
kong.Oauth2Credential
}
Oauth2Credential represents an OAuth2 client configuration including credentials.
func NewOauth2Credential ¶
func NewOauth2Credential(config interface{}) (*Oauth2Credential, error)
func (*Oauth2Credential) SanitizedCopy ¶
func (c *Oauth2Credential) SanitizedCopy() *Oauth2Credential
SanitizedCopy returns a shallow copy with sensitive values redacted best-effort.
type PortDef ¶
type PortDef struct { Mode PortMode // Name is the port name as stated in the Kubernetes service. Must be set iff Mode == PortModeName. Name string // Number is the port number. Must be set iff PortMode == PortModeNumber. Number int32 }
func (*PortDef) CanonicalString ¶
type PortMode ¶
type PortMode int
const ( // PortModeImplicit means that the Ingress does not specify the Kubernetes Service port, and that KIC should expect // the Service to have only one port defined. PortModeImplicit PortMode = iota // PortModeByNumber means that the Ingress specifies the Service port by raw port number. PortModeByNumber PortMode = iota // PortModeByName means that the Ingress specifies the Service port by its name field. PortModeByName PortMode = iota )
type Route ¶
type Route struct { kong.Route Ingress util.K8sObjectInfo Plugins []kong.Plugin ExpressionRoutes bool }
Route represents a Kong Route and holds a reference to the Ingress rule.
type SecretGetter ¶
type Service ¶
type Service struct { kong.Service Namespace string Routes []Route Plugins []kong.Plugin Backends []ServiceBackend K8sServices map[string]*corev1.Service // Parent is the parent object of this Service. // It is expected to be a Kubernetes object which translation resulted in creating this Kong Service. // For example, if this Service was created as a result of translating a Kubernetes Ingress, then // Parent is expected to be the Ingress object itself. Parent client.Object }
Service represents a service in Kong and holds routes associated with the service and other k8s metadata.
type ServiceBackend ¶
type ServiceBackends ¶
type ServiceBackends []ServiceBackend