Documentation ¶
Index ¶
- func NewDomainV1(name string, namespace string) ingressv1alpha1.Domain
- func NewHTTPSEdge(name string, namespace string, domain string) ingressv1alpha1.HTTPSEdge
- func NewTestIngressClass(name string, isDefault bool, isNgrok bool) netv1.IngressClass
- func NewTestIngressV1(name string, namespace string) netv1.Ingress
- func NewTestIngressV1WithClass(name string, namespace string, ingressClass string) netv1.Ingress
- func NewTestNgrokModuleSet(name string, namespace string, compressionEnabled bool) ingressv1alpha1.NgrokModuleSet
- func NewTestNgrokTrafficPolicy(name string, namespace string, policyStr string) ngrokv1alpha1.NgrokTrafficPolicy
- func NewTestServiceV1(name string, namespace string) corev1.Service
- type AddHeadersConfig
- type CacheStores
- type Driver
- func (d *Driver) DeleteGateway(gateway *gatewayv1.Gateway) error
- func (d *Driver) DeleteHTTPRoute(httproute *gatewayv1.HTTPRoute) error
- func (d *Driver) DeleteIngress(ingress *netv1.Ingress) error
- func (d *Driver) DeleteNamedGateway(n types.NamespacedName) error
- func (d *Driver) DeleteNamedHTTPRoute(n types.NamespacedName) error
- func (d *Driver) DeleteNamedIngress(n types.NamespacedName) error
- func (d *Driver) MigrateKubernetesIngressControllerLabelsToNgrokOperator(ctx context.Context, k8sClient client.Client) error
- func (d *Driver) PrintState(setupLog logr.Logger)
- func (d *Driver) Seed(ctx context.Context, c client.Reader) error
- func (d *Driver) Sync(ctx context.Context, c client.Client) error
- func (d *Driver) SyncEdges(ctx context.Context, c client.Client) error
- func (d *Driver) UpdateGateway(gateway *gatewayv1.Gateway) (*gatewayv1.Gateway, error)
- func (d *Driver) UpdateHTTPRoute(httproute *gatewayv1.HTTPRoute) (*gatewayv1.HTTPRoute, error)
- func (d *Driver) UpdateIngress(ingress *netv1.Ingress) (*netv1.Ingress, error)
- func (d *Driver) WithNgrokMetadata(customNgrokMetadata map[string]string) *Driver
- type DriverOpt
- type RemoveHeadersConfig
- type Store
- func (s Store) Add(obj runtime.Object) error
- func (s Store) Delete(obj runtime.Object) error
- func (s Store) Get(obj runtime.Object) (interface{}, bool, error)
- func (s Store) GetGateway(name string, namespace string) (*gatewayv1.Gateway, error)
- func (s Store) GetHTTPRoute(name string, namespace string) (*gatewayv1.HTTPRoute, error)
- func (s Store) GetIngressClassV1(name string) (*netv1.IngressClass, error)
- func (s Store) GetIngressV1(name, namespcae string) (*netv1.Ingress, error)
- func (s Store) GetNgrokIngressV1(name, namespace string) (*netv1.Ingress, error)
- func (s Store) GetNgrokModuleSetV1(name, namespace string) (*ingressv1alpha1.NgrokModuleSet, error)
- func (s Store) GetNgrokTrafficPolicyV1(name, namespace string) (*ngrokv1alpha1.NgrokTrafficPolicy, error)
- func (s Store) GetServiceV1(name, namespace string) (*corev1.Service, error)
- func (s Store) ListDomainsV1() []*ingressv1alpha1.Domain
- func (s Store) ListGateways() []*gatewayv1.Gateway
- func (s Store) ListHTTPRoutes() []*gatewayv1.HTTPRoute
- func (s Store) ListHTTPSEdgesV1() []*ingressv1alpha1.HTTPSEdge
- func (s Store) ListIngressClassesV1() []*netv1.IngressClass
- func (s Store) ListIngressesV1() []*netv1.Ingress
- func (s Store) ListNgrokIngressClassesV1() []*netv1.IngressClass
- func (s Store) ListNgrokIngressesV1() []*netv1.Ingress
- func (s Store) ListNgrokModuleSetsV1() []*ingressv1alpha1.NgrokModuleSet
- func (s Store) ListTunnelsV1() []*ingressv1alpha1.Tunnel
- func (s Store) Update(obj runtime.Object) error
- type Storer
- type URLRedirectConfig
- type URLRewriteConfig
- type UpdateStoreHandler
- func (e *UpdateStoreHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *UpdateStoreHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *UpdateStoreHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *UpdateStoreHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDomainV1 ¶
func NewDomainV1(name string, namespace string) ingressv1alpha1.Domain
func NewHTTPSEdge ¶
func NewHTTPSEdge(name string, namespace string, domain string) ingressv1alpha1.HTTPSEdge
func NewTestIngressClass ¶
func NewTestIngressClass(name string, isDefault bool, isNgrok bool) netv1.IngressClass
func NewTestNgrokModuleSet ¶
func NewTestNgrokModuleSet(name string, namespace string, compressionEnabled bool) ingressv1alpha1.NgrokModuleSet
func NewTestNgrokTrafficPolicy ¶
func NewTestNgrokTrafficPolicy(name string, namespace string, policyStr string) ngrokv1alpha1.NgrokTrafficPolicy
Types ¶
type AddHeadersConfig ¶
type CacheStores ¶
type CacheStores struct { // Core Kubernetes Stores IngressV1 cache.Store IngressClassV1 cache.Store ServiceV1 cache.Store // Gateway API Stores Gateway cache.Store GatewayClass cache.Store HTTPRoute cache.Store // Ngrok Stores DomainV1 cache.Store TunnelV1 cache.Store HTTPSEdgeV1 cache.Store NgrokModuleV1 cache.Store NgrokTrafficPolicyV1 cache.Store // contains filtered or unexported fields }
CacheStores stores cache.Store for all Kinds of k8s objects that the Ingress Controller reads.
func NewCacheStores ¶
func NewCacheStores(logger logr.Logger) CacheStores
NewCacheStores is a convenience function for CacheStores to initialize all attributes with new cache stores.
func (CacheStores) Add ¶
func (c CacheStores) Add(obj runtime.Object) error
Add stores a provided runtime.Object into the CacheStore if it's of a supported type. The CacheStore must be initialized (see NewCacheStores()) or this will panic.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver maintains the store of information, can derive new information from the store, and can synchronize the desired state of the store to the actual state of the cluster.
func NewDriver ¶
func NewDriver(logger logr.Logger, scheme *runtime.Scheme, controllerName string, managerName types.NamespacedName, opts ...DriverOpt) *Driver
NewDriver creates a new driver with a basic logger and cache store setup
func (*Driver) DeleteHTTPRoute ¶
func (*Driver) DeleteNamedGateway ¶
func (d *Driver) DeleteNamedGateway(n types.NamespacedName) error
func (*Driver) DeleteNamedHTTPRoute ¶
func (d *Driver) DeleteNamedHTTPRoute(n types.NamespacedName) error
func (*Driver) DeleteNamedIngress ¶
func (d *Driver) DeleteNamedIngress(n types.NamespacedName) error
Delete an ingress object given the NamespacedName Takes a namespacedName string as a parameter and deletes the ingress object from the cacheStores map
func (*Driver) MigrateKubernetesIngressControllerLabelsToNgrokOperator ¶
func (d *Driver) MigrateKubernetesIngressControllerLabelsToNgrokOperator(ctx context.Context, k8sClient client.Client) error
MigrateKubernetesIngressControllerLabelsToNgrokOperator migrates the labels from the old Kubernetes Ingress Controller to the new ngrok operator labels so that the ngrok operator can take over management of items previously managed by the Kubernetes Ingress Controller. TODO: Delete this function after users have migrated from the ngrok Kubernetes Ingress Controller to the ngrok Operator.
func (*Driver) PrintState ¶
func (*Driver) Seed ¶
Seed fetches all the upfront information the driver needs to operate It needs to be seeded fully before it can be used to make calculations otherwise each calculation will be based on an incomplete state of the world. It currently relies on: - Ingresses - IngressClasses - Gateways - HTTPRoutes - Services - Domains - Edges - Tunnels - ModuleSets - TrafficPolicies When the sync method becomes a background process, this likely won't be needed anymore
func (*Driver) Sync ¶
Sync calculates what the desired state for each of our CRDs should be based on the ingresses and other objects in the store. It then compares that to the actual state of the cluster and updates the cluster
func (*Driver) UpdateGateway ¶
func (*Driver) UpdateHTTPRoute ¶
func (*Driver) UpdateIngress ¶
type DriverOpt ¶
type DriverOpt func(*Driver)
func WithClusterDomain ¶
func WithGatewayEnabled ¶
func WithSyncAllowConcurrent ¶
type RemoveHeadersConfig ¶
type RemoveHeadersConfig struct {
Headers []string `json:"headers"`
}
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) GetGateway ¶
func (Store) GetHTTPRoute ¶
func (Store) GetIngressClassV1 ¶
func (s Store) GetIngressClassV1(name string) (*netv1.IngressClass, error)
GetIngressClassV1 returns the 'name' IngressClass resource.
func (Store) GetIngressV1 ¶
GetIngressV1 returns the 'name' Ingress resource.
func (Store) GetNgrokIngressV1 ¶
GetNgrokIngressV1 looks up the Ingress resource by name and namespace and returns it if it's found
func (Store) GetNgrokModuleSetV1 ¶
func (s Store) GetNgrokModuleSetV1(name, namespace string) (*ingressv1alpha1.NgrokModuleSet, error)
func (Store) GetNgrokTrafficPolicyV1 ¶
func (s Store) GetNgrokTrafficPolicyV1(name, namespace string) (*ngrokv1alpha1.NgrokTrafficPolicy, error)
func (Store) GetServiceV1 ¶
func (Store) ListDomainsV1 ¶
func (s Store) ListDomainsV1() []*ingressv1alpha1.Domain
ListDomainsV1 returns the list of Domains in the Domain v1 store.
func (Store) ListGateways ¶
func (Store) ListHTTPRoutes ¶
func (Store) ListHTTPSEdgesV1 ¶
func (s Store) ListHTTPSEdgesV1() []*ingressv1alpha1.HTTPSEdge
ListHTTPSEdgesV1 returns the list of HTTPSEdges in the HTTPSEdge v1 store.
func (Store) ListIngressClassesV1 ¶
func (s Store) ListIngressClassesV1() []*netv1.IngressClass
ListIngressClassesV1 returns the list of Ingresses in the Ingress v1 store.
func (Store) ListIngressesV1 ¶
ListIngressesV1 returns the list of Ingresses in the Ingress v1 store.
func (Store) ListNgrokIngressClassesV1 ¶
func (s Store) ListNgrokIngressClassesV1() []*netv1.IngressClass
ListNgrokIngressClassesV1 returns the list of Ingresses in the Ingress v1 store filtered by ones that match the controllerName
func (Store) ListNgrokIngressesV1 ¶
func (Store) ListNgrokModuleSetsV1 ¶
func (s Store) ListNgrokModuleSetsV1() []*ingressv1alpha1.NgrokModuleSet
ListNgrokModuleSetsV1 returns the list of NgrokModules in the NgrokModuleSet v1 store.
func (Store) ListTunnelsV1 ¶
func (s Store) ListTunnelsV1() []*ingressv1alpha1.Tunnel
ListTunnelsV1 returns the list of Tunnels in the Tunnel v1 store.
type Storer ¶
type Storer interface { Get(obj runtime.Object) (item interface{}, exists bool, err error) Add(runtime.Object) error Update(runtime.Object) error Delete(runtime.Object) error GetIngressClassV1(name string) (*netv1.IngressClass, error) GetIngressV1(name, namespace string) (*netv1.Ingress, error) GetServiceV1(name, namespace string) (*corev1.Service, error) GetNgrokIngressV1(name, namespace string) (*netv1.Ingress, error) GetNgrokModuleSetV1(name, namespace string) (*ingressv1alpha1.NgrokModuleSet, error) GetNgrokTrafficPolicyV1(name, namespace string) (*ngrokv1alpha1.NgrokTrafficPolicy, error) GetGateway(name string, namespace string) (*gatewayv1.Gateway, error) GetHTTPRoute(name string, namespace string) (*gatewayv1.HTTPRoute, error) ListIngressClassesV1() []*netv1.IngressClass ListNgrokIngressClassesV1() []*netv1.IngressClass ListIngressesV1() []*netv1.Ingress ListNgrokIngressesV1() []*netv1.Ingress ListGateways() []*gatewayv1.Gateway ListHTTPRoutes() []*gatewayv1.HTTPRoute ListDomainsV1() []*ingressv1alpha1.Domain ListTunnelsV1() []*ingressv1alpha1.Tunnel ListHTTPSEdgesV1() []*ingressv1alpha1.HTTPSEdge ListNgrokModuleSetsV1() []*ingressv1alpha1.NgrokModuleSet }
Storer is the interface that wraps the required methods to gather information about ingresses, services, and other CRDs. It exposes methods to list both all and filtered resources
type URLRedirectConfig ¶
type URLRewriteConfig ¶
type UpdateStoreHandler ¶
type UpdateStoreHandler struct {
// contains filtered or unexported fields
}
UpdateStoreHandler implements the controller-runtime eventhandler interface https://github.com/kubernetes-sigs/controller-runtime/blob/v0.14.1/pkg/handler/eventhandler.go This allows it to be used to handle each reconcile event for a watched resource type. This handler takes a basic object and updates/deletes the store with it. It is used to simply watch some resources and keep their values updated in the store. It is used to keep various crds like edges/tunnels/domains, and core resources like ingress classes, updated.
func NewUpdateStoreHandler ¶
func NewUpdateStoreHandler(resourceName string, d *Driver, client client.Client) *UpdateStoreHandler
NewUpdateStoreHandler creates a new UpdateStoreHandler
func (*UpdateStoreHandler) Create ¶
func (e *UpdateStoreHandler) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create is called in response to an create event - e.g. Edge Creation.
func (*UpdateStoreHandler) Delete ¶
func (e *UpdateStoreHandler) Delete(ctx context.Context, evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete is called in response to a delete event - e.g. Edge Deleted.
func (*UpdateStoreHandler) Generic ¶
func (e *UpdateStoreHandler) Generic(ctx context.Context, evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or external trigger request
func (*UpdateStoreHandler) Update ¶
func (e *UpdateStoreHandler) Update(ctx context.Context, evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update is called in response to an update event - e.g. Edge Updated.