license

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PollingInterval is the interval at which the license agent will poll for license updates.
	PollingInterval = time.Hour * 12

	// PollingTimeout is the timeout for retrieving a license from upstream.
	PollingTimeout = time.Minute * 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent handles retrieving a Kong license and providing it to other KIC subsystems.

func NewAgent

func NewAgent(
	konnectAPIClient UpstreamClient,
	logger logr.Logger,
) *Agent

NewAgent creates a new license agent that retrieves a license from the given url once every given period.

func (*Agent) GetLicense

func (a *Agent) GetLicense() kong.License

GetLicense returns the agent's current license as a go-kong License struct. It omits the origin timestamps, as Kong will auto-populate these when adding the license to its config database.

func (*Agent) NeedLeaderElection

func (a *Agent) NeedLeaderElection() bool

NeedLeaderElection indicates if the Agent requires leadership to run. It always returns true.

func (*Agent) Start

func (a *Agent) Start(ctx context.Context) error

Start starts the Agent. It attempts to pull an initial license from upstream, and then polls for updates on a regular interval defined by PollingInterval.

type UpstreamClient

type UpstreamClient interface {
	List(ctx context.Context, pageNumber int) (*license.ListLicenseResponse, error)
}

Jump to

Keyboard shortcuts

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