Documentation ¶
Index ¶
- type AdditionalIngressAnnotationsManager
- type Applier
- type AsyncExecutor
- type AsyncStep
- type CollectApplier
- type CommandExecutor
- type DeleteManager
- type DependencyValidator
- type DoguHealthChecker
- type DoguManager
- type DoguRecursiveHealthChecker
- type DoguRegistrator
- type DoguResourceGenerator
- type DoguSecretHandler
- type ExecPod
- type ExecPodFactory
- type ExposePortAdder
- type ExposePortRemover
- type FileExtractor
- type ImageRegistry
- type InstallManager
- type LocalDoguFetcher
- type PodStatusForExec
- type PodTemplateResourceGenerator
- type PremisesChecker
- type RequeueHandler
- type ResourceDoguFetcher
- type ResourceRequirementsGenerator
- type ResourceUpserter
- type SecretResourceGenerator
- type ServiceAccountCreator
- type ServiceAccountRemover
- type ShellCommand
- type SuffixGenerator
- type SupportManager
- type TcpUpdServiceExposer
- type UpgradeExecutor
- type UpgradeManager
- type VolumeManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalIngressAnnotationsManager ¶ added in v0.29.0
type AdditionalIngressAnnotationsManager interface { // SetDoguAdditionalIngressAnnotations edits the additional ingress annotations in the given dogu's service. SetDoguAdditionalIngressAnnotations(ctx context.Context, doguResource *v1.Dogu) error }
AdditionalIngressAnnotationsManager includes functionality to edit additional ingress annotations for dogus in the cluster.
type Applier ¶
type Applier interface { // ApplyWithOwner provides a testable method for applying generic, unstructured K8s resources to the API ApplyWithOwner(doc apply.YamlDocument, namespace string, resource metav1.Object) error }
Applier provides ways to apply unstructured Kubernetes resources against the API.
type AsyncExecutor ¶
type AsyncExecutor interface { // AddStep adds a step. AddStep(step AsyncStep) // Execute executes all steps. Execute(ctx context.Context, dogu *k8sv1.Dogu, currentState string) error }
AsyncExecutor collects steps and executes them all.
type AsyncStep ¶
type AsyncStep interface { // GetStartCondition returns the start condition for the step. GetStartCondition() string // Execute executes the step and returns the end condition of the step. Execute(ctx context.Context, dogu *k8sv1.Dogu) (string, error) }
AsyncStep capsules an action with a starting and end condition
type CollectApplier ¶
type CollectApplier interface { // CollectApply applies the given resources to the K8s cluster CollectApply(ctx context.Context, customK8sResources map[string]string, doguResource *k8sv1.Dogu) error }
CollectApplier provides ways to collectedly apply unstructured Kubernetes resources against the API.
type CommandExecutor ¶
type CommandExecutor interface { // ExecCommandForDogu executes a command in a dogu. ExecCommandForDogu(ctx context.Context, resource *k8sv1.Dogu, command ShellCommand, expected PodStatusForExec) (*bytes.Buffer, error) // ExecCommandForPod executes a command in a pod that must not necessarily be a dogu. ExecCommandForPod(ctx context.Context, pod *corev1.Pod, command ShellCommand, expected PodStatusForExec) (*bytes.Buffer, error) }
CommandExecutor is used to execute commands in pods and dogus
type DeleteManager ¶
type DeleteManager interface { // Delete deletes a dogu resource. Delete(ctx context.Context, doguResource *v1.Dogu) error }
DeleteManager includes functionality to delete dogus from the cluster.
type DependencyValidator ¶
type DependencyValidator interface { // ValidateDependencies is used to check if dogu dependencies are installed. ValidateDependencies(ctx context.Context, dogu *cesappcore.Dogu) error }
DependencyValidator checks if all necessary dependencies for an upgrade are installed.
type DoguHealthChecker ¶
type DoguHealthChecker interface { // CheckWithResource returns nil if the dogu described by the resource is up and running. CheckWithResource(ctx context.Context, doguResource *k8sv1.Dogu) error }
DoguHealthChecker includes functionality to check if the dogu described by the resource is up and running.
type DoguManager ¶
type DoguManager interface { InstallManager UpgradeManager DeleteManager VolumeManager AdditionalIngressAnnotationsManager SupportManager }
DoguManager abstracts the simple dogu operations in a k8s CES.
type DoguRecursiveHealthChecker ¶
type DoguRecursiveHealthChecker interface { // CheckDependenciesRecursive returns nil if the dogu's mandatory dependencies are up and running. CheckDependenciesRecursive(ctx context.Context, fromDogu *cesappcore.Dogu, currentK8sNamespace string) error }
DoguRecursiveHealthChecker includes functionality to check if a dogus dependencies are up and running.
type DoguRegistrator ¶
type DoguRegistrator interface { // RegisterNewDogu registers a new dogu in the local dogu registry. RegisterNewDogu(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) error // RegisterDoguVersion registers a new version for an existing dogu in the dogu registry. RegisterDoguVersion(dogu *cesappcore.Dogu) error // UnregisterDogu removes a registration of a dogu from the local dogu registry. UnregisterDogu(dogu string) error }
DoguRegistrator includes functionality to manage the registration of dogus in the local dogu registry.
type DoguResourceGenerator ¶
type DoguResourceGenerator interface { SecretResourceGenerator PodTemplateResourceGenerator // CreateDoguDeployment creates a new instance of a deployment with a given dogu.json and dogu custom resource. CreateDoguDeployment(doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) (*apps.Deployment, error) // CreateDoguService creates a new instance of a service with the given dogu custom resource and container image. // The container image is used to extract the exposed ports. The created service is rather meant for cluster-internal // apps and dogus (f. e. postgresql) which do not need external access. The given container image config provides // the service ports to the created service. CreateDoguService(doguResource *k8sv1.Dogu, imageConfig *image.ConfigFile) (*v1.Service, error) // CreateDoguPVC creates a persistent volume claim with a 5Gi storage for the given dogu. CreateDoguPVC(doguResource *k8sv1.Dogu) (*v1.PersistentVolumeClaim, error) }
DoguResourceGenerator is used to generate kubernetes resources for the dogu.
type DoguSecretHandler ¶
type DoguSecretHandler interface { // WriteDoguSecretsToRegistry is used to write potential secret from the setup.json registryConfigEncrypted to the // respective dogu configurations. WriteDoguSecretsToRegistry(ctx context.Context, doguResource *k8sv1.Dogu) error }
DoguSecretHandler includes functionality to associate secrets from setup with a dogu.
type ExecPod ¶
type ExecPod interface { // Create adds a new exec pod to the cluster. Create(ctx context.Context) error // Delete deletes the exec pod from the cluster. Delete(ctx context.Context) error // PodName returns the name of the pod. PodName() string // ObjectKey returns the ExecPod's K8s object key. ObjectKey() *client.ObjectKey // Exec runs the provided command in this execPod Exec(ctx context.Context, cmd ShellCommand) (out *bytes.Buffer, err error) }
ExecPod provides methods for instantiating and removing an intermediate pod based on a Dogu container image.
type ExecPodFactory ¶
type ExecPodFactory interface { // NewExecPod creates a new ExecPod. NewExecPod(doguResource *k8sv1.Dogu, dogu *core.Dogu) (ExecPod, error) }
ExecPodFactory provides functionality to create ExecPods.
type ExposePortAdder ¶ added in v0.31.0
type ExposePortAdder interface { // CreateOrUpdateCesLoadbalancerService deletes the exposure of the exposed services from the dogu. CreateOrUpdateCesLoadbalancerService(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) (*v1.Service, error) }
ExposePortAdder is used to expose exposed services from the dogu.
type ExposePortRemover ¶ added in v0.31.0
type ExposePortRemover interface { // RemoveExposedPorts deletes the exposure of the exposed services from the dogu. RemoveExposedPorts(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) error }
ExposePortRemover is used to delete the exposure of the exposed services from the dogu.
type FileExtractor ¶
type FileExtractor interface { // ExtractK8sResourcesFromContainer copies a file from stdout into map of strings. ExtractK8sResourcesFromContainer(ctx context.Context, k8sExecPod ExecPod) (map[string]string, error) }
FileExtractor provides functionality to get the contents of files from a container.
type ImageRegistry ¶
type ImageRegistry interface { // PullImageConfig is used to pull the given container image. PullImageConfig(ctx context.Context, image string) (*imagev1.ConfigFile, error) }
ImageRegistry abstracts the use of a container registry and includes functionality to pull container images.
type InstallManager ¶
type InstallManager interface { // Install installs a dogu resource. Install(ctx context.Context, doguResource *v1.Dogu) error }
InstallManager includes functionality to install dogus in the cluster.
type LocalDoguFetcher ¶
type LocalDoguFetcher interface { // FetchInstalled fetches the dogu from the local registry and returns it with patched dogu dependencies (which // otherwise might be incompatible with K8s CES). FetchInstalled(doguName string) (installedDogu *cesappcore.Dogu, err error) }
LocalDoguFetcher includes functionality to search the local dogu registry for a dogu.
type PodStatusForExec ¶
type PodStatusForExec string
PodStatusForExec describes a state in the lifecycle of a pod.
const ( // ContainersStarted means that all containers of a pod were started. ContainersStarted PodStatusForExec = "started" // PodReady means that the readiness probe of the pod has succeeded. PodReady PodStatusForExec = "ready" )
type PodTemplateResourceGenerator ¶ added in v0.36.0
type PodTemplateResourceGenerator interface { // GetPodTemplate returns a pod template for the given dogu. GetPodTemplate(doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) (*v1.PodTemplateSpec, error) }
PodTemplateResourceGenerator is used to generate pod templates.
type PremisesChecker ¶
type PremisesChecker interface { // Check checks if dogu premises are met before a dogu upgrade. Check(ctx context.Context, toDoguResource *k8sv1.Dogu, fromDogu *cesappcore.Dogu, toDogu *cesappcore.Dogu) error }
PremisesChecker includes functionality to check if the premises for an upgrade are met.
type RequeueHandler ¶ added in v0.36.0
type RequeueHandler interface { // Handle takes an error and handles the requeue process for the current dogu operation. Handle(ctx context.Context, contextMessage string, doguResource *v1.Dogu, err error, onRequeue func(dogu *v1.Dogu)) (result ctrl.Result, requeueErr error) }
RequeueHandler abstracts the process to decide whether a requeue process should be done based on received errors.
type ResourceDoguFetcher ¶
type ResourceDoguFetcher interface { // FetchWithResource fetches the dogu either from the remote dogu registry or from a local development dogu map and // returns it with patched dogu dependencies (which otherwise might be incompatible with K8s CES). FetchWithResource(ctx context.Context, doguResource *k8sv1.Dogu) (*cesappcore.Dogu, *k8sv1.DevelopmentDoguMap, error) }
ResourceDoguFetcher includes functionality to get a dogu either from the remote dogu registry or from a local development dogu map.
type ResourceRequirementsGenerator ¶ added in v0.33.0
type ResourceRequirementsGenerator interface { // Generate creates resource limits and requests for dogu deployments. // It tries to retrieve them from the dogu config registry. If not set, defaults from the dogu.json are used. // If there is no default, the requirement will be omitted. Generate(dogu *cesappcore.Dogu) (v1.ResourceRequirements, error) }
ResourceRequirementsGenerator handles resource requirements (limits and requests) for dogu deployments.
type ResourceUpserter ¶
type ResourceUpserter interface { // UpsertDoguDeployment generates a deployment for a given dogu and applies it to the cluster. // All parameters are mandatory except deploymentPatch which may be nil. // The deploymentPatch can be used to arbitrarily alter the deployment after resource generation. UpsertDoguDeployment(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu, deploymentPatch func(*apps.Deployment)) (*apps.Deployment, error) // UpsertDoguService generates a service for a given dogu and applies it to the cluster. UpsertDoguService(ctx context.Context, doguResource *k8sv1.Dogu, image *image.ConfigFile) (*v1.Service, error) // UpsertDoguPVCs generates a persistent volume claim for a given dogu and applies it to the cluster. UpsertDoguPVCs(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) (*v1.PersistentVolumeClaim, error) // UpsertDoguExposedService creates oder updates the exposed service with the given dogu. UpsertDoguExposedService(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) (*v1.Service, error) }
ResourceUpserter includes functionality to generate and create all the necessary K8s resources for a given dogu.
type SecretResourceGenerator ¶
type SecretResourceGenerator interface { // CreateDoguSecret generates a secret for the dogu resource containing the given data. CreateDoguSecret(doguResource *k8sv1.Dogu, stringData map[string]string) (*v1.Secret, error) }
SecretResourceGenerator is used to generate kubernetes secret resources
type ServiceAccountCreator ¶
type ServiceAccountCreator interface { // CreateAll is used to create all necessary service accounts for the given dogu. CreateAll(ctx context.Context, dogu *cesappcore.Dogu) error }
ServiceAccountCreator includes functionality to create necessary service accounts for a dogu.
type ServiceAccountRemover ¶
type ServiceAccountRemover interface { // RemoveAll is used to remove all existing service accounts for the given dogu. RemoveAll(ctx context.Context, dogu *cesappcore.Dogu) error }
ServiceAccountRemover includes functionality to remove existing service accounts for a dogu.
type ShellCommand ¶
type ShellCommand interface { // CommandWithArgs returns the commands and its arguments in a way suitable for execution. CommandWithArgs() []string // Stdin returns the appropriate reader for standard input. Stdin() io.Reader }
ShellCommand represents a command that can be executed in the shell of a container.
type SuffixGenerator ¶
type SuffixGenerator interface { // String returns a random suffix string with the given length String(length int) string }
SuffixGenerator can generate random suffix strings, e.g. for ExecPods.
type SupportManager ¶
type SupportManager interface { // HandleSupportMode handles the support flag in the dogu spec. HandleSupportMode(ctx context.Context, doguResource *v1.Dogu) (bool, error) }
SupportManager includes functionality to handle the support flag for dogus in the cluster.
type TcpUpdServiceExposer ¶ added in v0.31.0
type TcpUpdServiceExposer interface { // ExposeOrUpdateDoguServices adds or updates the exposing of the exposed ports in the dogu from the cluster. These are typically // entries in a configmap. ExposeOrUpdateDoguServices(ctx context.Context, namespace string, dogu *cesappcore.Dogu) error // DeleteDoguServices removes the exposing of the exposed ports in the dogu from the cluster. These are typically // entries in a configmap. DeleteDoguServices(ctx context.Context, namespace string, dogu *cesappcore.Dogu) error }
TcpUpdServiceExposer is used to expose non http services.
type UpgradeExecutor ¶
type UpgradeExecutor interface { // Upgrade executes the actual dogu upgrade. Upgrade(ctx context.Context, toDoguResource *k8sv1.Dogu, fromDogu *cesappcore.Dogu, toDogu *cesappcore.Dogu) error }
UpgradeExecutor applies upgrades the upgrade from an earlier dogu version to a newer version.