controllers

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NetworkContainer    = "network"
	ConsensusContainer  = "consensus"
	ExecutorContainer   = "executor"
	StorageContainer    = "storage"
	ControllerContainer = "controller"
	KmsContainer        = "kms"

	AccountVolumeName         = "account"
	AccountVolumeMountPath    = "/mnt"
	LogConfigVolumeName       = "log-config"
	NodeConfigVolumeName      = "node-config"
	NodeConfigVolumeMountPath = "/etc/cita-cloud/config"
	DataVolumeName            = "datadir"
	DataVolumeMountPath       = "/data"
	LogConfigVolumeMountPath  = "/etc/cita-cloud/log"
	LogDir                    = DataVolumeMountPath + "/logs"

	NodeConfigFile          = "config.toml"
	ControllerLogConfigFile = "controller-log4rs.yaml"
	ExecutorLogConfigFile   = "executor-log4rs.yaml"
	KmsLogConfigFile        = "kms-log4rs.yaml"
	NetworkLogConfigFile    = "network-log4rs.yaml"
	StorageLogConfigFile    = "storage-log4rs.yaml"
	ConsensusLogConfigFile  = "consensus-log4rs.yaml"

	NetworkPort       = 40000
	NetworkRPCPort    = 50000
	ConsensusRPCPort  = 50001
	ExecutorRPCPort   = 50002
	StorageRPCPort    = 50003
	ControllerRPCPort = 50004
	KmsRPCPort        = 50005

	CaCert = "cert.pem"
	CaKey  = "key.pem"

	NodeCert = "cert.pem"
	NodeCsr  = "csr.pem"
	NodeKey  = "key.pem"
)

Variables

This section is empty.

Functions

func DiffObject

func DiffObject(old, new client.Object) ([]byte, error)

DiffObject merge

func GeneratePVC

func GeneratePVC(chainNode *citacloudv1.ChainNode) []corev1.PersistentVolumeClaim

func GetAccountCertAndKeySecretName

func GetAccountCertAndKeySecretName(account string) string

func GetAccountConfigmap

func GetAccountConfigmap(account string) string

func GetCaSecretName

func GetCaSecretName(chainName string) string

func GetLogConfigName

func GetLogConfigName(nodeName string) string

GetLogConfigName get node's log config configmap name

func GetNodeConfigName

func GetNodeConfigName(nodeName string) string

GetNodeConfigName get node's config configmap name

func GetNodePortServiceName

func GetNodePortServiceName(nodeName string) string

GetNodePortServiceName get node's clusterIP service name

func GetVolumes

func GetVolumes(chainNode *citacloudv1.ChainNode) []corev1.Volume

func IsEqual

func IsEqual(obj1, obj2 interface{}) bool

IsEqual check two object is equal.

func LabelsForChain

func LabelsForChain(name string) map[string]string

func LabelsForNode

func LabelsForNode(chainName, nodeName string) map[string]string

func MergeLabels

func MergeLabels(allLabels ...map[string]string) map[string]string

MergeLabels merges all labels together and returns a new label.

Types

type AccountReconciler

type AccountReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

AccountReconciler reconciles a Account object

func (*AccountReconciler) Reconcile

func (r *AccountReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*AccountReconciler) SetupWithManager

