config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitManager

func InitManager(
	ctx context.Context,
	appName, namespace string,
	client *clabernetesgeneratedclientset.Clientset,
)

InitManager initializes the config manager -- it does this once only, its a no-op if the manager is already initialized.

func MergeFromBootstrapConfig added in v0.0.19

func MergeFromBootstrapConfig(
	bootstrapConfigMap *k8scorev1.ConfigMap,
	config *clabernetesapisv1alpha1.Config,
	configCRExists bool,
) error

MergeFromBootstrapConfig accepts a bootstrap config configmap and the instance of the global config CR and merges the bootstrap config data onto the CR. The merge operation is based on the config merge mode set in both the bootstrap config and the CR (with the CR setting taking precedence). If the config cr did not exist (as in this is the first deployment of c9s), we run overwrite mode to forcibly apply the settings from helm/the configmap.

Types

type Manager

type Manager interface {
	// Start starts the config manager -- this should be called by the clabernetes manager during
	// the "pre-start" phase -- we want this to happen prior to starting controller-runtime manager
	// things. This method attempts to find the clabernetes config configmap and then watches that
	// object. *If* this configmap cannot be found we will log a WARN error but *will not crash*
	// -- we will simply return default (empty) values when the config manager is queried by the
	// controllers.
	Start() error
	// GetGlobalAnnotations returns a map of the "global" annotations from the config -- these are
	// annotations that should be applied to *all* clabernetes objects.
	GetGlobalAnnotations() map[string]string
	// GetGlobalLabels returns a map of the "global" labels from the config -- these are labels
	// that should be applied to *all* clabernetes objects.
	GetGlobalLabels() map[string]string
	// GetAllMetadata returns the global annotations and global labels.
	GetAllMetadata() (map[string]string, map[string]string)
	// GetResourcesForContainerlabKind returns the desired default resources for a containerlab
	// kind/type combo.
	GetResourcesForContainerlabKind(
		containerlabKind string,
		containerlabType string,
	) *k8scorev1.ResourceRequirements
	// GetPrivilegedLauncher returns the global config value for the privileged launcher mode.
	GetPrivilegedLauncher() bool
	// GetContainerlabDebug returns the global config value for containerlabDebug.
	GetContainerlabDebug() bool
	// GetContainerlabTimeout returns the global config containerlab timeout value.
	GetContainerlabTimeout() string
	// GetInClusterDNSSuffix returns the in cluster dns suffix as set by the global config.
	GetInClusterDNSSuffix() string
	// GetImagePullThroughMode returns the image pull through mode in the global config.
	GetImagePullThroughMode() string
	// GetImagePullCriSockOverride returns the cri sock path override.
	GetImagePullCriSockOverride() string
	// GetImagePullCriKindOverride returns the cri kind override.
	GetImagePullCriKindOverride() string
	// GetDockerDaemonConfig returns the secret name to mount in /etc/docker -- the secret *must*
	// have a key "daemon.json" so the final mounted file is /etc/docker/daemon.json.
	GetDockerDaemonConfig() string
	// GetDockerConfig returns the secret name to mount in /root/.docker/ -- the secret *must* have
	// a key "config.json" so the final mounted file is /root/.docker/config.json.
	GetDockerConfig() string
	// GetLauncherImage returns the global default launcher image.
	GetLauncherImage() string
	// GetLauncherImagePullPolicy returns the global default launcher image pull policy.
	GetLauncherImagePullPolicy() string
	// GetLauncherLogLevel returns the default launcher log level.
	GetLauncherLogLevel() string
	// GetExtraEnv returns the default extra env vars for setting on launcher containers.
	GetExtraEnv() []k8scorev1.EnvVar
	// GetRemoveTopologyPrefix returns true if the topology prefix should be removed from Topology
	// resources, otherwise false.
	GetRemoveTopologyPrefix() bool
	// GetContainerlabVersion returns the global config containerlab version.
	GetContainerlabVersion() string
}

Manager is the config manager interface defining the config manager methods.

func GetFakeManager

func GetFakeManager() Manager

GetFakeManager returns a fake config manager -- eventually this should have some options to load it with data for unit tests. That is a future me problem.

func GetManager

func GetManager() Manager

GetManager returns the config manager -- if the manager has not been initialized it panics.

type ManagerGetterFunc

type ManagerGetterFunc func() Manager

ManagerGetterFunc returns an instance of the config manager.

Jump to

Keyboard shortcuts

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