Documentation ¶
Overview ¶
Package manifests contains types and functionality around generating (rendering) the descriptors of the component's dependent resources. Most prominently, this includes the Generator interface, the KustomizeController and HelmController implementation, and logic to enhance existing generators.
Index ¶
- func ClientFromContext(ctx context.Context) (cluster.Client, error)
- func MergeMaps(x, y map[string]any) map[string]any
- func NewContextWithClient(ctx context.Context, client cluster.Client) context.Context
- func NewContextWithReconcilerName(ctx context.Context, reconcilerName string) context.Context
- func ReconcilerNameFromContext(ctx context.Context) (string, error)
- type DummyGenerator
- type Generator
- type HelmGenerator
- type KustomizeGenerator
- type ObjectTransformer
- type ParameterTransformer
- type TemplateParameterTransformer
- type TransformableGenerator
- func NewGenerator(generator Generator) TransformableGenerator
- func NewHelmGeneratorWithObjectTransformer(name string, fsys fs.FS, chartPath string, client client.Client, ...) (TransformableGenerator, error)
- func NewHelmGeneratorWithParameterTransformer(name string, fsys fs.FS, chartPath string, client client.Client, ...) (TransformableGenerator, error)
- func NewKustomizeGeneratorWithObjectTransformer(fsys fs.FS, kustomizationPath string, templateSuffix string, ...) (TransformableGenerator, error)
- func NewKustomizeGeneratorWithParameterTransformer(fsys fs.FS, kustomizationPath string, templateSuffix string, ...) (TransformableGenerator, error)
- func NewTransformableHelmGenerator(name string, fsys fs.FS, chartPath string, client client.Client, ...) (TransformableGenerator, error)
- func NewTransformableKustomizeGenerator(fsys fs.FS, kustomizationPath string, templateSuffix string, ...) (TransformableGenerator, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientFromContext ¶ added in v0.2.0
Retrieve client from given context.
func MergeMaps ¶
Deep-merge two maps with the usual logic and return the result. The first map (x) must be deeply JSON (i.e. consist deeply of JSON values only). The maps given as input will not be changed.
func NewContextWithClient ¶ added in v0.2.0
Create new context with client added as value.
func NewContextWithReconcilerName ¶ added in v0.2.0
Create new context with reconciler name added as value.
Types ¶
type DummyGenerator ¶
type DummyGenerator struct{}
DummyGenerator is a generator that does nothing.
func NewDummyGenerator ¶
func NewDummyGenerator() (*DummyGenerator, error)
Create a new DummyGenerator.
type Generator ¶
type Generator interface {
Generate(ctx context.Context, namespace string, name string, parameters types.Unstructurable) ([]client.Object, error)
}
Resource generator interface. When called from the reconciler, the arguments namespace and name will match the component's namespace and name or, if the component or its spec implement the PlacementConfiguration interface, the return values of the GetDeploymentNamespace(), GetDeploymentName() methods (if non-empty). The parameters argument will be assigned the return value of the component's GetSpec() method.
type HelmGenerator ¶
type HelmGenerator struct {
// contains filtered or unexported fields
}
HelmGenerator is a Generator implementation that basically renders a given Helm chart. A few restrictions apply to the provided Helm chart: it must not contain any subcharts, some template functions are not supported, some bultin variables are not supported, and hooks are processed in a slightly different fashion.
func NewHelmGenerator ¶
func NewHelmGenerator(name string, fsys fs.FS, chartPath string, client client.Client, discoveryClient discovery.DiscoveryInterface) (*HelmGenerator, error)
Create a new HelmGenerator. Deprecation warning: the parameters name, client and discoveryClient are ignored (can be passed as empty resp. nil) and will be removed in a future release; the according values will be retrieved from the context passed to Generate(). If fsys is nil, the local operating system filesystem will be used, and chartPath can be an absolute or relative path (in the latter case it will be considered relative to the current working directory). If fsys is non-nil, then chartPath should be a relative path; if an absolute path is supplied, it will be turned An empty chartPath will be treated like ".".
type KustomizeGenerator ¶
type KustomizeGenerator struct {
// contains filtered or unexported fields
}
KustomizeGenerator is a Generator implementation that basically renders a given Kustomization.
func NewKustomizeGenerator ¶
func NewKustomizeGenerator(fsys fs.FS, kustomizationPath string, templateSuffix string, client client.Client) (*KustomizeGenerator, error)
Create a new KustomizeGenerator. Deprecation warning: the parameter client is ignored (can be passed as nil) and will be removed in a future release; the according value will be retrieved from the context passed to Generate(). If fsys is nil, the local operating system filesystem will be used, and kustomizationPath can be an absolute or relative path (in the latter case it will be considered relative to the current working directory). If fsys is non-nil, then kustomizationPath should be a relative path; if an absolute path is supplied, it will be turned An empty kustomizationPath will be treated like ".".
type ObjectTransformer ¶
type ObjectTransformer interface {
TransformObjects(namespace string, name string, objects []client.Object) ([]client.Object, error)
}
Object transformer interface. Allows to manipulate the parameters returned by an existing generator.
type ParameterTransformer ¶
type ParameterTransformer interface {
TransformParameters(namespace string, name string, parameters types.Unstructurable) (types.Unstructurable, error)
}
Parameter transformer interface. Allows to manipulate the parameters passed to an existing generator.
type TemplateParameterTransformer ¶
type TemplateParameterTransformer struct {
// contains filtered or unexported fields
}
TemplateParameterTransformer allows to transform parameters through a given go template. The template can use all functions from the sprig library, plus toYaml, fromYaml, toJson, fromJson, required.
func NewTemplateParameterTransformer ¶
func NewTemplateParameterTransformer(fsys fs.FS, path string) (*TemplateParameterTransformer, error)
Create a new TemplateParameterTransformer (reading the template from the given fsys and path). If fsys is nil, the local OS filesystem will be used.
func (*TemplateParameterTransformer) TransformParameters ¶
func (t *TemplateParameterTransformer) TransformParameters(namespace string, name string, parameters types.Unstructurable) (types.Unstructurable, error)
Transform parameters.
type TransformableGenerator ¶
type TransformableGenerator interface { Generator WithParameterTransformer(transformer ParameterTransformer) TransformableGenerator WithObjectTransformer(transformer ObjectTransformer) TransformableGenerator }
Interface for generators that can be enhanced with parameter/object transformers.
func NewGenerator ¶
func NewGenerator(generator Generator) TransformableGenerator
Wrap a given Generator into a TransformableGenerator, to allow to attach further parameter or object transformers to it.
func NewHelmGeneratorWithObjectTransformer ¶
func NewHelmGeneratorWithObjectTransformer(name string, fsys fs.FS, chartPath string, client client.Client, discoveryClient discovery.DiscoveryInterface, transformer ObjectTransformer) (TransformableGenerator, error)
Create a new HelmGenerator with an ObjectTransformer attached (further transformers can be attached to the returned generator object). Deprecation warning: the parameters name, client and discoveryClient are ignored (can be passed as empty resp. nil) and will be removed in a future release.
func NewHelmGeneratorWithParameterTransformer ¶
func NewHelmGeneratorWithParameterTransformer(name string, fsys fs.FS, chartPath string, client client.Client, discoveryClient discovery.DiscoveryInterface, transformer ParameterTransformer) (TransformableGenerator, error)
Create a new HelmGenerator with a ParameterTransformer attached (further transformers can be attached to the returned generator object). Deprecation warning: the parameters name, client and discoveryClient are ignored (can be passed as empty resp. nil) and will be removed in a future release.
func NewKustomizeGeneratorWithObjectTransformer ¶
func NewKustomizeGeneratorWithObjectTransformer(fsys fs.FS, kustomizationPath string, templateSuffix string, client client.Client, transformer ObjectTransformer) (TransformableGenerator, error)
Create a new KustomizeGenerator with an ObjectTransformer attached (further transformers can be attached to the returned generator object). Deprecation warning: the parameter client is ignored (can be passed as nil) and will be removed in a future release.
func NewKustomizeGeneratorWithParameterTransformer ¶
func NewKustomizeGeneratorWithParameterTransformer(fsys fs.FS, kustomizationPath string, templateSuffix string, client client.Client, transformer ParameterTransformer) (TransformableGenerator, error)
Create a new KustomizeGenerator with a ParameterTransformer attached (further transformers can be attached to the returned generator object). Deprecation warning: the parameter client is ignored (can be passed as nil) and will be removed in a future release.
func NewTransformableHelmGenerator ¶ added in v0.1.2
func NewTransformableHelmGenerator(name string, fsys fs.FS, chartPath string, client client.Client, discoveryClient discovery.DiscoveryInterface) (TransformableGenerator, error)
Create a new HelmGenerator as TransformableGenerator. Deprecation warning: the parameters name, client and discoveryClient are ignored (can be passed as empty resp. nil) and will be removed in a future release.
func NewTransformableKustomizeGenerator ¶ added in v0.1.2
func NewTransformableKustomizeGenerator(fsys fs.FS, kustomizationPath string, templateSuffix string, client client.Client) (TransformableGenerator, error)
Create a new KustomizeGenerator as TransformableGenerator. Deprecation warning: the parameter client is ignored (can be passed as nil) and will be removed in a future release.