Documentation
¶
Index ¶
- Constants
- func EqualPluginOperation(pluginOp1, pluginOp2 PluginOperation) bool
- func EqualPluginOperationList(pluginOps1, pluginOps2 []PluginOperation) bool
- func GetResourceTypeKey(resource unstructured.Unstructured) string
- func ParseOptionalFieldMapVal(sliceVal string) map[string]string
- func ParseOptionalFieldSliceVal(sliceVal string) []string
- func ReadResourceTypeFile(filename string) ([]unstructured.Unstructured, error)
- func SplitNewResourceToSkeletonAndPatch(resource unstructured.Unstructured) (unstructured.Unstructured, jsonpatch.Patch, error)
- func WriteResourceTypeFile(filename string, resources []unstructured.Unstructured) error
- type IgnoredOperation
- type Metadata
- type OptionalFields
- type PatchTarget
- type Plugin
- type PluginMetadata
- type PluginOperation
- type PluginRequest
- type PluginResponse
- type PluginRun
- type ResourceGroup
- type Runner
- type RunnerResponse
- type TransformArtifact
- type Version
Constants ¶
const ( RequestVersion = V1 ResponseVersion = V1 )
const ( // Metadata string is the constant string that will be used by the binary-pluigin helper and the cli helpers // To notice that MetadataString string = "METADATA" )
Variables ¶
This section is empty.
Functions ¶
func EqualPluginOperation ¶
func EqualPluginOperation(pluginOp1, pluginOp2 PluginOperation) bool
func EqualPluginOperationList ¶
func EqualPluginOperationList(pluginOps1, pluginOps2 []PluginOperation) bool
func GetResourceTypeKey ¶ added in v0.1.6
func GetResourceTypeKey(resource unstructured.Unstructured) string
GetResourceTypeKey returns the unique type key for grouping resources Format: "<kind>" for core resources, "<kind>.<group>" for non-core
func ReadResourceTypeFile ¶ added in v0.1.6
func ReadResourceTypeFile(filename string) ([]unstructured.Unstructured, error)
ReadResourceTypeFile reads a multi-doc YAML file and returns individual resources This is useful for reading output from previous stages in multi-stage pipeline
func SplitNewResourceToSkeletonAndPatch ¶ added in v0.1.6
func SplitNewResourceToSkeletonAndPatch(resource unstructured.Unstructured) (unstructured.Unstructured, jsonpatch.Patch, error)
SplitNewResourceToSkeletonAndPatch takes a complete resource generated by a plugin and splits it into a minimal skeleton and a RFC 6902 JSONPatch.
The skeleton contains only: apiVersion, kind, metadata.name, metadata.namespace. Everything else (labels, annotations, spec, status, ...) becomes "add" operations in the returned patch.
This allows new resources to follow the same skeleton + patches flow as transformed resources, keeping the stage directory structure consistent and transparent.
func WriteResourceTypeFile ¶ added in v0.1.6
func WriteResourceTypeFile(filename string, resources []unstructured.Unstructured) error
WriteResourceTypeFile writes a group of resources to a multi-doc YAML file Resources are separated by "---" separator as per YAML multi-doc format
Types ¶
type IgnoredOperation ¶ added in v0.1.6
type IgnoredOperation struct {
// Operation is the JSONPatch operation that was ignored
Operation jsonpatch.Operation
// Plugin is the name of the plugin that generated this operation
Plugin string
// Reason describes why the operation was ignored (e.g., "path-conflict-priority")
Reason string
// WinnerPlugin is the name of the plugin whose operation was selected instead
WinnerPlugin string
}
IgnoredOperation represents a JSONPatch operation that was discarded due to conflicts with higher priority plugins
type Metadata ¶
type Metadata interface {
Metadata() PluginMetadata
}
type OptionalFields ¶
type PatchTarget ¶ added in v0.1.6
type PatchTarget struct {
// Group is the API group (empty string for core resources)
Group string
// Version is the API version (e.g., "v1", "v1beta1")
Version string
// Kind is the resource kind (e.g., "Deployment", "Service")
Kind string
// Name is the resource name from metadata.name
Name string
// Namespace is the resource namespace from metadata.namespace (optional)
Namespace string
}
PatchTarget contains Kustomize patch target selector metadata derived from the resource's apiVersion, kind, and metadata
func DeriveTargetFromResource ¶ added in v0.1.6
func DeriveTargetFromResource(resource unstructured.Unstructured) PatchTarget
DeriveTargetFromResource extracts PatchTarget metadata from a Kubernetes resource
type PluginMetadata ¶
type PluginMetadata struct {
Name string `json:"name"`
Version string `json:"version"`
RequestVersion []Version `json:"requestVersion"`
ResponseVersion []Version `json:"responseVersion"`
OptionalFields []OptionalFields `json:"optionalFields,omitempty"`
}
type PluginOperation ¶
func PluginOperationsFromPatch ¶
func PluginOperationsFromPatch(pluginName string, patches jsonpatch.Patch) []PluginOperation
type PluginRequest ¶ added in v0.0.2
type PluginRequest struct {
unstructured.Unstructured `json:",inline"`
Extras map[string]string `json:"extras,omitempty"`
}
type PluginResponse ¶
type PluginResponse struct {
Version string `json:"version,omitempty"`
IsWhiteOut bool `json:"isWhiteOut,omitempty"`
Patches jsonpatch.Patch `json:"patches,omitempty"`
NewResources []unstructured.Unstructured `json:"newResources,omitempty"`
}
type PluginRun ¶
type PluginRun interface {
// Determine for a given resources what the plugin is deciding to do with this
Run(PluginRequest) (PluginResponse, error)
}
type ResourceGroup ¶ added in v0.1.6
type ResourceGroup struct {
// TypeKey is the unique identifier for this resource type
// Format: "<kind>" for core resources, "<kind>.<group>" for others
// Examples: "deployment", "service", "route.route.openshift.io"
TypeKey string
// Resources contains all resources of this type
Resources []unstructured.Unstructured
}
ResourceGroup represents resources grouped by type (kind + group) for multi-doc YAML file generation
func GroupResourcesByType ¶ added in v0.1.6
func GroupResourcesByType(resources []unstructured.Unstructured) []ResourceGroup
GroupResourcesByType groups resources by their type (kind + group) Resources are grouped into ResourceGroup structures for multi-doc YAML file generation
type Runner ¶
type Runner struct {
// This is where we need to put extra info
// This should include generic args to be passed to each Plugin
// This also needs to handle the options that it will need.
// TODO: Figure out options that the runner will need and implement here.
PluginPriorities map[string]int
OptionalFlags map[string]string
Log *logrus.Logger
}
func NewRunner ¶ added in v0.1.6
func NewRunner(logger *logrus.Logger, pluginPriorities map[string]int, optionalFlags map[string]string) *Runner
NewRunner creates a new Runner with the required logger. If logger is nil, a new default logger is created.
func (*Runner) Run ¶
func (r *Runner) Run(object unstructured.Unstructured, plugins []Plugin) (RunnerResponse, error)
type RunnerResponse ¶
type RunnerResponse struct {
TransformFile []byte
HaveWhiteOut bool
IgnoredPatches []byte
NewResources []unstructured.Unstructured
}
RunnerResponse will be responsble for TransformFile is a marshaled jsonpatch.Patch IgnoredPatches is a marshaled []PluginOperation
type TransformArtifact ¶ added in v0.1.6
type TransformArtifact struct {
// Resource is the original Kubernetes resource
Resource unstructured.Unstructured
// HaveWhiteOut indicates if this resource should be excluded from output
HaveWhiteOut bool
// Patches contains all JSONPatch operations to be applied
Patches jsonpatch.Patch
// IgnoredOps contains operations that were ignored due to conflicts
IgnoredOps []IgnoredOperation
// Target contains the Kustomize patch target metadata
Target PatchTarget
// PluginName is the name of the plugin that generated this artifact (for multi-stage)
PluginName string
}
TransformArtifact represents the transformation result for a single resource including patches, whiteout status, and metadata for Kustomize generation
Directories
¶
| Path | Synopsis |
|---|---|
|
examples/test/annotation
command
|
|
|
examples/test/whiteout-all
command
|
|
|
examples/test/whiteout-pods
command
|
|
|
internal
|
|