Documentation ¶
Index ¶
- func ParseResource(data []byte) (*unstructured.Unstructured, error)
- type Client
- func (c *Client) ReadResourceFile(rfile string) ([]RawResource, error)
- func (c *Client) SetFunc(name string, f any)
- func (c *Client) SetFuncMap(funcMap template.FuncMap)
- func (c *Client) TemplateConfigFile(name string, data []byte) (string, error)
- func (c *Client) WriteResourceFile(wfile string, bs []byte) error
- type ProcessedResource
- type RawResource
- type Resource
- type ResourceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseResource ¶
func ParseResource(data []byte) (*unstructured.Unstructured, error)
ParseResource parses a single resource. This MUST already be broken up from other files using a triple hyphen separator.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client grants access to locate, read, and process k8s resource/manifest files.
func (*Client) ReadResourceFile ¶
func (c *Client) ReadResourceFile(rfile string) ([]RawResource, error)
ReadResourceFile reads a resource file and breaks it into parts by the triple hyphen separator. The parts are raw bytes. They may be in need of templating or otherwise incomplete. Empty parts (those consisting entirely of blank lines or comments) will be removed.
func (*Client) SetFunc ¶
SetFunc modifies the function map associated with the Client to replace or add another function to it.
func (*Client) SetFuncMap ¶ added in v0.1.0
SetFuncMap sets the function map associated with the Client to the provided map.
func (*Client) TemplateConfigFile ¶
TemplateConfigFile takes the given template string and templates the file as a configuration. It returns the output of the templating.
type ProcessedResource ¶
type ProcessedResource struct { Data interface{} ResourceOptions }
ProcessedResource represents any parsed typed or unstructured kubernetes resource that can be applied via SSA patch after being converted to unstructured with its ResourceOptions.
type RawResource ¶
type RawResource struct { Config []byte // The content of the configuration to apply. ResourceOptions }
RawResource encapsulates a configuration file with its ResourceOptions.
type Resource ¶
type Resource struct { Data *unstructured.Unstructured // The templated, parsed, and rewritten resource. ResourceOptions }
Resource represents a parsed and unstructured kubernetes resource that can be applied via SSA patch with its ResourceOptions.
func (*Resource) ProcessedResource ¶
func (r *Resource) ProcessedResource() ProcessedResource
ProcessedResource converts the Resource to a ProcessedResource without making any changes.
type ResourceOptions ¶
type ResourceOptions struct { Validate bool // Set by the ZZZ --validate option. NeedsRestart bool // Can be set by rewriters to trigger a rollout restart on a deployment }
ResourceOptions encapsulates operational options associated with a resource that modify how these libraries work with it.