helmreconciler

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartCustomizer

type ChartCustomizer interface {
	// BeginChart is the same as RenderingListener.BeginChart
	BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)
	// BeginResource is the same as RenderingListener.BeginResource
	BeginResource(obj runtime.Object) (runtime.Object, error)
	// ResourceCreated is the same as RenderingListener.ResourceCreated
	ResourceCreated(created runtime.Object) error
	// ResourceUpdated is the same as RenderingListener.ResourceUpdated
	ResourceUpdated(new, existing runtime.Object) error
	// ResourceError is the same as RenderingListener.ResourceError
	ResourceError(obj runtime.Object, err error) error
	// EndResource is the same as RenderingListener.EndResource
	EndResource(obj runtime.Object) error
	// EndChart is the same as RenderingListener.EndChart
	EndChart(chart string) error
	// ResourceDeleted is the same as RenderingListener.ResourceDeleted
	ResourceDeleted(deleted runtime.Object) error
}

ChartCustomizer defines callbacks used by a listener that manages customizations for a specific chart.

type ChartCustomizerFactory

type ChartCustomizerFactory interface {
	// NewChartCustomizer returns a new ChartCustomizer for the specified chartName.
	NewChartCustomizer(chartName string) ChartCustomizer
}

ChartCustomizerFactory is a factory for creating ChartCustomizer objects.

type ChartManifestsMap

type ChartManifestsMap map[string][]manifest.Manifest

ChartManifestsMap is a typedef representing a map of chart-name: []manifest, i.e. the manifests associated with a specific chart

type ClientProvider

type ClientProvider interface {
	// GetClient returns a kubernetes client.
	GetClient() client.Client
}

ClientProvider is a helper interface which allows HelmReconciler to expose a client to clients.

type CompositeRenderingListener

type CompositeRenderingListener struct {
	// Listeners represents a list of Listeners to which this object will delegate calls.
	Listeners []RenderingListener
}

CompositeRenderingListener is an implementation of RenderingListener which is composed of an array of listeners. All methods are delegated to each element in the Listeners array. For completion events (e.g. EndResource()), the delegates are invoked last to first.

func (*CompositeRenderingListener) BeginChart

func (l *CompositeRenderingListener) BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)

BeginChart delegates BeginChart to the Listeners in first to last order.

func (*CompositeRenderingListener) BeginDelete

func (l *CompositeRenderingListener) BeginDelete(instance runtime.Object) error

BeginDelete delegates BeginDelete to the Listeners in first to last order.

func (*CompositeRenderingListener) BeginPrune

func (l *CompositeRenderingListener) BeginPrune(all bool) error

BeginPrune delegates BeginPrune to the Listeners in first to last order.

func (*CompositeRenderingListener) BeginReconcile

func (l *CompositeRenderingListener) BeginReconcile(instance runtime.Object) error

BeginReconcile delegates BeginReconcile to the Listeners in first to last order.

func (*CompositeRenderingListener) BeginResource

func (l *CompositeRenderingListener) BeginResource(obj runtime.Object) (runtime.Object, error)

BeginResource delegates BeginResource to the Listeners in first to last order.

func (*CompositeRenderingListener) EndChart

func (l *CompositeRenderingListener) EndChart(chart string) error

EndChart delegates EndChart to the Listeners in last to first order.

func (*CompositeRenderingListener) EndDelete

func (l *CompositeRenderingListener) EndDelete(instance runtime.Object, err error) error

EndDelete delegates EndDelete to the Listeners in last to first order.

func (*CompositeRenderingListener) EndPrune

func (l *CompositeRenderingListener) EndPrune() error

EndPrune delegates EndPrune to the Listeners in last to first order.

func (*CompositeRenderingListener) EndReconcile

func (l *CompositeRenderingListener) EndReconcile(instance runtime.Object, err error) error

EndReconcile delegates EndReconcile to the Listeners in last to first order.

func (*CompositeRenderingListener) EndResource

func (l *CompositeRenderingListener) EndResource(obj runtime.Object) error

EndResource delegates EndResource to the Listeners in last to first order.