func (r *AccountReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ChainConfigReconciler

type ChainConfigReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

ChainConfigReconciler reconciles a ChainConfig object

func (*ChainConfigReconciler) Reconcile

func (r *ChainConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ChainConfigReconciler) SetDefaultSpec

func (r *ChainConfigReconciler) SetDefaultSpec(chainConfig *citacloudv1.ChainConfig) error

func (*ChainConfigReconciler) SetDefaultStatus

func (r *ChainConfigReconciler) SetDefaultStatus(ctx context.Context, chainConfig *citacloudv1.ChainConfig) (bool, error)

func (*ChainConfigReconciler) SetupWithManager

func (r *ChainConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type ChainNodeReconciler

type ChainNodeReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

ChainNodeReconciler reconciles a ChainNode object

func (*ChainNodeReconciler) Reconcile

func (r *ChainNodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*ChainNodeReconciler) ReconcileAllRecourse

func (r *ChainNodeReconciler) ReconcileAllRecourse(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) error

func (*ChainNodeReconciler) ReconcileConfigMap

func (r *ChainNodeReconciler) ReconcileConfigMap(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) (bool, error)

func (*ChainNodeReconciler) ReconcileLogConfigMap

func (r *ChainNodeReconciler) ReconcileLogConfigMap(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) (bool, error)

func (*ChainNodeReconciler) ReconcileService

func (r *ChainNodeReconciler) ReconcileService(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) error

func (*ChainNodeReconciler) ReconcileStatefulSet

func (r *ChainNodeReconciler) ReconcileStatefulSet(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) (bool, error)

ReconcileStatefulSet if statefulset update, then should return true for sync status

func (*ChainNodeReconciler) SetDefaultSpec

func (r *ChainNodeReconciler) SetDefaultSpec(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) error

func (*ChainNodeReconciler) SetDefaultStatus

func (r *ChainNodeReconciler) SetDefaultStatus(ctx context.Context, chainNode *citacloudv1.ChainNode) (bool, error)

func (*ChainNodeReconciler) SetupWithManager

func (r *ChainNodeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*ChainNodeReconciler) SyncRunningStatus

func (r *ChainNodeReconciler) SyncRunningStatus(ctx context.Context, chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) error

SyncRunningStatus 如果status == Initialized,则判断当前pod的ready

func (*ChainNodeReconciler) SyncStopStatus

func (r *ChainNodeReconciler) SyncStopStatus(ctx context.Context, chainNode *citacloudv1.ChainNode) error

type ChainNodeService

type ChainNodeService struct {
	ChainConfig          *citacloudv1.ChainConfig
	ChainNode            *citacloudv1.ChainNode
	Account              *citacloudv1.Account
	CaSecret             *corev1.Secret
	NodeCertAndKeySecret *corev1.Secret
}

func NewChainNodeServiceForLog

func NewChainNodeServiceForLog(chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode) *ChainNodeService

func NewChainNodeServiceForP2P

func NewChainNodeServiceForP2P(chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode, account *citacloudv1.Account) *ChainNodeService

func NewChainNodeServiceForTls

func NewChainNodeServiceForTls(chainConfig *citacloudv1.ChainConfig, chainNode *citacloudv1.ChainNode, account *citacloudv1.Account, caSecret, nodeCertAndKeySecret *corev1.Secret) *ChainNodeService

func (*ChainNodeService) GenerateConsensusLogConfig

func (cns *ChainNodeService) GenerateConsensusLogConfig() string

func (*ChainNodeService) GenerateControllerLogConfig

func (cns *ChainNodeService) GenerateControllerLogConfig() string

func (*ChainNodeService) GenerateExecutorLogConfig

func (cns *ChainNodeService) GenerateExecutorLogConfig() string

func (*ChainNodeService) GenerateKmsLogConfig

func (cns *ChainNodeService) GenerateKmsLogConfig() string

func (*ChainNodeService) GenerateNetworkLogConfig

func (cns *ChainNodeService) GenerateNetworkLogConfig() string

func (*ChainNodeService) GenerateNodeConfig

func (cns *ChainNodeService) GenerateNodeConfig() string

func (*ChainNodeService) GenerateStorageLogConfig

func (cns *ChainNodeService) GenerateStorageLogConfig() string

type ChainNodeServiceImpl

type ChainNodeServiceImpl interface {
	GenerateNodeConfig() string
	GenerateControllerLogConfig() string
	GenerateExecutorLogConfig() string
	GenerateKmsLogConfig() string
	GenerateNetworkLogConfig() string
	GenerateStorageLogConfig() string
	GenerateConsensusLogConfig() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL