reconcilers package - github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers - Go Packages

reconcilers

package
v0.0.0-...-6793450 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecurityAdminBaseCmdTmpl = `` /* 305-byte string literal not displayed */

	ApplyAllYmlCmdTmpl = `` /* 211-byte string literal not displayed */

	ApplySingleYmlCmdTmpl = `` /* 216-byte string literal not displayed */

)
View Source
const (
	CertContextTransport certContextType = "transport"
	CertContextHttp      certContextType = "http"
)
View Source
const (
	CaCertKey                     = "ca.crt"
	SimultaneousCertGenerationCap = 8

	// CertRenewalAnnotation is set on generated certificate secrets whenever an
	// existing certificate is renewed (as opposed to created). Its value is
	// folded into the node pool config hashes so that a renewal changes the pod
	// templates and the rolling-restart machinery reloads the certificates.
	CertRenewalAnnotation = "opensearch.org/cert-renewal"
)

Variables

View Source
var (
	ErrVersionDowngrade = errors.New("version requested is downgrade")
	ErrMajorVersionJump = errors.New("version request is more than 1 major version ahead")
	ErrUnexpectedStatus = errors.New("unexpected upgrade status")
)

Functions

func AsTerminal

func AsTerminal(err error) error

AsTerminal wraps err as a TerminalError. A nil err is returned unchanged.

func BuildClusterSvcHostName

func BuildClusterSvcHostName(instance *opensearchv1.OpenSearchCluster) string

BuildClusterSvcHostName builds the cluster host name as {svc-name}.{namespace}.svc.{dns-base}

func BuildCmdArg

func BuildCmdArg(instance *opensearchv1.OpenSearchCluster, secret *corev1.Secret, log logr.Logger) string

BuildCmdArg builds the command for the securityconfig-update job for each individual ymls present in the securityconfig secret. yml files which are not present in the secret are not applied/updated

func IsTerminal

func IsTerminal(err error) bool

IsTerminal reports whether err is or wraps a TerminalError.

func UpdateComponentStatus

func UpdateComponentStatus(
	k8sClient k8s.K8sClient,
	cluster *opensearchv1.OpenSearchCluster,
	status *opensearchv1.ComponentStatus,
) error

Types

type ActionGroupReconciler

type ActionGroupReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewActionGroupReconciler

func NewActionGroupReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	instance *opensearchv1.OpensearchActionGroup,
	opts ...ReconcilerOption,
) *ActionGroupReconciler

func (*ActionGroupReconciler) Delete

func (r *ActionGroupReconciler) Delete() error

func (*ActionGroupReconciler) Reconcile

func (r *ActionGroupReconciler) Reconcile() (retResult ctrl.Result, retErr error)

type ClusterReconciler

type ClusterReconciler struct {
	// contains filtered or unexported fields
}

func NewClusterReconciler

func NewClusterReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *ClusterReconciler

func (*ClusterReconciler) DeleteResources

func (r *ClusterReconciler) DeleteResources() (ctrl.Result, error)

func (*ClusterReconciler) DisableClusterRoleBindingManagement

func (r *ClusterReconciler) DisableClusterRoleBindingManagement()

DisableClusterRoleBindingManagement prevents this reconciler from creating or deleting cluster-scoped RBAC. It is used by namespace-scoped installs that intentionally run without ClusterRoleBinding permissions.

func (*ClusterReconciler) Name

func (r *ClusterReconciler) Name() string

func (*ClusterReconciler) Reconcile

func (r *ClusterReconciler) Reconcile() (ctrl.Result, error)

func (*ClusterReconciler) SetNodeAttributesClusterRoleName

func (r *ClusterReconciler) SetNodeAttributesClusterRoleName(name string)

func (*ClusterReconciler) UpdateClusterStatus

func (r *ClusterReconciler) UpdateClusterStatus() error

UpdateClusterStatus updates the cluster health and number of available nodes in the CR status

type ComponentReconciler

type ComponentReconciler func() (reconcile.Result, error)

type ComponentTemplateReconciler

type ComponentTemplateReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func (*ComponentTemplateReconciler) Delete

func (r *ComponentTemplateReconciler) Delete() error

func (*ComponentTemplateReconciler) Reconcile

func (r *ComponentTemplateReconciler) Reconcile() (result ctrl.Result, err error)

type ConfigurationReconciler

type ConfigurationReconciler struct {
	// contains filtered or unexported fields
}

func NewConfigurationReconciler

func NewConfigurationReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *ConfigurationReconciler

func (*ConfigurationReconciler) DeleteResources

func (r *ConfigurationReconciler) DeleteResources() (ctrl.Result, error)

func (*ConfigurationReconciler) Name

func (r *ConfigurationReconciler) Name() string