func (*CompositeRenderingListener) RegisterReconciler

func (l *CompositeRenderingListener) RegisterReconciler(reconciler *HelmReconciler)

RegisterReconciler will register the HelmReconciler with any Listeners also implementing ReconcilerListener.

func (*CompositeRenderingListener) ResourceCreated

func (l *CompositeRenderingListener) ResourceCreated(created runtime.Object) error

ResourceCreated delegates ResourceCreated to the Listeners in first to last order.

func (*CompositeRenderingListener) ResourceDeleted

func (l *CompositeRenderingListener) ResourceDeleted(deleted runtime.Object) error

ResourceDeleted delegates ResourceDeleted to the Listeners in first to last order.

func (*CompositeRenderingListener) ResourceError

func (l *CompositeRenderingListener) ResourceError(obj runtime.Object, err error) error

ResourceError delegates ResourceError to the Listeners in first to last order.

func (*CompositeRenderingListener) ResourceUpdated

func (l *CompositeRenderingListener) ResourceUpdated(updated runtime.Object, old runtime.Object) error

ResourceUpdated delegates ResourceUpdated to the Listeners in first to last order.

type DefaultChartCustomizer

type DefaultChartCustomizer struct {
	ChartName              string
	ChartAnnotationKey     string
	Reconciler             *HelmReconciler
	NewResourcesByKind     map[string][]runtime.Object
	DeletedResourcesByKind map[string][]runtime.Object
}

DefaultChartCustomizer is a ChartCustomizer that collects resources created/deleted during rendering and adds a chart annotation to rendered resources.

func NewDefaultChartCustomizer

func NewDefaultChartCustomizer(chartName, chartAnnotationKey string) *DefaultChartCustomizer

NewDefaultChartCustomizer creates a new DefaultChartCustomizer

func (*DefaultChartCustomizer) BeginChart

func (c *DefaultChartCustomizer) BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)

BeginChart empty implementation

func (*DefaultChartCustomizer) BeginResource

func (c *DefaultChartCustomizer) BeginResource(obj runtime.Object) (runtime.Object, error)

BeginResource adds the chart annotation to the resource (ChartAnnotationKey=ChartName)

func (*DefaultChartCustomizer) EndChart

func (c *DefaultChartCustomizer) EndChart(chart string) error

EndChart empty implementation

func (*DefaultChartCustomizer) EndResource

func (c *DefaultChartCustomizer) EndResource(obj runtime.Object) error

EndResource empty implementation

func (*DefaultChartCustomizer) RegisterReconciler

func (c *DefaultChartCustomizer) RegisterReconciler(reconciler *HelmReconciler)

RegisterReconciler registers the HelmReconciler with this.

func (*DefaultChartCustomizer) ResourceCreated

func (c *DefaultChartCustomizer) ResourceCreated(created runtime.Object) error

ResourceCreated adds the created object to NewResourcesByKind

func (*DefaultChartCustomizer) ResourceDeleted

func (c *DefaultChartCustomizer) ResourceDeleted(deleted runtime.Object) error

ResourceDeleted adds the deleted object to DeletedResourcesByKind

func (*DefaultChartCustomizer) ResourceError

func (c *DefaultChartCustomizer) ResourceError(obj runtime.Object, err error) error

ResourceError empty implementation

func (*DefaultChartCustomizer) ResourceUpdated

func (c *DefaultChartCustomizer) ResourceUpdated(updated, old runtime.Object) error

ResourceUpdated adds the updated object to NewResourcesByKind

type DefaultChartCustomizerFactory

type DefaultChartCustomizerFactory struct {
	// ChartAnnotationKey is the key used to add an annotation identifying the chart that rendered the resource
	// to the rendered resource.
	ChartAnnotationKey string
}

DefaultChartCustomizerFactory is a factory for creating DefaultChartCustomizer objects

func (*DefaultChartCustomizerFactory) NewChartCustomizer

func (f *DefaultChartCustomizerFactory) NewChartCustomizer(chartName string) ChartCustomizer

NewChartCustomizer returns a new DefaultChartCustomizer for the specified chart.

