controllers

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const TXT_PREFIX = "_managed."

TXT_PREFIX is the prefix added to TXT records for whom the corresponding DNS records are managed by the operator.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudflareAPI

type CloudflareAPI struct {
	Log              logr.Logger
	TunnelName       string
	TunnelId         string
	AccountName      string
	AccountId        string
	Domain           string
	APIToken         string
	APIKey           string
	APIEmail         string
	ValidAccountId   string
	ValidTunnelId    string
	ValidTunnelName  string
	ValidZoneId      string
	CloudflareClient *cloudflare.API
}

CloudflareAPI config object holding all relevant fields to use the API

func (*CloudflareAPI) CreateCloudflareTunnel

func (c *CloudflareAPI) CreateCloudflareTunnel() (string, string, error)

CreateCloudflareTunnel creates a Cloudflare Tunnel and returns the tunnel Id and credentials file

func (*CloudflareAPI) DeleteCloudflareTunnel

func (c *CloudflareAPI) DeleteCloudflareTunnel() error

DeleteCloudflareTunnel deletes a Cloudflare Tunnel

func (*CloudflareAPI) DeleteDNSId added in v0.7.0

func (c *CloudflareAPI) DeleteDNSId(fqdn, dnsId string, created bool) error

DeleteDNSId deletes DNS entry for the given dnsId

func (*CloudflareAPI) GetAccountId

func (c *CloudflareAPI) GetAccountId() (string, error)

GetAccountId gets AccountId from Account Name

func (*CloudflareAPI) GetDNSCNameId added in v0.7.0

func (c *CloudflareAPI) GetDNSCNameId(fqdn string) (string, error)

GetDNSCNameId returns the ID of the CNAME record requested

func (*CloudflareAPI) GetManagedDnsTxt added in v0.7.0

func (c *CloudflareAPI) GetManagedDnsTxt(fqdn string) (string, DnsManagedRecordTxt, bool, error)

GetManagedDnsTxt gets the TXT record corresponding to the fqdn

func (*CloudflareAPI) GetTunnelCreds

func (c *CloudflareAPI) GetTunnelCreds(tunnelSecret string) (string, error)

GetTunnelCreds gets Tunnel Credentials from Tunnel secret

func (*CloudflareAPI) GetTunnelId

func (c *CloudflareAPI) GetTunnelId() (string, error)

GetTunnelId gets Tunnel Id from available information

func (*CloudflareAPI) GetZoneId

func (c *CloudflareAPI) GetZoneId() (string, error)

GetZoneId gets Zone Id from DNS domain

func (*CloudflareAPI) InsertOrUpdateCName

func (c *CloudflareAPI) InsertOrUpdateCName(fqdn, dnsId string) (string, error)

InsertOrUpdateCName upsert DNS CNAME record for the given FQDN to point to the tunnel

func (*CloudflareAPI) InsertOrUpdateTXT added in v0.7.0

func (c *CloudflareAPI) InsertOrUpdateTXT(fqdn, txtId, dnsId string) error

InsertOrUpdateTXT upsert DNS TXT record for the given FQDN to point to the tunnel

func (*CloudflareAPI) ValidateAll

func (c *CloudflareAPI) ValidateAll() error

ValidateAll validates the contents of the CloudflareAPI struct

type CloudflareTunnelCredentialsFile added in v0.10.1

type CloudflareTunnelCredentialsFile struct {
	AccountTag   string `json:"AccountTag"`
	TunnelID     string `json:"TunnelID"`
	TunnelName   string `json:"TunnelName"`
	TunnelSecret string `json:"TunnelSecret"`
}

CloudflareTunnelCredentialsFile object containing the fields that make up a Cloudflare Tunnel's credentials

type ClusterTunnelAdapter added in v0.9.0

type ClusterTunnelAdapter struct {
	Tunnel    *networkingv1alpha1.ClusterTunnel
	Namespace string
}

ClusterTunnelAdapter implementation

func (ClusterTunnelAdapter) DeepCopyTunnel added in v0.9.0

func (o ClusterTunnelAdapter) DeepCopyTunnel() Tunnel

func (ClusterTunnelAdapter) GetAnnotations added in v0.9.0

func (o ClusterTunnelAdapter) GetAnnotations() map[string]string

