Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ type ValidatorConfig struct {
Spec *ValidatorSpec `json:"spec"`
}

// PrunerConfig defines the pruner configuration
type PrunerConfig struct {
Enabled bool `json:"enabled"`
Spec *PrunerSpec `json:"spec"`
}

// ClusterSpec defines the desired state of Cluster
type ClusterSpec struct {
AlertSystem AlertSystemConfig `json:"alertSystem"`
Expand All @@ -129,6 +135,7 @@ type ClusterSpec struct {
SubtreeValidator SubtreeValidatorConfig `json:"subtreeValidator"`
UtxoPersister UtxoPersisterConfig `json:"utxoPersister"`
Validator ValidatorConfig `json:"validator"`
Pruner PrunerConfig `json:"pruner"`

ConfigMapName string `json:"configMapName"`
Env []corev1.EnvVar `json:"env,omitempty"`
Expand Down
67 changes: 67 additions & 0 deletions api/v1alpha1/pruner_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2024.

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 v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// PrunerSpec defines the desired state of Pruner
type PrunerSpec struct {
DeploymentOverrides *DeploymentOverrides `json:"deploymentOverrides,omitempty"`
}

// PrunerStatus defines the observed state of Pruner
type PrunerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// Pruner is the Schema for the pruners API
type Pruner struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec PrunerSpec `json:"spec,omitempty"`
Status PrunerStatus `json:"status,omitempty"`
}

func (p *Pruner) DeploymentOverrides() *DeploymentOverrides {
return p.Spec.DeploymentOverrides
}

func (p *Pruner) Metadata() metav1.ObjectMeta {
return p.ObjectMeta
}

//+kubebuilder:object:root=true

// PrunerList contains a list of Pruner
type PrunerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []Pruner `json:"items"`
}

func init() {
SchemeBuilder.Register(&Pruner{}, &PrunerList{})
}
144 changes: 142 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "AlertSystem")
os.Exit(1)
}
if err = (&controller.PrunerReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, CreateControllerError, "controller", "Pruner")
os.Exit(1)
}
//+kubebuilder:scaffold:builder

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Expand Down
Loading
Loading