context

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecretDoguRegistry is the name of the secret containing the dogu registry credentials.
	SecretDoguRegistry = "k8s-dogu-operator-dogu-registry"
	// SecretDoguRegistryDevPath is the path to the secret containing the dogu registry credentials. This is used for development.
	SecretDoguRegistryDevPath = "k8s/dev-resources/dogu-registry-secret.yaml"
	// SecretDockerRegistry is the name of the secret containing the docker registry credentials.
	SecretDockerRegistry = "k8s-dogu-operator-docker-registry"
	// SetupConfigConfigmap is the name of the config map containing the setup config.
	SetupConfigConfigmap = "k8s-ces-setup-config"
	// SetupConfigConfigmapDevPath is the path to the config map containing the setup config. This is used for development.
	SetupConfigConfigmapDevPath = "k8s/dev-resources/k8s-ces-setup.yaml"
	// SetupStartUpConfigMap is the name of the config map containing the setup.json.
	SetupStartUpConfigMap = "k8s-ces-setup-json"
	// SetupStartUpConfigMapDevPath is the path to the config map containing the setup.json. This is used for development.
	SetupStartUpConfigMapDevPath = "k8s/dev-resources/setup.json"
	// SetupStateConfigMap is the name of the config map containing the setup state.
	SetupStateConfigMap = "k8s-setup-config"
	// SetupStateKey is the key by which the setup state can be referenced.
	SetupStateKey = "state"
	// SetupStateInstalled means the setup installed the Cloudogu EcoSystem successfully.
	SetupStateInstalled = "installed"
	// SetupStateInstalling means the setup is currently installing the Cloudogu EcoSystem.
	SetupStateInstalling = "installing"
	// EnvironmentVariableStage is the name of the environment variable by which the development stage can be set.
	EnvironmentVariableStage = "STAGE"
	// StageDevelopment is the value that EnvironmentVariableStage must have in order to start the setup in development mode.
	StageDevelopment = "development"
	// EnvironmentVariableTargetNamespace is the name of the environment variable which discerns where the setup should deploy the Cloudogu EcoSystem.
	EnvironmentVariableTargetNamespace = "POD_NAMESPACE"
)

Variables

This section is empty.

Functions

func GetEnvVar added in v0.5.0

func GetEnvVar(name string) (string, error)

GetEnvVar returns an arbitrary environment variable; otherwise it returns an error

func GetSetupStateConfigMap added in v0.5.0

func GetSetupStateConfigMap(ctx context.Context, client kubernetes.Interface, namespace string) (*corev1.ConfigMap, error)

GetSetupStateConfigMap returns or creates if it does not exist the configmap map for presenting the state of the setup process

Types

type Config

type Config struct {
	// LogLevel sets the log level for the app
	LogLevel logrus.Level `yaml:"log_level"`
	// TargetNamespace represents the namespace that is created for the ecosystem
	TargetNamespace string `yaml:"target_namespace"`
	// DoguOperatorResourceURL sets the K8s resource URL which controls the installation of the operator into the current cluster.
	DoguOperatorURL string `yaml:"dogu_operator_url"`
	// ServiceDiscoveryURL sets the K8s resource URL which controls the installation of the service discovery into the current cluster.
	ServiceDiscoveryURL string `yaml:"service_discovery_url"`
	// EtcdServerResourceURL sets the K8s resource URL which controls the installation of the etcd server into the current cluster.
	EtcdServerResourceURL string `yaml:"etcd_server_url"`
	// EtcdServerResourceURL sets the K8s resource URL which controls the installation of the etcd server into the current cluster.
	EtcdClientImageRepo string `yaml:"etcd_client_image_repo"`
	// KeyProvider sets the key provider used to encrypt etcd values
	KeyProvider string `yaml:"key_provider"`
	// ResourcePatches contains json patches for kubernetes resources to be applied on certain phases of the setup process.
	ResourcePatches []patch.ResourcePatch `yaml:"resource_patches"`
}

Config contains the common configuration for the setup

func ReadConfigFromCluster added in v0.5.0

func ReadConfigFromCluster(ctx context.Context, client kubernetes.Interface, namespace string) (*Config, error)

ReadConfigFromCluster reads the setup config from the cluster state

func ReadConfigFromFile added in v0.5.0

func ReadConfigFromFile(path string) (*Config, error)

ReadConfigFromFile reads the application configuration from a configuration file.

type CustomKeyValue added in v0.4.0

type CustomKeyValue map[string]map[string]interface{}

CustomKeyValue is a map of string -> map pairs.

type DoguRegistrySecret added in v0.8.0

type DoguRegistrySecret struct {
	Endpoint  string `yaml:"endpoint"`
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
	URLSchema string `yaml:"urlschema"`
}

DoguRegistrySecret defines the credentials and the endpoint for the dogu registry.

func ReadDoguRegistrySecretFromCluster added in v0.8.0

