Documentation
¶
Index ¶
- func CreateFieldMutator(config FieldMutatorConfig) *fieldMutator
- func CreateNamePrefixPlugin(config NamePrefixConfig) *namePrefixTransformer
- func CreateNamespacePlugin(namespace string) (*namespacePlugin, error)
- func ValidateK8sLabelName(name string) error
- type FieldMapping
- type FieldMutatorConfig
- type NamePrefixConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFieldMutator ¶
func CreateFieldMutator(config FieldMutatorConfig) *fieldMutator
CreateFieldMutator creates a mutator plugin that sets a value for a given field.
func CreateNamePrefixPlugin ¶
func CreateNamePrefixPlugin(config NamePrefixConfig) *namePrefixTransformer
CreateNamePrefixPlugin creates a transformer plugin that adds a prefix to resource names. Acts as a constructor, ensuring the plugin is properly initialized with its configuration.
func CreateNamespacePlugin ¶
CreateNamespacePlugin creates a new namespace plugin.
func ValidateK8sLabelName ¶
ValidateK8sLabelName uses the strictest naming rule (for Namespaces) to ensure the provided name string is valid for any given Resource.
Types ¶
type FieldMapping ¶
type FieldMapping struct {
// SourceValue is the value to copy to the target field.
SourceValue any `json:"sourceValue"`
// DefaultValue is the value to use if SourceValue is empty.
// This provides a fallback mechanism, making transformations more robust.
DefaultValue any `json:"defaultValue,omitempty"`
// TargetField is the JSON Pointer path to the field in the target object.
// Uses RFC 6901 JSON Pointer syntax like "/spec/ports/0/port"
// Special characters in field names are escaped: ~0 for ~ and ~1 for /
// Example: "/spec/selector/app.kubernetes.io~1instance"
TargetField string `json:"targetField"`
// TargetKind is the kind of resource to apply the transformation to.
TargetKind string `json:"targetKind"`
// CreateIfNotExists will create the target field and any intermediate
// map structures if they don't exist in the target resource.
CreateIfNotExists bool `json:"createIfNotExists,omitempty"`
}
FieldMapping defines a single field mapping.
type FieldMutatorConfig ¶
type FieldMutatorConfig struct {
// Mappings is a list of field mappings to apply.
Mappings []FieldMapping `json:"mappings"`
}
FieldMutatorConfig is a collection of FieldMappings.
type NamePrefixConfig ¶
type NamePrefixConfig struct {
// Prefix to add to resource names.
Prefix string
// IncludeKinds specifies which resource kinds to apply the prefix to.
// If empty, the prefix is applied to all resource kinds not specified in ExcludeKinds.
IncludeKinds []string
// ExcludeKinds specifies which resource kinds to exclude from prefixing.
// This list takes precedence over IncludeKinds; if a kind is in both lists,
// it will be excluded.
ExcludeKinds []string
}
NamePrefixConfig holds configuration for the name prefix plugin.
Click to show internal directories.
Click to hide internal directories.