Documentation
¶
Index ¶
- Constants
- Variables
- func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg *Config, ...) (endpoint.Source, error)
- func EndpointsForHostname(hostname string, targets endpoint.Targets, ttl endpoint.TTL, ...) []*endpoint.Endpoint
- func GetAccessFromAnnotations(annotations map[string]string) string
- func GetEndpointsTypeFromAnnotations(annotations map[string]string) string
- func GetRestConfig(kubeConfig, apiServerURL string) (*rest.Config, error)
- func GetTTLFromAnnotations(annotations map[string]string, resource string) endpoint.TTL
- func GetTargetsFromTargetAnnotation(annotations map[string]string) endpoint.Targets
- func NewCRDClientForAPIVersionKind(client kubernetes.Interface, kubeConfig, apiServerURL, apiVersion, kind string) (*rest.RESTClient, *runtime.Scheme, error)
- func NewCRDSource(crdClient rest.Interface, namespace, kind string, annotationFilter string, ...) (endpoint.Source, error)
- func NewConnectorSource(remoteServer string) (endpoint.Source, error)
- func NewDedupSource(source endpoint.Source) endpoint.Source
- func NewDynamicKubernetesClient(kubeConfig, apiServerURL string, requestTimeout time.Duration) (dynamic.Interface, error)
- func NewGatewaySource(clients ClientGenerator, config *Config) (endpoint.Source, error)
- func NewIngressSource(ctx context.Context, kubeClient kubernetes.Interface, ...) (endpoint.Source, error)
- func NewIstioClient(kubeConfig string, apiServerURL string) (*istioclient.Clientset, error)
- func NewIstioGatewaySource(ctx context.Context, kubeClient kubernetes.Interface, ...) (endpoint.Source, error)
- func NewIstioServiceEntrySourceConfig(ctx context.Context, kubeClient kubernetes.Interface, ...) (endpoint.Source, error)
- func NewKubeClient(kubeConfig, apiServerURL string, requestTimeout time.Duration) (*kubernetes.Clientset, error)
- func NewMultiSource(children []endpoint.Source, defaultTargets []string) endpoint.Source
- func NewNodeSource(ctx context.Context, kubeClient kubernetes.Interface, fqdnTemplate string, ...) (endpoint.Source, error)
- func NewPodSource(ctx context.Context, kubeClient kubernetes.Interface, namespace string, ...) (endpoint.Source, error)
- func NewTargetFilterSource(source endpoint.Source, targetFilter endpoint.TargetFilterInterface) endpoint.Source
- func SuitableType(target string) string
- func WaitForCacheSync(ctx context.Context, factory informerFactory) error
- type ClientGenerator
- type Config
- type EventHandlerFunc
- type K8SSource
- type K8SSourceConfig
- type OnAnyChange
- type ServiceEntrySource
- func (sc *ServiceEntrySource) AddEventHandler(ctx context.Context, handler func())
- func (sc *ServiceEntrySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error)
- func (sc *ServiceEntrySource) PatchSE(ctx context.Context, ns, name, address string) error
- func (sc *ServiceEntrySource) SyncFromProvider(ctx context.Context, ep []*endpoint.Endpoint) error
- type ServiceEntrySourceConfig
- type SingletonClientGenerator
- func (p *SingletonClientGenerator) DynamicKubernetesClient() (dynamic.Interface, error)
- func (p *SingletonClientGenerator) GatewayClient() (gateway.Interface, error)
- func (p *SingletonClientGenerator) IstioClient() (istioclient.Interface, error)
- func (p *SingletonClientGenerator) KubeClient() (kubernetes.Interface, error)
Constants ¶
const ( // ALBDualstackAnnotationKey is the annotation used for determining if an ALB ingress is dualstack ALBDualstackAnnotationKey = "alb.ingress.kubernetes.io/ip-address-type" // ALBDualstackAnnotationValue is the value of the ALB dualstack annotation that indicates it is dualstack ALBDualstackAnnotationValue = "dualstack" // Possible values for the ingress-hostname-source annotation IngressHostnameSourceAnnotationOnlyValue = "annotation-only" IngressHostnameSourceDefinedHostsOnlyValue = "defined-hosts-only" IngressClassAnnotationKey = "kubernetes.io/ingress.class" )
const ( EndpointsTypeNodeExternalIP = "NodeExternalIP" EndpointsTypeHostIP = "HostIP" )
const ( // The annotation used for determining if traffic will go through Cloudflare CloudflareProxiedKey = "external-dns.alpha.kubernetes.io/cloudflare-proxied" SetIdentifierKey = "external-dns.alpha.kubernetes.io/set-identifier" )
Provider-specific annotations
const IstioGatewayIngressSource = "external-dns.alpha.kubernetes.io/ingress"
IstioGatewayIngressSource is the annotation used to determine if the gateway is implemented by an Ingress object instead of a standard LoadBalancer service type
Variables ¶
var ErrSourceNotFound = errors.New("source not found")
ErrSourceNotFound is returned when a requested source doesn't exist.
var InstrumentationWrapper func(rt http.RoundTripper) http.RoundTripper
If set, will instrument the K8S and other outgoing calls.
var SourceFn = map[string]func(ctx context.Context, source string, p ClientGenerator, srcCfg *endpoint.SourceSpec, config *endpoint.SyncConfig) (endpoint.Source, error){}
Functions ¶
func BuildWithConfig ¶
func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg *Config, srcCfg *endpoint.SourceSpec, config *endpoint.SyncConfig) (endpoint.Source, error)
BuildWithConfig allows to generate a Source implementation from the shared config
func EndpointsForHostname ¶
func EndpointsForHostname(hostname string, targets endpoint.Targets, ttl endpoint.TTL, providerSpecific endpoint.ProviderSpecific, setIdentifier string, resource string) []*endpoint.Endpoint
EndpointsForHostname returns the endpoint objects for each host-target combination.
func GetRestConfig ¶
GetRestConfig returns the rest clients config to get automatically data if you run inside a cluster or by passing flags.
func GetTTLFromAnnotations ¶
func GetTargetsFromTargetAnnotation ¶
GetTargetsFromTargetAnnotation gets endpoints from optional "target" annotation. Returns empty endpoints array if none are found.
func NewCRDClientForAPIVersionKind ¶
func NewCRDClientForAPIVersionKind(client kubernetes.Interface, kubeConfig, apiServerURL, apiVersion, kind string) (*rest.RESTClient, *runtime.Scheme, error)
NewCRDClientForAPIVersionKind return rest client for the given apiVersion and kind of the CRD
func NewCRDSource ¶
func NewCRDSource(crdClient rest.Interface, namespace, kind string, annotationFilter string, labelSelector labels.Selector, scheme *runtime.Scheme, startInformer bool) (endpoint.Source, error)
NewCRDSource creates a new crdSource with the given config.
func NewConnectorSource ¶
NewConnectorSource creates a new connectorSource with the given config.
func NewDedupSource ¶
NewDedupSource creates a new dedupSource wrapping the provided Source.
func NewDynamicKubernetesClient ¶
func NewDynamicKubernetesClient(kubeConfig, apiServerURL string, requestTimeout time.Duration) (dynamic.Interface, error)
NewDynamicKubernetesClient returns a new Dynamic Kubernetes client object. It takes a Config and uses APIServerURL and KubeConfig attributes to connect to the cluster. If KubeConfig isn't provided it defaults to using the recommended default.
func NewGatewaySource ¶
func NewGatewaySource(clients ClientGenerator, config *Config) (endpoint.Source, error)
NewGatewaySource creates a new Gateway source with the given config.
func NewIngressSource ¶
func NewIngressSource(ctx context.Context, kubeClient kubernetes.Interface, namespace, annotationFilter string, fqdnTemplate string, combineFqdnAnnotation bool, ignoreHostnameAnnotation bool, ignoreIngressTLSSpec bool, ignoreIngressRulesSpec bool, labelSelector labels.Selector, ingressClassNames []string) (endpoint.Source, error)
NewIngressSource creates a new ingressSource with the given config.
func NewIstioClient ¶
func NewIstioClient(kubeConfig string, apiServerURL string) (*istioclient.Clientset, error)
NewIstioClient returns a new Istio client object. It uses the configured KubeConfig attribute to connect to the cluster. If KubeConfig isn't provided it defaults to using the recommended default. NB: Istio controls the creation of the underlying Kubernetes client, so we have no ability to tack on transport wrappers (e.g., MetricReader request wrappers) to the client's config at this level. Furthermore, the Istio client constructor does not expose the ability to override the Kubernetes API server endpoint, so the apiServerURL config attribute has no effect.
func NewIstioGatewaySource ¶
func NewIstioGatewaySource( ctx context.Context, kubeClient kubernetes.Interface, istioClient istioclient.Interface, namespace string, annotationFilter string, fqdnTemplate string, combineFQDNAnnotation bool, ignoreHostnameAnnotation bool, ) (endpoint.Source, error)
NewIstioGatewaySource creates a new gatewaySource with the given config.
func NewIstioServiceEntrySourceConfig ¶
func NewIstioServiceEntrySourceConfig( ctx context.Context, kubeClient kubernetes.Interface, istioClient istioclient.Interface, config ServiceEntrySourceConfig) (endpoint.Source, error)
func NewKubeClient ¶
func NewKubeClient(kubeConfig, apiServerURL string, requestTimeout time.Duration) (*kubernetes.Clientset, error)
NewKubeClient returns a new Kubernetes client object. It takes a Config and uses APIServerURL and KubeConfig attributes to connect to the cluster. If KubeConfig isn't provided it defaults to using the recommended default.
func NewMultiSource ¶
NewMultiSource creates a new multiSource.
func NewNodeSource ¶
func NewNodeSource(ctx context.Context, kubeClient kubernetes.Interface, fqdnTemplate string, labelSelector labels.Selector) (endpoint.Source, error)
NewNodeSource creates a new nodeSource with the given config.
func NewPodSource ¶
func NewPodSource(ctx context.Context, kubeClient kubernetes.Interface, namespace string, compatibility string) (endpoint.Source, error)
NewPodSource creates a new podSource with the given config.
func NewTargetFilterSource ¶
func NewTargetFilterSource(source endpoint.Source, targetFilter endpoint.TargetFilterInterface) endpoint.Source
NewTargetFilterSource creates a new targetFilterSource wrapping the provided Source.
func SuitableType ¶
SuitableType returns the DNS resource record type suitable for the target. In this case type A for IPs and type CNAME for everything else.
func WaitForCacheSync ¶
Types ¶
type ClientGenerator ¶
type ClientGenerator interface { KubeClient() (kubernetes.Interface, error) GatewayClient() (gateway.Interface, error) IstioClient() (istioclient.Interface, error) //CloudFoundryClient(cfAPPEndpoint string, cfUsername string, cfPassword string) (*cfclient.Client, error) DynamicKubernetesClient() (dynamic.Interface, error) }
ClientGenerator provides clients
type Config ¶
type Config struct { endpoint.SourceSpec `json:",inline"` AnnotationFilter string LabelFilter labels.Selector IngressClassNames []string FQDNTemplate string CombineFQDNAndAnnotation bool IgnoreHostnameAnnotation bool IgnoreIngressTLSSpec bool IgnoreIngressRulesSpec bool GatewayNamespace string GatewayLabelFilter string Compatibility string PublishInternal bool PublishHostIP bool AlwaysPublishNotReadyAddresses bool ConnectorServer string CRDSourceAPIVersion string CRDSourceKind string KubeConfig string APIServerURL string ServiceTypeFilter []string CFAPIEndpoint string CFUsername string CFPassword string GlooNamespaces []string SkipperRouteGroupVersion string RequestTimeout time.Duration DefaultTargets []string OCPRouterName string UpdateEvents bool ResolveLoadBalancerHostname bool TraefikDisableLegacy bool TraefikDisableNew bool }
Config holds shared configuration options for all Sources.
type EventHandlerFunc ¶
type EventHandlerFunc func()
func (EventHandlerFunc) OnAdd ¶
func (fn EventHandlerFunc) OnAdd(obj interface{}, isInInitialList bool)
func (EventHandlerFunc) OnDelete ¶
func (fn EventHandlerFunc) OnDelete(obj interface{})
func (EventHandlerFunc) OnUpdate ¶
func (fn EventHandlerFunc) OnUpdate(oldObj, newObj interface{})
type K8SSource ¶
type K8SSource struct { Internal string // contains filtered or unexported fields }
func NewK8SSource ¶
func NewK8SSource(p ClientGenerator, config *Config) (*K8SSource, error)
NewK8SSource creates a new source that syncs up all pods to an internal zone, using podname.NAMESPACE.SUFFIX as the DNS name. TODO: This will create TXT, SRV and PTR records as well.
func (*K8SSource) AddEventHandler ¶
AddEventHandler is supposed to trigger a full resync. This is not supported and should not be implemented - too much data and overhead. Instead, this source should send incremental updates. See Istio ServiceEntry source as well.
type K8SSourceConfig ¶
type K8SSourceConfig struct {
// contains filtered or unexported fields
}
K8SSourceConfig is used to configure a new K8SSource, which creates DNS entries for all Nodes, Pods, Services and objects in one cluster.
type OnAnyChange ¶
type OnAnyChange struct {
// contains filtered or unexported fields
}
func (OnAnyChange) OnAdd ¶
func (fn OnAnyChange) OnAdd(obj interface{}, isInInitialList bool)
func (OnAnyChange) OnDelete ¶
func (fn OnAnyChange) OnDelete(obj interface{})
func (OnAnyChange) OnUpdate ¶
func (fn OnAnyChange) OnUpdate(oldObj, newObj interface{})
type ServiceEntrySource ¶
type ServiceEntrySource struct { ServiceEntrySourceConfig // contains filtered or unexported fields }
ServiceEntrySource is an implementation of Source for Istio ServiceEntry objects.
It is strongly recommended to only use ServiceEntry as DNS config for mesh internal names as well as 'egress'.
This Source DOES NOT require or use the annotation - it provides similar behavior to Istio DNS interception, but with the ability to use external DNS.
func (*ServiceEntrySource) AddEventHandler ¶
func (sc *ServiceEntrySource) AddEventHandler(ctx context.Context, handler func())
AddEventHandler adds an event handler that should be triggered if the watched object changes, resulting in scheduling a full resync, with some throttling.
This is triggered by the '--events' option in external-dns default main, and results in faster sync of the DNS. It is called before SyncOnce or Start - but it does add a second SyncOnce since all existing objects will trigger the events.
func (*ServiceEntrySource) Endpoints ¶
Endpoints returns endpoint objects for each host-target combination that should be processed. Retrieves all VirtualService resources in the source's namespace(s).
func (*ServiceEntrySource) PatchSE ¶
func (sc *ServiceEntrySource) PatchSE(ctx context.Context, ns, name, address string) error
func (*ServiceEntrySource) SyncFromProvider ¶
type ServiceEntrySourceConfig ¶
type ServiceEntrySourceConfig struct { // MeshExternalNamespace is the namespace for MESH_EXTERNAL ServiceEntry. // Allowing arbitrary untrusted namespaces to define DNS records is a security risk. // This is the same concept with the namespace param of external-dns, limits the // dangerous, unbound entries - but this source also handles mesh internal. MeshExternalNamespace string // MeshInternalDomain is the domain suffix for MESH_INTERNAL ServiceEntry. // The entry MUST be in the format NAME.NAMESPACE.MESH_DOMAIN. MeshInternalDomain string // WIP: EgressGatewayVIP is the IP of the egress gateway. All MESH_EXTERNAL ServiceEntry // without an IP will get allocate this VIP. Entries should only go to a private // zone, and EgressGateway must also be external (not use the zone). EgressGatewayVIP []string // HttpVIP is a VIP to be assigned to all MESH_INTERNAL ServiceEntry with HTTP or HTTPS // ports and without an explicit IP. This is to allow for a single VIP to be used for // all HTTP - without relying on auto-allocation and using different IPs. Istio will // generate a listener for the VIP and route based on the Host header. HttpVIP string UpdateServiceEntry bool }
type SingletonClientGenerator ¶
type SingletonClientGenerator struct { KubeConfig string APIServerURL string RequestTimeout time.Duration // contains filtered or unexported fields }
SingletonClientGenerator stores provider clients and guarantees that only one instance of client will be generated
func (*SingletonClientGenerator) DynamicKubernetesClient ¶
func (p *SingletonClientGenerator) DynamicKubernetesClient() (dynamic.Interface, error)
DynamicKubernetesClient generates a dynamic client if it was not created before
func (*SingletonClientGenerator) GatewayClient ¶
func (p *SingletonClientGenerator) GatewayClient() (gateway.Interface, error)
GatewayClient generates a gateway client if it was not created before
func (*SingletonClientGenerator) IstioClient ¶
func (p *SingletonClientGenerator) IstioClient() (istioclient.Interface, error)
IstioClient generates an istio go client if it was not created before
func (*SingletonClientGenerator) KubeClient ¶
func (p *SingletonClientGenerator) KubeClient() (kubernetes.Interface, error)
KubeClient generates a kube client if it was not created before