func ReadDoguRegistrySecretFromCluster(ctx context.Context, client kubernetes.Interface, namespace string) (*DoguRegistrySecret, error)

ReadDoguRegistrySecretFromCluster reads the dogu registry credentials from the kubernetes secret.

func ReadDoguRegistrySecretFromFile added in v0.8.0

func ReadDoguRegistrySecretFromFile(path string) (*DoguRegistrySecret, error)

ReadDoguRegistrySecretFromFile reads the dogu registry credentials from a yaml file.

type Dogus added in v0.4.0

type Dogus struct {
	// DefaultDogu is the dogu that a call to the EcoSystem in the browser should be redirected to.
	DefaultDogu string `json:"defaultDogu"`
	// Install contains a list of all dogus that should be installed during the setup.
	// Entries may contain a version. If they do not, the latest version will be used.
	Install []string `json:"install"`
	// Completed indicates that this step should not be shown in the UI of the setup.
	Completed bool `json:"completed"`
}

Dogus struct defines which dogus are installed and which one is the default.

type Naming added in v0.4.0

type Naming struct {
	// Fqdn contains the complete fully qualified domain name of the Cloudogu EcoSystem.
	Fqdn string `json:"fqdn"`
	// Domain is primarily used to send emails from within the EcoSystem.
	Domain string `json:"domain"`
	// CertificateType is the type of certificate used to connect to the EcoSystem.
	CertificateType string `json:"certificateType"`
	// Certificate is a PEM-formatted certificate used to connect to the EcoSystem.
	// This is only necessary if CertificateType is set to "external".
	Certificate string `json:"certificate"`
	// CertificateKey is a PEM-formatted certificate key for the EcoSystem.
	// This is only necessary if CertificateType is set to "external".
	CertificateKey string `json:"certificateKey"`
	// RelayHost over which mails get sent from the EcoSystem.
	RelayHost string `json:"relayHost"`
	// MailAddress is used by all dogus to send mail.
	MailAddress string `json:"mailAddress"`
	// Completed indicates that the Naming step should not be shown in the UI of the setup.
	Completed bool `json:"completed"`
	// UseInternalIp configures if InternalIp should be used.
	UseInternalIp bool `json:"useInternalIp"`
	// InternalIp is useful if an external loadbalancer with its own IP is configured in front of the Cloudogu EcoSystem.
	// It can be set to let dogus communicate directly within the Cloudogu EcoSystem without the detour over the load balancer.
	InternalIp string `json:"internalIp"`
}

Naming settings such as fqdn, hostname and domain.

type SetupContext

type SetupContext struct {
	AppVersion                string
	AppConfig                 *Config
	SetupJsonConfiguration    *SetupJsonConfiguration
	DoguRegistryConfiguration *DoguRegistrySecret
}

SetupContext contains all context information provided by the setup.

type SetupContextBuilder added in v0.5.0

type SetupContextBuilder struct {
	DevSetupConfigPath        string
	DevStartupConfigPath      string
	DevDoguRegistrySecretPath string
	// contains filtered or unexported fields
}

SetupContextBuilder contains information to create a setup context

func NewSetupContextBuilder added in v0.5.0

func NewSetupContextBuilder(version string) *SetupContextBuilder

NewSetupContextBuilder creates a new builder to create a setup context. Default dev resources paths are used.

func (*SetupContextBuilder) NewSetupContext added in v0.5.0

func (scb *SetupContextBuilder) NewSetupContext(ctx context.Context, clientSet kubernetes.Interface) (*SetupContext, error)

NewSetupContext creates a new setup context.

type SetupJsonConfiguration added in v0.16.0

type SetupJsonConfiguration struct {
	// Naming configures for example FQDN, mail and certificate configuration of the EcoSystem.
	Naming Naming `json:"naming"`
	// Dogus configures the installed dogus.
	Dogus Dogus `json:"dogus"`
	// Admin configures the admin user of the EcoSystem.
	Admin User `json:"admin"`
	// UserBackend configures where and how users are stored.
	UserBackend UserBackend `json:"userBackend"`
	// RegistryConfig contains custom registry configuration that is to be applied to the EcoSystem.
	RegistryConfig CustomKeyValue `json:"registryConfig"`
	// RegistryConfigEncrypted also contains custom registry configuration but with encrypted values.
	RegistryConfigEncrypted CustomKeyValue `json:"registryConfigEncrypted"`
}

SetupJsonConfiguration is the main struct for the configuration of the setup.

func ReadSetupConfigFromCluster added in v0.5.0

func ReadSetupConfigFromCluster(ctx context.Context, client kubernetes.Interface, namespace string) (*SetupJsonConfiguration, error)

ReadSetupConfigFromCluster reads the setup configuration from the configmap

func ReadSetupConfigFromFile added in v0.5.0

func ReadSetupConfigFromFile(path string) (*SetupJsonConfiguration, error)

ReadSetupConfigFromFile reads the setup configuration from a setup json file.