type DefaultChartCustomizerListener

type DefaultChartCustomizerListener struct {
	*DefaultRenderingListener
	// ChartCustomizerFactory is the factory used to create ChartCustomizer objects for each chart
	// encountered during rendering.
	ChartCustomizerFactory ChartCustomizerFactory
	// ChartAnnotationKey represents the annotation key in which the chart name is stored on the rendered resource.
	ChartAnnotationKey string
	// contains filtered or unexported fields
}

DefaultChartCustomizerListener manages ChartCustomizer objects for a rendering.

func NewDefaultChartCustomizerListener

func NewDefaultChartCustomizerListener(chartAnnotationKey string) *DefaultChartCustomizerListener

NewDefaultChartCustomizerListener creates a new DefaultChartCustomizerListener which creates DefaultChartCustomizer objects for each chart (which simply adds a chart owner annotation to each rendered resource). The ChartCustomizerFactory may be modified by users to create custom ChartCustomizer objects.

func (*DefaultChartCustomizerListener) BeginChart

func (l *DefaultChartCustomizerListener) BeginChart(chartName string, manifests []manifest.Manifest) ([]manifest.Manifest, error)

BeginChart creates a new ChartCustomizer for the specified chart and delegates listener calls applying to resources (e.g. BeginResource) to the customizer up through EndChart.

func (*DefaultChartCustomizerListener) BeginResource

BeginResource delegates to the active ChartCustomizer's BeginResource

func (*DefaultChartCustomizerListener) EndChart

func (l *DefaultChartCustomizerListener) EndChart(chartName string) error

EndChart delegates to the active ChartCustomizer's EndChart and resets the active ChartCustomizer to nil.

func (*DefaultChartCustomizerListener) EndResource

func (l *DefaultChartCustomizerListener) EndResource(obj runtime.Object) error

EndResource delegates to the active ChartCustomizer's EndResource

func (*DefaultChartCustomizerListener) GetOrCreateCustomizer

func (l *DefaultChartCustomizerListener) GetOrCreateCustomizer(chartName string) ChartCustomizer

GetOrCreateCustomizer does what it says.

func (*DefaultChartCustomizerListener) RegisterReconciler

func (l *DefaultChartCustomizerListener) RegisterReconciler(reconciler *HelmReconciler)

RegisterReconciler registers the HelmReconciler with the listener.

func (*DefaultChartCustomizerListener) ResourceCreated

func (l *DefaultChartCustomizerListener) ResourceCreated(created runtime.Object) error

ResourceCreated delegates to the active ChartCustomizer's ResourceCreated

func (*DefaultChartCustomizerListener) ResourceDeleted

func (l *DefaultChartCustomizerListener) ResourceDeleted(deleted runtime.Object) error

ResourceDeleted looks up the ChartCustomizer for the object that was deleted and invokes its ResourceDeleted method.

func (*DefaultChartCustomizerListener) ResourceError

func (l *DefaultChartCustomizerListener) ResourceError(obj runtime.Object, err error) error

ResourceError delegates to the active ChartCustomizer's ResourceError

func (*DefaultChartCustomizerListener) ResourceUpdated

func (l *DefaultChartCustomizerListener) ResourceUpdated(updated runtime.Object, old runtime.Object) error

ResourceUpdated delegates to the active ChartCustomizer's ResourceUpdated

type DefaultRenderingListener

type DefaultRenderingListener struct {
}

DefaultRenderingListener is a base type with empty implementations for each callback.

func (*DefaultRenderingListener) BeginChart

func (l *DefaultRenderingListener) BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)

BeginChart default implementation

func (*DefaultRenderingListener) BeginDelete

func (l *DefaultRenderingListener) BeginDelete(instance runtime.Object) error

BeginDelete default implementation

func (*DefaultRenderingListener) BeginPrune

func (l *DefaultRenderingListener) BeginPrune(all bool) error

BeginPrune default implementation

func (*DefaultRenderingListener) BeginReconcile

func (l *DefaultRenderingListener) BeginReconcile(instance runtime.Object) error

BeginReconcile default implementation

func (*DefaultRenderingListener) BeginResource