func (*ConfigurationReconciler) Reconcile

func (r *ConfigurationReconciler) Reconcile() (ctrl.Result, error)

type DashboardsReconciler

type DashboardsReconciler struct {
	// contains filtered or unexported fields
}

func NewDashboardsReconciler

func NewDashboardsReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *DashboardsReconciler

func (*DashboardsReconciler) DeleteResources

func (r *DashboardsReconciler) DeleteResources() (ctrl.Result, error)

func (*DashboardsReconciler) Name

func (r *DashboardsReconciler) Name() string

func (*DashboardsReconciler) Reconcile

func (r *DashboardsReconciler) Reconcile() (ctrl.Result, error)

type IndexTemplateReconciler

type IndexTemplateReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func (*IndexTemplateReconciler) Delete

func (r *IndexTemplateReconciler) Delete() error

func (*IndexTemplateReconciler) Reconcile

func (r *IndexTemplateReconciler) Reconcile() (result ctrl.Result, err error)

type IsmPolicyReconciler

type IsmPolicyReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewIsmReconciler

func NewIsmReconciler(
	ctx context.Context,
	client client.Client,
	recorder record.EventRecorder,
	instance *opensearchv1.OpenSearchISMPolicy,
	opts ...ReconcilerOption,
) *IsmPolicyReconciler

func (*IsmPolicyReconciler) CreateISMPolicy

func (r *IsmPolicyReconciler) CreateISMPolicy() (*requests.ISMPolicySpec, error)

func (*IsmPolicyReconciler) Delete

func (r *IsmPolicyReconciler) Delete() error

Delete ISM policy from the OS cluster

func (*IsmPolicyReconciler) Reconcile

func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error)

type NamedComponentReconciler

type NamedComponentReconciler struct {
	Name string
	Func ComponentReconciler
}

type NodePoolHash

type NodePoolHash struct {
	Component  string
	ConfigHash string
}

type ReconcilerContext

type ReconcilerContext struct {
	Volumes        []corev1.Volume
	VolumeMounts   []corev1.VolumeMount
	NodePoolHashes []NodePoolHash
	// CertHashData holds markers for renewed TLS certificates. They are folded
	// into each node pool's config hash so that a certificate renewal changes
	// the pod templates and triggers the rolling-restart machinery, without
	// being written to opensearch.yml.
	CertHashData     []string
	DashboardsConfig map[string]string
	OpenSearchConfig map[string]string
	// contains filtered or unexported fields
}

func NewReconcilerContext

func NewReconcilerContext(recorder record.EventRecorder, instance *opensearchv1.OpenSearchCluster, nodepools []opensearchv1.NodePool) ReconcilerContext

func (*ReconcilerContext) AddConfig

func (c *ReconcilerContext) AddConfig(key string, value string)

func (*ReconcilerContext) AddDashboardsConfig

func (c *ReconcilerContext) AddDashboardsConfig(key string, value string)

type ReconcilerOption

type ReconcilerOption func(*ReconcilerOptions)

func WithOSClientTransport

func WithOSClientTransport(transport http.RoundTripper) ReconcilerOption

func WithUpdateStatus

func WithUpdateStatus(update bool) ReconcilerOption

type ReconcilerOptions

type ReconcilerOptions struct {
	// contains filtered or unexported fields
}

type RoleReconciler

type RoleReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewRoleReconciler

func NewRoleReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	instance *opensearchv1.OpensearchRole,
	opts ...ReconcilerOption,
) *RoleReconciler

func (*RoleReconciler) Delete

func (r *RoleReconciler) Delete() error

func (*RoleReconciler) Reconcile

func (r *RoleReconciler) Reconcile() (retResult ctrl.Result, retErr error)

type RollingRestartReconciler

type RollingRestartReconciler struct {
	// contains filtered or unexported fields
}

func NewRollingRestartReconciler

func NewRollingRestartReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *RollingRestartReconciler

func (*RollingRestartReconciler) DeleteResources

func (r *RollingRestartReconciler) DeleteResources() (ctrl.Result, error)

func (*RollingRestartReconciler) Name

func (r *RollingRestartReconciler) Name() string

func (*RollingRestartReconciler) Reconcile

func (r *RollingRestartReconciler) Reconcile() (ctrl.Result, error)

type ScalerReconciler

type ScalerReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewScalerReconciler

func NewScalerReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...ReconcilerOption,
) *ScalerReconciler

func (*ScalerReconciler) Name

func (r *ScalerReconciler) Name() string

func (*ScalerReconciler) Reconcile

func (r *ScalerReconciler) Reconcile() (ctrl.Result, error)

type SecurityconfigReconciler

type SecurityconfigReconciler struct {
	// contains filtered or unexported fields
}

