deployment

package
v0.0.0-...-9a2654e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 83 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverPodDetails

func RecoverPodDetails(in *api.DeploymentStatus) (changed bool, _ error)

func RecoverStatus

func RecoverStatus(in *api.DeploymentStatus, fs ...RecoverStatusFunc) (bool, error)

Types

type ArangoDIdentity

type ArangoDIdentity struct {
	interfaces.ContainerCreator

	ID      *api.ServerIDGroupSpec
	License *string
	// contains filtered or unexported fields
}

ArangoDIdentity helps to resolve the ArangoD identity, e.g.: image ID, version of the entrypoint.

func (*ArangoDIdentity) GetCommand

func (a *ArangoDIdentity) GetCommand() ([]string, error)

GetCommand returns the command for the ArangoD container identification.

func (*ArangoDIdentity) GetEnvs

func (a *ArangoDIdentity) GetEnvs() ([]core.EnvVar, []core.EnvFromSource)

GetEnvs returns environment variables for Arango identity containers.

func (*ArangoDIdentity) GetVolumeMounts

func (a *ArangoDIdentity) GetVolumeMounts() []core.VolumeMount

GetVolumeMounts returns volume mount for the ArangoD data.

type ArangoSyncIdentity

type ArangoSyncIdentity struct {
	interfaces.ContainerCreator
}

ArangoSyncIdentity helps to resolve the ArangoSync identity, e.g.: image ID, version of the entrypoint.

func (*ArangoSyncIdentity) GetExecutor

func (a *ArangoSyncIdentity) GetExecutor() string

GetExecutor returns the fixed path to the ArangoSync binary in the container.

type ConditionsMetrics

type ConditionsMetrics struct {
	// contains filtered or unexported fields
}

func (*ConditionsMetrics) CollectMetrics

func (c *ConditionsMetrics) CollectMetrics(namespace, name string, m metrics.PushMetric)

func (*ConditionsMetrics) RefreshDeployment

func (c *ConditionsMetrics) RefreshDeployment(conditions api.ConditionList, types ...api.ConditionType)

func (*ConditionsMetrics) RefreshMembers

func (c *ConditionsMetrics) RefreshMembers(members api.DeploymentStatusMemberElements, types ...api.ConditionType)

type ConditionsMetricsMap

type ConditionsMetricsMap map[api.ConditionType]bool

type Config

type Config struct {
	ServiceAccount            string
	AllowChaos                bool
	ScalingIntegrationEnabled bool
	OperatorImage             string
	ReconciliationDelay       time.Duration
	Scope                     scope.Scope
}

Config holds configuration settings for a Deployment

type ContainerIdentity

type ContainerIdentity struct {
	ID *api.ServerIDGroupSpec
	// contains filtered or unexported fields
}

ContainerIdentity helps to resolve the container identity, e.g.: image ID, version of the entrypoint.

func (*ContainerIdentity) GetCommand

func (a *ContainerIdentity) GetCommand() ([]string, error)

func (*ContainerIdentity) GetEnvs

func (a *ContainerIdentity) GetEnvs() ([]core.EnvVar, []core.EnvFromSource)

GetEnvs returns environment variables for identity containers.

func (*ContainerIdentity) GetExecutor

func (a *ContainerIdentity) GetExecutor() string

func (*ContainerIdentity) GetImage

func (a *ContainerIdentity) GetImage() string

func (*ContainerIdentity) GetImagePullPolicy

func (a *ContainerIdentity) GetImagePullPolicy() core.PullPolicy

func (*ContainerIdentity) GetLifecycle

func (a *ContainerIdentity) GetLifecycle() (*core.Lifecycle, error)

func (*ContainerIdentity) GetName

func (a *ContainerIdentity) GetName() string

func (*ContainerIdentity) GetPorts

func (a *ContainerIdentity) GetPorts() []core.ContainerPort

func (*ContainerIdentity) GetProbes

func (a *ContainerIdentity) GetProbes() (*core.Probe, *core.Probe, *core.Probe, error)

func (*ContainerIdentity) GetResourceRequirements

func (a *ContainerIdentity) GetResourceRequirements() core.ResourceRequirements

func (*ContainerIdentity) GetSecurityContext

func (a *ContainerIdentity) GetSecurityContext() *core.SecurityContext

func (*ContainerIdentity) GetVolumeMounts

func (a *ContainerIdentity) GetVolumeMounts() []core.VolumeMount

GetVolumeMounts returns nil for the basic container identity.

type Dependencies

type Dependencies struct {
	EventRecorder record.EventRecorder

	Client kclient.Client
}

