controllers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const CLOUDFLARE_ENDPOINT = "https://api.cloudflare.com/client/v4/"

Cloudflare API base URL from https://api.cloudflare.com/#getting-started-endpoints.

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
}

CloudflareAPI config object holding all relevant fields to use the API

func (*CloudflareAPI) CreateCloudflareTunnel

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

Create a Cloudflare Tunnel and return the tunnel Id and credentials file

func (*CloudflareAPI) DeleteCloudflareTunnel

func (c *CloudflareAPI) DeleteCloudflareTunnel() error

Delete a Cloudflare Tunnel

func (*CloudflareAPI) DeleteDNSCName

func (c *CloudflareAPI) DeleteDNSCName(fqdn string) error

Delete DNS CNAME entry for the given FQDN

func (*CloudflareAPI) GetAccountId

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

Get the AccountId from Account Name

func (*CloudflareAPI) GetTunnelCreds

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

Get Tunnel Credentials from Tunnel secret

func (*CloudflareAPI) GetTunnelId

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

Get Tunnel Id from available information

func (*CloudflareAPI) GetZoneId

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

Get Zone Id from DNS domain

func (*CloudflareAPI) InsertOrUpdateCName

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

Upsert DNS CNAME record for the given FQDN to point to the tunnel

func (*CloudflareAPI) ValidateAll

func (c *CloudflareAPI) ValidateAll() error

Validate the contents of the CloudflareAPI struct

type CloudflareAPIMultiResponse

type CloudflareAPIMultiResponse struct {
	Result []struct {
		Id   string
		Name string
	}
	Errors []struct {
		Message string
	}
	Success bool
}

type CloudflareAPIResponse

type CloudflareAPIResponse struct {
	Result struct {
		Id              string
		Name            string
		CredentialsFile map[string]string `json:"credentials_file"`
	}
	Success bool
	Errors  []struct {
		Message string
	}
}

Cloudflare API Response object containing a slice of Results with a Name and Id field

type CloudflareAPITunnelCreate

type CloudflareAPITunnelCreate struct {
	Name         string
	TunnelSecret string `json:"tunnel_secret"`
}

Cloudflare API Input for creating a Tunnel

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"`
}

cloudflared configuration yaml model

type IngressIPRule

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

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"`
}

cloudflared origin request configuration model

type ServiceReconciler

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

ServiceReconciler reconciles a Service object

func (*ServiceReconciler) Reconcile

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

func (*ServiceReconciler) SetupWithManager

func (r *ServiceReconciler) 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) Reconcile

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

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"`
}

cloudflared ingress entry model

type WarpRoutingConfig

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

cloudflared warp routing model

Jump to

Keyboard shortcuts

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