func (ClusterTunnelAdapter) GetLabels added in v0.9.0

func (o ClusterTunnelAdapter) GetLabels() map[string]string

func (ClusterTunnelAdapter) GetName added in v0.9.0

func (o ClusterTunnelAdapter) GetName() string

func (ClusterTunnelAdapter) GetNamespace added in v0.9.0

func (o ClusterTunnelAdapter) GetNamespace() string

func (ClusterTunnelAdapter) GetObject added in v0.9.0

func (o ClusterTunnelAdapter) GetObject() client.Object

func (ClusterTunnelAdapter) GetSpec added in v0.9.0

func (ClusterTunnelAdapter) GetStatus added in v0.9.0

func (ClusterTunnelAdapter) GetUID added in v0.9.0

func (o ClusterTunnelAdapter) GetUID() types.UID

func (ClusterTunnelAdapter) SetAnnotations added in v0.9.0

func (o ClusterTunnelAdapter) SetAnnotations(in map[string]string)

func (ClusterTunnelAdapter) SetLabels added in v0.9.0

func (o ClusterTunnelAdapter) SetLabels(in map[string]string)

func (ClusterTunnelAdapter) SetStatus added in v0.9.0

type ClusterTunnelReconciler added in v0.3.0

type ClusterTunnelReconciler struct {
	client.Client
	Scheme    *runtime.Scheme
	Recorder  record.EventRecorder
	Namespace string
	// contains filtered or unexported fields
}

ClusterTunnelReconciler reconciles a ClusterTunnel object

func (*ClusterTunnelReconciler) GetCfAPI added in v0.9.0

func (r *ClusterTunnelReconciler) GetCfAPI() *CloudflareAPI

func (*ClusterTunnelReconciler) GetCfSecret added in v0.9.0

func (r *ClusterTunnelReconciler) GetCfSecret() *corev1.Secret

func (*ClusterTunnelReconciler) GetClient added in v0.9.0

func (r *ClusterTunnelReconciler) GetClient() client.Client

func (*ClusterTunnelReconciler) GetContext added in v0.9.0

func (r *ClusterTunnelReconciler) GetContext() context.Context

func (*ClusterTunnelReconciler) GetLog added in v0.9.0

func (r *ClusterTunnelReconciler) GetLog() logr.Logger

func (*ClusterTunnelReconciler) GetRecorder added in v0.9.0

func (r *ClusterTunnelReconciler) GetRecorder() record.EventRecorder

func (*ClusterTunnelReconciler) GetScheme added in v0.9.0

func (r *ClusterTunnelReconciler) GetScheme() *runtime.Scheme

func (*ClusterTunnelReconciler) GetTunnel added in v0.9.0

func (r *ClusterTunnelReconciler) GetTunnel() Tunnel

func (*ClusterTunnelReconciler) GetTunnelCreds added in v0.9.0

func (r *ClusterTunnelReconciler) GetTunnelCreds() string

func (*ClusterTunnelReconciler) Reconcile added in v0.3.0

