controllers

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

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

	AccountVolumeName         = "account"
	KmsDBMountPath            = "/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
	ControllerPort = 50004
	ExecutorPort   = 50002

	POD_NAME_ENV      = "MY_POD_NAME"
	POD_NAMESPACE_ENV = "MY_POD_NAMESPACE"
)

Variables

View Source
var NodeMap sync.Map

Functions

func CleanJob

func CleanJob(ctx context.Context, cli client.Client, job *v1.Job, ttl int64)

func GetErrorLogFromPod added in v0.0.3

func GetErrorLogFromPod(ctx context.Context, cli client.Client, namespace, name, jobId string) (string, error)

func GetLogConfigName

func GetLogConfigName(nodeName string) string

GetLogConfigName get node's log config configmap name

func GetMountPoint added in v0.0.5

func GetMountPoint(path string) (string, error)

func GetNodeLabelKeyByType added in v0.0.2

func GetNodeLabelKeyByType(deployMethod nodepkg.DeployMethod) (string, error)

func GetNodePortServiceName

func GetNodePortServiceName(nodeName string) string

GetNodePortServiceName get node's clusterIP service name

func GetVolumes

func GetVolumes(node *citacloudv1.CitaNode) []corev1.Volume

func IsEqual

func IsEqual(obj1, obj2 interface{}) bool

IsEqual check two object is equal.

func LabelsForChain added in v0.0.2

func LabelsForChain(chainName 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.

func SetAffinity added in v0.0.2

func SetAffinity(podAffinityFlag bool, key, value string) *corev1.Affinity

Types

type BackupReconciler

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

BackupReconciler reconciles a Backup object

func (*BackupReconciler) Reconcile

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

func (*BackupReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type BlockHeightFallbackReconciler

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

BlockHeightFallbackReconciler reconciles a BlockHeightFallback object

func (*BlockHeightFallbackReconciler) Reconcile

func (*BlockHeightFallbackReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type ChainNodeServiceImpl

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

type ChangeOwnerReconciler added in v0.0.2

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

ChangeOwnerReconciler reconciles a ChangeOwner object

func (*ChangeOwnerReconciler) Reconcile added in v0.0.2

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ChangeOwner object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.11.0/pkg/reconcile

func (*ChangeOwnerReconciler) SetupWithManager added in v0.0.2

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

SetupWithManager sets up the controller with the Manager.

type CitaNodeReconciler

type CitaNodeReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
}

CitaNodeReconciler reconciles a CitaNode object

func (*CitaNodeReconciler) Reconcile

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

func (*CitaNodeReconciler) ReconcileAllRecourse

func (r *CitaNodeReconciler) ReconcileAllRecourse(ctx context.Context, node *citacloudv1.CitaNode) error

func (*CitaNodeReconciler) ReconcileConfigMap

func (r *CitaNodeReconciler) ReconcileConfigMap(ctx context.Context, node *citacloudv1.CitaNode) (bool, error)

func (*CitaNodeReconciler) ReconcileLogConfigMap

func (r *CitaNodeReconciler) ReconcileLogConfigMap(ctx context.Context, node *citacloudv1.CitaNode) (bool, error)

func (*CitaNodeReconciler) ReconcileService

func (r *CitaNodeReconciler) ReconcileService(ctx context.Context, node *citacloudv1.CitaNode) error

func (*CitaNodeReconciler) ReconcileStatefulSet

func (r *CitaNodeReconciler) ReconcileStatefulSet(ctx context.Context, node *citacloudv1.CitaNode) (*NodeValue, error)

func (*CitaNodeReconciler) SetDefaultStatus

func (r *CitaNodeReconciler) SetDefaultStatus(ctx context.Context, node *citacloudv1.CitaNode) (bool, error)

func (*CitaNodeReconciler) SetStatusAndCondition

func (r *CitaNodeReconciler) SetStatusAndCondition(ctx context.Context, wantedStatus citacloudv1.Status,
	node *citacloudv1.CitaNode, conditionType status.ConditionType, conditionStatus corev1.ConditionStatus,
	reason status.ConditionReason, message string, eventType string) error

func (*CitaNodeReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*CitaNodeReconciler) SyncStatus

func (r *CitaNodeReconciler) SyncStatus(ctx context.Context, node *citacloudv1.CitaNode) error

type DuplicateReconciler added in v0.0.5

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

DuplicateReconciler reconciles a Duplicate object

func (*DuplicateReconciler) Reconcile added in v0.0.5

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

func (*DuplicateReconciler) SetupWithManager added in v0.0.5

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

SetupWithManager sets up the controller with the Manager.

type JobRbac

type JobRbac struct {
	client.Client
	Log            logr.Logger
	Namespace      string
	ServiceAccount string
	Role           string
	RoleBinding    string
}

func (*JobRbac) Ensure

func (r *JobRbac) Ensure(ctx context.Context) error

type NodeService

type NodeService struct {
	Node *citacloudv1.CitaNode
}

func NewChainNodeServiceForLog

func NewChainNodeServiceForLog(node *citacloudv1.CitaNode) *NodeService

func (*NodeService) GenerateConsensusLogConfig

func (cns *NodeService) GenerateConsensusLogConfig() string

func (*NodeService) GenerateControllerLogConfig

func (cns *NodeService) GenerateControllerLogConfig() string

func (*NodeService) GenerateExecutorLogConfig

func (cns *NodeService) GenerateExecutorLogConfig() string

func (*NodeService) GenerateKmsLogConfig

func (cns *NodeService) GenerateKmsLogConfig() string

func (*NodeService) GenerateNetworkLogConfig

func (cns *NodeService) GenerateNetworkLogConfig() string

func (*NodeService) GenerateStorageLogConfig

func (cns *NodeService) GenerateStorageLogConfig() string

type NodeValue

type NodeValue struct {
	Status citacloudv1.Status
}

func NewNodeValue

func NewNodeValue(status citacloudv1.Status) *NodeValue

type RecoverReconciler added in v0.0.5

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

RecoverReconciler reconciles a Recover object

func (*RecoverReconciler) Reconcile added in v0.0.5

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

func (*RecoverReconciler) SetupWithManager added in v0.0.5

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

SetupWithManager sets up the controller with the Manager.

type RestoreReconciler

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

RestoreReconciler reconciles a Restore object

func (*RestoreReconciler) Reconcile

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

func (*RestoreReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SnapshotReconciler added in v0.0.2

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

SnapshotReconciler reconciles a Snapshot object

func (*SnapshotReconciler) Reconcile added in v0.0.2

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

func (*SnapshotReconciler) SetupWithManager added in v0.0.2

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

SetupWithManager sets up the controller with the Manager.

type SwitchoverReconciler added in v0.0.2

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

SwitchoverReconciler reconciles a Switchover object

func (*SwitchoverReconciler) Reconcile added in v0.0.2

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

func (*SwitchoverReconciler) SetupWithManager added in v0.0.2

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

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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