planner

package
v0.0.0-...-d6b22fe 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: 8 Imported by: 0

Documentation

Overview

Package planner helps determine the desired state.

Index

Constants

View Source
const (
	// DNSRegisterNever means the system should never register itself.
	DNSRegisterNever = DNSRegister("never")
	// DNSRegisterExternalIP means the system should register its
	// external IP address.
	DNSRegisterExternalIP = DNSRegister("external-ip")
	// DNSRegisterClusterIP means the system should register its
	// in-cluster IP address.
	DNSRegisterClusterIP = DNSRegister("cluster-ip")
)
View Source
const (
	// UserMode means users and groups are locally configured
	UserMode = SecurityMode("user")
	// ADMode means users and groups are sourced from an Active Directory
	// domain.
	ADMode = SecurityMode("active-directory")
)
View Source
const (
	// GroupModeNever disallows grouping shares. this is the default
	GroupModeNever = GroupMode("never")
	// GroupModeExplicit enables grouping with specific group naming
	GroupModeExplicit = GroupMode("explicit")
	// GroupModeUnset is equivalent to groupModeNever
	GroupModeUnset = GroupMode("")
)

Variables

This section is empty.

Functions

func CheckCompatible

func CheckCompatible(current, existing InstanceConfiguration) error

CheckCompatible returns an error if the instance configurations are not compatible with each other. A compatible instance is one that can share the same smbd.

Types

type DNSRegister

type DNSRegister string

DNSRegister describes how an instance should register itself with a DNS system (typically AD).

type GroupMode

type GroupMode string

GroupMode describes how/if SmbShares are allowed to be grouped together in on server instance

type IncompatibleInstanceError

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

IncompatibleInstanceError indicates SmbShare resources are not compatible with each other and can not hosted by the same server.

func (IncompatibleInstanceError) Error

func (iie IncompatibleInstanceError) Error() string

Error interface method.

type InstanceConfiguration

type InstanceConfiguration struct {
	SmbShare       *api.SmbShare
	SecurityConfig *api.SmbSecurityConfig
	CommonConfig   *api.SmbCommonConfig
	GlobalConfig   *conf.OperatorConfig
}

InstanceConfiguration bundles together the various inputs that define the configuration of a server group instance.

type Paths

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

Paths for relevant files and dirs within the containers.

func (*Paths) ContainerConfigDir

func (*Paths) ContainerConfigDir() string

ContainerConfigDir absolute path.

func (*Paths) ContainerConfigs

func (p *Paths) ContainerConfigs() []string

ContainerConfigs returns a slice containing all configuration files that the samba-container should process.

func (*Paths) JoinJSONBaseName

func (*Paths) JoinJSONBaseName() string

JoinJSONBaseName file name component.

func (*Paths) JoinJSONSource

func (p *Paths) JoinJSONSource(index int) string

JoinJSONSource absolute path based on the given index value.

func (*Paths) JoinJSONSourceDir

func (*Paths) JoinJSONSourceDir(index int) string

JoinJSONSourceDir absolute path based on the given index value.

func (*Paths) OSRunDir

func (*Paths) OSRunDir() string

OSRunDir absolute path.

func (*Paths) SambaStateDir

func (*Paths) SambaStateDir() string

SambaStateDir absolute path.

func (*Paths) ServiceWatchJSON

func (p *Paths) ServiceWatchJSON() string

ServiceWatchJSON file absolute path.

func (*Paths) ServiceWatchStateDir

func (*Paths) ServiceWatchStateDir() string

ServiceWatchStateDir absolute path.

func (*Paths) Share

func (p *Paths) Share() string

Share path.

func (*Paths) ShareMountPath

func (p *Paths) ShareMountPath() string

ShareMountPath returns the mount path.

func (*Paths) UsersConfigBaseName

func (*Paths) UsersConfigBaseName() string

UsersConfigBaseName file name component.

func (*Paths) UsersConfigDir

func (*Paths) UsersConfigDir() string

UsersConfigDir absolute path.

func (*Paths) WinbindSocketsDir

func (*Paths) WinbindSocketsDir() string

WinbindSocketsDir absolute path.

type Planner

type Planner struct {
	// InstanceConfiguration is used as the configuration "intent".
	// The planner treats it as read only.
	InstanceConfiguration

	// ConfigState covers the shared configuration state that is mapped
	// into all containers/pods and generally interpreted by sambacc
	// for managing the behavior of samba containers. The planner treats
	// it as read/write.
	ConfigState *smbcc.SambaContainerConfig
}

Planner arranges the state of the instance to be.

func New

New instance of a planner based on the configuration CRs as well an existing configuration state (if it existed).

func (*Planner) Args

func (p *Planner) Args() *SambaContainerArgs

