@@ -19,6 +19,7 @@ package v1beta1
1919import (
2020 "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2121 "github.com/openstack-k8s-operators/lib-common/modules/common/util"
22+ "k8s.io/apimachinery/pkg/api/resource"
2223 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2324)
2425
@@ -48,6 +49,18 @@ const (
4849 MaxTokensForResponseDefault = 2048
4950)
5051
52+ // DatabaseSpec defines configuration for persistent PostgreSQL storage.
53+ type DatabaseSpec struct {
54+ // +kubebuilder:validation:Optional
55+ // Size of the PersistentVolumeClaim for PostgreSQL data. Defaults to 1Gi.
56+ Size resource.Quantity `json:"size,omitempty"`
57+
58+ // +kubebuilder:validation:Optional
59+ // StorageClass name for the PersistentVolumeClaim. If omitted, the cluster's
60+ // default StorageClass is used.
61+ Class string `json:"class,omitempty"`
62+ }
63+
5164// OpenStackLightspeedSpec defines the desired state of OpenStackLightspeed
5265type OpenStackLightspeedSpec struct {
5366 OpenStackLightspeedCore `json:",inline"`
@@ -65,6 +78,12 @@ type OpenStackLightspeedSpec struct {
6578 // Allows forcing a specific OCP version instead of auto-detection.
6679 // Format should be like "4.15", "4.16", etc.
6780 OCPRAGVersionOverride string `json:"ocpVersionOverride,omitempty"`
81+
82+ // +kubebuilder:validation:Optional
83+ // Database configures persistent storage for PostgreSQL data.
84+ // When omitted, an emptyDir volume is used (data is lost on pod reschedule).
85+ // When set, a PersistentVolumeClaim is created and mounted.
86+ Database * DatabaseSpec `json:"database,omitempty"`
6887}
6988
7089// OpenStackLightspeedCore defines the desired state of OpenStackLightspeed
@@ -154,6 +173,7 @@ type OpenStackLightspeedStatus struct {
154173// +operator-sdk:csv:customresourcedefinitions:resources={{ServiceAccount,v1,lightspeed-app-server}}
155174// +operator-sdk:csv:customresourcedefinitions:resources={{NetworkPolicy,v1,lightspeed-app-server}}
156175// +operator-sdk:csv:customresourcedefinitions:resources={{NetworkPolicy,v1,lightspeed-postgres-server}}
176+ // +operator-sdk:csv:customresourcedefinitions:resources={{PersistentVolumeClaim,v1,openstack-lightspeed-data}}
157177// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterRole,v1,lightspeed-app-server-sar-role}}
158178// +operator-sdk:csv:customresourcedefinitions:resources={{ClusterRoleBinding,v1,lightspeed-app-server-sar-role-binding}}
159179// +operator-sdk:csv:customresourcedefinitions:resources={{Subscription,v1alpha1}}
0 commit comments