Documentation
¶
Index ¶
- Constants
- func AddResourcesTo(o any, opts *AddResourcesOptions) error
- func DataResourcesFromYaml(in []byte) (result []unstructured.Unstructured, err error)
- func JsonByteToRawExtension(jsonByte []byte) (runtime.RawExtension, error)
- func JsonByteToUnstructured(jsonByte []byte) (*unstructured.Unstructured, error)
- func ObjToRawExtension(obj interface{}) (runtime.RawExtension, error)
- func SetData(data any, path string, o any, overwrite bool) error
- func UnstructuredToRawExtension(obj *unstructured.Unstructured) (runtime.RawExtension, error)
- type AddResourcesOptions
- type AddResourcesResult
- type DesiredMatch
- type Resource
- type ResourceList
- type Target
Constants ¶
const ( AnnotationKeyReady = "krm.kcl.dev/ready" MetaApiVersion = "meta.krm.kcl.dev/v1alpha1" )
Variables ¶
This section is empty.
Functions ¶
func AddResourcesTo ¶
func AddResourcesTo(o any, opts *AddResourcesOptions) error
AddResourcesTo adds the given data to any allowed object passed Will return err if the object is not of a supported type For 'desired' composed resources, the Basename is used for the resource name For 'xr' resources, the Basename must match the xr name For 'existing' resources, the Basename must match the resource name
func DataResourcesFromYaml ¶
func DataResourcesFromYaml(in []byte) (result []unstructured.Unstructured, err error)
DataResourcesFromYaml returns the manifests list from the YAML stream data.
func JsonByteToRawExtension ¶ added in v0.5.0
func JsonByteToRawExtension(jsonByte []byte) (runtime.RawExtension, error)
func JsonByteToUnstructured ¶
func JsonByteToUnstructured(jsonByte []byte) (*unstructured.Unstructured, error)
func ObjToRawExtension ¶
func ObjToRawExtension(obj interface{}) (runtime.RawExtension, error)
func SetData ¶
SetData is a recursive function that is intended to build a kube fieldpath valid JSONPath(s) of the given object, it will then copy from 'data' at the given path to the passed o object - at the same path, overwrite defines if this function should be allowed to overwrite values or not, if not return an conflicting value error
If the resource to write to 'o' contains a nil .Resource, setData will return an error It is expected that the resource is created via composed.New() or composite.New() prior to calling setData
func UnstructuredToRawExtension ¶
func UnstructuredToRawExtension(obj *unstructured.Unstructured) (runtime.RawExtension, error)
Types ¶
type AddResourcesOptions ¶
type AddResourcesOptions struct { Basename string Data []unstructured.Unstructured Overwrite bool }
type AddResourcesResult ¶
func ProcessResources ¶
func ProcessResources(dxr *resource.Composite, oxr *resource.Composite, desired map[resource.Name]*resource.DesiredComposed, observed map[resource.Name]resource.ObservedComposed, target Target, resources ResourceList, opts *AddResourcesOptions) (AddResourcesResult, error)
type DesiredMatch ¶
type DesiredMatch map[*resource.DesiredComposed][]map[string]interface{}
DesiredMatch matches a list of data to apply to a desired resource This is used when targeting PatchDesired resources
func MatchResources ¶
func MatchResources(desired map[resource.Name]*resource.DesiredComposed, data []unstructured.Unstructured) (DesiredMatch, error)
MatchResources finds and associates the data to the desired resource The length of the passed data should match the total count of desired match data
type Resource ¶
type Resource struct { // Name is a unique identifier for this entry in a ResourceList Name string `json:"name"` Base unstructured.Unstructured `json:"base,omitempty"` }
type ResourceList ¶
type ResourceList []Resource
type Target ¶
type Target string
const ( // PatchDesired targets existing Resources on the Desired XR PatchDesired Target = "PatchDesired" // PatchResources targets existing KCLInput.spec.Resources // These resources are then created similar to the Resources target PatchResources Target = "PatchResources" // Resources creates new resources that are added to the DesiredComposed Resources Resources Target = "Resources" // XR targets the existing Observed XR itself XR Target = "XR" // Default targets the existing all resources including XR, Desired XR, // spec.Resources and DesiredComposed Resources. Default Target = "Default" )