Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorIsTransient(err error) bool
- func MakeAbsoluteImportPath(importedFrom, importPath string) string
- type AdmissionReconciler
- type CacheSizeCollector
- type EspejoteError
- type EspejoteErrorType
- type ImporterCacheEntry
- type ManagedResourceControllerManager
- type ManagedResourceReconciler
- type ManagedResourceStatusCollector
- type ManifestImporter
- type Renderer
- type Request
- type TriggerInfo
- type WatchResource
Constants ¶
const MetricsNamespace = "espejote"
Variables ¶
var ErrCacheNotReady = errors.New("cache not ready")
var ErrFailedSyncCache = errors.New("failed to sync cache")
var EspejoteLibsonnet string
Functions ¶
func ErrorIsTransient ¶ added in v0.4.1
ErrorIsTransient returns true if the error is transient and the reconciliation should be retried without an error log and backoff.
func MakeAbsoluteImportPath ¶ added in v0.7.0
MakeAbsoluteImportPath makes an absolute import path from the given importedFrom and importPath. It handles relative imports and absolute imports and knows about the topology of the espejote imports.
Types ¶
type AdmissionReconciler ¶ added in v0.3.0
type AdmissionReconciler struct {
client.Client
MutatingWebhookName string
ValidatingWebhookName string
WebhookPort int32
WebhookServiceName string
ControllerNamespace string
}
AdmissionReconciler reconciles Admission objects.
func (*AdmissionReconciler) Reconcile ¶ added in v0.3.0
func (r *AdmissionReconciler) Reconcile(ctx context.Context, _ admissionRequest) (ctrl.Result, error)
Reconcile adds admissions to the MutatingWebhookConfiguration and ValidatingWebhookConfigurations.
func (*AdmissionReconciler) SetupWithManager ¶ added in v0.3.0
func (r *AdmissionReconciler) SetupWithManager(mgr ctrl.Manager) error
Setup sets up the controller with the Manager. All fields must be populated before calling this function.
type CacheSizeCollector ¶
type CacheSizeCollector struct {
ControllerManager *ManagedResourceControllerManager
}
CacheSizeCollector collects cache size metrics. It loops over all caches and collects the number of cached objects and the size of the cache.
func (*CacheSizeCollector) Collect ¶
func (c *CacheSizeCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*CacheSizeCollector) Describe ¶
func (c *CacheSizeCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type EspejoteError ¶
type EspejoteError struct {
Type EspejoteErrorType
// contains filtered or unexported fields
}
func (EspejoteError) Error ¶
func (e EspejoteError) Error() string
func (EspejoteError) Transient ¶ added in v0.4.1
func (e EspejoteError) Transient() bool
Transient returns true if the error is transient and the reconciliation should be retried without an error log and backoff.
type EspejoteErrorType ¶
type EspejoteErrorType string
const ( ServiceAccountError EspejoteErrorType = "ServiceAccountError" WaitingForCacheSync EspejoteErrorType = "WaitingForCacheSync" DependencyConfigurationError EspejoteErrorType = "DependencyConfigurationError" TemplateError EspejoteErrorType = "TemplateError" ApplyError EspejoteErrorType = "ApplyError" TemplateReturnError EspejoteErrorType = "TemplateReturnError" ControllerInstantiationError EspejoteErrorType = "ControllerInstantiationError" )
type ImporterCacheEntry ¶ added in v0.7.0
ImporterCacheEntry is a cache entry for MultiImporter. It holds the result of the last import.
type ManagedResourceControllerManager ¶ added in v0.11.0
type ManagedResourceControllerManager struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
ControllerLifetimeCtx context.Context
JsonnetLibraryNamespace string
// contains filtered or unexported fields
}
func (*ManagedResourceControllerManager) SetupWithManager ¶ added in v0.11.0
type ManagedResourceReconciler ¶
type ManagedResourceReconciler struct {
// For identifies the managed resource being reconciled.
// This reconciler does not work like a classic reconciler.
// One instance of this reconciler exists for each managed resource and it only ever reconciles that resource.
// ManagedResourceControllerManager dynamically creates and manages these reconciler instances.
For types.NamespacedName
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
ControllerLifetimeCtx context.Context
JsonnetLibraryNamespace string
// contains filtered or unexported fields
}
type ManagedResourceStatusCollector ¶ added in v0.6.0
ManagedResourceStatusCollector collects status metrics for managed resources. It loops over all managed resources and collects the infomation in the .status field.
func (*ManagedResourceStatusCollector) Collect ¶ added in v0.6.0
func (c *ManagedResourceStatusCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*ManagedResourceStatusCollector) Describe ¶ added in v0.6.0
func (c *ManagedResourceStatusCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type ManifestImporter ¶
type ManifestImporter struct {
client.Client
// Namespace is the namespace for local imports.
// If Namespace is empty, local imports are not allowed.
Namespace string
// LibraryNamespace is the namespace for library imports.
LibraryNamespace string
Cache map[string]ImporterCacheEntry
}
ManifestImporter imports data from espejotev1alpha1.JsonnetLibraries.
func FromClientImporter ¶
func FromClientImporter(c client.Client, localNamespace, libNamespace string) *ManifestImporter
FromClientImporter returns an importer that fetches libraries from the cluster using the given client. "espejote.libsonnet" is statically embedded.
func (*ManifestImporter) Import ¶
func (im *ManifestImporter) Import(importedFrom, importPath string) (contents jsonnet.Contents, foundAt string, err error)
Import know about the topology of the espejote imports. It handles relative imports and absolute imports. It also caches the results of the imports. The cache is non thread-safe, same as the upstream file importer. The import "espejote.libsonnet" is statically embedded and always resolves to the built-in library. If a local "espejote.libsonnet" import is required it can be prefixed with "./". Relative imports by JsonnetLibraries always resolve to the same local or library namespace.
type Renderer ¶
type Renderer struct {
Importer jsonnet.Importer
TriggerClientGetter func(triggerName string) (client.Reader, error)
ContextClientGetter func(contextName string) (client.Reader, error)
}
Render renders the given ManagedResource.
func (*Renderer) Render ¶
func (r *Renderer) Render(ctx context.Context, managedResource espejotev1alpha1.ManagedResource, ti TriggerInfo) (string, error)
Render renders the given ManagedResource.
type Request ¶
type Request struct {
TriggerInfo TriggerInfo
}
type TriggerInfo ¶
type TriggerInfo struct {
TriggerName string
WatchResource WatchResource
}