Skip to content
Open
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
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,13 @@ resources:
kind: Namespace
path: github.com/kfsoftware/fabric-x-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kfsoft.tech
group: fabricx
kind: BlockExplorer
path: github.com/kfsoftware/fabric-x-operator/api/v1alpha1
version: v1alpha1
version: "3"
119 changes: 119 additions & 0 deletions api/v1alpha1/blockexplorer_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
Copyright 2025.

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 (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// BlockExplorerSpec defines the desired state of BlockExplorer.
type BlockExplorerSpec struct {
// Bootstrap mode: "configure" or "deploy"
BootstrapMode string `json:"bootstrapMode,omitempty"`

// Image for the block explorer (combined backend + UI container)
// +kubebuilder:default="ghcr.io/lf-decentralized-trust-labs/fabric-x-block-explorer"
Image string `json:"image,omitempty"`

// ImageTag for the block explorer
// +kubebuilder:default="0.1.0"
ImageTag string `json:"imageTag,omitempty"`

// Replicas for this component
// +kubebuilder:default=1
Replicas int32 `json:"replicas,omitempty"`

// Sidecar gRPC endpoint the explorer ingests blocks from (host:port).
// e.g. fabric-x-committer-sidecar-service.default.svc.cluster.local:5050
SidecarEndpoint string `json:"sidecarEndpoint"`

// StartBlock is the first block number to stream from the sidecar (defaults to 0)
StartBlock uint64 `json:"startBlock,omitempty"`

// DatabaseName for the explorer PostgreSQL database (defaults to "explorer")
DatabaseName string `json:"databaseName,omitempty"`

// DatabaseUser for the explorer PostgreSQL database (defaults to "explorer")
DatabaseUser string `json:"databaseUser,omitempty"`

// Storage configuration for the managed PostgreSQL PVC
Storage *StorageConfig `json:"storage,omitempty"`

// Resources configuration applied to the explorer and postgres containers
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// Pod annotations
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`

// Pod labels
PodLabels map[string]string `json:"podLabels,omitempty"`

// Extra environment variables for the explorer container
Env []corev1.EnvVar `json:"env,omitempty"`

// Image pull secrets
ImagePullSecrets []ImagePullSecret `json:"imagePullSecrets,omitempty"`

// Tolerations
Tolerations []Toleration `json:"tolerations,omitempty"`
}

// BlockExplorerStatus defines the observed state of BlockExplorer.
type BlockExplorerStatus struct {
// Status of the BlockExplorer
Status DeploymentStatus `json:"status,omitempty"`

// Message describing the current state
Message string `json:"message,omitempty"`

// Endpoint of the BlockExplorer REST API (e.g. <name>-service:8080)
Endpoint string `json:"endpoint,omitempty"`

// Conditions represent the latest available observations of an object's state
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Namespaced,shortName=blockexplorer,singular=blockexplorer
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.status"
// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".status.endpoint"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

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

Spec BlockExplorerSpec `json:"spec,omitempty"`
Status BlockExplorerStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// BlockExplorerList contains a list of BlockExplorer.
type BlockExplorerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BlockExplorer `json:"items"`
}

func init() {
SchemeBuilder.Register(&BlockExplorer{}, &BlockExplorerList{})
}
6 changes: 6 additions & 0 deletions api/v1alpha1/orderergroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ type BatcherInstance struct {
// Shard ID for this batcher instance
ShardID int32 `json:"shardID"`

// PVC storage size for the batcher
PVCStorageSize string `json:"pvcStorageSize,omitempty"`

// Component-specific ingress configuration
Ingress *IngressConfig `json:"ingress,omitempty"`

Expand Down Expand Up @@ -609,6 +612,9 @@ type ConsenterInstance struct {
// Consenter ID for this consenter instance
ConsenterID int32 `json:"consenterID"`

// PVC storage size for the consenter
PVCStorageSize string `json:"pvcStorageSize,omitempty"`

// Component-specific ingress configuration
Ingress *IngressConfig `json:"ingress,omitempty"`

Expand Down
141 changes: 140 additions & 1 deletion 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 @@ -325,6 +325,13 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "ChainNamespace")
os.Exit(1)
}
if err := (&controller.BlockExplorerReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "BlockExplorer")
os.Exit(1)
}
// +kubebuilder:scaffold:builder

if metricsCertWatcher != nil {
Expand Down
Loading