func NewSecurityconfigReconciler

func NewSecurityconfigReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *SecurityconfigReconciler

func (*SecurityconfigReconciler) DeleteResources

func (r *SecurityconfigReconciler) DeleteResources() (ctrl.Result, error)

func (*SecurityconfigReconciler) Name

func (r *SecurityconfigReconciler) Name() string

func (*SecurityconfigReconciler) Reconcile

func (r *SecurityconfigReconciler) Reconcile() (ctrl.Result, error)

type SnapshotPolicyReconciler

type SnapshotPolicyReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func (*SnapshotPolicyReconciler) CreateSnapshotPolicy

func (r *SnapshotPolicyReconciler) CreateSnapshotPolicy() (*requests.SnapshotPolicySpec, error)

func (*SnapshotPolicyReconciler) Delete

func (r *SnapshotPolicyReconciler) Delete() error

func (*SnapshotPolicyReconciler) Reconcile

func (r *SnapshotPolicyReconciler) Reconcile() (result ctrl.Result, err error)

type SnapshotRepositoryReconciler

type SnapshotRepositoryReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewSnapshotRepositoryReconciler

func NewSnapshotRepositoryReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	instance *opensearchv1.OpenSearchCluster,
	opts ...ReconcilerOption,
) *SnapshotRepositoryReconciler

func (*SnapshotRepositoryReconciler) Delete

func (r *SnapshotRepositoryReconciler) Delete() error

func (*SnapshotRepositoryReconciler) Name

func (*SnapshotRepositoryReconciler) Reconcile

func (r *SnapshotRepositoryReconciler) Reconcile() (ctrl.Result, error)

func (*SnapshotRepositoryReconciler) ReconcileRepository

func (r *SnapshotRepositoryReconciler) ReconcileRepository(repoConfig *opensearchv1.SnapshotRepoConfig) error

type TLSReconciler

type TLSReconciler struct {
	// contains filtered or unexported fields
}

func NewTLSReconciler

func NewTLSReconciler(
	client client.Client,
	ctx context.Context,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *TLSReconciler

func (*TLSReconciler) DeleteResources

func (r *TLSReconciler) DeleteResources() (ctrl.Result, error)

func (*TLSReconciler) Name

func (r *TLSReconciler) Name() string

func (*TLSReconciler) Reconcile

func (r *TLSReconciler) Reconcile() (ctrl.Result, error)

type TenantReconciler

type TenantReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewTenantReconciler

func NewTenantReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	instance *opensearchv1.OpensearchTenant,
	opts ...ReconcilerOption,
) *TenantReconciler

func (*TenantReconciler) Delete

func (r *TenantReconciler) Delete() error

func (*TenantReconciler) Reconcile

func (r *TenantReconciler) Reconcile() (retResult ctrl.Result, retErr error)

type TerminalError

type TerminalError struct {
	Err error
}

TerminalError marks a permanent configuration problem. The affected sub-reconciler should stop its own work, but the main reconcile chain should continue so unrelated maintenance (scaler, upgrade, restart, etc.) is not frozen until the operator restarts or the CR is deleted.

func (*TerminalError) Error

func (e *TerminalError) Error() string

func (*TerminalError) Unwrap

func (e *TerminalError) Unwrap() error

type UpgradeReconciler

type UpgradeReconciler struct {
	// contains filtered or unexported fields
}

func NewUpgradeReconciler

func NewUpgradeReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	reconcilerContext *ReconcilerContext,
	instance *opensearchv1.OpenSearchCluster,
	opts ...reconciler.ResourceReconcilerOption,
) *UpgradeReconciler

func (*UpgradeReconciler) Name

func (r *UpgradeReconciler) Name() string

func (*UpgradeReconciler) Reconcile

func (r *UpgradeReconciler) Reconcile() (ctrl.Result, error)

type UserReconciler

type UserReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func NewUserReconciler

func NewUserReconciler(
	client client.Client,
	ctx context.Context,
	recorder record.EventRecorder,
	instance *opensearchv1.OpensearchUser,
	opts ...ReconcilerOption,
) *UserReconciler

func (*UserReconciler) Delete

func (r *UserReconciler) Delete() error

func (*UserReconciler) Reconcile

func (r *UserReconciler) Reconcile() (retResult ctrl.Result, retErr error)

type UserRoleBindingReconciler

type UserRoleBindingReconciler struct {
	ReconcilerOptions
	// contains filtered or unexported fields
}

func (*UserRoleBindingReconciler) Delete

func (r *UserRoleBindingReconciler) Delete() error

func (*UserRoleBindingReconciler) Reconcile

func (r *UserRoleBindingReconciler) Reconcile() (retResult ctrl.Result, retErr error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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