bridge

package
v0.0.0-...-30d1bac Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	KeyBridgeLocalTime = "bridge-local-time"
	KeyBridgeToken     = "bridge-token"
)

Variables

This section is empty.

Functions

func ManagedInstallationReconciler

func ManagedInstallationReconciler(m manager.Manager, newClient func() *Client) error

ManagedInstallationReconciler creates an InstallationReconciler and adds it to m.

Types

type AuthObject

type AuthObject struct {
	ID        string    `json:"id"`
	ExpiresAt time.Time `json:"expires_at"`
	Secret    string    `json:"secret"`
}

type Client

type Client struct {
	http.Client
	wait.Backoff

	BaseURL url.URL
	Version string
}

func NewClient

func NewClient(apiURL, version string) *Client

NewClient creates a Client with backoff settings that amount to ~10 attempts over ~2 minutes. A default is used when apiURL is not an acceptable URL.

func (*Client) CreateInstallation

func (c *Client) CreateInstallation(ctx context.Context) (Installation, error)

type Installation

type Installation struct {
	ID         string     `json:"id"`
	AuthObject AuthObject `json:"auth_object"`
}

type InstallationReconciler

type InstallationReconciler struct {
	Owner  client.FieldOwner
	Reader interface {
		Get(context.Context, client.ObjectKey, client.Object) error
	}
	Writer interface {
		Patch(context.Context, client.Object, client.Patch, ...client.PatchOption) error
	}

	// SecretRef is the name of the corev1.Secret in which to store Bridge tokens.
	SecretRef client.ObjectKey

	// NewClient is called each time a new Client is needed.
	NewClient func() *Client
}

func (*InstallationReconciler) Reconcile

func (r *InstallationReconciler) Reconcile(
	ctx context.Context, request reconcile.Request) (reconcile.Result, error,
)

Jump to

Keyboard shortcuts

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