Dependencies holds dependent services for a Deployment

type Deployment

type Deployment struct {
	// contains filtered or unexported fields
}

Deployment is the in process state of an ArangoDeployment.

func New

func New(config Config, deps Dependencies, apiObject *api.ArangoDeployment) (*Deployment, error)

New creates a new Deployment from the given API object.

func (*Deployment) ACS

func (d *Deployment) ACS() sutil.ACS

func (*Deployment) ApplyPatch

func (d *Deployment) ApplyPatch(ctx context.Context, p ...patch.Item) error

func (*Deployment) ApplyPatchOnPod

func (d *Deployment) ApplyPatchOnPod(ctx context.Context, pod *core.Pod, p ...patch.Item) error

func (*Deployment) CleanupPod

func (d *Deployment) CleanupPod(ctx context.Context, p *core.Pod) error

CleanupPod deletes a given pod with force and explicit UID. If the pod does not exist, the error is ignored.

func (*Deployment) CollectMetrics

func (d *Deployment) CollectMetrics(m metrics.PushMetric)

func (*Deployment) CreateEvent

func (d *Deployment) CreateEvent(evt *k8sutil.Event)

CreateEvent creates a given event. On error, the error is logged.

func (*Deployment) CreateMember

func (d *Deployment) CreateMember(ctx context.Context, group api.ServerGroup, id string, mods ...reconcile.CreateMemberMod) (string, error)

CreateMember adds a new member to the given group. If ID is non-empty, it will be used, otherwise a new ID is created.

func (*Deployment) CreateOperatorEngineOpsAlertEvent

func (d *Deployment) CreateOperatorEngineOpsAlertEvent(message string, args ...interface{})

func (*Deployment) DatabaseURL

func (d *Deployment) DatabaseURL() string

DatabaseURL returns an URL to reach the database from outside the Kubernetes cluster Empty string means that the database is not reachable outside the Kubernetes cluster.

func (*Deployment) DatabaseVersion

func (d *Deployment) DatabaseVersion() (string, string)

DatabaseVersion returns the version used by the deployment Returns versionNumber, licenseType

func (*Deployment) DeletePod

func (d *Deployment) DeletePod(ctx context.Context, podName string, options meta.DeleteOptions) error

DeletePod deletes a pod with given name in the namespace of the deployment. If the pod does not exist, the error is ignored.

func (*Deployment) DeletePvc

func (d *Deployment) DeletePvc(ctx context.Context, pvcName string) error

DeletePvc deletes a persistent volume claim with given name in the namespace of the deployment. If the pvc does not exist, the error is ignored.

func (*Deployment) DeleteSecret

func (d *Deployment) DeleteSecret(secretName string) error

DeleteSecret removes the Secret with given name. If the secret does not exist, the error is ignored.

func (*Deployment) DeleteTLSKeyfile

func (d *Deployment) DeleteTLSKeyfile(ctx context.Context, group api.ServerGroup, member api.MemberStatus) error

DeleteTLSKeyfile removes the Secret containing the TLS keyfile for the given member. If the secret does not exist, the error is ignored.

func (*Deployment) DisableScalingCluster

func (d *Deployment) DisableScalingCluster(ctx context.Context) error

func (*Deployment) EnableScalingCluster

func (d *Deployment) EnableScalingCluster(ctx context.Context) error

func (*Deployment) Environment

func (d *Deployment) Environment() api.Environment

Environment returns the environment used in the deployment.

func (*Deployment) GenerateMemberEndpoint

func (d *Deployment) GenerateMemberEndpoint(group api.ServerGroup, member api.MemberStatus) (string, error)

func (*Deployment) GetAPIObject

func (d *Deployment) GetAPIObject() k8sutil.APIObject

GetAPIObject returns the deployment as k8s object.

func (*Deployment) GetAgency

func (d *Deployment) GetAgency(ctx context.Context, agencyIDs ...string) (agency.Agency, error)

GetAgency returns a connection to the agency.

func (*Deployment) GetAgencyArangoDBCache

func (d *Deployment) GetAgencyArangoDBCache() (state.DB, bool)

func (*Deployment) GetAgencyCache deprecated

func (d *Deployment) GetAgencyCache() (state.State, bool)

Deprecated: Use WithAgencyCache instead

func (*Deployment) GetAgencyData

func (d *Deployment) GetAgencyData(ctx context.Context, i interface{}, keyParts ...string) error

GetAgencyData returns agency plan.

func (*Deployment) GetAgencyHealth

func (d *Deployment) GetAgencyHealth() (agency.Health, bool)

func (*Deployment) GetAuthentication

