Documentation
¶
Index ¶
- Variables
- 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 LogError(logger logr.Logger, err error)
- 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)
Constants ¶
This section is empty.
Variables ¶
var KindToKeyName = map[string]string{
"proxy": "proxy_key",
"cluster": "cluster_key",
"route": "route_key",
"domain": "domain_key",
"listener": "listener_key",
"catalogservice": "service_id",
}
KindToKeyName is an internal operator data structure that is utilized to determine the id of an object given what kind of "type" it is.
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
Types ¶
type Config ¶ added in v0.9.0
type Config struct { // Flags Spire bool `json:"spire"` DeploySpire bool `json:"deploy_spire"` AutoCopyImagePullSecret bool `json:"auto_copy_image_pull_secret"` // Values ClusterIngressName string `json:"cluster_ingress_name"` OperatorNamespace string `json:"operator_namespace"` }
Config represents the `config` struct from the operator CUE in inputs.cue
type Defaults ¶ added in v0.9.0
type Defaults struct { SidecarList []string `json:"sidecar_list"` ProxyPortName string `json:"proxy_port_name"` RedisHost string `json:"redis_host"` RedisPort int `json:"redis_port"` RedisDB int `json:"redis_db"` RedisUsername string `json:"redis_username"` RedisPassword string `json:"redis_password"` GitOpsStateKeyGM string `json:"gitops_state_key_gm"` GitOpsStateKeyK8s string `json:"gitops_state_key_k8s"` GitOpsStateKeySidecar string `json:"gitops_state_key_sidecar"` Spire spire `json:"spire"` }
Defaults contains select fields from the `defaults` block of the 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 greymatter 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
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 greymatter 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