atconf

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterSection          = "Cluster"
	NodesSection            = "Nodes"
	ConfigurationSection    = "Configuration"
	ClusterHostOption       = "hosts"
	ConfigurationIPv6Option = "ipv6"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeWriter

type FakeWriter struct {
}

FakeWriter is a fake admintools.conf writer for testing purposes

func (*FakeWriter) AddHosts

func (f *FakeWriter) AddHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)

AddHosts is called to add IPs to an admintools.conf. New admintools.conf, stored in a temporarily, is returned by name. Since this is fake, we just return a name of a dummy file. Actual file doesn't exist.

func (*FakeWriter) RemoveHosts

func (f *FakeWriter) RemoveHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)

RemoveHosts is called to remove hosts from admintools.conf.

type FileWriter

type FileWriter struct {
	Log            logr.Logger
	PRunner        cmds.PodRunner
	Vdb            *vapi.VerticaDB
	ATConfTempFile string
	Cfg            *configparser.ConfigParser
}

FileWriter is a writer for admintools.conf

func (*FileWriter) AddHosts

func (f *FileWriter) AddHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)

AddHosts will add IPs to the admintools.conf. It will add the IPs to the Cluster.hosts section and add a new entry (using the compat21 format) to Nodes for each IP. If a given IP is already part of admintools.conf, then it will be treated as a no-op. If the sourcePod is blank, then we will create a new admintools.conf from scratch. New admintools.conf, stored in a temporary file, is returned by name. It is the callers responsibility to clean it up.

func (*FileWriter) RemoveHosts

func (f *FileWriter) RemoveHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)

RemoveHosts will remove IPs from admintools.conf. It will remove the IPs from the Cluster.hosts section and any compat21 node entries. It is expected that the regular database nodes will have already been removed via 'admintools -t db_remove_nodes'. The sourcePod cannot be blank. New admintools.conf, stored in a temporary file, is returned by name to the caller. The caller is responsible for removing this file.

type Writer

type Writer interface {
	// AddHosts will add IPs to the admintools.conf.  It will add the IPs to the
	// Cluster.hosts section and add a new entry (using the compat21 format) to
	// Nodes for each IP.  If a given IP is already part of admintools.conf, then
	// it will be treated as a no-op.  If the sourcePod is blank, then we will
	// create a new admintools.conf from scratch.  New admintools.conf, stored
	// in a temporary file, is returned by name.  It is the callers
	// responsibility to clean it up.
	AddHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)

	// RemoveHosts will remove IPs from admintools.conf.  It will remove the IPs from the
	// Cluster.hosts section and any compat21 node entries.  It is expected that the
	// regular database nodes will have already been removed via 'admintools -t
	// db_remove_nodes'.  The sourcePod cannot be blank.  New admintools.conf,
	// stored in a temporary file, is returned by name to the caller.  The caller is
	// responsible for removing this file.
	RemoveHosts(ctx context.Context, sourcePod types.NamespacedName, ips []string) (string, error)
}

func MakeFileWriter

func MakeFileWriter(log logr.Logger, vdb *vapi.VerticaDB, prunner cmds.PodRunner) Writer

MakeFileWriter will build and return the FileWriter struct

Jump to

Keyboard shortcuts

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