func (l *DefaultRenderingListener) BeginResource(obj runtime.Object) (runtime.Object, error)

BeginResource default implementation

func (*DefaultRenderingListener) EndChart

func (l *DefaultRenderingListener) EndChart(chart string) error

EndChart default implementation

func (*DefaultRenderingListener) EndDelete

func (l *DefaultRenderingListener) EndDelete(instance runtime.Object, err error) error

EndDelete default implementation

func (*DefaultRenderingListener) EndPrune

func (l *DefaultRenderingListener) EndPrune() error

EndPrune default implementation

func (*DefaultRenderingListener) EndReconcile

func (l *DefaultRenderingListener) EndReconcile(instance runtime.Object, err error) error

EndReconcile default implementation

func (*DefaultRenderingListener) EndResource

func (l *DefaultRenderingListener) EndResource(obj runtime.Object) error

EndResource default implementation

func (*DefaultRenderingListener) ResourceCreated

func (l *DefaultRenderingListener) ResourceCreated(created runtime.Object) error

ResourceCreated default implementation

func (*DefaultRenderingListener) ResourceDeleted

func (l *DefaultRenderingListener) ResourceDeleted(deleted runtime.Object) error

ResourceDeleted default implementation

func (*DefaultRenderingListener) ResourceError

func (l *DefaultRenderingListener) ResourceError(obj runtime.Object, err error) error

ResourceError default implementation

func (*DefaultRenderingListener) ResourceUpdated

func (l *DefaultRenderingListener) ResourceUpdated(updated runtime.Object, old runtime.Object) error

ResourceUpdated default implementation

type Factory

type Factory struct {
	// CustomizerFactory is a factory for creating the Customizer object for the HelmReconciler.
	CustomizerFactory RenderingCustomizerFactory
}

Factory is a factory for creating HelmReconciler objects using the specified CustomizerFactory.

func (*Factory) New

func (f *Factory) New(instance runtime.Object, client client.Client, logger logr.Logger) (*HelmReconciler, error)

New Returns a new HelmReconciler for the custom resource. instance is the custom resource to be reconciled/deleted. client is the kubernetes client logger is the logger

type HelmReconciler

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

HelmReconciler reconciles resources rendered by a set of helm charts for a specific instances of a custom resource, or deletes all resources associated with a specific instance of a custom resource.

func (*HelmReconciler) CreatePatch

func (h *HelmReconciler) CreatePatch(current, updated runtime.Object) (Patch, error)

CreatePatch creates a patch based on the current and updated versions of an object

func (*HelmReconciler) Delete

func (h *HelmReconciler) Delete() error

Delete resources associated with the custom resource instance

func (*HelmReconciler) GetClient

func (h *HelmReconciler) GetClient() client.Client

GetClient returns the kubernetes client associated with this HelmReconciler

func (*HelmReconciler) GetLogger

func (h *HelmReconciler) GetLogger() logr.Logger

GetLogger returns the logger associated with this HelmReconciler

func (*HelmReconciler) Reconcile

func (h *HelmReconciler) Reconcile() error

Reconcile the resources associated with the custom resource instance.

type LoggerProvider

type LoggerProvider interface {
	// GetLogger returns a logger
	GetLogger() logr.Logger
}

LoggerProvider is a helper interface which allows HelmReconciler to expose a logger to clients.

type LoggingRenderingListener

type LoggingRenderingListener struct {
	Level int
	// contains filtered or unexported fields
}

LoggingRenderingListener is a RenderingListener which logs events. It also updates the HelmReconciler logger with values applying to various stages of processing (e.g. chart=chart-name, kind=resource-kind, etc.). This can be used as the first listener in a CompositeRenderingListener.

func (*LoggingRenderingListener) BeginChart

func (l *LoggingRenderingListener) BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)

BeginChart logs the event and updates the logger to log with values chart=chart-name

func (*LoggingRenderingListener) BeginDelete

func (l *LoggingRenderingListener) BeginDelete(instance runtime.Object) error

BeginDelete logs the event

func (*LoggingRenderingListener) BeginPrune

