context

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 14 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"
	// HelmRepositoryConfigMapName is the name of the configMap containing the endpoint of the HelmRepository.
	HelmRepositoryConfigMapName = "component-operator-helm-repository"
	// HelmRepositoryDevPath is the path to the config containing the endpoint of the HelmRepository. This is used for development.
	HelmRepositoryDevPath = "k8s/dev-resources/helm-repository.yaml"
	// 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

func IsDevelopmentStage added in v0.16.1

func IsDevelopmentStage(stage string) bool

Types

type ComponentAttributes added in v0.17.0

type ComponentAttributes struct {
	// Version specifies the component version.
	Version string `json:"version" yaml:"version"`
	// HelmRepositoryNamespace specifies the component namespace inside the originating helm repository, f. i. "k8s" or "official".
	HelmRepositoryNamespace string `json:"helmRepositoryNamespace" yaml:"helmRepositoryNamespace"`
	// DeployNamespace specifies the cluster namespace where the helm chart should be deployed to. If left empty, the currently selected cluster namespace will be used by the component operator.
	// +optional
	DeployNamespace string `json:"deployNamespace" yaml:"deployNamespace"`
	// ValuesYamlOverwrite is a multiline-yaml string that is applied alongside the original values.yaml-file of the component.
	// It can be used to overwrite specific configurations. Lists are overwritten, maps are merged.
	// +optional
	ValuesYamlOverwrite string `json:"valuesYamlOverwrite,omitempty"`
}

ComponentAttributes defines the component to install.

type Config

type Config struct {
	// LogLevel sets the log level for the app
	LogLevel *logrus.Level `json:"log_level" yaml:"log_level"`
	// TargetNamespace represents the namespace that is created for the ecosystem
	TargetNamespace string `json:"target_namespace" yaml:"target_namespace"`
	// ComponentOperatorCrdChart sets the Helm-Chart which controls the installation of the component-operator CRD into the current cluster.
	ComponentOperatorCrdChart string `json:"component_operator_crd_chart" yaml:"component_operator_crd_chart"`
	// ComponentOperatorChart sets the Helm-Chart which controls the installation of the component-operator into the current cluster.
	ComponentOperatorChart string `json:"component_operator_chart" yaml:"component_operator_chart"`
	// Components sets the List of Components that should be installed by the setup
	Components map[string]ComponentAttributes `json:"components" yaml:"components"`
	// EtcdServerResourceURL sets the K8s resource URL which controls the installation of the etcd server into the current cluster.
	EtcdClientImageRepo string `json:"etcd_client_image_repo" yaml:"etcd_client_image_repo"`
	// KeyProvider sets the key provider used to encrypt etcd values
	KeyProvider string `json:"key_provider" yaml:"key_provider"`
	// ResourcePatches contains json patches for kubernetes resources to be applied on certain phases of the setup process.
	ResourcePatches []patch.ResourcePatch `json:"resource_patches" 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 `json:"endpoint" yaml:"endpoint"`
	Username  string `json:"username" yaml:"username"`
	Password  string `json:"password" yaml:"password"`
	URLSchema string `json:"urlschema" 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
	Stage                     string
	AppConfig                 *Config
	SetupJsonConfiguration    *SetupJsonConfiguration
	DoguRegistryConfiguration *DoguRegistrySecret
	HelmRepositoryData        *componentOpConfig.HelmRepositoryData
}

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
	DevHelmRepositoryDataPath 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