controller

package
v0.0.0-...-fb363da Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ContainerVector = "vector"

Variables

This section is empty.

Functions

func ExtendConfigMapByVector

func ExtendConfigMapByVector(ctx context.Context, params VectorConfigParams, data map[string]string)

func ExtendWorkloadByVector

func ExtendWorkloadByVector(
	image *util.Image,
	logProvider []string,
	dep *appsv1.StatefulSet,
	vectorConfigMapName string)

func IsVectorEnable

func IsVectorEnable(roleLoggingConfig *kafkav1alpha1.BrokersContainerLoggingSpec) bool

func MergeConfig

MergeConfig merge the role's config into the role group's config

func NewRole

NewRole new a ClusterRoleReconciler

func NewRoleBinding

NewRoleBinding new a ClusterRoleBindingReconciler

func NewServiceAccount

func NewServiceAccount(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	mergedLabels map[string]string,
	mergedCfg any,
) *common.GenericServiceAccountReconciler[*kafkav1alpha1.KafkaCluster, any]

NewServiceAccount new a ServiceAccountReconciler

Types

type ClusterReconciler

type ClusterReconciler struct {
	Log logr.Logger

	*security.KafkaTlsSecurity
	// contains filtered or unexported fields
}

func NewClusterReconciler

func NewClusterReconciler(client client.Client, scheme *runtime.Scheme, cr *kafkav1alpha1.KafkaCluster) *ClusterReconciler

func (*ClusterReconciler) ReconcileCluster

func (c *ClusterReconciler) ReconcileCluster(ctx context.Context) (ctrl.Result, error)

func (*ClusterReconciler) ReconcileDiscovery

func (c *ClusterReconciler) ReconcileDiscovery(ctx context.Context) (ctrl.Result, error)

func (*ClusterReconciler) RegisterResource

func (c *ClusterReconciler) RegisterResource()

func (*ClusterReconciler) RegisterRole

func (c *ClusterReconciler) RegisterRole()

RegisterRole register role reconciler

type ConfigMapReconciler

func NewConfigMap

func NewConfigMap(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	groupName string,
	labels map[string]string,
	mergedCfg *kafkav1alpha1.BrokersRoleGroupSpec,

	tlsSecurity *security.KafkaTlsSecurity,

) *ConfigMapReconciler

NewConfigMap new a ConfigMapReconciler

func (*ConfigMapReconciler) Build

func (*ConfigMapReconciler) ConfigurationOverride

func (c *ConfigMapReconciler) ConfigurationOverride(resource client.Object)

type Discovery

func NewDiscovery

func NewDiscovery(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	tlsSecurity *security.KafkaTlsSecurity,
) *Discovery

func (*Discovery) Build

func (d *Discovery) Build(ctx context.Context) (client.Object, error)

Build implements the ResourceBuilder interface

type KafkaClusterInstance

type KafkaClusterInstance struct {
	Instance *kafkav1alpha1.KafkaCluster
}

func (*KafkaClusterInstance) GetClusterConfig

func (h *KafkaClusterInstance) GetClusterConfig() any

func (*KafkaClusterInstance) GetInstanceName

func (h *KafkaClusterInstance) GetInstanceName() string

func (*KafkaClusterInstance) GetNamespace

func (h *KafkaClusterInstance) GetNamespace() string

func (*KafkaClusterInstance) GetRoleConfigSpec

func (h *KafkaClusterInstance) GetRoleConfigSpec(_ common.Role) (any, error)

type KafkaClusterReconciler

type KafkaClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Log    logr.Logger
}

KafkaClusterReconciler reconciles a KafkaCluster object

func (*KafkaClusterReconciler) Reconcile

func (r *KafkaClusterReconciler) 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 KafkaCluster 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.15.0/pkg/reconcile

func (*KafkaClusterReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

func (*KafkaClusterReconciler) UpdateStatus

func (r *KafkaClusterReconciler) UpdateStatus(ctx context.Context, instance *kafkav1alpha1.KafkaCluster) error

UpdateStatus updates the status of the KafkaCluster resource https://stackoverflow.com/questions/76388004/k8s-controller-update-status-and-condition

type Role

func NewRoleBroker

func NewRoleBroker(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	log logr.Logger) *Role

func (*Role) CacheRoleGroupConfig

func (r *Role) CacheRoleGroupConfig()

func (*Role) ReconcileRole

func (r *Role) ReconcileRole(ctx context.Context) (ctrl.Result, error)

func (*Role) RoleName

func (r *Role) RoleName() common.Role

type RoleGroup

RoleGroup master role group reconcile

func NewRoleGroupReconciler

func NewRoleGroupReconciler(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	groupName string,
	roleLabels map[string]string,
	log logr.Logger) *RoleGroup

func (*RoleGroup) MergeGroupConfigSpec

func (m *RoleGroup) MergeGroupConfigSpec() any

func (*RoleGroup) MergeLabels

func (m *RoleGroup) MergeLabels(mergedCfg any) map[string]string

func (*RoleGroup) RegisterResource

func (m *RoleGroup) RegisterResource()

type StatefulSetReconciler

func NewStatefulSet

func NewStatefulSet(
	scheme *runtime.Scheme,
	instance *kafkav1alpha1.KafkaCluster,
	client client.Client,
	groupName string,
	labels map[string]string,
	mergedCfg *kafkav1alpha1.BrokersRoleGroupSpec,
	replicate int32,
	tlsSecurity *security.KafkaTlsSecurity,
) *StatefulSetReconciler

func (*StatefulSetReconciler) Build

func (*StatefulSetReconciler) CommandOverride

func (s *StatefulSetReconciler) CommandOverride(resource client.Object)

func (*StatefulSetReconciler) EnvOverride

func (s *StatefulSetReconciler) EnvOverride(resource client.Object)

func (*StatefulSetReconciler) GetConditions

func (s *StatefulSetReconciler) GetConditions() *[]metav1.Condition

func (*StatefulSetReconciler) LogOverride

func (s *StatefulSetReconciler) LogOverride(_ client.Object)

func (*StatefulSetReconciler) SetAffinity

func (s *StatefulSetReconciler) SetAffinity(resource client.Object)

type VectorConfigParams

type VectorConfigParams struct {
	Client        client.Client
	ClusterConfig *kafkav1alpha1.ClusterConfigSpec
	Namespace     string
	InstanceName  string
	Role          string
	GroupName     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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