controllers

package
v0.0.0-...-949eaf4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TokenSecretReleaseKey = "release"
	TokenSecretConfigKey  = "config"
	TokenSecretTokenKey   = "token"
	TokenSecretAnnotation = "hypershift.openshift.io/ignition-config"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpiringCache

type ExpiringCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ExpiringCache enables a cache of pairs "token: payload". Any pair in the cache is expired once entry.expiry time is above the cache ttl. The expiry time is renewed for an existing value on every Get operation. Garbage collection of expired values happens on every Get operation.

func NewPayloadStore

func NewPayloadStore() *ExpiringCache

func (*ExpiringCache) Delete

func (c *ExpiringCache) Delete(key string)

func (*ExpiringCache) Get

func (c *ExpiringCache) Get(key string) (value []byte, ok bool)

func (*ExpiringCache) Set

func (c *ExpiringCache) Set(key string, value []byte)

type IgnitionProvider

type IgnitionProvider interface {
	// GetPayload returns the ignition payload content for
	// the provided release image and a config string containing 0..N MachineConfig yaml definitions.
	GetPayload(ctx context.Context, payloadImage, config string) ([]byte, error)
}

IgnitionProvider can build ignition payload contents for a given release image.

type MCSIgnitionProvider

type MCSIgnitionProvider struct {
	Client          client.Client
	ReleaseProvider releaseinfo.Provider
	Namespace       string
}

MCSIgnitionProvider is an IgnitionProvider that uses MachineConfigServer pods to build ignition payload contents out of a given releaseImage and a config string containing 0..N MachineConfig yaml definitions.

func (*MCSIgnitionProvider) GetPayload

func (p *MCSIgnitionProvider) GetPayload(ctx context.Context, releaseImage string, config string) (payload []byte, err error)

type TokenSecretReconciler

type TokenSecretReconciler struct {
	client.Client
	IgnitionProvider IgnitionProvider
	PayloadStore     *ExpiringCache
}

TokenSecretReconciler watches token Secrets and uses an IgnitionProvider to get a payload out them and stores it in the PayloadsStore. A token Secret is by contractual convention: type: Secret

  metadata:
  annotations:
	   hypershift.openshift.io/ignition-config: "true"
	 data:
    token: <authz token>
    release: <release image string>
    config: |-

func (*TokenSecretReconciler) Reconcile

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

func (*TokenSecretReconciler) SetupWithManager

func (r *TokenSecretReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

Jump to

Keyboard shortcuts

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