Documentation ¶
Index ¶
- type AdditionalIngressAnnotationsManager
- type Applier
- type AsyncExecutor
- type AsyncStep
- type CollectApplier
- type CommandExecutor
- type DeleteManager
- type DependencyValidator
- type DoguHealthChecker
- type DoguLimits
- type DoguManager
- type DoguRecursiveHealthChecker
- type DoguRegistrator
- type DoguResourceGenerator
- type DoguSecretHandler
- type ExecPod
- type ExecPodFactory
- type ExecPodVolumeMode
- type FileExtractor
- type ImageRegistry
- type InstallManager
- type LimitPatcher
- type LocalDoguFetcher
- type PodStatusForExec
- type PremisesChecker
- type ResourceDoguFetcher
- type ResourceUpserter
- type ResourceValidator
- type SecretResourceGenerator
- type ServiceAccountCreator
- type ServiceAccountRemover
- type ShellCommand
- type SuffixGenerator
- type SupportManager
- 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 DoguLimits ¶
type DoguLimits interface { // CpuLimit returns the cpu requests and limit values for the dogu deployment. For more information about resource management in Kubernetes see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. CpuLimit() *resource.Quantity // MemoryLimit returns the memory requests and limit values for the dogu deployment. For more information about resource management in Kubernetes see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. MemoryLimit() *resource.Quantity // EphemeralStorageLimit returns the ephemeral storage requests and limit values for the dogu deployment. For more information about resource management in Kubernetes see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. EphemeralStorageLimit() *resource.Quantity }
DoguLimits provides physical resource limits for a dogu.
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 { // 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) // CreateReservedPVC creates a persistent volume claim with a 10Mi storage for the given dogu. // Used for example for upgrade operations. CreateReservedPVC(doguResource *k8sv1.Dogu) (*v1.PersistentVolumeClaim, error) // CreateDoguExposedServices creates a new instance of a LoadBalancer service for each exposed port. // The created service is rather meant for cluster-external access. The given dogu provides the service ports to the // created service. An additional ingress rule must be created in order to map the arbitrary port to something useful // (see K8s-service-discovery). CreateDoguExposedServices(doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) ([]*v1.Service, 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 string, 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(execPodFactoryMode ExecPodVolumeMode, doguResource *k8sv1.Dogu, dogu *core.Dogu) (ExecPod, error) }
ExecPodFactory provides functionality to create ExecPods.
type ExecPodVolumeMode ¶
type ExecPodVolumeMode int
ExecPodVolumeMode indicates whether to mount a dogu's PVC (which only makes sense when the dogu was already installed).
const ( // VolumeModeInstall indicates to not mount a dogu's PVC. VolumeModeInstall ExecPodVolumeMode = iota // VolumeModeUpgrade indicates to mount a dogu's PVC. VolumeModeUpgrade )
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 LimitPatcher ¶
type LimitPatcher interface { // RetrievePodLimits reads all container keys from the dogu configuration and creates a DoguLimits object. RetrievePodLimits(doguResource *k8sv1.Dogu) (DoguLimits, error) // PatchDeployment patches the given deployment with the resource limits provided. PatchDeployment(deployment *v1.Deployment, limits DoguLimits) error }
LimitPatcher includes functionality to read and patch the physical resource limits of a dogu.
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 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 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 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) // UpsertDoguExposedServices creates exposed services based on the given dogu. If an error occurs during creating // several exposed services, this method tries to apply as many exposed services as possible and returns then // an error collection. UpsertDoguExposedServices(ctx context.Context, doguResource *k8sv1.Dogu, dogu *cesappcore.Dogu) ([]*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) }
ResourceUpserter includes functionality to generate and create all the necessary K8s resources for a given dogu.
type ResourceValidator ¶
type ResourceValidator interface { // Validate checks that a resource contains all necessary data to be used in a dogu. Validate(ctx context.Context, doguName string, obj client.Object) error }
ResourceValidator provides functionality to validate 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) (*corev1.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 }
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 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.