@@ -21,116 +21,85 @@ import (
2121 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222)
2323
24- // ServiceConfig holds all service configuration about KvCache public facing service
25- type ServiceConfig struct {
24+ // ServiceSpec holds all service configuration about KvCache public facing service
25+ type ServiceSpec struct {
2626 // Type defines the type of service (e.g., ClusterIP, NodePort, LoadBalancer).
27- // +kubebuilder:validation:Optional
2827 // +kubebuilder:default:="ClusterIP"
2928 Type corev1.ServiceType `json:"type,omitempty"`
3029
31- // service port
32- // +kubebuilder:validation:Optional
33- // +kubebuilder:default:=9600
34- Port int32 `json:"port,omitempty"`
35-
36- // NodePort specifies the port on each node on which this service is exposed when using NodePort type.
37- // +kubebuilder:validation:Optional
38- NodePort * int32 `json:"nodePort,omitempty"`
30+ // Ports defines the list of exposed ports
31+ // +kubebuilder:validation:MinItems=1
32+ Ports []corev1.ServicePort `json:"ports"`
3933}
4034
41- // MetadataConfig holds the configuration about the kv cache metadata service
42- type MetadataConfig struct {
43- Redis * RedisConfig `json:"redis,omitempty"`
44- Etcd * EtcdConfig `json:"etcd,omitempty"`
45- }
35+ // ExternalConnectionConfig holds config for connecting to external metadata service
36+ type ExternalConnectionConfig struct {
37+ // Address to connect to (host:port)
38+ Address string `json:"address,omitempty"`
4639
47- // RedisConfig provides the configuration fields for deploying Redis.
48- type RedisConfig struct {
49- Image string `json:"image"`
50- Replicas int32 `json:"replicas"`
51- Resources corev1.ResourceRequirements `json:"resources,omitempty"`
52- Storage * MetadataStorage `json:"storage,omitempty"`
40+ // Optional secret reference for password or credential
41+ PasswordSecretRef string `json:"passwordSecretRef,omitempty"`
5342}
5443
55- // EtcdConfig provides the configuration fields for deploying etcd.
56- type EtcdConfig struct {
57- Image string `json:"image"`
58- // +kubebuilder:validation:Optional
59- // +kubebuilder:default:=1
60- Replicas int32 `json:"replicas"`
61- Resources corev1.ResourceRequirements `json:"resources,omitempty"`
62- Storage * MetadataStorage `json:"storage,omitempty"`
44+ // MetadataConfig provides the configuration fields for deploying Redis.
45+ type MetadataConfig struct {
46+ ExternalConnection * ExternalConnectionConfig `json:"externalConnection,omitempty"`
47+ Runtime * RuntimeSpec `json:"runtime,omitempty"`
6348}
6449
65- // MetadataStorage configures the persistent storage used by the metadata service.
66- type MetadataStorage struct {
67- Size string `json:"size"`
50+ // MetadataSpec holds deployment or external connection config for metadata services
51+ type MetadataSpec struct {
52+ Redis * MetadataConfig `json:"redis,omitempty"`
53+ Etcd * MetadataConfig `json:"etcd,omitempty"`
6854}
6955
70- type CacheSpec struct {
56+ type RuntimeSpec struct {
7157 // Replicas is the number of kvcache pods to deploy
7258 // +kubebuilder:validation:Optional
73- // +kubebuilder:default:=3
74- Replicas int `json:"replicas,omitempty"`
59+ // +kubebuilder:default:=1
60+ Replicas int32 `json:"replicas,omitempty"`
7561
7662 // represent the kvcache's image
77- // +kubebuilder:validation:Optional
78- // +kubebuilder:default:="aibrix/kvcache:20241120"
63+ // +kubebuilder:validation:Required
7964 Image string `json:"image,omitempty"`
8065
8166 // the policy about pulling image
8267 // +kubebuilder:validation:Optional
8368 // +kubebuilder:default:="IfNotPresent"
8469 ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
8570
86- // shared memory size for kvcache
87- // +kubebuilder:validation:Optional
88- // +kubebuilder:default:=""
89- SharedMemorySize string `json:"sharedMemorySize,omitempty"`
90-
9171 // kvcache environment configuration
9272 // +kubebuilder:validation:Optional
9373 // +kubebuilder:default:={}
9474 Env []corev1.EnvVar `json:"env,omitempty"`
9575
96- // the memory resources of kvcache container
76+ // the resources of kvcache container
9777 // +kubebuilder:validation:Optional
98- // +kubebuilder:default:="2Gi"
99- Memory string `json:"memory,omitempty"`
100-
101- // the cpu resources of kvcache container
102- // +kubebuilder:validation:Optional
103- // +kubebuilder:default:="1"
104- CPU string `json:"cpu,omitempty"`
78+ Resources corev1.ResourceRequirements `json:"resources,omitempty"`
10579}
10680
10781// KVCacheSpec defines the desired state of KVCache
10882type KVCacheSpec struct {
109- // Replicas is the number of kv cache pods to deploy
110- // +kubebuilder:validation:Required
111- // +kubebuilder:default:=1
112- Replicas int32 `json:"replicas,omitempty"`
113-
114- // EtcdReplicas describe the etcd replicas
115- // +kubebuilder:validation:Optional
116- // +kubebuilder:default:=1
117- EtcdReplicas int32 `json:"etcdReplicas,omitempty"`
83+ // +kubebuilder:default:=distributed
84+ Mode string `json:"mode,omitempty"` // centralized | distributed
11885
11986 // Metadata configuration for kv cache service
12087 // +kubebuilder:validation:Optional
121- // +kubebuilder:default:={etcd: {image: "", replicas: 1, storage: {size: "10Gi"}}}
122- Metadata * MetadataConfig `json:"metadata,omitempty"`
88+ Metadata * MetadataSpec `json:"metadata,omitempty"`
12389
12490 // kvcache dataplane container configuration
12591 // +kubebuilder:validation:Optional
12692 //nolint: lll
12793 // +kubebuilder:default:={image: "aibrix/kvcache:20241120", imagePullPolicy: "IfNotPresent"}
128- Cache CacheSpec `json:"cacheSpec,omitempty"`
94+ Cache RuntimeSpec `json:"cache,omitempty"`
95+
96+ // kvcache watcher pod for member registration
97+ // +kubebuilder:validation:Optional
98+ Watcher * RuntimeSpec `json:"watcher,omitempty"`
12999
130100 // cache's service
131101 // +kubebuilder:validation:Optional
132- // +kubebuilder:default:={type: "ClusterIP", port: 9600}
133- Service ServiceConfig `json:"service,omitempty"`
102+ Service ServiceSpec `json:"service,omitempty"`
134103}
135104
136105// KVCacheStatus defines the observed state of KVCache
0 commit comments