func (l *LoggingRenderingListener) BeginPrune(all bool) error

BeginPrune logs the event and updates the logger to log with values all=true/false

func (*LoggingRenderingListener) BeginReconcile

func (l *LoggingRenderingListener) BeginReconcile(instance runtime.Object) error

BeginReconcile logs the event

func (*LoggingRenderingListener) BeginResource

func (l *LoggingRenderingListener) BeginResource(obj runtime.Object) (runtime.Object, error)

BeginResource logs the event and updates the logger to log with values resource=name, kind=kind, apiVersion=api-version

func (*LoggingRenderingListener) EndChart

func (l *LoggingRenderingListener) EndChart(chart string) error

EndChart logs the event and resets the logger to its previous state (i.e. removes the chart specific labels).

func (*LoggingRenderingListener) EndDelete

func (l *LoggingRenderingListener) EndDelete(instance runtime.Object, err error) error

EndDelete logs the event and any error that occurred

func (*LoggingRenderingListener) EndPrune

func (l *LoggingRenderingListener) EndPrune() error

EndPrune logs the event and resets the logger to its previous state (i.e. removes the all label).

func (*LoggingRenderingListener) EndReconcile

func (l *LoggingRenderingListener) EndReconcile(instance runtime.Object, err error) error

EndReconcile logs the event and any error that occurred

func (*LoggingRenderingListener) EndResource

func (l *LoggingRenderingListener) EndResource(obj runtime.Object) error

EndResource logs the event and resets the logger to its previous state (i.e. removes the resource specific labels).

func (*LoggingRenderingListener) RegisterReconciler

func (l *LoggingRenderingListener) RegisterReconciler(reconciler *HelmReconciler)

RegisterReconciler associates the HelmReconciler with the LoggingRenderingListener

func (*LoggingRenderingListener) ResourceCreated

func (l *LoggingRenderingListener) ResourceCreated(created runtime.Object) error

ResourceCreated logs the event

func (*LoggingRenderingListener) ResourceDeleted

func (l *LoggingRenderingListener) ResourceDeleted(deleted runtime.Object) error

ResourceDeleted logs the event

func (*LoggingRenderingListener) ResourceError

func (l *LoggingRenderingListener) ResourceError(obj runtime.Object, err error) error

ResourceError logs the event and the error

func (*LoggingRenderingListener) ResourceUpdated

func (l *LoggingRenderingListener) ResourceUpdated(updated runtime.Object, old runtime.Object) error

ResourceUpdated logs the event

type Patch

type Patch interface {
	// Apply applies the patch to object through the api server
	// the returned object is the updated resource
	Apply() (*unstructured.Unstructured, error)
}

Patch represents a "patch" for an object XXX: currently, this is internal to HelmReconciler

type PruningDetails

type PruningDetails interface {
	// GetOwnerLabels returns the labels applied to all resources managed by the operator.
	// These are used as label selectors when selecting resources managed by the operator (e.g. as part of pruning
	// operations).  A typical example might be:
	//
	// myoperator.example.com/owner-name=my-custom-resource
	// myoperator.example.com/owner-namespace=containing-namespace
	//
	GetOwnerLabels() map[string]string
	// GetOwnerAnnotations returns the annotations applied to all resources managed by the operator.  These annotations
	// are used to determine whether or not an object should be pruned, i.e. all objects selected using the owner labels
	// that don't have annotations with values matching these will be pruned.  A typical example might be:
	//
	// myoperator.example.com/owner-generation=5
	//
	// which would cause resources with a different generation value to be
	// pruned.  To avoid pruning derived resources (which typically inherit the parent's labels), the prune logic
	// verifies that the annotation keys exist.
	GetOwnerAnnotations() map[string]string
	// GetResourceTypes returns the types of resources managed by the operator.  These types are used when selecting
	// resources to be pruned.
	GetResourceTypes() (namespaced []schema.GroupVersionKind, nonNamespaced []schema.GroupVersionKind)
}

PruningDetails define the labels and annotations used to mark resources managed by the operator, as well as the resource types managed by the operator.

type ReconcilerListener

