resource

package
v3.29.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActualVolumeSizeMeetsMinDataSize = "ActualVolumeSizeMeetsMinDataSize"
	VolumeSizeNotMeetsMinDataSize    = "VolumeSizeNotMeetsMinDataSize"
)
View Source
const ReplicaCountStarted = 1
View Source
const ReplicaCountStopped = 0

Variables

This section is empty.

Functions

func CreateExporterContainerName added in v3.3.0

func CreateExporterContainerName(doguName string) string

CreateExporterContainerName creates the name for the exporter-container used as a sidecar-container

func CreateStartupProbe

func CreateStartupProbe(dogu *core.Dogu) *corev1.Probe

CreateStartupProbe returns a container start-up probe for the given dogu if it contains a state healthcheck. Otherwise, it returns nil.

func CreateVolumes added in v3.8.0

func CreateVolumes(doguResource *k8sv2.Dogu, dogu *core.Dogu, exportModeActive bool) ([]corev1.Volume, error)

func GetAppLabel

func GetAppLabel() k8sv2.CesMatchingLabels

GetAppLabel returns an app label which all CES resource may receive for general selection.

func NewCollectApplier

func NewCollectApplier(applier Applier) *collectApplier

NewCollectApplier creates a K8s resource applier that filters and collects deployment resources for a later, customized application.

func SetCurrentDataVolumeSize added in v3.9.0

func SetCurrentDataVolumeSize(ctx context.Context, doguInterface doguClientV2.DoguInterface, client client.Client, doguResource *k8sv2.Dogu, pvc *corev1.PersistentVolumeClaim) error

SetCurrentDataVolumeSize set the current DataVolumeSize within the status of the dogu

Types

type AdditionalImages added in v3.14.0

type AdditionalImages map[string]string

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 CollectApplier

type CollectApplier interface {
	// CollectApply applies the given resources to the K8s cluster
	CollectApply(ctx context.Context, customK8sResources map[string]string, doguResource *k8sv2.Dogu) error
}

CollectApplier provides ways to collectedly apply unstructured Kubernetes resources against the API.

type DoguConfigRepository added in v3.14.0

type DoguConfigRepository interface {
	Get(ctx context.Context, name dogu.SimpleName) (config.DoguConfig, error)
}

type DoguResourceGenerator

type DoguResourceGenerator interface {

	// CreateDoguDeployment creates a new instance of a deployment with a given dogu.json and dogu custom resource.
	CreateDoguDeployment(ctx context.Context, doguResource *k8sv2.Dogu, dogu *cesappcore.Dogu) (*apps.Deployment, error)
	// UpdateDoguDeployment updates the given dogu deployment with a given dogu.json and dogu custom resource.
	// This method should be used to update the dogu deployments. A creation of a new Deployment in CreateDoguDeployment
	// would result in an unnecessary reconciliation and even with the predicate filter in an endless loop.
	UpdateDoguDeployment(ctx context.Context, deployment *apps.Deployment, doguResource *k8sv2.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 *k8sv2.Dogu, dogu *cesappcore.Dogu, imageConfig *image.ConfigFile) (*v1.Service, error)
	// CreateDoguPVC creates a persistent volume claim with a 5Gi storage for the given dogu.
	CreateDoguPVC(doguResource *k8sv2.Dogu) (*v1.PersistentVolumeClaim, error)
	BuildAdditionalMountInitContainer(ctx context.Context, dogu *cesappcore.Dogu, doguResource *k8sv2.Dogu, image string, requirements v1.ResourceRequirements) (*v1.Container, error)
	// contains filtered or unexported methods
}

DoguResourceGenerator is used to generate kubernetes resources for the dogu.

func NewResourceGenerator

func NewResourceGenerator(
	scheme *runtime.Scheme,
	requirementsGenerator RequirementsGenerator,
	hostAliasGenerator HostAliasGenerator,
	securityContextGenerator SecurityContextGenerator,
	additionalImages AdditionalImages,
	operatorConfig *config.OperatorConfig,
) DoguResourceGenerator

NewResourceGenerator creates a new generator for k8s resources

type GlobalConfigRepository added in v3.14.0

type GlobalConfigRepository interface {
	Get(ctx context.Context) (config.GlobalConfig, error)
}

type HostAliasGenerator added in v3.14.0

type HostAliasGenerator interface {
	Generate(context.Context) (hostAliases []v1.HostAlias, err error)
}

HostAliasGenerator creates host aliases from fqdn, internal ip and additional host configuration.

type NetPolType added in v3.0.3

type NetPolType int

func (NetPolType) String added in v3.0.3

func (c NetPolType) String() string

type RequirementsGenerator

type RequirementsGenerator interface {
	Generate(ctx context.Context, dogu *cesappcore.Dogu) (v1.ResourceRequirements, error)
}

RequirementsGenerator handles resource requirements (limits and requests) for dogu deployments.

func NewRequirementsGenerator

func NewRequirementsGenerator(doguConfigGetter DoguConfigRepository) RequirementsGenerator

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 *k8sv2.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 *k8sv2.Dogu, dogu *cesappcore.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 *k8sv2.Dogu, dogu *cesappcore.Dogu) (*v1.PersistentVolumeClaim, error)
	// SetControllerReferenceForPVC sets a controller reference to the dogu in the specified PVC.
	SetControllerReferenceForPVC(ctx context.Context, pvc *v1.PersistentVolumeClaim, doguResource *k8sv2.Dogu) error
	UpsertDoguNetworkPolicies(ctx context.Context, doguResource *k8sv2.Dogu, dogu *cesappcore.Dogu, hasIngress bool) error
}

ResourceUpserter includes functionality to generate and create all the necessary K8s resources for a given dogu.

func NewUpserter

func NewUpserter(client client.Client, scheme *runtime.Scheme, generator DoguResourceGenerator, config *opConfig.OperatorConfig) ResourceUpserter

NewUpserter creates a new upserter that generates dogu resources and applies them to the cluster.

type SecurityContextGenerator added in v3.2.0

type SecurityContextGenerator interface {
	// Generate creates a k8s security context for the pod and containers of a dogu.
	Generate(ctx context.Context, dogu *cesappcore.Dogu, doguResource *k8sv2.Dogu) (*v1.PodSecurityContext, *v1.SecurityContext)
}

func NewSecurityContextGenerator added in v3.2.0

func NewSecurityContextGenerator() SecurityContextGenerator

Jump to

Keyboard shortcuts

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