func (d *Deployment) GetAuthentication() conn.Auth

GetAuthentication return authentication for members

func (*Deployment) GetBackup

func (d *Deployment) GetBackup(ctx context.Context, backup string) (*backupApi.ArangoBackup, error)

GetBackup receives information about a backup resource

func (*Deployment) GetCachedStatus

func (d *Deployment) GetCachedStatus() inspectorInterface.Inspector

func (*Deployment) GetDatabaseAsyncClient

func (d *Deployment) GetDatabaseAsyncClient(ctx context.Context) (driver.Client, error)

GetDatabaseAsyncClient returns asynchronous client to the database.

func (*Deployment) GetDatabaseWithWrap

func (d *Deployment) GetDatabaseWithWrap(wrappers ...conn.ConnectionWrap) (driver.Client, error)

GetDatabaseWithWrap wraps client to the database with provided connection.

func (*Deployment) GetMembersState

func (d *Deployment) GetMembersState() memberState.StateInspector

func (*Deployment) GetMode

func (d *Deployment) GetMode() api.DeploymentMode

GetMode returns the mode of the deployment.

func (*Deployment) GetName

func (d *Deployment) GetName() string

func (*Deployment) GetNamespace

func (d *Deployment) GetNamespace() string

GetNamespace returns the kubernetes namespace that contains this deployment.

func (*Deployment) GetOperatorImage

func (d *Deployment) GetOperatorImage() string

func (*Deployment) GetOwnedPVCs

func (d *Deployment) GetOwnedPVCs() ([]core.PersistentVolumeClaim, error)

GetOwnedPVCs returns a list of all PVCs owned by the deployment.

func (*Deployment) GetOwnedPods

func (d *Deployment) GetOwnedPods(ctx context.Context) ([]core.Pod, error)

func (*Deployment) GetPhase

func (d *Deployment) GetPhase() api.DeploymentPhase

GetPhase returns the current phase of the deployment

func (*Deployment) GetPod

func (d *Deployment) GetPod(ctx context.Context, podName string) (*core.Pod, error)

GetPod returns pod.

func (*Deployment) GetPvc

func (d *Deployment) GetPvc(ctx context.Context, pvcName string) (*core.PersistentVolumeClaim, error)

GetPvc gets a PVC by the given name, in the samespace of the deployment.

func (*Deployment) GetScope

func (d *Deployment) GetScope() scope.Scope

func (*Deployment) GetServerAsyncClient

func (d *Deployment) GetServerAsyncClient(id string) (driver.Client, error)

GetServerAsyncClient returns an async client for a specific server.

func (*Deployment) GetServerClient

func (d *Deployment) GetServerClient(ctx context.Context, group api.ServerGroup, id string) (driver.Client, error)

GetServerClient returns a cached client for a specific server.

func (*Deployment) GetServerGroupIterator

func (d *Deployment) GetServerGroupIterator() reconciler.ServerGroupIterator

GetServerGroupIterator returns the deployment as ServerGroupIterator.

func (*Deployment) GetSpec

func (d *Deployment) GetSpec() api.DeploymentSpec

GetSpec returns the current specification

func (*Deployment) GetStatus

func (d *Deployment) GetStatus() api.DeploymentStatus

GetStatus returns the current status of the deployment together with the current version of that status.

func (*Deployment) GetSyncServerClient

func (d *Deployment) GetSyncServerClient(ctx context.Context, group api.ServerGroup, id string) (client.API, error)

GetSyncServerClient returns a cached client for a specific arangosync server.

func (*Deployment) GetTLSKeyfile

func (d *Deployment) GetTLSKeyfile(group api.ServerGroup, member api.MemberStatus) (string, error)

GetTLSKeyfile returns the keyfile encoded TLS certificate+key for the given member.

func (*Deployment) IsSyncEnabled

func (d *Deployment) IsSyncEnabled() bool

func (*Deployment) Members

func (d *Deployment) Members() map[api.ServerGroup][]server.Member

Members returns all members of the deployment by role.

func (*Deployment) Name

func (d *Deployment) Name() string

Name returns the name of the deployment.

func (*Deployment) Namespace

func (d *Deployment) Namespace() string

Namespace returns the namespace that contains the deployment.

func (*Deployment) PersistentVolumeClaimsModInterface

func (d *Deployment) PersistentVolumeClaimsModInterface() persistentvolumeclaimv1.ModInterface

func (*Deployment) PodCount

func (d *Deployment) PodCount() int

PodCount returns the number of pods for the deployment

func (*Deployment) PodDisruptionBudgetsModInterface

