multiclusterrolebinding

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LogPolicyName        = "log-policy"
	LogIndexPrefix       = "logs-v0.5.4"
	LogIndexAlias        = "logs"
	LogIndexTemplateName = "logs_rollover_mapping"

	ClusterMetadataIndexName = "opni-cluster-metadata"
)

Variables

View Source
var (
	OldIndexPrefixes = []string{
		"logs-v0.1.3*",
		"logs-v0.5.1*",
	}
	DefaultRetry = opensearchtypes.RetrySpec{
		Count:   3,
		Backoff: "exponential",
		Delay:   "1m",
	}
	OpniLogPolicy = opensearchtypes.ISMPolicySpec{
		ISMPolicyIDSpec: &opensearchtypes.ISMPolicyIDSpec{
			PolicyID:   LogPolicyName,
			MarshallID: false,
		},
		Description:  "Opni policy with hot-warm-cold workflow",
		DefaultState: "hot",
		States: []opensearchtypes.StateSpec{
			{
				Name: "hot",
				Actions: []opensearchtypes.ActionSpec{
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							Rollover: &opensearchtypes.RolloverOperation{
								MinIndexAge: "1d",
								MinSize:     "20gb",
							},
						},
					},
				},
				Transitions: []opensearchtypes.TransitionSpec{
					{
						StateName: "warm",
					},
				},
			},
			{
				Name: "warm",
				Actions: []opensearchtypes.ActionSpec{
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							ReplicaCount: &opensearchtypes.ReplicaCountOperation{
								NumberOfReplicas: 0,
							},
						},
					},
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							IndexPriority: &opensearchtypes.IndexPriorityOperation{
								Priority: 50,
							},
						},
					},
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							ForceMerge: &opensearchtypes.ForceMergeOperation{
								MaxNumSegments: 1,
							},
						},
					},
				},
				Transitions: []opensearchtypes.TransitionSpec{
					{
						StateName: "cold",
						Conditions: &opensearchtypes.ConditionSpec{
							MinIndexAge: "2d",
						},
					},
				},
			},
			{
				Name: "cold",
				Actions: []opensearchtypes.ActionSpec{
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							ReadOnly: &opensearchtypes.ReadOnlyOperation{},
						},
					},
				},
				Transitions: []opensearchtypes.TransitionSpec{
					{
						StateName: "delete",
						Conditions: &opensearchtypes.ConditionSpec{
							MinIndexAge: "7d",
						},
					},
				},
			},
			{
				Name: "delete",
				Actions: []opensearchtypes.ActionSpec{
					{
						ActionOperation: &opensearchtypes.ActionOperation{
							Delete: &opensearchtypes.DeleteOperation{},
						},
					},
				},
				Transitions: make([]opensearchtypes.TransitionSpec, 0),
			},
		},
		ISMTemplate: []opensearchtypes.ISMTemplateSpec{
			{
				IndexPatterns: []string{
					fmt.Sprintf("%s*", LogIndexPrefix),
				},
				Priority: 100,
			},
		},
	}

	OpniLogTemplate = opensearchtypes.IndexTemplateSpec{
		TemplateName: LogIndexTemplateName,
		IndexPatterns: []string{
			fmt.Sprintf("%s*", LogIndexPrefix),
		},
		Template: opensearchtypes.TemplateSpec{
			Settings: opensearchtypes.TemplateSettingsSpec{
				NumberOfShards:   1,
				NumberOfReplicas: 1,
				ISMPolicyID:      LogPolicyName,
				RolloverAlias:    LogIndexAlias,
				DefaultPipeline:  preProcessingPipelineName,
			},
			Mappings: opensearchtypes.TemplateMappingsSpec{
				Properties: map[string]opensearchtypes.PropertySettings{
					"timestamp": {
						Type: "date",
					},
					"time": {
						Type: "date",
					},
					"log": {
						Type: "text",
					},
					"masked_log": {
						Type: "text",
					},
					"log_type": {
						Type: "keyword",
					},
					"kubernetes_component": {
						Type: "keyword",
					},
					"cluster_id": {
						Type: "keyword",
					},
					"anomaly_level": {
						Type: "keyword",
					},
				},
			},
		},
		Priority: 100,
	}
)

Functions

This section is empty.

Types

type Reconciler

type Reconciler struct {
	reconciler.ResourceReconciler
	// contains filtered or unexported fields
}

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile() (retResult *reconcile.Result, retErr error)

func (*Reconciler) ReconcileOpensearchObjects

func (r *Reconciler) ReconcileOpensearchObjects(opensearchCluster *opensearchv1.OpenSearchCluster) (retResult *reconcile.Result, retErr error)

Jump to

Keyboard shortcuts

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