Documentation ¶
Index ¶
- type Config
- type Dependencies
- type Deployment
- func (d *Deployment) CleanupPod(p v1.Pod) error
- func (d *Deployment) CreateEvent(evt *k8sutil.Event)
- func (d *Deployment) CreateMember(group api.ServerGroup, id string) (string, error)
- func (d *Deployment) DatabaseURL() string
- func (d *Deployment) DatabaseVersion() (string, string)
- func (d *Deployment) Delete()
- func (d *Deployment) DeletePod(podName string) error
- func (d *Deployment) DeletePvc(pvcName string) error
- func (d *Deployment) DeleteSecret(secretName string) error
- func (d *Deployment) DeleteTLSKeyfile(group api.ServerGroup, member api.MemberStatus) error
- func (d *Deployment) Environment() api.Environment
- func (d *Deployment) GetAPIObject() k8sutil.APIObject
- func (d *Deployment) GetAgency(ctx context.Context) (agency.Agency, error)
- func (d *Deployment) GetAgencyClients(ctx context.Context, predicate func(id string) bool) ([]driver.Connection, error)
- func (d *Deployment) GetAlpineImage() string
- func (d *Deployment) GetDatabaseClient(ctx context.Context) (driver.Client, error)
- func (d *Deployment) GetExpectedPodArguments(apiObject metav1.Object, deplSpec api.DeploymentSpec, group api.ServerGroup, ...) []string
- func (d *Deployment) GetKubeCli() kubernetes.Interface
- func (d *Deployment) GetLifecycleImage() string
- func (d *Deployment) GetNamespace() string
- func (d *Deployment) GetOwnedPVCs() ([]v1.PersistentVolumeClaim, error)
- func (d *Deployment) GetOwnedPods() ([]v1.Pod, error)
- func (d *Deployment) GetPhase() api.DeploymentPhase
- func (d *Deployment) GetPvc(pvcName string) (*v1.PersistentVolumeClaim, error)
- func (d *Deployment) GetServerClient(ctx context.Context, group api.ServerGroup, id string) (driver.Client, error)
- func (d *Deployment) GetServerGroupIterator() resources.ServerGroupIterator
- func (d *Deployment) GetSpec() api.DeploymentSpec
- func (d *Deployment) GetStatus() (api.DeploymentStatus, int32)
- func (d *Deployment) GetSyncServerClient(ctx context.Context, group api.ServerGroup, id string) (client.API, error)
- func (d *Deployment) GetTLSCA(secretName string) (string, string, bool, error)
- func (d *Deployment) GetTLSKeyfile(group api.ServerGroup, member api.MemberStatus) (string, error)
- func (d *Deployment) Members() map[api.ServerGroup][]server.Member
- func (d *Deployment) Mode() api.DeploymentMode
- func (d *Deployment) Name() string
- func (d *Deployment) Namespace() string
- func (d *Deployment) PodCount() int
- func (d *Deployment) ReadyPodCount() int
- func (d *Deployment) ReadyVolumeCount() int
- func (d *Deployment) RemovePodFinalizers(podName string) error
- func (d *Deployment) StateColor() server.StateColor
- func (d *Deployment) StorageClasses() []string
- func (d *Deployment) Update(apiObject *api.ArangoDeployment)
- func (d *Deployment) UpdateStatus(status api.DeploymentStatus, lastVersion int32, force ...bool) error
- func (d *Deployment) VolumeCount() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ServiceAccount string AllowChaos bool LifecycleImage string AlpineImage string }
Config holds configuration settings for a Deployment
type Dependencies ¶
type Dependencies struct { Log zerolog.Logger KubeCli kubernetes.Interface DatabaseCRCli versioned.Interface EventRecorder record.EventRecorder }
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) CleanupPod ¶
func (d *Deployment) CleanupPod(p v1.Pod) error
CleanupPod deletes a given pod with force and explicit UID. If the pod does not exist, the error is ignored.
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(group api.ServerGroup, id string) (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) 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) Delete ¶
func (d *Deployment) Delete()
Delete the deployment. Called when the deployment was deleted by the user.
func (*Deployment) DeletePod ¶
func (d *Deployment) DeletePod(podName string) 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(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(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) Environment ¶
func (d *Deployment) Environment() api.Environment
Environment returns the environment used in the deployment.
func (*Deployment) GetAPIObject ¶
func (d *Deployment) GetAPIObject() k8sutil.APIObject
GetAPIObject returns the deployment as k8s object.
func (*Deployment) GetAgencyClients ¶
func (d *Deployment) GetAgencyClients(ctx context.Context, predicate func(id string) bool) ([]driver.Connection, error)
GetAgencyClients returns a client connection for every agency member. If the given predicate is not nil, only agents are included where the given predicate returns true.
func (*Deployment) GetAlpineImage ¶
func (d *Deployment) GetAlpineImage() string
GetAlpineImage returns the image name containing the alpine environment
func (*Deployment) GetDatabaseClient ¶
GetDatabaseClient returns a cached client for the entire database (cluster coordinators or single server), creating one if needed.
func (*Deployment) GetExpectedPodArguments ¶
func (d *Deployment) 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 (*Deployment) GetKubeCli ¶
func (d *Deployment) GetKubeCli() kubernetes.Interface
GetKubeCli returns the kubernetes client
func (*Deployment) GetLifecycleImage ¶
func (d *Deployment) GetLifecycleImage() string
GetLifecycleImage returns the image name containing the lifecycle helper (== name of operator image)
func (*Deployment) GetNamespace ¶
func (d *Deployment) GetNamespace() string
GetNamespace returns the kubernetes namespace that contains this deployment.
func (*Deployment) GetOwnedPVCs ¶
func (d *Deployment) GetOwnedPVCs() ([]v1.PersistentVolumeClaim, error)
GetOwnedPVCs returns a list of all PVCs owned by the deployment.
func (*Deployment) GetOwnedPods ¶
func (d *Deployment) GetOwnedPods() ([]v1.Pod, error)
GetOwnedPods returns a list of all pods owned by the deployment.
func (*Deployment) GetPhase ¶
func (d *Deployment) GetPhase() api.DeploymentPhase
GetPhase returns the current phase of the deployment
func (*Deployment) GetPvc ¶
func (d *Deployment) GetPvc(pvcName string) (*v1.PersistentVolumeClaim, error)
GetPvc gets a PVC by the given name, in the samespace of the deployment.
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() resources.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, int32)
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) GetTLSCA ¶
GetTLSCA returns the TLS CA certificate in the secret with given name. Returns: publicKey, privateKey, ownerByDeployment, error
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) Members ¶
func (d *Deployment) Members() map[api.ServerGroup][]server.Member
Members returns all members of the deployment by role.
func (*Deployment) Mode ¶
func (d *Deployment) Mode() api.DeploymentMode
Mode returns the mode of the deployment.
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) PodCount ¶
func (d *Deployment) PodCount() int
PodCount returns the number of pods for the deployment
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) RemovePodFinalizers ¶
func (d *Deployment) RemovePodFinalizers(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) StateColor ¶
func (d *Deployment) StateColor() server.StateColor
StateColor determinates the state of the deployment in color codes.
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) UpdateStatus ¶
func (d *Deployment) UpdateStatus(status api.DeploymentStatus, lastVersion int32, force ...bool) 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