type ReconcilerListener interface {
	// RegisterReconciler is the callback function that allows the HelmReconciler to be registered.
	RegisterReconciler(reconciler *HelmReconciler)
}

ReconcilerListener is an interface that may be implemented by objects which require access to the HelmReconciler. These objects would typically require access to the kubernetes client or logger.

type RenderingCustomizer

type RenderingCustomizer interface {
	// Input returns the RenderingInput that should be used to rendering the charts.
	Input() RenderingInput
	// PruningDetails returns the details required to support pruning of obsolete resources.
	PruningDetails() PruningDetails
	// Listener returns the RenderingListener that should handle the rendering callbacks.
	Listener() RenderingListener
}

RenderingCustomizer encompasses all the customization details for a specific rendering invocation.

type RenderingCustomizerFactory

type RenderingCustomizerFactory interface {
	// NewCustomizer returns a new RenderingCustomizer for the specified object.
	NewCustomizer(obj runtime.Object) (RenderingCustomizer, error)
}

type RenderingInput

type RenderingInput interface {
	// GetChartPath returns the absolute path locating the chart to be rendered.
	GetChartPath() string
	// GetValues returns the values object used during rendering.
	GetValues() map[string]interface{}
	// GetTargetNamespace returns the target namespace which should be applied to namespaced resources
	// (i.e. used to set Release.Namespace)
	GetTargetNamespace() string
	// GetProcessingOrder is a hook which allows a user to specify the order in which the generated charts
	// should be applied.  manifests maps chart name to a list of manifests.  Examples of chart names:
	// istio, istio/charts/security, istio/charts/galley, etc.  Subcharts will have the form:
	// <main-chart-name>/charts/<subchart-name>
	GetProcessingOrder(manifests ChartManifestsMap) ([]string, error)
}

RenderingInput specifies the details used for rendering charts.

type RenderingListener

type RenderingListener interface {
	// BeginReconcile occurs when a reconciliation is started.  instance represents the object (custom resource)
	// being reconciled.  Reconciliation occurs when a custom resource is created or modified.
	BeginReconcile(instance runtime.Object) error
	// BeginDelete is similar to BeginReconcile, but applies to deletion of a custom resource.
	BeginDelete(instance runtime.Object) error
	// BeginChart occurs before processing manifests associated with a specific chart.
	// chart is the name of the chart being processed.
	// manifests is the list of manifests to be applied.
	// The returned list of manifest.Manifest objects are the manifests that will be applied.
	BeginChart(chart string, manifests []manifest.Manifest) ([]manifest.Manifest, error)
	// BeginResource occurs when a new resource is being processed.  This method allows users to programmatically
	// customize resources created by the charts.  Examples of modifications:  applying owner labels/annotations;
	// applying settings that are specific to the environment, e.g. URLs from Ingress/Service resources created from
	// other charts; etc.
	// obj represents a resource created from a manifest.
	// The returned runtime.Object is the object that will be reconciled (created/updated).
	BeginResource(obj runtime.Object) (runtime.Object, error)
	// ResourceCreated occurs after a resource has been created (i.e. client.Create(obj)).  This method allows users
	// to programmatically apply other details which are necessary as part of the object creation, e.g. updating
	// SecurityContextConstraints for a new ServiceAccount.
	// created is the object returned from the client.Create() call.
	ResourceCreated(created runtime.Object) error
	// ResourceUpdated occurs after a resource has been updated.  This method is similar to ResourceCreated, but applies
	// to client.Update().
	// updated represents the new state of the object
	// old represents the existing state of the object
	ResourceUpdated(updated, old runtime.Object) error
	// ResourceError occurs after a create/update/delete operation fails.
	// obj is the object on which the error occurred.
	// err is the error returned from the api server.
	ResourceError(obj runtime.Object, err error) error
	// EndResource represents the end of resource processing.  This is the counterpart to BeginResource.
	// obj is the resource whose processing has completed.
	EndResource(obj runtime.Object) error
	// EndChart represents the end of chart processing.  This is the counterpart to BeginChart.
	// chart is the name of the chart whose processing has completed.
	EndChart(chart string) error
	// BeginPrune represents the beginning of the pruning process.  Pruning occurs after all chart processing.
	// all indicates whether or not all resources are being pruned (i.e. a delete operation) or just out of sync
	// resources.
	BeginPrune(all bool) error
	// ResourceDeleted occurs after a resource has been deleted.  This method is similar to ResourceCreated, but applies
	// to client.Delete().  Like ResourceCreated, this method should be used to cleanup any programmatically applied
	// changes made when the object was created, e.g. removing a ServiceAccount from a SecurityContextConstraints.
	// deleted represents the object that was deleted.
	ResourceDeleted(deleted runtime.Object) error
	// EndPrune represents the end of the pruning process.
	EndPrune() error
	// EndDelete occurs after the deletion process has completed.
	// instance is the custom resource being deleted
	// err is any error that might have occurred during the deletion proecess
	EndDelete(instance runtime.Object, err error) error
	// EndReconcile occurs after reconciliation has completed.  It is similar to EndDelete, but applies to reconciliation.
	// instance is the custom resource being reconciled
	// err is any error that might have occurred during the reconciliation process.
	EndReconcile(instance runtime.Object, err error) error
}

