Documentation
¶
Index ¶
- Constants
- Variables
- func BoolPtr(b bool) *bool
- func ContainsString(slice []string, s string) bool
- func ContextWithTimeout(ctx context.Context, timeoutSeconds int64) (context.Context, context.CancelFunc)
- func EncodeAndFillPath(ctx *cue.Context, value cue.Value, parsePath string, valuePath string, ...) (cue.Value, error)
- func GetEnvOrDefault(key, defaultValue string) string
- func GetPVCName(kode *kodev1alpha1.Kode) string
- func Int32Ptr(i int32) *int32
- func Int64Ptr(i int64) *int64
- func IsNotFound(err error) bool
- func JoinErrors(errs ...error) error
- func LogObject(log logr.Logger, obj client.Object, msg string)
- func MaskEnvVars(envs []corev1.EnvVar) []corev1.EnvVar
- func MaskSensitiveValue(s string) string
- func MergeLabels(labelsSlice ...map[string]string) map[string]string
- func NamespacedName(namespace string, name string) types.NamespacedName
- func RemoveString(slice []string, s string) []string
- func StringPtr(s string) *string
- type BootstrapConfigOptions
- type KodeResourcesConfig
- type TemplateNotFoundError
- type Templates
Constants ¶
const ( // General constants OperatorName = "kode-operator" FinalizerName = "kode.jacero.io/finalizer" PVCFinalizerName = "kode.jacero.io/pvc-finalizer" // Resource-related constants DefaultNamespace = "default" KodeVolumeStorageName = "kode-storage" DefaultLocalServicePort = 3000 // Container-related constants EnvoyProxyContainerName = "envoy-proxy" EnvoyProxyRunAsUser = 1111 ProxyInitContainerName = "proxy-init" ProxyInitContainerImage = "openpolicyagent/proxy_init:v8" BasicAuthContainerPort = 9001 // Basic Auth-related constants BasicAuthContainerImage = "ghcr.io/emil-jacero/grpc-basic-auth:latest" BasicAuthContainerName = "basic-auth-service" // Time-related constants ReconcileTimeout = 1 * time.Minute RequeueInterval = 10 * time.Second DefaultInactiveAfterSeconds = 600 DefaultRecycleAfterSeconds = 28800 // Label keys LabelAppName = "app.kubernetes.io/name" LabelManagedBy = "app.kubernetes.io/managed-by" LabelKodeName = "kode.jacero.io/name" // Annotation keys AnnotationLastUpdated = "kode.jacero.io/last-updated" // Status condition types ConditionTypeCreated = "Created" ConditionTypeReady = "Ready" ConditionTypeRecycled = "Recycled" ConditionTypeInactive = "Inactive" ConditionTypeError = "Error" // Default values DefaultUser = "abc" DefaultHome = "/config" DefaultWorkspace = "workspace" DefaultStorageSize = "1Gi" // Environment variable names EnvVarPassword = "PASSWORD" EnvVarUser = "USER" EnvVarHome = "HOME" EnvVarPUID = "PUID" EnvVarPGID = "PGID" EnvVarTZ = "TZ" // Validation constants MinPasswordLength = 8 MinUsernameLength = 3 MaxUsernameLength = 256 )
Variables ¶
var ( // DefaultLabels are the base labels added to all resources created by the operator DefaultLabels = map[string]string{ LabelManagedBy: OperatorName, } // DefaultAccessModes are the default access modes for PersistentVolumeClaims DefaultAccessModes = []corev1.PersistentVolumeAccessMode{ corev1.ReadWriteOnce, } )
Functions ¶
func ContainsString ¶
checks if a string slice contains a specific string
func ContextWithTimeout ¶
func ContextWithTimeout(ctx context.Context, timeoutSeconds int64) (context.Context, context.CancelFunc)
wraps a context with a timeout
func EncodeAndFillPath ¶
func EncodeAndFillPath(ctx *cue.Context, value cue.Value, parsePath string, valuePath string, schema string, data interface{}) (cue.Value, error)
EncodeAndFillPath encodes a data structure, fills it into a CUE value at a specified path, and validates the result The ctx is the CUE context The value is the CUE value to fill The parsePath is used to parse the schema The valuePath is used to fill the data structure into the CUE value The schema is used to validate the data structure The data is the data structure to encode and fill The function returns the updated CUE value and nil if successful If an error occurs, the function returns the original CUE value and the error
func GetEnvOrDefault ¶
gets an environment variable or returns a default value
func GetPVCName ¶
func GetPVCName(kode *kodev1alpha1.Kode) string
returns the name of the PersistentVolumeClaim for the Kode instance
func MaskEnvVars ¶
masks sensitive environment variables
func MergeLabels ¶
merges multiple sets of labels
func NamespacedName ¶
func NamespacedName(namespace string, name string) types.NamespacedName
creates a types.NamespacedName from a namespace and name
func RemoveString ¶
removes a string from a slice of strings
Types ¶
type BootstrapConfigOptions ¶
type BootstrapConfigOptions struct { HTTPFilters []kodev1alpha1.HTTPFilter Clusters []kodev1alpha1.Cluster LocalPort int32 ExternalPort int32 }
BootstrapConfigOptions contains options for generating Envoy bootstrap config
type KodeResourcesConfig ¶
type KodeResourcesConfig struct { Kode kodev1alpha1.Kode Templates Templates UserInitPlugins []kodev1alpha1.InitPluginSpec TemplateInitPlugins []kodev1alpha1.InitPluginSpec Labels map[string]string LocalServicePort int32 ExternalServicePort int32 }
KodeResourcesConfig holds configuration for Kode resources
type TemplateNotFoundError ¶
type TemplateNotFoundError struct { NamespacedName types.NamespacedName Kind string }
func (*TemplateNotFoundError) Error ¶
func (e *TemplateNotFoundError) Error() string
type Templates ¶
type Templates struct { KodeTemplate *kodev1alpha1.SharedKodeTemplateSpec EnvoyProxyConfig *kodev1alpha1.SharedEnvoyProxyConfigSpec KodeTemplateName string KodeTemplateNamespace string EnvoyProxyConfigName string EnvoyProxyConfigNamespace string }
Templates holds the fetched template configurations