| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- Copyright 2026 LocoStack.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- package reconciler
- import (
- "context"
- "fmt"
- "github.com/LocoStack/loco-operator/api/v1alpha1"
- "k8s.io/apimachinery/pkg/runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- )
- const (
- NEO4J_DEFAULT_STORAGE_SIZE = "1Gi"
- )
- type Neo4jReconciler struct {
- *DefaultComponentReconciler
- client client.Client
- scheme *runtime.Scheme
- stack *v1alpha1.Stack
- component *v1alpha1.Component
- }
- func NewNeo4jReconciler(client client.Client, scheme *runtime.Scheme, stack *v1alpha1.Stack, component *v1alpha1.Component) *Neo4jReconciler {
- return &Neo4jReconciler{
- DefaultComponentReconciler: NewDefaultComponentReconciler(client, scheme, stack, component),
- client: client,
- scheme: scheme,
- stack: stack,
- component: component,
- }
- }
- func (r *Neo4jReconciler) ReconcileComponent(ctx context.Context, tmpl *v1alpha1.Template, variables map[string]string) ([]client.Object, error) {
- if err := r.ReconcileStorage(ctx, "neo4j", NEO4J_DEFAULT_STORAGE_SIZE); err != nil {
- return nil, fmt.Errorf("reconciling neo4j persistent volume: %w", err)
- }
- if _, err := r.DefaultComponentReconciler.ReconcileComponent(ctx, tmpl, variables); err != nil {
- return nil, err
- }
- return nil, nil
- }
|