func (*SetupJsonConfiguration) IsCompleted added in v0.16.0

func (conf *SetupJsonConfiguration) IsCompleted() bool

IsCompleted checks if a SetupJsonConfiguration is completed.

type User added in v0.4.0

type User struct {
	Username string `json:"username"`
	Mail     string `json:"mail"`
	Password string `json:"password"`
	// AdminGroup is the name of the group in the user backend that should gain admin privileges.
	AdminGroup string `json:"adminGroup"`
	// Completed indicates that this step should not be shown in the UI of the setup.
	Completed bool `json:"completed"`
	// AdminMember determines if this user should become a member of the AdminGroup.
	AdminMember     bool `json:"adminMember"`
	SendWelcomeMail bool `json:"sendWelcomeMail"`
}

User account for a Cloudogu EcoSystem instance.

type UserBackend added in v0.4.0

type UserBackend struct {
	// DsType is the type of the UserBackend. If set to "embedded", the ldap dogu will be installed and used as a user backend.
	// If set to "external", the credentials for an external user backend have to be set.
	DsType string `json:"dsType"`
	// Server contains the type of user backend server. Can either be "activeDirectory" or "custom".
	// This is only necessary if DsType is set to "external".
	Server string `json:"server"`
	// AttributeID contains the name of the attribute describing the user id in the user backend.
	// Must be "uid" if DsType is "embedded". Must be "sAMAccountName", if DsType is "external" and Server is "activeDirectory".
	AttributeID string `json:"attributeID"`
	// AttributeGivenName contains the name of the attribute describing the given name of a user.
	// This is only necessary if DsType is set to "external".
	AttributeGivenName string `json:"attributeGivenName"`
	// AttributeSurname contains the name of the attribute describing the surname of a user.
	// This is only necessary if DsType is set to "external".
	AttributeSurname string `json:"attributeSurname"`
	// AttributeFullname contains the name of the attribute describing the full name of a user.
	// Must be "cn" if DsType is "embedded" or Server is "activeDirectory".
	AttributeFullname string `json:"attributeFullname"`
	// AttributeMail contains the name of the attribute describing the mail address of a user.
	// Must be "mail" if DsType is "embedded" or Server is "activeDirectory".
	AttributeMail string `json:"attributeMail"`
	// AttributeGroup contains the name of the attribute managing the membership of the user to a particular group.
	// Must be "memberOf" if DsType is "embedded" or Server is "activeDirectory".
	AttributeGroup string `json:"attributeGroup"`
	// BaseDN is the distinguished name from which the server is searched for users.
	// This is only necessary if DsType is set to "external".
	BaseDN string `json:"baseDN"`
	// SearchFilter is restricting which object classes should be searched.
	// Must be "(objectClass=person)" if DsType is "embedded" or Server is "activeDirectory".
	SearchFilter string `json:"searchFilter"`
	// ConnectionDN is the distinguished name of a user that is authorized to read in the user backend.
	// This is only necessary if DsType is set to "external".
	ConnectionDN string `json:"connectionDN"`
	// Password of the user in ConnectionDN.
	// This is only necessary if DsType is set to "external".
	Password string `json:"password"`
	// Host address of the external user backend.
	// This is only necessary if DsType is set to "external".
	// Must be "ldap" if DsType is "embedded".
	Host string `json:"host"`
	// Port of the external user backend.
	// This is only necessary if DsType is set to "external".
	// Must be "389" if DsType is "embedded".
	Port          string `json:"port"`
	LoginID       string `json:"loginID"`
	LoginPassword string `json:"loginPassword"`
	// Encryption determines if and how communication with the user backend should be encrypted.
	// Can be "none", "ssl", "sslAny", "startTLS" or "startTLSAny".
	// This is only necessary if DsType is set to "external".
	Encryption string `json:"encryption"`
	// Completed indicates that the UserBackend step should not be shown in the UI of the setup.
	Completed bool `json:"completed"`

	// GroupBaseDN is the distinguished name for the group mapping.
	// This is only necessary if DsType is set to "external".
	GroupBaseDN string `json:"groupBaseDN"`
	// GroupSearchFilter is restricting which object classes should be searched for the group mapping.
	// This is only necessary if DsType is set to "external".
	GroupSearchFilter string `json:"groupSearchFilter"`
	// GroupAttributeName contains the name of the attribute of the group name.
	// This is only necessary if DsType is set to "external".
	GroupAttributeName string `json:"groupAttributeName"`
	// GroupAttributeDescription contains the name of the attribute for the group description.
	// This is only necessary if DsType is set to "external".
	GroupAttributeDescription string `json:"groupAttributeDescription"`
	// GroupAttributeMember contains the name of the attribute for the group members.
	// This is only necessary if DsType is set to "external".
	GroupAttributeMember string `json:"groupAttributeMember"`
}

UserBackend contains configuration for the directory service.

Jump to

Keyboard shortcuts

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