RenderingListener is the main hook into the rendering process. The methods represent each stage in the rendering process.

func NewOwnerReferenceDecorator

func NewOwnerReferenceDecorator(instance runtime.Object) (RenderingListener, error)

NewOwnerReferenceDecorator creates a new OwnerReferenceDecorator that adds an OwnerReference, where applicable to rendered resources. instance is the owner (custom resource) of the rendered resources.

func NewPruningMarkingsDecorator

func NewPruningMarkingsDecorator(pruneDetails PruningDetails) RenderingListener

NewPruningMarkingsDecorator creates a new RenderingListener that applies PruningDetails to rendered resources. pruneDetails are the PruningDetails (owner labels and owner annotations) to be applied to the resources

type SimplePruningDetails

type SimplePruningDetails struct {
	// OwnerLabels to be added to all rendered resources.
	OwnerLabels map[string]string
	// OwnerAnnotations to be added to all rendered resources.
	OwnerAnnotations map[string]string
	// NamespacedResources rendered by these charts
	NamespacedResources []schema.GroupVersionKind
	// NonNamespacedResources rendered by these charts
	NonNamespacedResources []schema.GroupVersionKind
}

SimplePruningDetails is a helper to implement PruningDetails from a known set of labels, annotations, and resource types.

func (*SimplePruningDetails) GetOwnerAnnotations

func (m *SimplePruningDetails) GetOwnerAnnotations() map[string]string

GetOwnerAnnotations returns this.OwnerAnnotations

func (*SimplePruningDetails) GetOwnerLabels

func (m *SimplePruningDetails) GetOwnerLabels() map[string]string

GetOwnerLabels returns this.OwnerLabels

func (*SimplePruningDetails) GetResourceTypes

func (m *SimplePruningDetails) GetResourceTypes() (namespaced []schema.GroupVersionKind, nonNamespaced []schema.GroupVersionKind)

GetResourceTypes returns this.NamespacedResources and this.NonNamespacedResources

type SimpleRenderingCustomizer

type SimpleRenderingCustomizer struct {
	// InputValue represents the RenderingInput for this customizer
	InputValue RenderingInput
	// PruningDetailsValue represents the PruningDetails for this customizer
	PruningDetailsValue PruningDetails
	// ListenerValue represents the RenderingListener for this customizer
	ListenerValue RenderingListener
}

SimpleRenderingCustomizer provides the basics needed for a RenderingCustomizer composed of static instances.

func (*SimpleRenderingCustomizer) Input

func (*SimpleRenderingCustomizer) Listener

func (*SimpleRenderingCustomizer) PruningDetails

func (c *SimpleRenderingCustomizer) PruningDetails() PruningDetails

func (*SimpleRenderingCustomizer) RegisterReconciler

func (c *SimpleRenderingCustomizer) RegisterReconciler(reconciler *HelmReconciler)

Jump to

Keyboard shortcuts

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