Documentation
¶
Index ¶
- func Diff(a, b cue.Value)
- func Extract(v cue.Value, s interface{}) error
- func ExtractAndTypeK8sManifestObjects(manifests []json.RawMessage) (manifestObjects []client.Object)
- func FromStrings(ss ...string) cue.Value
- func FromStruct(name string, s interface{}) (cue.Value, error)
- func IdentifyGMConfigObjects(rawObjects []json.RawMessage) (kinds []string)
- func Interfaces(kvs map[string]interface{}) cue.Value
- func LogError(logger logr.Logger, err error)
- func StringSlices(kvs map[string][]string) cue.Value
- func Strings(kvs map[string]string) cue.Value
- type Config
- type Defaults
- type OperatorCUE
- func (operatorCUE *OperatorCUE) ExtractConfig() (Config, Defaults)
- func (operatorCUE *OperatorCUE) ExtractCoreK8sManifests() (manifestObjects []client.Object, err error)
- func (operatorCUE *OperatorCUE) ExtractCoreMeshConfigs() (meshConfigs []json.RawMessage, kinds []string, err error)
- func (operatorCUE *OperatorCUE) ExtractRedisListener() (configObject json.RawMessage, err error)
- func (operatorCUE *OperatorCUE) TempGMValueUnifiedWithDefaults(defaults Defaults) (OperatorCUE, error)
- func (operatorCUE *OperatorCUE) UnifyAndExtractSidecar(clusterLabel string) (container corev1.Container, volumes []corev1.Volume, err error)
- func (operatorCUE *OperatorCUE) UnifyAndExtractSidecarConfig(name string, port int) (configObjects []json.RawMessage, kinds []string, err error)
- func (operatorCUE *OperatorCUE) UnifyWithMesh(mesh *v1alpha1.Mesh) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Extract ¶ added in v0.9.0
Extract pulls values out of CUE and encodes them into a Go struct with JSON tags.
func ExtractAndTypeK8sManifestObjects ¶ added in v0.9.0
func ExtractAndTypeK8sManifestObjects(manifests []json.RawMessage) (manifestObjects []client.Object)
ExtractAndTypeK8sManifestObjects takes a list of raw k8s manifest objects, determines their types, and unmarshals each one into an object of the correct type.
func FromStrings ¶ added in v0.9.0
FromStrings creates a cue.Value from string arguments.
func FromStruct ¶ added in v0.9.0
FromStruct creates a nested cue.Value from a Go struct. The new cue.Value will have a single field from name, which will contain the struct.
func IdentifyGMConfigObjects ¶ added in v0.9.0
func IdentifyGMConfigObjects(rawObjects []json.RawMessage) (kinds []string)
IdentifyGMConfigObjects takes a list of raw objects and identifies them as particular GreyMatter config object types
func Interfaces ¶ added in v0.9.0
StringSlices creates a cue.Value from fields defined in a map[string]interface{}. Supported Cue builtin types are bool, number, and struct.
func LogError ¶ added in v0.9.0
LogError logs errors that may or may not contain a list of cue/errors.Error. If the error provided is not a cue/errors.Error, a plain error is logged.
func StringSlices ¶ added in v0.9.0
StringSlices creates a cue.Value from fields defined in a map[string][]string.
Types ¶
type Config ¶ added in v0.9.0
type Config struct {
// Flags
Spire bool `json:"spire"`
AutoApplyMesh bool `json:"auto_apply_mesh"`
GenerateWebhookCerts bool `json:"generate_webhook_certs"`
// Values
ClusterIngressName string `json:"cluster_ingress_name"`
}
Config represents the `config` struct from the operator CUE in inputs.cue
type OperatorCUE ¶ added in v0.9.0
type OperatorCUE struct {
// cue.Value for all of k8s/outputs containing k8s manifest objects
K8s cue.Value
// cue.Value for all of gm/outputs containing Grey Matter config objects
GM cue.Value
}
OperatorCUE holds the two top-level cue.Values that configure the operator, according to the major split between K8s and GM configuration
func LoadAll ¶ added in v0.9.0
func LoadAll(cuemoduleRoot string) (*OperatorCUE, *v1alpha1.Mesh, error)
LoadAll loads the provided CUE for configuring the operator into an OperatorCUE and a Mesh
func (*OperatorCUE) ExtractConfig ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) ExtractConfig() (Config, Defaults)
ExtractConfig pulls the values from the CUE into the Config struct in Go for use in various places in the operator
func (*OperatorCUE) ExtractCoreK8sManifests ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) ExtractCoreK8sManifests() (manifestObjects []client.Object, err error)
ExtractCoreK8sManifests extracts the K8s manifests for a mesh from the top-level array in the k8s/outputs/EXTRACTME.cue
func (*OperatorCUE) ExtractCoreMeshConfigs ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) ExtractCoreMeshConfigs() (meshConfigs []json.RawMessage, kinds []string, err error)
ExtractCoreMeshConfigs extracts the GM config objects for a mesh from the top-level array in the gm/outputs/EXTRACTME.cue
func (*OperatorCUE) ExtractRedisListener ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) ExtractRedisListener() (configObject json.RawMessage, err error)
ExtractRedisListener returns the listener object for the redis listener with spire subjects set. Assumes unification has already happened to insert the correct sidecarList
func (*OperatorCUE) TempGMValueUnifiedWithDefaults ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) TempGMValueUnifiedWithDefaults(defaults Defaults) (OperatorCUE, error)
func (*OperatorCUE) UnifyAndExtractSidecar ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) UnifyAndExtractSidecar(clusterLabel string) (container corev1.Container, volumes []corev1.Volume, err error)
UnifyAndExtractSidecar unifies the cluster meant for a deployment with the CUE for a to-be-injected sidecar, and extracts the K8s manifest components to be injected
func (*OperatorCUE) UnifyAndExtractSidecarConfig ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) UnifyAndExtractSidecarConfig(name string, port int) (configObjects []json.RawMessage, kinds []string, err error)
UnifyAndExtractSidecarConfig unifies a name and port with the Grey Matter sidecar configuration CUE for injected sidecars, and returns those configuration objects, along with their kinds (e.g., listener, cluster, etc.) It also extracts the special redis_listener object. NB: This method expects that the embedded Mesh in the CUE has already been updated with a status.sidecar_list for that redis_listener
func (*OperatorCUE) UnifyWithMesh ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) UnifyWithMesh(mesh *v1alpha1.Mesh) error
UnifyWithMesh unifies the operatorCUE with a Mesh CR to fill in values