license

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConditionTypeProgrammed = "Programmed"
	// ConditionReasonPickedAsLatest represents that the KongLicense being picked as the newest one.
	ConditionReasonPickedAsLatest = "PickedAsLatest"
	// ConditionReasonReplacedByNewer represents that the KongLicense is replaced by other one that is newer.
	ConditionReasonReplacedByNewer = "ReplacedByNewer"

	// ConditionTypeLicenseValid is the type of condition for the license validation.
	ConditionTypeLicenseValid = "LicenseValid"
	// ConditionReasonLicenseValid represents that the license is validated successfully.
	ConditionReasonLicenseValid = "ValidatedSuccessfully"
	// ConditionReasonLicenseInvalid represents that the provided license is invalid.
	ConditionReasonLicenseInvalid = "InvalidLicenseProvided"
)
View Source
const (
	// LicenseControllerTypeKIC annotates the controller type.
	LicenseControllerTypeKIC = "konghq.com/kong-ingress-controller"
)

Variables

This section is empty.

Functions

func NewLicenseCache

func NewLicenseCache() cache.Store

func WrapKongLicenseReconcilerToDynamicCRDController

func WrapKongLicenseReconcilerToDynamicCRDController(
	ctx context.Context, mgr ctrl.Manager, r *KongV1Alpha1KongLicenseReconciler,
) *crds.DynamicCRDController

WrapKongLicenseReconcilerToDynamicCRDController wraps KongLicenseReconciler to DynamicCRDController to watch presence of KongLicense CRD to avoid aborts if KongLicense is not installed when controller initialized.

Types

type KongV1Alpha1KongLicenseReconciler

type KongV1Alpha1KongLicenseReconciler struct {
	client.Client

	Log              logr.Logger
	Scheme           *runtime.Scheme
	LicenseCache     cache.Store
	CacheSyncTimeout time.Duration
	StatusQueue      *status.Queue
	// ControllerName is the part of field status.controllers[].controllerName: "LicenseControllerType/ControllerName".
	LicenseControllerType string
	// ElectionID is the part of field status.controllers[].controllerName: "LicenseControllerType/ElectionID".
	// This is unique identifier of the controller instance. When not specified, the field will be set to
	// status.controllers[].controllerName: "LicenseControllerType".
	ElectionID mo.Option[string]
	// contains filtered or unexported fields
}

KongV1Alpha1KongLicenseReconciler reconciles KongLicense resources.

func NewKongV1Alpha1KongLicenseReconciler

func NewKongV1Alpha1KongLicenseReconciler(
	client client.Client,
	log logr.Logger,
	scheme *runtime.Scheme,
	licenseCache cache.Store,
	cacheSyncTimeout time.Duration,
	statusQueue *status.Queue,
	licenseControllerType string,
	electionID mo.Option[string],
	licenseValidator mo.Option[ValidatorFunc],
) *KongV1Alpha1KongLicenseReconciler

NewKongV1Alpha1KongLicenseReconciler creates a new KongV1Alpha1KongLicenseReconciler. It can validate the license and set conditions accordingly when licenseValidator is provided. Based on whether it returns an error it sets `status.status.controllers[].controllerName.conditions[].type`: "LicenseValid" to "True" or "False" according with other fields of the condition. Field `message` is set to the returned error message. If not provided, the whole validation step is skipped.

func (*KongV1Alpha1KongLicenseReconciler) GetLicense

GetLicense returns the license in Kong configuration format. It does not check the license validity. This method is provided to implement the translator.LicenseGetter interface (use case where information about validity is not required). When the info about validity is required, use method GetValidatedLicense.

func (*KongV1Alpha1KongLicenseReconciler) GetValidatedLicense

func (r *KongV1Alpha1KongLicenseReconciler) GetValidatedLicense() mo.Option[License]

GetValidatedLicense is the interface to get the license in Kong configuration format and information about its validity when if validator has been configured.

func (*KongV1Alpha1KongLicenseReconciler) Reconcile

Reconcile processes the watched objects.

func (*KongV1Alpha1KongLicenseReconciler) SetLogger

SetLogger sets the logger.

func (*KongV1Alpha1KongLicenseReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type License

type License struct {
	License kong.License
	IsValid mo.Option[bool]
}

License is a wrapper for kong.License that include the information about its validity. Field IsValid is set to true if the license is valid, otherwise it's set to false. If it's not set at all, it means that the license validation is not configured, thus the information about the license validity is not available.

type ValidatorFunc

type ValidatorFunc func(rawLicenseString string) error

ValidatorFunc is the function type used to validate the license string by KongV1Alpha1KongLicenseReconciler.

Jump to

Keyboard shortcuts

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