initialization

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunInitCommands

func RunInitCommands(ctx context.Context)

RunInitCommands reads and processes initialization commands from a file.

This function is designed to execute an initial set of commands that are declaratively defined in a file. The end result will be as if an operator manually entered those commands using the Sentinel CLI.

The function opens the file and reads it line by line using a `bufio.Scanner`. Each line is expected to be a command in a specific format, typically key-value pairs separated by a defined separator. Lines that do not conform to the expected format are ignored.

Special handling is applied for commands that require sleeping (pause execution for a specified duration) or processing a block of commands.

The function supports dynamic commands, which are defined in the 'entity.SentinelCommand' struct.

Key commands include: - workload: (w) Sets the WorkloadIds field in the SentinelCommand. - namespace: (n) Sets the Namespaces field. - secret: (s) Sets the Secret field. - transformation: (t) Sets the Template field. - sleep: (sleep) Enables sleep mode and sets the SleepIntervalMs field.

If the file cannot be opened, the function logs an informational message and returns early. Errors encountered while reading the file or closing it are logged as errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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