func (d *Deployment) PodDisruptionBudgetsModInterface() poddisruptionbudgetv1.ModInterface

func (*Deployment) PodsModInterface

func (d *Deployment) PodsModInterface() podv1.ModInterface

func (*Deployment) ReadyPodCount

func (d *Deployment) ReadyPodCount() int

ReadyPodCount returns the number of pods for the deployment that are in ready state

func (*Deployment) ReadyVolumeCount

func (d *Deployment) ReadyVolumeCount() int

ReadyVolumeCount returns the number of volumes for the deployment that are in ready state

func (*Deployment) RefreshAgencyCache

func (d *Deployment) RefreshAgencyCache(ctx context.Context) (uint64, error)

func (*Deployment) RemovePodFinalizers

func (d *Deployment) RemovePodFinalizers(ctx context.Context, podName string) error

RemovePodFinalizers removes all the finalizers from the Pod with given name in the namespace of the deployment. If the pod does not exist, the error is ignored.

func (*Deployment) RenderPodForMember

func (d *Deployment) RenderPodForMember(ctx context.Context, acs sutil.ACS, spec api.DeploymentSpec, status api.DeploymentStatus, memberID string, imageInfo api.ImageInfo) (*core.Pod, error)

func (*Deployment) RenderPodTemplateForMember

func (d *Deployment) RenderPodTemplateForMember(ctx context.Context, acs sutil.ACS, spec api.DeploymentSpec, status api.DeploymentStatus, memberID string, imageInfo api.ImageInfo) (*core.PodTemplateSpec, error)

func (*Deployment) SecretsModInterface

func (d *Deployment) SecretsModInterface() secretv1.ModInterface

func (*Deployment) SelectImage

func (d *Deployment) SelectImage(spec api.DeploymentSpec, status api.DeploymentStatus) (api.ImageInfo, bool)

func (*Deployment) SelectImageForMember

func (d *Deployment) SelectImageForMember(spec api.DeploymentSpec, status api.DeploymentStatus, member api.MemberStatus) (api.ImageInfo, bool)

func (*Deployment) ServiceAccountsModInterface

func (d *Deployment) ServiceAccountsModInterface() serviceaccountv1.ModInterface

func (*Deployment) ServiceMonitorsModInterface

func (d *Deployment) ServiceMonitorsModInterface() servicemonitorv1.ModInterface

func (*Deployment) ServicesModInterface

func (d *Deployment) ServicesModInterface() servicev1.ModInterface

func (*Deployment) SetAgencyMaintenanceMode

func (d *Deployment) SetAgencyMaintenanceMode(ctx context.Context, enabled bool) error

func (*Deployment) SetNumberOfServers

func (d *Deployment) SetNumberOfServers(ctx context.Context, noCoordinators, noDBServers *int) error

SetNumberOfServers adjust number of DBservers and coordinators in arangod

func (*Deployment) ShardsInSyncMap

func (d *Deployment) ShardsInSyncMap() (state.ShardsSyncStatus, bool)

ShardsInSyncMap returns last in sync state of shards. If no state is available, false is returned.

func (*Deployment) StateColor

func (d *Deployment) StateColor() server.StateColor

StateColor determinates the state of the deployment in color codes.

func (*Deployment) Stop

func (d *Deployment) Stop()

Stop the deployment. Called when the deployment was deleted by the user.

func (*Deployment) StorageClasses

func (d *Deployment) StorageClasses() []string

StorageClasses returns the names of the StorageClasses used by this deployment.

func (*Deployment) Update

func (d *Deployment) Update(apiObject *api.ArangoDeployment)

Update the deployment. This sends an update event in the deployment event queue.

func (*Deployment) UpdateMember

func (d *Deployment) UpdateMember(ctx context.Context, member api.MemberStatus) error

UpdateMember updates the deployment status wrt the given member.

func (*Deployment) UpdatePvc

func (d *Deployment) UpdatePvc(ctx context.Context, pvc *core.PersistentVolumeClaim) error

UpdatePvc updated a persistent volume claim in the namespace of the deployment. If the pvc does not exist, the error is ignored.

func (*Deployment) UpdateStatus

func (d *Deployment) UpdateStatus(ctx context.Context, status api.DeploymentStatus) error

UpdateStatus replaces the status of the deployment with the given status and updates the resources in k8s. If the given last version does not match the actual last version of the status object, an error is returned.

func (*Deployment) VolumeCount

func (d *Deployment) VolumeCount() int

VolumeCount returns the number of volumes for the deployment

func (*Deployment) WithAgencyCache

func (d *Deployment) WithAgencyCache(action func(state.State)) bool

