store

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStores

type CacheStores struct {
	IngressV1beta1 cache.Store
	IngressV1      cache.Store
	TCPIngress     cache.Store

	Service  cache.Store
	Secret   cache.Store
	Endpoint cache.Store

	Plugin        cache.Store
	ClusterPlugin cache.Store
	Consumer      cache.Store
	Configuration cache.Store

	KnativeIngress cache.Store
}

CacheStores stores cache.Store for all Kinds of k8s objects that the Ingress Controller reads.

type ErrNotFound

type ErrNotFound struct {
	// contains filtered or unexported fields
}

ErrNotFound error is returned when a lookup results in no resource. This type is meant to be used for error handling using `errors.As()`.

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type FakeObjects

type FakeObjects struct {
	IngressesV1beta1   []*networkingv1beta1.Ingress
	IngressesV1        []*networkingv1.Ingress
	TCPIngresses       []*configurationv1beta1.TCPIngress
	Services           []*apiv1.Service
	Endpoints          []*apiv1.Endpoints
	Secrets            []*apiv1.Secret
	KongPlugins        []*configurationv1.KongPlugin
	KongClusterPlugins []*configurationv1.KongClusterPlugin
	KongIngresses      []*configurationv1.KongIngress
	KongConsumers      []*configurationv1.KongConsumer

	KnativeIngresses []*knative.Ingress
}

FakeObjects can be used to populate a fake Store.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements Storer and can be used to list Ingress, Services and other resources from k8s APIserver. The backing stores should be synced and updated by the caller. It is ingressClass filter aware.

func (Store) GetEndpointsForService

func (s Store) GetEndpointsForService(namespace, name string) (*apiv1.Endpoints, error)

GetEndpointsForService returns the internal endpoints for service 'namespace/name' inside k8s.

func (Store) GetKongClusterPlugin

func (s Store) GetKongClusterPlugin(name string) (*configurationv1.KongClusterPlugin, error)

GetKongClusterPlugin returns the 'name' KongClusterPlugin resource.

func (Store) GetKongConsumer

func (s Store) GetKongConsumer(namespace, name string) (*configurationv1.KongConsumer, error)

GetKongConsumer returns the 'name' KongConsumer resource in namespace.

func (Store) GetKongIngress

func (s Store) GetKongIngress(namespace, name string) (*configurationv1.KongIngress, error)

GetKongIngress returns the 'name' KongIngress resource in namespace.

func (Store) GetKongPlugin

func (s Store) GetKongPlugin(namespace, name string) (*configurationv1.KongPlugin, error)

GetKongPlugin returns the 'name' KongPlugin resource in namespace.

func (Store) GetSecret

func (s Store) GetSecret(namespace, name string) (*apiv1.Secret, error)

GetSecret returns a Secret using the namespace and name as key

func (Store) GetService

func (s Store) GetService(namespace, name string) (*apiv1.Service, error)

GetService returns a Service using the namespace and name as key

func (Store) ListCACerts

func (s Store) ListCACerts() ([]*apiv1.Secret, error)

ListCACerts returns all Secrets containing the label "konghq.com/ca-cert"="true".

func (Store) ListGlobalKongClusterPlugins

func (s Store) ListGlobalKongClusterPlugins() ([]*configurationv1.KongClusterPlugin, error)

ListGlobalKongClusterPlugins returns all KongClusterPlugin resources filtered by the ingress.class annotation and with the label global:"true".

func (Store) ListGlobalKongPlugins

func (s Store) ListGlobalKongPlugins() ([]*configurationv1.KongPlugin, error)

ListGlobalKongPlugins returns all KongPlugin resources filtered by the ingress.class annotation and with the label global:"true". Support for these global namespaced KongPlugins was removed in 0.10.0 This function remains only to provide warnings to users with old configuration

func (Store) ListIngressesV1

func (s Store) ListIngressesV1() []*networkingv1.Ingress

ListIngressesV1 returns the list of Ingresses in the Ingress v1 store.

func (Store) ListIngressesV1beta1

func (s Store) ListIngressesV1beta1() []*networkingv1beta1.Ingress

ListIngressesV1beta1 returns the list of Ingresses in the Ingress v1beta1 store.

func (Store) ListKnativeIngresses

func (s Store) ListKnativeIngresses() ([]*knative.Ingress, error)

ListKnativeIngresses returns the list of TCP Ingresses from configuration.konghq.com group.

func (Store) ListKongConsumers

func (s Store) ListKongConsumers() []*configurationv1.KongConsumer

ListKongConsumers returns all KongConsumers filtered by the ingress.class annotation.

func (Store) ListTCPIngresses

func (s Store) ListTCPIngresses() ([]*configurationv1beta1.TCPIngress, error)

ListTCPIngresses returns the list of TCP Ingresses from configuration.konghq.com group.

type Storer

type Storer interface {
	GetSecret(namespace, name string) (*apiv1.Secret, error)
	GetService(namespace, name string) (*apiv1.Service, error)
	GetEndpointsForService(namespace, name string) (*apiv1.Endpoints, error)
	GetKongIngress(namespace, name string) (*configurationv1.KongIngress, error)
	GetKongPlugin(namespace, name string) (*configurationv1.KongPlugin, error)
	GetKongClusterPlugin(name string) (*configurationv1.KongClusterPlugin, error)
	GetKongConsumer(namespace, name string) (*configurationv1.KongConsumer, error)

	ListIngressesV1beta1() []*networkingv1beta1.Ingress
	ListIngressesV1() []*networkingv1.Ingress
	ListTCPIngresses() ([]*configurationv1beta1.TCPIngress, error)
	ListKnativeIngresses() ([]*knative.Ingress, error)
	ListGlobalKongPlugins() ([]*configurationv1.KongPlugin, error)
	ListGlobalKongClusterPlugins() ([]*configurationv1.KongClusterPlugin, error)
	ListKongConsumers() []*configurationv1.KongConsumer
	ListCACerts() ([]*apiv1.Secret, error)
}

Storer is the interface that wraps the required methods to gather information about ingresses, services, secrets and ingress annotations.

func New

func New(cs CacheStores, ingressClass string, processClasslessIngressV1Beta1 bool, processClasslessIngressV1 bool,
	processClasslessKongConsumer bool, logger logrus.FieldLogger) Storer

New creates a new object store to be used in the ingress controller

func NewFakeStore

func NewFakeStore(
	objects FakeObjects) (Storer, error)

NewFakeStore creates a store backed by the objects passed in as arguments.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL