Documentation
¶
Overview ¶
Package kubernetes implements the database store using Kubernetes resources.
Index ¶
- func NewClient(kubeconfig string) (kubernetes.Interface, error)
- type CnpgDatabaseStore
- func (s *CnpgDatabaseStore) CheckHealth(ctx context.Context) error
- func (s *CnpgDatabaseStore) Create(ctx context.Context, spec v1alpha1.DatabaseSpec, id string) (*v1alpha1.Database, error)
- func (s *CnpgDatabaseStore) Delete(ctx context.Context, databaseId string) error
- func (s *CnpgDatabaseStore) Get(ctx context.Context, containerID string) (*v1alpha1.Database, error)
- func (s *CnpgDatabaseStore) List(ctx context.Context, maxPageSize int32, pageToken string) (*v1alpha1.DatabaseList, error)
- type CnpgK8sConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CnpgDatabaseStore ¶
type CnpgDatabaseStore struct {
// contains filtered or unexported fields
}
CnpgDatabaseStore implements store.DatabaseRepository backed by CNPG Clusters, and Kubernetes Pods and Services.
func NewCnpgDatabaseStore ¶
func NewCnpgDatabaseStore(client kubernetes.Interface, dynamicClient dynamic.Interface, cfg CnpgK8sConfig, logger *slog.Logger) *CnpgDatabaseStore
NewCnpgDatabaseStore creates a new CnpgDatabaseStore with the given client, config, and logger.
func (*CnpgDatabaseStore) CheckHealth ¶
func (s *CnpgDatabaseStore) CheckHealth(ctx context.Context) error
CheckHealth verifies the backing Kubernetes cluster is reachable by calling the API server's version discovery endpoint.
func (*CnpgDatabaseStore) Create ¶
func (s *CnpgDatabaseStore) Create(ctx context.Context, spec v1alpha1.DatabaseSpec, id string) (*v1alpha1.Database, error)
Create creates a new container backed by a Kubernetes Deployment (and optionally a Service when ports have non-none visibility).
func (*CnpgDatabaseStore) Delete ¶
func (s *CnpgDatabaseStore) Delete(ctx context.Context, databaseId string) error
Delete removes a database and its associated Kubernetes resources.
func (*CnpgDatabaseStore) Get ¶
func (s *CnpgDatabaseStore) Get(ctx context.Context, containerID string) (*v1alpha1.Database, error)
Get retrieves a cluster by its instance ID, enriching it with runtime data from Pods, Services, and secrets.
func (*CnpgDatabaseStore) List ¶
func (s *CnpgDatabaseStore) List(ctx context.Context, maxPageSize int32, pageToken string) (*v1alpha1.DatabaseList, error)
List returns a paginated list of databases using Kubernetes Limit/Continue tokens as the AEP opaque page_token / next_page_token.