func (r *ClusterTunnelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ClusterTunnel object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.0/pkg/reconcile

func (*ClusterTunnelReconciler) SetCfAPI added in v0.9.0

func (r *ClusterTunnelReconciler) SetCfAPI(in *CloudflareAPI)

func (*ClusterTunnelReconciler) SetTunnelCreds added in v0.9.0

func (r *ClusterTunnelReconciler) SetTunnelCreds(in string)

func (*ClusterTunnelReconciler) SetupWithManager added in v0.3.0

func (r *ClusterTunnelReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Configuration

type Configuration struct {
	TunnelId      string                   `yaml:"tunnel"`
	Ingress       []UnvalidatedIngressRule `yaml:"ingress,omitempty"`
	WarpRouting   WarpRoutingConfig        `yaml:"warp-routing,omitempty"`
	OriginRequest OriginRequestConfig      `yaml:"originRequest,omitempty"`
	SourceFile    string                   `yaml:"credentials-file"`
	Metrics       string                   `yaml:"metrics,omitempty"`
	NoAutoUpdate  bool                     `yaml:"no-autoupdate,omitempty"`
}

https://github.com/cloudflare/cloudflared/blob/master/config/configuration.go Configuration is a cloudflared configuration yaml model

type DnsManagedRecordTxt added in v0.7.0

type DnsManagedRecordTxt struct {
	DnsId      string // DnsId of the managed record
	TunnelName string // TunnelName of the managed record
	TunnelId   string // TunnelId of the managed record
}

DnsManagedRecordTxt object that represents each managed DNS record in a separate TXT record

type GenericTunnelReconciler added in v0.9.0

type GenericTunnelReconciler interface {
	GetClient() client.Client
	GetRecorder() record.EventRecorder
	GetScheme() *runtime.Scheme
	GetContext() context.Context
	GetLog() logr.Logger
	GetTunnel() Tunnel
	GetCfAPI() *CloudflareAPI
	SetCfAPI(*CloudflareAPI)
	GetCfSecret() *corev1.Secret
	GetTunnelCreds() string
	SetTunnelCreds(string)
}

type IngressIPRule

type IngressIPRule struct {
	Prefix *string `yaml:"prefix,omitempty"`
	Ports  []int   `yaml:"ports,omitempty"`
	Allow  bool    `yaml:"allow,omitempty"`
}

IngressIPRule is a cloudflared origin ingress IP rule config model

type OriginRequestConfig

type OriginRequestConfig struct {
	// HTTP proxy timeout for establishing a new connection
	ConnectTimeout *time.Duration `yaml:"connectTimeout,omitempty"`
	// HTTP proxy timeout for completing a TLS handshake
	TLSTimeout *time.Duration `yaml:"tlsTimeout,omitempty"`
	// HTTP proxy TCP keepalive duration
	TCPKeepAlive *time.Duration `yaml:"tcpKeepAlive,omitempty"`
	// HTTP proxy should disable "happy eyeballs" for IPv4/v6 fallback
	NoHappyEyeballs *bool `yaml:"noHappyEyeballs,omitempty"`
	// HTTP proxy maximum keepalive connection pool size
	KeepAliveConnections *int `yaml:"keepAliveConnections,omitempty"`
	// HTTP proxy timeout for closing an idle connection
	KeepAliveTimeout *time.Duration `yaml:"keepAliveTimeout,omitempty"`
	// Sets the HTTP Host header for the local webserver.
	HTTPHostHeader *string `yaml:"httpHostHeader,omitempty"`
	// Hostname on the origin server certificate.
	OriginServerName *string `yaml:"originServerName,omitempty"`
	// Path to the CA for the certificate of your origin.
	// This option should be used only if your certificate is not signed by Cloudflare.
	CAPool *string `yaml:"caPool,omitempty"`
	// Disables TLS verification of the certificate presented by your origin.
	// Will allow any certificate from the origin to be accepted.
	// Note: The connection from your machine to Cloudflare's Edge is still encrypted.
	NoTLSVerify *bool `yaml:"noTLSVerify,omitempty"`
	// Disables chunked transfer encoding.
	// Useful if you are running a WSGI server.
	DisableChunkedEncoding *bool `yaml:"disableChunkedEncoding,omitempty"`
	// Runs as jump host
	BastionMode *bool `yaml:"bastionMode,omitempty"`
	// Listen address for the proxy.
	ProxyAddress *string `yaml:"proxyAddress,omitempty"`
	// Listen port for the proxy.
	ProxyPort *uint `yaml:"proxyPort,omitempty"`
	// Valid options are 'socks' or empty.
	ProxyType *string `yaml:"proxyType,omitempty"`
	// IP rules for the proxy service
	IPRules []IngressIPRule `yaml:"ipRules,omitempty"`
}

OriginRequestConfig is a cloudflared origin request configuration model

type Tunnel added in v0.9.0

type Tunnel interface {
	GetObject() client.Object
	GetNamespace() string
	GetName() string
	GetLabels() map[string]string
	SetLabels(map[string]string)
	GetAnnotations() map[string]string
	SetAnnotations(map[string]string)
	GetSpec() networkingv1alpha1.TunnelSpec
	GetStatus() networkingv1alpha1.TunnelStatus
	SetStatus(networkingv1alpha1.TunnelStatus)
	DeepCopyTunnel() Tunnel
}

type TunnelAdapter added in v0.9.0

type TunnelAdapter struct {
	Tunnel *networkingv1alpha1.Tunnel
}

TunnelAdapater implementation

func (TunnelAdapter) DeepCopyTunnel added in v0.9.0

func (o TunnelAdapter) DeepCopyTunnel() Tunnel

func (TunnelAdapter) GetAnnotations added in v0.9.0

func (o TunnelAdapter) GetAnnotations() map[string]string

func (TunnelAdapter) GetLabels added in v0.9.0

func (o TunnelAdapter) GetLabels() map[string]string

func (TunnelAdapter) GetName added in v0.9.0

func (o TunnelAdapter) GetName() string

func (TunnelAdapter) GetNamespace added in v0.9.0

func (o TunnelAdapter) GetNamespace() string

func (TunnelAdapter) GetObject added in v0.9.0

func (o TunnelAdapter) GetObject() client.Object

func (TunnelAdapter) GetSpec added in v0.9.0

func (TunnelAdapter) GetStatus added in v0.9.0

func (TunnelAdapter) GetUID added in v0.9.0

func (o TunnelAdapter) GetUID() types.UID

func (TunnelAdapter) SetAnnotations added in v0.9.0

func (o TunnelAdapter) SetAnnotations(in map[string]string)

func (TunnelAdapter) SetLabels added in v0.9.0

func (o TunnelAdapter) SetLabels(in map[string]string)

func (TunnelAdapter) SetStatus added in v0.9.0

type TunnelBindingReconciler added in v0.9.0

type TunnelBindingReconciler struct {
	client.Client
	Scheme             *runtime.Scheme
	Recorder           record.EventRecorder
	Namespace          string
	OverwriteUnmanaged bool
	// contains filtered or unexported fields
}

TunnelBindingReconciler reconciles a TunnelBinding object

func (*TunnelBindingReconciler) Reconcile added in v0.9.0

func (r *TunnelBindingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.0/pkg/reconcile

func (*TunnelBindingReconciler) SetupWithManager added in v0.9.0

func (r *TunnelBindingReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type TunnelReconciler

type TunnelReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

TunnelReconciler reconciles a Tunnel object

func (*TunnelReconciler) GetCfAPI added in v0.9.0

func (r *TunnelReconciler) GetCfAPI() *CloudflareAPI

func (*TunnelReconciler) GetCfSecret added in v0.9.0

func (r *TunnelReconciler) GetCfSecret() *corev1.Secret

func (*TunnelReconciler) GetClient added in v0.9.0

func (r *TunnelReconciler) GetClient() client.Client

func (*TunnelReconciler) GetContext added in v0.9.0

func (r *TunnelReconciler) GetContext() context.Context

func (*TunnelReconciler) GetLog added in v0.9.0

func (r *TunnelReconciler) GetLog() logr.Logger

func (*TunnelReconciler) GetRecorder added in v0.9.0

func (r *TunnelReconciler) GetRecorder() record.EventRecorder

func (*TunnelReconciler) GetScheme added in v0.9.0

func (r *TunnelReconciler) GetScheme() *runtime.Scheme

func (*TunnelReconciler) GetTunnel added in v0.9.0

func (r *TunnelReconciler) GetTunnel() Tunnel

func (*TunnelReconciler) GetTunnelCreds added in v0.9.0

func (r *TunnelReconciler) GetTunnelCreds() string

func (*TunnelReconciler) Reconcile

func (r *TunnelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.0/pkg/reconcile

func (*TunnelReconciler) SetCfAPI added in v0.9.0

func (r *TunnelReconciler) SetCfAPI(in *CloudflareAPI)

func (*TunnelReconciler) SetTunnelCreds added in v0.9.0

func (r *TunnelReconciler) SetTunnelCreds(in string)

func (*TunnelReconciler) SetupWithManager

func (r *TunnelReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type UnvalidatedIngressRule

type UnvalidatedIngressRule struct {
	Hostname      string `yaml:"hostname,omitempty"`
	Path          string `yaml:"path,omitempty"`
	Service       string
	OriginRequest OriginRequestConfig `yaml:"originRequest,omitempty"`
}

UnvalidatedIngressRule is a cloudflared ingress entry model

type WarpRoutingConfig

type WarpRoutingConfig struct {
	Enabled bool `yaml:"enabled,omitempty"`
}

WarpRoutingConfig is a cloudflared warp routing model

Jump to

Keyboard shortcuts

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