Args returns a SambaContainerArgs type for starting containers in this instance.

func (*Planner) ClusterSize

func (pl *Planner) ClusterSize() int32

ClusterSize returns the (minimum) size of the cluster.

func (*Planner) DNSRegister

func (pl *Planner) DNSRegister() DNSRegister

DNSRegister returns a DNSRegister type for this instance.

func (*Planner) Grouping

func (pl *Planner) Grouping() (GroupMode, string)

Grouping returns the logical grouping mode and group name.

func (*Planner) InstanceName

func (pl *Planner) InstanceName() string

InstanceName returns the instance's name.

func (*Planner) IsClustered

func (pl *Planner) IsClustered() bool

IsClustered returns true if the instance is configured for clustering.

func (*Planner) MayCluster

func (pl *Planner) MayCluster() bool

MayCluster returns true if the operator is permitted to create clustered instances.

func (*Planner) NodeSelector

func (pl *Planner) NodeSelector() (map[string]string, error)

NodeSelector returns a mapping of k8s label names to values that are used to select what nodes resources are scheduled to run on.

func (*Planner) NodeSpread

func (pl *Planner) NodeSpread() bool

NodeSpread returns true if pods are required to be spread over multiple nodes.

func (*Planner) Paths

func (planner *Planner) Paths() *Paths

Paths returns an instance of the Paths type for our intended configuration.

func (*Planner) Prune

func (pl *Planner) Prune() (changed bool, err error)

Prune the target share from the configuration.

func (*Planner) Realm

func (pl *Planner) Realm() string

Realm returns the name of the realm (domain).

func (*Planner) SambaContainerDebugLevel

func (pl *Planner) SambaContainerDebugLevel() string

SambaContainerDebugLevel returns a string that can be passed to Samba tools for debugging.

func (*Planner) SecurityMode

func (pl *Planner) SecurityMode() SecurityMode

SecurityMode returns the high level security mode to be used.

func (*Planner) ServiceType

func (pl *Planner) ServiceType() string

ServiceType returns the value that should be used for a Service fronting the SMB port for this instance.

func (*Planner) Update

func (pl *Planner) Update() (changed bool, err error)

Update the held configuration based on the state of the instance configuration.

func (*Planner) UserSecuritySource

func (pl *Planner) UserSecuritySource() UserSecuritySource

UserSecuritySource returns the UserSecuritySource type for the particular instance.

func (*Planner) Workgroup

func (pl *Planner) Workgroup() string

Workgroup returns the name of the workgroup. This may be automatically derived from the realm.

type SambaContainerArgs

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

SambaContainerArgs generates sets for arguments for samba-container instances.

func (*SambaContainerArgs) CTDBDaemon

func (*SambaContainerArgs) CTDBDaemon() []string

CTDBDaemon container arguments generator.

func (*SambaContainerArgs) CTDBManageNodes

func (*SambaContainerArgs) CTDBManageNodes() []string

CTDBManageNodes container arguments generator.

func (*SambaContainerArgs) CTDBMigrate

func (*SambaContainerArgs) CTDBMigrate() []string

CTDBMigrate container arguments generator.

func (*SambaContainerArgs) CTDBMustHaveNode

func (*SambaContainerArgs) CTDBMustHaveNode() []string

CTDBMustHaveNode container arguments generator.

func (*SambaContainerArgs) CTDBNodeStatus

func (*SambaContainerArgs) CTDBNodeStatus() []string

CTDBNodeStatus container arguments generator.

func (*SambaContainerArgs) CTDBSetNode

func (*SambaContainerArgs) CTDBSetNode() []string

CTDBSetNode container arguments generator.

func (*SambaContainerArgs) DNSRegister

func (s *SambaContainerArgs) DNSRegister() []string

DNSRegister container arguments generator.

func (*SambaContainerArgs) EnsureSharePaths

func (*SambaContainerArgs) EnsureSharePaths() []string

EnsureSharePaths container arguments generator.

func (*SambaContainerArgs) Initializer

func (s *SambaContainerArgs) Initializer(cmd string) []string

Initializer container arguments generator.

func (*SambaContainerArgs) Run

func (s *SambaContainerArgs) Run(name string) []string

Run container arguments generator.

func (*SambaContainerArgs) UpdateConfigWatch

func (*SambaContainerArgs) UpdateConfigWatch() []string

UpdateConfigWatch container arguments generator.

type SecurityMode

type SecurityMode string

SecurityMode describes the high level user-authentication used by a share or instance.

type UserSecuritySource

type UserSecuritySource struct {
	Configured bool
	Namespace  string
	Secret     string
	Key        string
}

UserSecuritySource describes the location of user security configuration metadata.

Jump to

Keyboard shortcuts

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