controllers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostnameToZone

func HostnameToZone(hostname string) (zone string)

Helper function to turn a hostname into a Zone. Example blah.example.com into example.com.

Types

type ArgonautReconciler

type ArgonautReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ArgonautReconciler reconciles a Argonaut object

func (*ArgonautReconciler) BuildArgonautTunnelConfig

func (r *ArgonautReconciler) BuildArgonautTunnelConfig(ctx context.Context, argonaut *argonautv1.Argonaut, tun *cloudflare.ArgoTunnel) ArgonautTunnelConfig

Builds the cloudflared config.yml from an Argonaut objekt with endpoint selectors etc.

func (*ArgonautReconciler) BuildDeployment

func (r *ArgonautReconciler) BuildDeployment(ctx context.Context) (v1.Deployment, error)

func (*ArgonautReconciler) CloudflareLogin

func (r *ArgonautReconciler) CloudflareLogin(ctx context.Context, argonaut *argonautv1.Argonaut) (*cloudflare.API, error)

Get a Cloudflare API instance. Uses login secrets from the secret referenced in the Argonaut spec.

func (*ArgonautReconciler) CreateArgoTunnel

func (r *ArgonautReconciler) CreateArgoTunnel(ctx context.Context, cfc *cloudflare.API, argonaut *argonautv1.Argonaut) (cloudflare.ArgoTunnel, error)

Create a Argo Tunnel using the Cloudflare API

func (*ArgonautReconciler) CreateDNSRecord

func (r *ArgonautReconciler) CreateDNSRecord(ctx context.Context, cfc *cloudflare.API, name string, zoneid string, tun *cloudflare.ArgoTunnel) error

Create a Cloudflare DNS record.

func (*ArgonautReconciler) DeleteArgoTunnel

func (r *ArgonautReconciler) DeleteArgoTunnel(ctx context.Context, cfc *cloudflare.API, tun *cloudflare.ArgoTunnel) error

Deletes an Argo Tunnel using the Cloudflare API

func (*ArgonautReconciler) EndpointsLists

func (r *ArgonautReconciler) EndpointsLists(ctx context.Context, argonaut *argonautv1.Argonaut) map[string]v1.EndpointsList

Get a map with EndpointsList keyed on hostname for an Argonaut resource

func (*ArgonautReconciler) GetArgoTunnel

func (r *ArgonautReconciler) GetArgoTunnel(ctx context.Context, cfc *cloudflare.API, argonaut *argonautv1.Argonaut) (cloudflare.ArgoTunnel, error)

Fetch a Argo Tunnel from the Cloudflare API.

func (*ArgonautReconciler) GetDNSRecords

func (r *ArgonautReconciler) GetDNSRecords(ctx context.Context, cfc *cloudflare.API, zoneid string) ([]cloudflare.DNSRecord, error)

Fetch all DNS records for a Zone. We're only interestedin CNAME's for tunnels.

func (*ArgonautReconciler) Reconcile

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

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

func (*ArgonautReconciler) ReconcileArgoTunnel

func (r *ArgonautReconciler) ReconcileArgoTunnel(ctx context.Context, cfc *cloudflare.API, argonaut *argonautv1.Argonaut) (*cloudflare.ArgoTunnel, error)

Ensures that the Cloudflare Argo Tunnel exists. Will be created if does not exist. The Argo Tunnel name will be the name of the Argonaut resource.

func (*ArgonautReconciler) ReconcileArgonautDeployment

func (r *ArgonautReconciler) ReconcileArgonautDeployment(ctx context.Context, argonaut *argonautv1.Argonaut) error

Reconciles a Deployment for an Argonaut instance. This is a deployment of the cloudflare/cloudflared container with config and secrets.

func (*ArgonautReconciler) ReconcileArgonautTunnelConfig

func (r *ArgonautReconciler) ReconcileArgonautTunnelConfig(ctx context.Context, argonaut *argonautv1.Argonaut, tun *cloudflare.ArgoTunnel) error

Creates or updates a ConfigMap with the ArgoTunnel configuration.

func (*ArgonautReconciler) ReconcileArgonautTunnelSecret

func (r *ArgonautReconciler) ReconcileArgonautTunnelSecret(ctx context.Context, argonaut *argonautv1.Argonaut, tun *cloudflare.ArgoTunnel, account string) error

Create or Update a Secret with TunnelID and TunnelSecret.

func (*ArgonautReconciler) ReconcileDNS

func (r *ArgonautReconciler) ReconcileDNS(ctx context.Context, cfc *cloudflare.API, argonaut *argonautv1.Argonaut, tun *cloudflare.ArgoTunnel) error

Reconcile hostnames found in Argonaut instance with CloudFlare DNS

func (*ArgonautReconciler) ReconcileZone

func (r *ArgonautReconciler) ReconcileZone(ctx context.Context, cfc *cloudflare.API, argonaut *argonautv1.Argonaut) (string, error)

Reconcile Zones

func (*ArgonautReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*ArgonautReconciler) UpdateDNSRecord

func (r *ArgonautReconciler) UpdateDNSRecord(ctx context.Context, cfc *cloudflare.API, name string, tun *cloudflare.ArgoTunnel, record cloudflare.DNSRecord) error

func (*ArgonautReconciler) ZoneExists

func (r *ArgonautReconciler) ZoneExists(ctx context.Context, cfc *cloudflare.API, name string) (string, error)

Check if a DNS Zone exists.

type ArgonautTunnelConfig

type ArgonautTunnelConfig struct {
	Tunnel          string                        `json:"tunnel"`
	CredentialsFile string                        `json:"credentials-file"`
	Ingress         []ArgonautTunnelConfigIngress `json:"ingress"`
}

Struct for generating ConfigMap payload to be used in a Pod to run a tunnel

type ArgonautTunnelConfigIngress

type ArgonautTunnelConfigIngress struct {
	Hostname string `json:"hostname,omitempty"`
	Service  string `json:"service,omitempty"`
}

Struct for holding ingress information

type ArgonautTunnelSecret

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

Struct for generating Secret payload used in a Pod to run a tunnel.

Jump to

Keyboard shortcuts

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