Documentation ¶
Index ¶
- Variables
- func X509KeyPair(s api.Secret) (*tls.Certificate, error)
- type APIKey
- type APIKeyBinding
- type APIKeyBindingList
- type APIKeyBindingSpec
- type APIKeyList
- type APIKeySpec
- type APIProxy
- type APIProxyList
- type APIProxySpec
- type BindingFactory
- type GranularProxy
- type Host
- type Key
- type KeyFactory
- type Label
- type Labels
- type Mock
- type MockResponseFactory
- type Path
- type Plugin
- type ProxyFactory
- type Rate
- type Route
- type Rule
- type SSL
- type SecretFactory
- type Service
- type ServiceFactory
- type Store
- type TrafficFactory
- func (s *TrafficFactory) Clear()
- func (s *TrafficFactory) Delete(obj interface{}) (interface{}, error)
- func (s *TrafficFactory) Get(params ...interface{}) (interface{}, error)
- func (s *TrafficFactory) IsEmpty() bool
- func (s *TrafficFactory) IsQuotaViolated(binding APIKeyBinding, keyName string) bool
- func (s *TrafficFactory) IsRateLimitViolated(binding APIKeyBinding, keyName string, currTime time.Time) bool
- func (s *TrafficFactory) Set(obj interface{}) error
Constants ¶
This section is empty.
Variables ¶
var APIKeyDecryptionKey *rsa.PrivateKey
APIKeyDecryptionKey references the rsa private key that Kanali will use to decrypt the data in an APIKey spec
var KanaliEndpoints *api.Endpoints
KanaliEndpoints represents the endpoints of all running instances of Kanali
Functions ¶
func X509KeyPair ¶
func X509KeyPair(s api.Secret) (*tls.Certificate, error)
X509KeyPair creates a tls.Certificate from the tls data in a Kubernetes secret of type kubernetes.io/tls
Types ¶
type APIKey ¶
type APIKey struct { unversioned.TypeMeta `json:",inline"` api.ObjectMeta `json:"metadata,omitempty"` Spec APIKeySpec `json:"spec"` }
APIKey represents the TPR for an APIKey
type APIKeyBinding ¶
type APIKeyBinding struct { unversioned.TypeMeta `json:",inline"` api.ObjectMeta `json:"metadata,omitempty"` Spec APIKeyBindingSpec `json:"spec"` }
APIKeyBinding represents the TPR for an APIKeyBinding
func (*APIKeyBinding) GetAPIKey ¶
func (b *APIKeyBinding) GetAPIKey(apiKeyName string) *Key
GetAPIKey retrieves a pointer to a Key object for a given apikey name
type APIKeyBindingList ¶
type APIKeyBindingList struct { unversioned.TypeMeta `json:",inline"` unversioned.ListMeta `json:"metadata,omitempty"` Bindings []APIKeyBinding `json:"items"` }
APIKeyBindingList represents a list of APIKeyBindingings
type APIKeyBindingSpec ¶
APIKeyBindingSpec represents the data fields for the APIKeyBinding TPR
type APIKeyList ¶
type APIKeyList struct { unversioned.TypeMeta `json:",inline"` unversioned.ListMeta `json:"metadata,omitempty"` Keys []APIKey `json:"items"` }
APIKeyList represents a list of APIKeys
type APIKeySpec ¶
type APIKeySpec struct {
APIKeyData string `json:"data"`
}
APIKeySpec represents the data fields for the APIKey TPR
type APIProxy ¶
type APIProxy struct { unversioned.TypeMeta `json:",inline"` api.ObjectMeta `json:"metadata,omitempty"` Spec APIProxySpec `json:"spec"` }
APIProxy represents the TPR for an APIProxy
func (APIProxy) GetSSLCertificates ¶
GetSSLCertificates retreives the SSL object for a given hostname
type APIProxyList ¶
type APIProxyList struct { unversioned.TypeMeta `json:",inline"` unversioned.ListMeta `json:"metadata,omitempty"` Proxies []APIProxy `json:"items"` }
APIProxyList represents a list of APIProxies
type APIProxySpec ¶
type APIProxySpec struct { Path string `json:"path"` Target string `json:"target,omitempty"` Mock *Mock `json:"mock,omitempty"` Hosts []Host `json:"hosts,omitempty"` Service Service `json:"service,omitempty"` Plugins []Plugin `json:"plugins,omitempty"` SSL SSL `json:"ssl,omitempty"` }
APIProxySpec represents the data fields for the APIProxy TPR
type BindingFactory ¶
type BindingFactory struct {
// contains filtered or unexported fields
}
BindingFactory is factory that implements a concurrency safe store for Kanali APIKeyBindings
var BindingStore *BindingFactory
BindingStore holds all Kanali APIKeyBindings that Kanali has discovered in a cluster. It should not be mutated directly!
func (*BindingFactory) Clear ¶
func (s *BindingFactory) Clear()
Clear will remove all bindings from the store
func (*BindingFactory) Delete ¶
func (s *BindingFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular binding from the store
func (*BindingFactory) Get ¶
func (s *BindingFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual binding in the store. If not found, nil is returned.
func (*BindingFactory) IsEmpty ¶
func (s *BindingFactory) IsEmpty() bool
IsEmpty reports whether the binding store is empty
func (*BindingFactory) Set ¶
func (s *BindingFactory) Set(obj interface{}) error
Set takes a APIKeyBinding and either adds it to the store or updates it
type GranularProxy ¶
type GranularProxy struct {
Verbs []string `json:"verbs,omitempty"`
}
GranularProxy defines the list of HTTP methods that this key has access to
type Key ¶
type Key struct { Name string `json:"name"` Quota int `json:"quota,omitempty"` Rate *Rate `json:"rate,omitempty"` DefaultRule Rule `json:"defaultRule,omitempty"` Subpaths []*Path `json:"subpaths,omitempty"` SubpathTree *subpathNode `json:"tree,omitempty"` }
Key defines an apikey that has some level of permissions the the proxy this binding is bound to
type KeyFactory ¶
type KeyFactory struct {
// contains filtered or unexported fields
}
KeyFactory is factory that implements a concurrency safe store for Kanali APIKeys
var KeyStore *KeyFactory
KeyStore holds all Kanali APIKeys that Kanali has discovered in a cluster. It should not be mutated directly!
func (*KeyFactory) Delete ¶
func (s *KeyFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular key from the store
func (*KeyFactory) Get ¶
func (s *KeyFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual key in the store. If not found, nil is returned.
func (*KeyFactory) IsEmpty ¶
func (s *KeyFactory) IsEmpty() bool
IsEmpty reports whether the key store is empty
func (*KeyFactory) Set ¶
func (s *KeyFactory) Set(obj interface{}) error
Set takes a APIKey and either adds it to the store or updates it
type Label ¶
type Label struct { Name string `json:"name,omitempty"` Header string `json:"header,omitempty"` Value string `json:"value,omitempty"` }
Label represents a Kubernetes service label. It also represents a Kubernetes as defined in a proxy spec
type Mock ¶
type Mock struct {
ConfigMapName string `json:"configMapName,omitempty"`
}
Mock represents a mock configuration
type MockResponseFactory ¶ added in v1.1.4
type MockResponseFactory struct {
// contains filtered or unexported fields
}
MockResponseFactory is factory that implements a concurrency safe store for Kubernetes config maps
var MockResponseStore *MockResponseFactory
MockResponseStore holds all Kubernetes secrets that Kanali has discovered in a cluster. It should not be mutated directly!
func (*MockResponseFactory) Clear ¶ added in v1.1.4
func (s *MockResponseFactory) Clear()
Clear will remove all configmaps from the store
func (*MockResponseFactory) Delete ¶ added in v1.1.4
func (s *MockResponseFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular secret from the store
func (*MockResponseFactory) Get ¶ added in v1.1.4
func (s *MockResponseFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual mock response from the store. If not found, nil is returned.
func (*MockResponseFactory) IsEmpty ¶ added in v1.1.4
func (s *MockResponseFactory) IsEmpty() bool
IsEmpty reports whether the configmap store is empty
func (*MockResponseFactory) Set ¶ added in v1.1.4
func (s *MockResponseFactory) Set(obj interface{}) error
Set takes an APIProxy and either adds it to the store or updates it
type Path ¶
Path represents the fine grained subpath that finer permissions will be assined for this apikey
type Plugin ¶
Plugin defines a plugin which may be version controled
func (Plugin) GetFileName ¶
GetFileName gets the file name for a plugin. This is dynamic base on the plugin version used.
type ProxyFactory ¶
type ProxyFactory struct {
// contains filtered or unexported fields
}
ProxyFactory is factory that implements a concurrency safe store for Kanali ApiProxies
var ProxyStore *ProxyFactory
ProxyStore holds all Kanali ApiProxies that Kanali has discovered in a cluster. It should not be mutated directly!
func (*ProxyFactory) Clear ¶
func (s *ProxyFactory) Clear()
Clear will remove all proxies from the store
func (*ProxyFactory) Delete ¶
func (s *ProxyFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular proxy from the store
func (*ProxyFactory) Get ¶
func (s *ProxyFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual proxy in the store. If not found, nil is returned.
func (*ProxyFactory) IsEmpty ¶
func (s *ProxyFactory) IsEmpty() bool
IsEmpty reports whether the proxy store is empty
func (*ProxyFactory) Set ¶
func (s *ProxyFactory) Set(obj interface{}) error
Set takes an APIProxy and either adds it to the store or updates it
type Route ¶ added in v1.1.4
type Route struct { Route string `json:"route"` Code int `json:"code"` Method string `json:"method"` Body interface{} `json:"body"` }
Route represents the details for a mock response route
type Rule ¶
type Rule struct { Global bool `json:"global,omitempty"` Granular *GranularProxy `json:"granular,omitempty"` }
Rule defines the global and granular rules that this apikey should be assigned
type SSL ¶
type SSL struct {
SecretName string `json:"secretName"`
}
SSL defines the secret to use for certificates
type SecretFactory ¶
type SecretFactory struct {
// contains filtered or unexported fields
}
SecretFactory is factory that implements a concurrency safe store for Kubernetes secrets
var SecretStore *SecretFactory
SecretStore holds all Kubernetes secrets that Kanali has discovered in a cluster. It should not be mutated directly!
func (*SecretFactory) Clear ¶
func (s *SecretFactory) Clear()
Clear will remove all secrets from the store
func (*SecretFactory) Delete ¶
func (s *SecretFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular secret from the store
func (*SecretFactory) Get ¶
func (s *SecretFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual secret in the store. If not found, nil is returned.
func (*SecretFactory) IsEmpty ¶
func (s *SecretFactory) IsEmpty() bool
IsEmpty reports whether the secret store is empty
func (*SecretFactory) Set ¶
func (s *SecretFactory) Set(obj interface{}) error
Set takes a Secret and either adds it to the store or updates it
type Service ¶
type Service struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` ClusterIP string `json:"clusterIP,omitempty"` Port int64 `json:"port,omitempty"` Labels Labels `json:"labels,omitempty"` }
Service in an internal representation of a Kubernetes Service
func CreateService ¶
CreateService transforms a Kubernetes service of type api.Service into type Service
type ServiceFactory ¶
type ServiceFactory struct {
// contains filtered or unexported fields
}
ServiceFactory is factory that implements a concurrency safe store for Kubernetes services
var ServiceStore *ServiceFactory
ServiceStore holds all Kubernetes services that Kanali has discovered in a cluster. It should not be mutated directly!
func (*ServiceFactory) Clear ¶
func (s *ServiceFactory) Clear()
Clear will remove all services from the store
func (*ServiceFactory) Delete ¶
func (s *ServiceFactory) Delete(obj interface{}) (interface{}, error)
Delete will remove a particular service from the store
func (*ServiceFactory) Get ¶
func (s *ServiceFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a particual service in the store. If not found, nil is returned.
func (*ServiceFactory) IsEmpty ¶
func (s *ServiceFactory) IsEmpty() bool
IsEmpty reports whether the service store is empty
func (*ServiceFactory) Set ¶
func (s *ServiceFactory) Set(obj interface{}) error
Set takes a Service and either adds it to the store or updates it
type Store ¶
type Store interface { Set(obj interface{}) error Get(params ...interface{}) (interface{}, error) Delete(obj interface{}) (interface{}, error) Clear() IsEmpty() bool }
Store is an interface that provides a common set of operations for a data structure
type TrafficFactory ¶
type TrafficFactory struct {
// contains filtered or unexported fields
}
TrafficFactory is factory that implements a concurrency safe store for Kanali traffic
var TrafficStore *TrafficFactory
TrafficStore holds all API traffic that Kanali has discovered in a cluster. It should not be mutated directly!
func (*TrafficFactory) Clear ¶
func (s *TrafficFactory) Clear()
Clear will remove all entries from the traffic store
func (*TrafficFactory) Delete ¶
func (s *TrafficFactory) Delete(obj interface{}) (interface{}, error)
Delete removes all traffic for a given namespace, proxy, and key combination TODO
func (*TrafficFactory) Get ¶
func (s *TrafficFactory) Get(params ...interface{}) (interface{}, error)
Get retrieves a set of traffic points for a unique namespace/proxy/key combination TODO
func (*TrafficFactory) IsEmpty ¶
func (s *TrafficFactory) IsEmpty() bool
IsEmpty reports whether the traffic store is empty
func (*TrafficFactory) IsQuotaViolated ¶
func (s *TrafficFactory) IsQuotaViolated(binding APIKeyBinding, keyName string) bool
IsQuotaViolated will see whether a quota limit has been reached
func (*TrafficFactory) IsRateLimitViolated ¶
func (s *TrafficFactory) IsRateLimitViolated(binding APIKeyBinding, keyName string, currTime time.Time) bool
IsRateLimitViolated wee see whether a rate limit has been reached
func (*TrafficFactory) Set ¶
func (s *TrafficFactory) Set(obj interface{}) error
Set takes a traffic point and either adds it to the store