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) ExtractConfigAndDefaults() (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) UnifyAndExtractSidecar(clusterLabel string) (container corev1.Container, volumes []corev1.Volume, err error)
- func (operatorCUE *OperatorCUE) UnifyAndExtractSidecarConfig(name string, port int, sidecarList []string) (configObjects []json.RawMessage, kinds []string, err error)
- func (operatorCUE *OperatorCUE) UnifyWithMesh(mesh *v1alpha1.Mesh)
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 Defaults ¶ added in v0.9.0
type Defaults struct {
RedisSpireSubjects []string `json:"redis_spire_subjects"`
}
Defaults represents select keys from the `defaults` struct 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)
LoadAll loads the provided CUE for configuring the operator into an OperatorCUE and a Mesh
func (*OperatorCUE) ExtractConfigAndDefaults ¶
func (operatorCUE *OperatorCUE) ExtractConfigAndDefaults() (Config, Defaults)
ExtractConfigAndDefaults pulls the values from the CUE into Go Config and Defaults structs 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) 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, sidecarList []string) (configObjects []json.RawMessage, kinds []string, err error)
UnifyAndExtractSidecarConfig unifies a name, port, and sidecarList (a list of *all sidecars that need an egress to Redis for health checks*) with the Grey Matter sidecar condfiguration CUE for injected sidecars, and returns those configuration objects, along with their kinds (e.g., listener, cluster, etc.)
func (*OperatorCUE) UnifyWithMesh ¶ added in v0.9.0
func (operatorCUE *OperatorCUE) UnifyWithMesh(mesh *v1alpha1.Mesh)
UnifyWithMesh unifies the operatorCUE with a Mesh CR to fill in values