Documentation ¶
Index ¶
- Constants
- func NewLicenseCache() cache.Store
- func WrapKongLicenseReconcilerToDynamicCRDController(ctx context.Context, mgr ctrl.Manager, r *KongV1Alpha1KongLicenseReconciler) *crds.DynamicCRDController
- type KongV1Alpha1KongLicenseReconciler
- func (r *KongV1Alpha1KongLicenseReconciler) GetLicense() mo.Option[kong.License]
- func (r *KongV1Alpha1KongLicenseReconciler) GetValidatedLicense() mo.Option[License]
- func (r *KongV1Alpha1KongLicenseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *KongV1Alpha1KongLicenseReconciler) SetLogger(l logr.Logger)
- func (r *KongV1Alpha1KongLicenseReconciler) SetupWithManager(mgr ctrl.Manager) error
- type License
- type ValidatorFunc
Constants ¶
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" )
const (
// LicenseControllerTypeKIC annotates the controller type.
LicenseControllerTypeKIC = "konghq.com/kong-ingress-controller"
)
Variables ¶
This section is empty.
Functions ¶
func NewLicenseCache ¶
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 ¶
func (r *KongV1Alpha1KongLicenseReconciler) GetLicense() mo.Option[kong.License]
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 ¶
func (r *KongV1Alpha1KongLicenseReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile processes the watched objects.
func (*KongV1Alpha1KongLicenseReconciler) SetLogger ¶
func (r *KongV1Alpha1KongLicenseReconciler) SetLogger(l logr.Logger)
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 ¶
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 ¶
ValidatorFunc is the function type used to validate the license string by KongV1Alpha1KongLicenseReconciler.