func (*Deployment) WithMemberStatusUpdate

func (d *Deployment) WithMemberStatusUpdate(ctx context.Context, id string, group api.ServerGroup, action reconciler.DeploymentMemberStatusUpdateFunc) error

func (*Deployment) WithMemberStatusUpdateErr

func (d *Deployment) WithMemberStatusUpdateErr(ctx context.Context, id string, group api.ServerGroup, action reconciler.DeploymentMemberStatusUpdateErrFunc) error

func (*Deployment) WithStatusUpdate

func (d *Deployment) WithStatusUpdate(ctx context.Context, action reconciler.DeploymentStatusUpdateFunc) error

func (*Deployment) WithStatusUpdateErr

func (d *Deployment) WithStatusUpdateErr(ctx context.Context, action reconciler.DeploymentStatusUpdateErrFunc) error

func (*Deployment) WrapLogger

func (d *Deployment) WrapLogger(in *zerolog.Event) *zerolog.Event

type ImageUpdatePod

type ImageUpdatePod struct {
	// contains filtered or unexported fields
}

ImageUpdatePod describes how to launch the ID ArangoD POD.

func (*ImageUpdatePod) Annotations

func (i *ImageUpdatePod) Annotations() map[string]string

func (*ImageUpdatePod) ApplyPodSpec

func (i *ImageUpdatePod) ApplyPodSpec(p *core.PodSpec) error

func (*ImageUpdatePod) AsInput

func (a *ImageUpdatePod) AsInput() pod.Input

func (*ImageUpdatePod) GetAffinityRole

func (i *ImageUpdatePod) GetAffinityRole() string

func (*ImageUpdatePod) GetContainerCreator

func (i *ImageUpdatePod) GetContainerCreator() interfaces.ContainerCreator

func (*ImageUpdatePod) GetFinalizers

func (i *ImageUpdatePod) GetFinalizers() []string

func (*ImageUpdatePod) GetImagePullSecrets

func (i *ImageUpdatePod) GetImagePullSecrets() []string

func (*ImageUpdatePod) GetInitContainers

func (i *ImageUpdatePod) GetInitContainers(cachedStatus interfaces.Inspector) ([]core.Container, error)

func (*ImageUpdatePod) GetName

func (i *ImageUpdatePod) GetName() string

func (*ImageUpdatePod) GetNodeAffinity

func (i *ImageUpdatePod) GetNodeAffinity() *core.NodeAffinity

func (*ImageUpdatePod) GetNodeSelector

func (i *ImageUpdatePod) GetNodeSelector() map[string]string

func (*ImageUpdatePod) GetPodAffinity

func (i *ImageUpdatePod) GetPodAffinity() *core.PodAffinity

func (*ImageUpdatePod) GetPodAntiAffinity

func (i *ImageUpdatePod) GetPodAntiAffinity() *core.PodAntiAffinity

func (*ImageUpdatePod) GetRestartPolicy

func (i *ImageUpdatePod) GetRestartPolicy() core.RestartPolicy

func (*ImageUpdatePod) GetRole

func (i *ImageUpdatePod) GetRole() string

func (*ImageUpdatePod) GetServiceAccountName

func (i *ImageUpdatePod) GetServiceAccountName() string

func (*ImageUpdatePod) GetSidecars

func (i *ImageUpdatePod) GetSidecars(*core.Pod) error

func (*ImageUpdatePod) GetTolerations

func (i *ImageUpdatePod) GetTolerations() []core.Toleration

func (*ImageUpdatePod) GetVolumes

func (i *ImageUpdatePod) GetVolumes() []core.Volume

func (*ImageUpdatePod) Init

func (*ImageUpdatePod) IsDeploymentMode

func (i *ImageUpdatePod) IsDeploymentMode() bool

func (*ImageUpdatePod) Labels

func (i *ImageUpdatePod) Labels() map[string]string

func (*ImageUpdatePod) Validate

func (i *ImageUpdatePod) Validate(_ interfaces.Inspector) error

type Metrics

type Metrics struct {
	Agency struct {
		Errors  uint64
		Fetches uint64
		Index   uint64
	}

	Errors struct {
		DeploymentValidationErrors, DeploymentImmutableErrors, StatusRestores uint64
	}

	ArangodbOperatorEngineOpsAlerts int

	Deployment struct {
		Accepted, UpToDate, Propagated bool
	}

	Conditions ConditionsMetrics
}

type RecoverStatusFunc

type RecoverStatusFunc func(in *api.DeploymentStatus) (bool, error)

Jump to

Keyboard shortcuts

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