Documentation
¶
Index ¶
- type Context
- type Resources
- func (r *Resources) CleanupRemovedMembers() error
- func (r *Resources) CleanupTerminatedPods() (util.Interval, error)
- func (r *Resources) EnsurePVCs() error
- func (r *Resources) EnsurePods() error
- func (r *Resources) EnsureSecrets() error
- func (r *Resources) EnsureServices() error
- func (r *Resources) GetExpectedPodArguments(apiObject metav1.Object, deplSpec api.DeploymentSpec, group api.ServerGroup, ...) []string
- func (r *Resources) InspectPVCs(ctx context.Context) (util.Interval, error)
- func (r *Resources) InspectPods(ctx context.Context) (util.Interval, error)
- func (r *Resources) RunDeploymentHealthLoop(stopCh <-chan struct{})
- func (r *Resources) ValidateSecretHashes() error
- type ServerGroupIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
// GetAPIObject returns the deployment as k8s object.
GetAPIObject() k8sutil.APIObject
// GetServerGroupIterator returns the deployment as ServerGroupIterator.
GetServerGroupIterator() ServerGroupIterator
// GetSpec returns the current specification of the deployment
GetSpec() api.DeploymentSpec
// GetStatus returns the current status of the deployment
GetStatus() (api.DeploymentStatus, int32)
// UpdateStatus replaces the status of the deployment with the given status and
// updates the resources in k8s.
UpdateStatus(status api.DeploymentStatus, lastVersion int32, force ...bool) error
// GetKubeCli returns the kubernetes client
GetKubeCli() kubernetes.Interface
// GetLifecycleImage returns the image name containing the lifecycle helper (== name of operator image)
GetLifecycleImage() string
// GetAlpineImage returns the image name containing the alpine environment
GetAlpineImage() string
// GetNamespace returns the namespace that contains the deployment
GetNamespace() string
// CreateEvent creates a given event.
// On error, the error is logged.
CreateEvent(evt *k8sutil.Event)
// GetOwnedPods returns a list of all pods owned by the deployment.
GetOwnedPods() ([]v1.Pod, error)
// GetOwnedPVCs returns a list of all PVCs owned by the deployment.
GetOwnedPVCs() ([]v1.PersistentVolumeClaim, error)
// CleanupPod deletes a given pod with force and explicit UID.
// If the pod does not exist, the error is ignored.
CleanupPod(p v1.Pod) error
// DeletePod deletes a pod with given name in the namespace
// of the deployment. If the pod does not exist, the error is ignored.
DeletePod(podName 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.
DeletePvc(pvcName string) error
// GetAgencyClients returns a client connection for every agency member.
GetAgencyClients(ctx context.Context, predicate func(memberID string) bool) ([]driver.Connection, error)
// GetDatabaseClient returns a cached client for the entire database (cluster coordinators or single server),
// creating one if needed.
GetDatabaseClient(ctx context.Context) (driver.Client, error)
}
Context provides all functions needed by the Resources service to perform its service.
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Resources is a service that creates low level resources for members and inspects low level resources, put the inspection result in members.
func NewResources ¶
NewResources creates a new Resources service, used to create and inspect low level resources such as pods and services.
func (*Resources) CleanupRemovedMembers ¶
CleanupRemovedMembers removes all arangod members that are no longer part of ArangoDB deployment.
func (*Resources) CleanupTerminatedPods ¶
CleanupTerminatedPods removes all pods in Terminated state that belong to a member in Created state. Returns: Interval_till_next_inspection, error
func (*Resources) EnsurePVCs ¶
EnsurePVCs creates all PVC's listed in member status
func (*Resources) EnsurePods ¶
EnsurePods creates all Pods listed in member status
func (*Resources) EnsureSecrets ¶
EnsureSecrets creates all secrets needed to run the given deployment
func (*Resources) EnsureServices ¶
EnsureServices creates all services needed to service the deployment
func (*Resources) GetExpectedPodArguments ¶
func (r *Resources) GetExpectedPodArguments(apiObject metav1.Object, deplSpec api.DeploymentSpec, group api.ServerGroup, agents api.MemberStatusList, id string) []string
GetExpectedPodArguments creates command line arguments for a server in the given group with given ID.
func (*Resources) InspectPVCs ¶
InspectPVCs lists all PVCs that belong to the given deployment and updates the member status of the deployment accordingly.
func (*Resources) InspectPods ¶
InspectPods lists all pods that belong to the given deployment and updates the member status of the deployment accordingly. Returns: Interval_till_next_inspection, error
func (*Resources) RunDeploymentHealthLoop ¶
func (r *Resources) RunDeploymentHealthLoop(stopCh <-chan struct{})
RunDeploymentHealthLoop creates a loop to fetch the health of the deployment. The loop ends when the given channel is closed.
func (*Resources) ValidateSecretHashes ¶
ValidateSecretHashes checks the hash of used secrets against the stored ones. If a hash is different, the deployment is marked with a SecretChangedCondition and the operator will no touch it until this is resolved.
type ServerGroupIterator ¶
type ServerGroupIterator interface {
// ForeachServerGroup calls the given callback for all server groups.
// If the callback returns an error, this error is returned and no other server
// groups are processed.
// Groups are processed in this order: agents, single, dbservers, coordinators, syncmasters, syncworkers
ForeachServerGroup(cb func(group api.ServerGroup, spec api.ServerGroupSpec, status *api.MemberStatusList) error, status *api.DeploymentStatus) error
}
ServerGroupIterator provides a helper to callback on every server group of the deployment.