Documentation
¶
Index ¶
- Constants
- func BuildOwnerReference(ownerType metav1.TypeMeta, ownerMetadata metav1.ObjectMeta) []metav1.OwnerReference
- func ContainsPod(cluster *fdbv1beta2.FoundationDBCluster, pod corev1.Pod) bool
- func CreateDefaultBackup(cluster *fdbv1beta2.FoundationDBCluster) *fdbv1beta2.FoundationDBBackup
- func CreateDefaultCluster() *fdbv1beta2.FoundationDBCluster
- func GenerateRandomString(n int) string
- func GetBackupDeployment(backup *fdbv1beta2.FoundationDBBackup) (*appsv1.Deployment, error)
- func GetBackupDeploymentName(backup *fdbv1beta2.FoundationDBBackup) string
- func GetConfigMap(cluster *fdbv1beta2.FoundationDBCluster) (*corev1.ConfigMap, error)
- func GetConfigMapMonitorConfEntry(pClass fdbv1beta2.ProcessClass, imageType fdbv1beta2.ImageType, ...) string
- func GetDynamicConfHash(configMap *corev1.ConfigMap, pClass fdbv1beta2.ProcessClass, ...) (string, error)
- func GetEnvVars(container v1.Container) map[string]*v1.EnvVar
- func GetHeadlessService(cluster *fdbv1beta2.FoundationDBCluster) *corev1.Service
- func GetIPFamily(pod *corev1.Pod) (int, error)
- func GetImage(image string, configs []fdbv1beta2.ImageConfig, versionString string, ...) (string, error)
- func GetImageType(pod *corev1.Pod) fdbv1beta2.ImageType
- func GetImageTypeFromAnnotation(annotations map[string]string) fdbv1beta2.ImageType
- func GetJSONHash(object interface{}) (string, error)
- func GetMonitorConf(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) (string, error)
- func GetMonitorProcessConfiguration(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) monitorapi.ProcessConfiguration
- func GetObjectMetadata(cluster *fdbv1beta2.FoundationDBCluster, base *metav1.ObjectMeta, ...) metav1.ObjectMeta
- func GetPod(cluster *fdbv1beta2.FoundationDBCluster, ...) (*corev1.Pod, error)
- func GetPodDNSName(cluster *fdbv1beta2.FoundationDBCluster, podName string) string
- func GetPodLabels(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) map[string]string
- func GetPodListOptions(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) []client.ListOption
- func GetPodMatchLabels(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) map[string]string
- func GetPodMetadata(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) metav1.ObjectMeta
- func GetPodSpec(cluster *fdbv1beta2.FoundationDBCluster, ...) (*corev1.PodSpec, error)
- func GetPodSpecHash(cluster *fdbv1beta2.FoundationDBCluster, ...) (string, error)
- func GetProcessClassFromMeta(cluster *fdbv1beta2.FoundationDBCluster, metadata v1.ObjectMeta) fdbv1beta2.ProcessClass
- func GetProcessGroup(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) *fdbv1beta2.ProcessGroupStatus
- func GetProcessGroupIDFromMeta(cluster *fdbv1beta2.FoundationDBCluster, metadata metav1.ObjectMeta) fdbv1beta2.ProcessGroupID
- func GetProcessGroupIDFromPodName(cluster *fdbv1beta2.FoundationDBCluster, podName string) fdbv1beta2.ProcessGroupID
- func GetPublicIPSource(pod *corev1.Pod) (fdbv1beta2.PublicIPSource, error)
- func GetPublicIPsForPod(pod *corev1.Pod, log logr.Logger) []string
- func GetPvc(cluster *fdbv1beta2.FoundationDBCluster, ...) (*corev1.PersistentVolumeClaim, error)
- func GetPvcMetadata(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) metav1.ObjectMeta
- func GetServersPerPodForPod(pod *corev1.Pod, pClass fdbv1beta2.ProcessClass) (int, error)
- func GetService(cluster *fdbv1beta2.FoundationDBCluster, ...) (*corev1.Service, error)
- func GetSidecarImage(cluster *fdbv1beta2.FoundationDBCluster, pClass fdbv1beta2.ProcessClass) (string, error)
- func GetSinglePodListOptions(cluster *fdbv1beta2.FoundationDBCluster, ...) []client.ListOption
- func GetStartCommand(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) (string, error)
- func GetStartCommandWithSubstitutions(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) (string, error)
- func GetSubstitutionsFromClusterAndPod(logger logr.Logger, cluster *fdbv1beta2.FoundationDBCluster, pod *corev1.Pod) (map[string]string, error)
- func IsNetworkError(err error) bool
- func IsQuotaExceeded(err error) bool
- func IsResourceNotDeleted(err error) bool
- func IsTimeoutError(err error) bool
- func MergeAnnotations(target *metav1.ObjectMeta, desired metav1.ObjectMeta) bool
- func MergeLabels(target *metav1.ObjectMeta, desired metav1.ObjectMeta) bool
- func MetadataCorrect(desiredMetadata metav1.ObjectMeta, currentMetadata *metav1.ObjectMeta) bool
- func MetadataMatches(currentMetadata metav1.ObjectMeta, desiredMetadata metav1.ObjectMeta) bool
- func NewFdbPodClient(cluster *fdbv1beta2.FoundationDBCluster, pod *corev1.Pod, log logr.Logger, ...) (podclient.FdbPodClient, error)
- func NormalizeClusterSpec(cluster *fdbv1beta2.FoundationDBCluster, options DeprecationOptions) error
- func PickProcessGroups(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, ...) []*fdbv1beta2.ProcessGroupStatus
- func PodHasSidecarTLS(pod *corev1.Pod) bool
- func PodMetadataCorrect(cluster *fdbv1beta2.FoundationDBCluster, ...) (bool, error)
- func ProcessClassFromLabels(cluster *fdbv1beta2.FoundationDBCluster, labels map[string]string) fdbv1beta2.ProcessClass
- func SetupClusterForTest(cluster *fdbv1beta2.FoundationDBCluster, k8sClient ctrlClient.Client) error
- type CliLogFileCleaner
- type DeprecationOptions
- type NodeTaintChangedPredicate
- type ResourceNotDeleted
Constants ¶
const ( // MockUnreachableAnnotation defines if a Pod should be unreachable. This annotation // is currently only used for testing cases. MockUnreachableAnnotation = "foundationdb.org/mock-unreachable" )
Variables ¶
This section is empty.
Functions ¶
func BuildOwnerReference ¶
func BuildOwnerReference(ownerType metav1.TypeMeta, ownerMetadata metav1.ObjectMeta) []metav1.OwnerReference
BuildOwnerReference returns an OwnerReference for the provided input
func ContainsPod ¶
func ContainsPod(cluster *fdbv1beta2.FoundationDBCluster, pod corev1.Pod) bool
ContainsPod checks if the given Pod is part of the cluster or not.
func CreateDefaultBackup ¶
func CreateDefaultBackup(cluster *fdbv1beta2.FoundationDBCluster) *fdbv1beta2.FoundationDBBackup
CreateDefaultBackup creates a defaultFoundationDBCluster for testing
func CreateDefaultCluster ¶
func CreateDefaultCluster() *fdbv1beta2.FoundationDBCluster
CreateDefaultCluster creates a default FoundationDBCluster for testing
func GenerateRandomString ¶
GenerateRandomString can be used to generate a random string with length n
func GetBackupDeployment ¶
func GetBackupDeployment(backup *fdbv1beta2.FoundationDBBackup) (*appsv1.Deployment, error)
GetBackupDeployment builds a deployment for backup agents for a cluster.
func GetBackupDeploymentName ¶
func GetBackupDeploymentName(backup *fdbv1beta2.FoundationDBBackup) string
GetBackupDeploymentName returns the name for the associated deployment for the FoundationDBBackup.
func GetConfigMap ¶
func GetConfigMap(cluster *fdbv1beta2.FoundationDBCluster) (*corev1.ConfigMap, error)
GetConfigMap builds a config map for a cluster's dynamic config
func GetConfigMapMonitorConfEntry ¶
func GetConfigMapMonitorConfEntry(pClass fdbv1beta2.ProcessClass, imageType fdbv1beta2.ImageType, serversPerPod int) string
GetConfigMapMonitorConfEntry returns the specific key for the monitor conf in the ConfigMap
func GetDynamicConfHash ¶
func GetDynamicConfHash(configMap *corev1.ConfigMap, pClass fdbv1beta2.ProcessClass, imageType fdbv1beta2.ImageType, serversPerPod int) (string, error)
GetDynamicConfHash gets a hash of the data from the config map holding the cluster's dynamic conf.
This will omit keys that we do not expect the Pods to reference e.g. for storage Pods only include the storage config.
func GetEnvVars ¶
GetEnvVars returns a HashMap of EnvVars for the container
func GetHeadlessService ¶
func GetHeadlessService(cluster *fdbv1beta2.FoundationDBCluster) *corev1.Service
GetHeadlessService builds a headless service for a FoundationDB cluster.
func GetIPFamily ¶ added in v2.2.0
GetIPFamily determines the IP family based on the annotation. If the annotation is not present the method will try to get the ip family based on the pod spec.
func GetImage ¶
func GetImage(image string, configs []fdbv1beta2.ImageConfig, versionString string, allowTagOverride bool) (string, error)
GetImage returns the image for container
func GetImageType ¶
func GetImageType(pod *corev1.Pod) fdbv1beta2.ImageType
GetImageType determines whether a pod is using the unified or the split image.
func GetImageTypeFromAnnotation ¶
func GetImageTypeFromAnnotation(annotations map[string]string) fdbv1beta2.ImageType
GetImageTypeFromAnnotation determines whether a pod is using the unified or the split image based on the annotations.
func GetJSONHash ¶
GetJSONHash serializes an object to JSON and takes a hash of the resulting JSON.
func GetMonitorConf ¶
func GetMonitorConf(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, podClient podclient.FdbPodClient, serversPerPod int) (string, error)
GetMonitorConf builds the monitor conf template
func GetMonitorProcessConfiguration ¶
func GetMonitorProcessConfiguration(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, processCount int, imageType fdbv1beta2.ImageType) monitorapi.ProcessConfiguration
GetMonitorProcessConfiguration builds the monitor conf template for the unified image.
func GetObjectMetadata ¶
func GetObjectMetadata(cluster *fdbv1beta2.FoundationDBCluster, base *metav1.ObjectMeta, processClass fdbv1beta2.ProcessClass, id fdbv1beta2.ProcessGroupID) metav1.ObjectMeta
GetObjectMetadata returns the ObjectMetadata for a process
func GetPod ¶
func GetPod(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus) (*corev1.Pod, error)
GetPod builds a pod for a new process group
func GetPodDNSName ¶
func GetPodDNSName(cluster *fdbv1beta2.FoundationDBCluster, podName string) string
GetPodDNSName determines the fully qualified DNS name for a pod.
func GetPodLabels ¶
func GetPodLabels(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, id string) map[string]string
GetPodLabels creates the labels that we will apply to a Pod
func GetPodListOptions ¶
func GetPodListOptions(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, id string) []client.ListOption
GetPodListOptions returns the listOptions to list Pods
func GetPodMatchLabels ¶
func GetPodMatchLabels(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, id string) map[string]string
GetPodMatchLabels creates the labels that we will use when filtering for a pod.
func GetPodMetadata ¶
func GetPodMetadata(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, id fdbv1beta2.ProcessGroupID, specHash string) metav1.ObjectMeta
GetPodMetadata returns the metadata for a specific Pod
func GetPodSpec ¶
func GetPodSpec(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus) (*corev1.PodSpec, error)
GetPodSpec builds a pod spec for a FoundationDB pod
func GetPodSpecHash ¶
func GetPodSpecHash(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus, spec *corev1.PodSpec) (string, error)
GetPodSpecHash builds the hash of the expected spec for a pod.
func GetProcessClassFromMeta ¶
func GetProcessClassFromMeta(cluster *fdbv1beta2.FoundationDBCluster, metadata v1.ObjectMeta) fdbv1beta2.ProcessClass
GetProcessClassFromMeta fetches the process class from an object's metadata.
func GetProcessGroup ¶
func GetProcessGroup(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, idNum int) *fdbv1beta2.ProcessGroupStatus
GetProcessGroup is a helper method that creates a ProcessGroup based on the provided process class and id number.
func GetProcessGroupIDFromMeta ¶
func GetProcessGroupIDFromMeta(cluster *fdbv1beta2.FoundationDBCluster, metadata metav1.ObjectMeta) fdbv1beta2.ProcessGroupID
GetProcessGroupIDFromMeta fetches the process group ID from an object's metadata.
func GetProcessGroupIDFromPodName ¶
func GetProcessGroupIDFromPodName(cluster *fdbv1beta2.FoundationDBCluster, podName string) fdbv1beta2.ProcessGroupID
GetProcessGroupIDFromPodName returns the process group ID for a given Pod name.
func GetPublicIPSource ¶
func GetPublicIPSource(pod *corev1.Pod) (fdbv1beta2.PublicIPSource, error)
GetPublicIPSource determines how a Pod has gotten its public IP.
func GetPublicIPsForPod ¶
GetPublicIPsForPod returns the public IPs for a Pod
func GetPvc ¶
func GetPvc(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus) (*corev1.PersistentVolumeClaim, error)
GetPvc builds a persistent volume claim for a FoundationDB process group.
func GetPvcMetadata ¶
func GetPvcMetadata(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, id fdbv1beta2.ProcessGroupID) metav1.ObjectMeta
GetPvcMetadata returns the metadata for a PVC
func GetServersPerPodForPod ¶
func GetServersPerPodForPod(pod *corev1.Pod, pClass fdbv1beta2.ProcessClass) (int, error)
GetServersPerPodForPod returns the count of servers per Pod based on the processClass from the sidecar or 1
func GetService ¶
func GetService(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus) (*corev1.Service, error)
GetService builds a service for a new process group
func GetSidecarImage ¶
func GetSidecarImage(cluster *fdbv1beta2.FoundationDBCluster, pClass fdbv1beta2.ProcessClass) (string, error)
GetSidecarImage returns the expected sidecar image for a specific process class
func GetSinglePodListOptions ¶
func GetSinglePodListOptions(cluster *fdbv1beta2.FoundationDBCluster, processGroupID fdbv1beta2.ProcessGroupID) []client.ListOption
GetSinglePodListOptions returns the listOptions to list a single Pod
func GetStartCommand ¶
func GetStartCommand(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, podClient podclient.FdbPodClient, processNumber int, processCount int, imageType fdbv1beta2.ImageType) (string, error)
GetStartCommand builds the expected start command for a process group.
func GetStartCommandWithSubstitutions ¶
func GetStartCommandWithSubstitutions(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, substitutions map[string]string, processNumber int, processCount int, imageType fdbv1beta2.ImageType) (string, error)
GetStartCommandWithSubstitutions will be used by GetStartCommand and for internal testing.
func GetSubstitutionsFromClusterAndPod ¶
func GetSubstitutionsFromClusterAndPod(logger logr.Logger, cluster *fdbv1beta2.FoundationDBCluster, pod *corev1.Pod) (map[string]string, error)
GetSubstitutionsFromClusterAndPod returns a map that contains the substitutions based on the provided cluster and Pod. This method is used for testing and in the MockFdbPodClient.
func IsNetworkError ¶
IsNetworkError returns true if the network is a network error net.Error
func IsQuotaExceeded ¶
IsQuotaExceeded returns true if the error returned by the Kubernetes API is a forbidden error with the error message that the quota was exceeded
func IsResourceNotDeleted ¶
IsResourceNotDeleted returns true if provided error is of the type IsResourceNotDeleted.
func IsTimeoutError ¶
IsTimeoutError returns true if the observed error was a timeout error
func MergeAnnotations ¶ added in v2.3.0
func MergeAnnotations(target *metav1.ObjectMeta, desired metav1.ObjectMeta) bool
MergeAnnotations merges the annotations specified by the operator into on object's metadata.
This will return whether the target's annotations have changed.
func MergeLabels ¶ added in v2.3.0
func MergeLabels(target *metav1.ObjectMeta, desired metav1.ObjectMeta) bool
MergeLabels merges the labels specified by the operator into on object's metadata.
This will return whether the target's labels have changed.
func MetadataCorrect ¶ added in v2.3.0
func MetadataCorrect(desiredMetadata metav1.ObjectMeta, currentMetadata *metav1.ObjectMeta) bool
MetadataCorrect validates if the current metadata has the desired annotations and labels.
func MetadataMatches ¶ added in v2.3.0
func MetadataMatches(currentMetadata metav1.ObjectMeta, desiredMetadata metav1.ObjectMeta) bool
MetadataMatches determines if the current metadata on an object matches the metadata specified by the cluster spec.
func NewFdbPodClient ¶
func NewFdbPodClient(cluster *fdbv1beta2.FoundationDBCluster, pod *corev1.Pod, log logr.Logger, getTimeout time.Duration, postTimeout time.Duration) (podclient.FdbPodClient, error)
NewFdbPodClient builds a client for working with an FDB Pod
func NormalizeClusterSpec ¶
func NormalizeClusterSpec(cluster *fdbv1beta2.FoundationDBCluster, options DeprecationOptions) error
NormalizeClusterSpec converts a cluster spec into an unambiguous, future-proof form, by applying any implicit defaults and moving configuration from deprecated fields into fully-supported fields.
func PickProcessGroups ¶
func PickProcessGroups(cluster *fdbv1beta2.FoundationDBCluster, processClass fdbv1beta2.ProcessClass, count int) []*fdbv1beta2.ProcessGroupStatus
PickProcessGroups will pick a number of process groups for the specified process class.
func PodHasSidecarTLS ¶
PodHasSidecarTLS determines whether a pod currently has TLS enabled for the sidecar process. This method should only be used for split images.
func PodMetadataCorrect ¶ added in v2.3.0
func PodMetadataCorrect(cluster *fdbv1beta2.FoundationDBCluster, processGroup *fdbv1beta2.ProcessGroupStatus, pod *corev1.Pod) (bool, error)
PodMetadataCorrect validates if the current pod metadata is correct or if the Pod metadata must be updated.
func ProcessClassFromLabels ¶
func ProcessClassFromLabels(cluster *fdbv1beta2.FoundationDBCluster, labels map[string]string) fdbv1beta2.ProcessClass
ProcessClassFromLabels extracts the ProcessClass label from the metav1.ObjectMeta.Labels map
func SetupClusterForTest ¶
func SetupClusterForTest(cluster *fdbv1beta2.FoundationDBCluster, k8sClient ctrlClient.Client) error
SetupClusterForTest will generate all required resources like Pods for test cases.
Types ¶
type CliLogFileCleaner ¶
type CliLogFileCleaner struct {
// contains filtered or unexported fields
}
CliLogFileCleaner contains the logger and the minFileAge
func NewCliLogFileCleaner ¶
func NewCliLogFileCleaner(log logr.Logger, minFileAge time.Duration) *CliLogFileCleaner
NewCliLogFileCleaner returns a new CliLogFileCleaner
func (CliLogFileCleaner) CleanupOldCliLogs ¶
func (c CliLogFileCleaner) CleanupOldCliLogs()
CleanupOldCliLogs removes old fdbcli log files.
type DeprecationOptions ¶
type DeprecationOptions struct { // Whether we should apply the latest defaults rather than the defaults that // were initially established for this major version. UseFutureDefaults bool // Whether we should only fill in defaults that have changes between major // versions of the operator. OnlyShowChanges bool }
DeprecationOptions controls how deprecations and changes to defaults get applied to our specs.
type NodeTaintChangedPredicate ¶
NodeTaintChangedPredicate filters events before enqueuing the keys. Only if the node taints have changed a reconciliation will be triggered.
func (NodeTaintChangedPredicate) Create ¶
func (n NodeTaintChangedPredicate) Create(_ event.CreateEvent) bool
Create implements Predicate.
func (NodeTaintChangedPredicate) Delete ¶
func (n NodeTaintChangedPredicate) Delete(_ event.DeleteEvent) bool
Delete implements Predicate.
func (NodeTaintChangedPredicate) Generic ¶
func (n NodeTaintChangedPredicate) Generic(_ event.GenericEvent) bool
Generic implements Predicate.
func (NodeTaintChangedPredicate) Update ¶
func (n NodeTaintChangedPredicate) Update(event event.UpdateEvent) bool
Update returns true if the Update event should be processed. This is the case if the taints for the provided node has been changed.
type ResourceNotDeleted ¶
ResourceNotDeleted can be returned if the resource is not yet deleted.
func (ResourceNotDeleted) Error ¶
func (err ResourceNotDeleted) Error() string
Error returns the error message of the internal timeout error.