Documentation
¶
Index ¶
- Constants
- func AddACLsToEnv(allACL *solr.ZookeeperACL, readOnlyACL *solr.ZookeeperACL) (hasACLs bool, envVars []corev1.EnvVar)
- func AsyncIdForCollectionBackup(collection string, backupName string) string
- func BackupPath(backupName string) string
- func BackupRestoreSubPathForCloud(directoryOverride string, cloud string) string
- func BackupSubPathForCloud(directoryOverride string, cloud string, backupName string) string
- func BasicAuthHeader(basicAuthSecret *corev1.Secret) string
- func CheckBackupForCollection(cloud *solr.SolrCloud, collection string, backupName string, ...) (finished bool, success bool, asyncStatus string, err error)
- func CheckStatusOfCollectionBackups(backup *solr.SolrBackup) (allFinished bool)
- func ContainsString(slice []string, s string) bool
- func CopyConfigMapFields(from, to *corev1.ConfigMap, logger logr.Logger) bool
- func CopyDeploymentFields(from, to *appsv1.Deployment, logger logr.Logger) bool
- func CopyIngressFields(from, to *netv1.Ingress, logger logr.Logger) bool
- func CopyLabelsAndAnnotations(from, to *metav1.ObjectMeta, logger logr.Logger) (requireUpdate bool)
- func CopyPodContainers(fromPtr, toPtr *[]corev1.Container, basePath string, logger logr.Logger) (requireUpdate bool)
- func CopyPodTemplates(from, to *corev1.PodTemplateSpec, basePath string, logger logr.Logger) (requireUpdate bool)
- func CopyServiceFields(from, to *corev1.Service, logger logr.Logger) bool
- func CopyStatefulSetFields(from, to *appsv1.StatefulSet, logger logr.Logger) bool
- func CopyZookeeperClusterFields(from, to *zk.ZookeeperCluster, logger logr.Logger) bool
- func CreateCommonIngressRule(solrCloud *solr.SolrCloud, domainName string) (ingressRule netv1.IngressRule)
- func CreateMetricsIngressRule(solrPrometheusExporter *solr.SolrPrometheusExporter, ingressBaseDomain string) netv1.IngressRule
- func CreateNodeIngressRule(solrCloud *solr.SolrCloud, nodeName string, domainName string) (ingressRule netv1.IngressRule)
- func CreateSolrIngressRules(solrCloud *solr.SolrCloud, nodeNames []string, domainNames []string) (ingressRules []netv1.IngressRule, allHosts []string)
- func DeepEqualWithNils(x, y interface{}) bool
- func DeleteAsyncInfoForBackup(cloud *solr.SolrCloud, collection string, backupName string, ...) (err error)
- func DeterminePodsSafeToUpdate(cloud *solr.SolrCloud, outOfDatePods []corev1.Pod, totalPods int, ...) (podsToUpdate []corev1.Pod, retryLater bool)
- func DuplicateLabelsOrAnnotations(from map[string]string) map[string]string
- func EnsureDirectoryForBackup(solrCloud *solr.SolrCloud, backup string, config *rest.Config) (err error)
- func GenerateBackupPersistenceJob(solrBackup *solr.SolrBackup, solrBackupVolume corev1.VolumeSource, ...) *batchv1.Job
- func GenerateBackupPersistenceJobForCloud(backup *solr.SolrBackup, solrCloud *solr.SolrCloud) *batchv1.Job
- func GenerateBasicAuthSecretWithBootstrap(solrCloud *solr.SolrCloud) (*corev1.Secret, *corev1.Secret)
- func GenerateCommonService(solrCloud *solr.SolrCloud) *corev1.Service
- func GenerateConfigMap(solrCloud *solr.SolrCloud) *corev1.ConfigMap
- func GenerateHeadlessService(solrCloud *solr.SolrCloud) *corev1.Service
- func GenerateIngress(solrCloud *solr.SolrCloud, nodeNames []string) (ingress *netv1.Ingress)
- func GenerateMetricsConfigMap(solrPrometheusExporter *solr.SolrPrometheusExporter) *corev1.ConfigMap
- func GenerateNodeService(solrCloud *solr.SolrCloud, nodeName string) *corev1.Service
- func GeneratePersistenceOptions(solrBackup *solr.SolrBackup, solrBackupVolume corev1.VolumeSource) (image solr.ContainerImage, envVars []corev1.EnvVar, command []string, ...)
- func GenerateSolrMetricsService(solrPrometheusExporter *solr.SolrPrometheusExporter) *corev1.Service
- func GenerateSolrPrometheusExporterDeployment(solrPrometheusExporter *solr.SolrPrometheusExporter, ...) *appsv1.Deployment
- func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCloudStatus, ...) *appsv1.StatefulSet
- func GenerateZookeeperCluster(solrCloud *solr.SolrCloud, zkSpec *solr.ZookeeperSpec) *zk.ZookeeperCluster
- func GetCustomProbePaths(solrCloud *solr.SolrCloud) []string
- func IsPVCOrphan(pvcName string, replicas int32) bool
- func MergeLabelsOrAnnotations(base, additional map[string]string) map[string]string
- func OvertakeControllerRef(owner metav1.Object, controlled metav1.Object, scheme *runtime.Scheme) (needsUpdate bool, err error)
- func RemoveString(slice []string, s string) (result []string)
- func ResolveMaxPodsUnavailable(maxPodsUnavailable *intstr.IntOrString, desiredPods int) (int, error)
- func ResolveMaxShardReplicasUnavailable(maxShardReplicasUnavailable *intstr.IntOrString, shard string, ...) (int, error)
- func RestorePath(backupName string) string
- func RestoreSubPathForCloud(directoryOverride string, cloud string, restoreName string) string
- func RunExecForPod(podName string, namespace string, command []string, config rest.Config) (err error)
- func ScheduleNextRestart(restartSchedule string, podTemplateAnnotations map[string]string) (nextRestart string, reconcileWaitDuration *time.Duration, err error)
- func SolrNodeName(solrCloud *solr.SolrCloud, pod corev1.Pod) string
- func StartBackupForCollection(cloud *solr.SolrCloud, collection string, backupName string, ...) (success bool, err error)
- func ValidateBasicAuthSecret(basicAuthSecret *corev1.Secret) error
- type SolrConnectionInfo
- type SolrNodeContents
- type TLSCerts
- type TLSConfig
Constants ¶
const ( BaseBackupRestorePath = "/var/solr/data/backup-restore" TarredFile = "/var/solr/data/backup-restore/backup.tgz" CleanupCommand = " && rm -rf " + BaseBackupRestorePath + "/*" BackupTarCommand = "cd " + BaseBackupRestorePath + " && tar -czf /tmp/backup.tgz * " + CleanupCommand + " && mv /tmp/backup.tgz " + TarredFile + " && chmod -R a+rwx " + TarredFile + " && cd - && " AWSSecretDir = "/var/aws" JobTTLSeconds = int32(60) )
const ( SolrMetricsPort = 8080 SolrMetricsPortName = "solr-metrics" ExtSolrMetricsPort = 80 DefaultPrometheusExporterEntrypoint = "/opt/solr/contrib/prometheus-exporter/bin/solr-exporter" PrometheusExporterConfigMapKey = "solr-prometheus-exporter.xml" PrometheusExporterConfigXmlMd5Annotation = "solr.apache.org/exporterConfigXmlMd5" )
const ( SolrTlsCertMd5Annotation = "solr.apache.org/tlsCertMd5" SolrClientTlsCertMd5Annotation = "solr.apache.org/tlsClientCertMd5" DefaultKeyStorePath = "/var/solr/tls" DefaultClientKeyStorePath = "/var/solr/client-tls" DefaultWritableKeyStorePath = "/var/solr/tls/pkcs12" TLSCertKey = "tls.crt" DefaultTrustStorePath = "/var/solr/tls-truststore" DefaultClientTrustStorePath = "/var/solr/client-tls-truststore" InitdbPath = "/docker-entrypoint-initdb.d" DefaultPkcs12KeystoreFile = "keystore.p12" DefaultPkcs12TruststoreFile = "truststore.p12" DefaultKeystorePasswordFile = "keystore-password" )
const ( SolrScheduledRestartAnnotation = "solr.apache.org/nextScheduledRestart" )
const ( SolrClientPortName = "solr-client" BackupRestoreVolume = "backup-restore" SolrNodeContainer = "solrcloud-node" DefaultSolrUser = 8983 DefaultSolrGroup = 8983 SolrStorageFinalizer = "storage.finalizers.solr.apache.org" SolrZKConnectionStringAnnotation = "solr.apache.org/zkConnectionString" SolrPVCTechnologyLabel = "solr.apache.org/technology" SolrCloudPVCTechnology = "solr-cloud" SolrPVCStorageLabel = "solr.apache.org/storage" SolrCloudPVCDataStorage = "data" SolrPVCInstanceLabel = "solr.apache.org/instance" SolrXmlMd5Annotation = "solr.apache.org/solrXmlMd5" SolrXmlFile = "solr.xml" LogXmlMd5Annotation = "solr.apache.org/logXmlMd5" LogXmlFile = "log4j2.xml" SecurityJsonFile = "security.json" BasicAuthMd5Annotation = "solr.apache.org/basicAuthMd5" DefaultProbePath = "/admin/info/system" DefaultStatefulSetPodManagementPolicy = appsv1.ParallelPodManagement )
Variables ¶
This section is empty.
Functions ¶
func AddACLsToEnv ¶
func AddACLsToEnv(allACL *solr.ZookeeperACL, readOnlyACL *solr.ZookeeperACL) (hasACLs bool, envVars []corev1.EnvVar)
AddACLsToEnv creates the neccessary environment variables for using ZK ACLs, and returns whether ACLs were provided. info: Zookeeper Connection Information
func BackupPath ¶
func BackupSubPathForCloud ¶
func BasicAuthHeader ¶
func CheckStatusOfCollectionBackups ¶
func CheckStatusOfCollectionBackups(backup *solr.SolrBackup) (allFinished bool)
func ContainsString ¶
ContainsString helper function to test string contains
func CopyConfigMapFields ¶
CopyConfigMapFields copies the owned fields from one ConfigMap to another
func CopyDeploymentFields ¶
func CopyDeploymentFields(from, to *appsv1.Deployment, logger logr.Logger) bool
CopyDeploymentFields copies the owned fields from one Deployment to another Returns true if the fields copied from don't match to.
func CopyIngressFields ¶
CopyIngressFields copies the owned fields from one Ingress to another
func CopyLabelsAndAnnotations ¶
func CopyLabelsAndAnnotations(from, to *metav1.ObjectMeta, logger logr.Logger) (requireUpdate bool)
CopyLabelsAndAnnotations copies the labels and annotations from one object to another. Additional Labels and Annotations in the 'to' object will not be removed. Returns true if there are updates required to the object.
func CopyPodContainers ¶
func CopyPodTemplates ¶
func CopyServiceFields ¶
CopyServiceFields copies the owned fields from one Service to another
func CopyStatefulSetFields ¶
func CopyStatefulSetFields(from, to *appsv1.StatefulSet, logger logr.Logger) bool
CopyStatefulSetFields copies the owned fields from one StatefulSet to another Returns true if the fields copied from don't match to.
func CopyZookeeperClusterFields ¶
func CopyZookeeperClusterFields(from, to *zk.ZookeeperCluster, logger logr.Logger) bool
CopyZookeeperClusterFields copies the owned fields from one ZookeeperCluster to another Returns true if the fields copied from don't match to.
func CreateCommonIngressRule ¶
func CreateCommonIngressRule(solrCloud *solr.SolrCloud, domainName string) (ingressRule netv1.IngressRule)
CreateCommonIngressRule returns a new Ingress Rule generated for a SolrCloud under the given domainName solrCloud: SolrCloud instance domainName: string Domain for the ingress rule to use
func CreateMetricsIngressRule ¶
func CreateMetricsIngressRule(solrPrometheusExporter *solr.SolrPrometheusExporter, ingressBaseDomain string) netv1.IngressRule
CreateMetricsIngressRule returns a new Ingress Rule generated for the solr metrics endpoint This is not currently used, as an ingress is not created for the metrics endpoint. solrCloud: SolrCloud instance nodeName: string Name of the node ingressBaseDomain: string base domain for the ingress controller
func CreateNodeIngressRule ¶
func CreateNodeIngressRule(solrCloud *solr.SolrCloud, nodeName string, domainName string) (ingressRule netv1.IngressRule)
CreateNodeIngressRule returns a new Ingress Rule generated for a specific Solr Node under the given domainName solrCloud: SolrCloud instance nodeName: string Name of the node domainName: string Domain for the ingress rule to use
func CreateSolrIngressRules ¶
func CreateSolrIngressRules(solrCloud *solr.SolrCloud, nodeNames []string, domainNames []string) (ingressRules []netv1.IngressRule, allHosts []string)
CreateSolrIngressRules returns all applicable ingress rules for a cloud. solrCloud: SolrCloud instance nodeNames: the names for each of the solr pods domainName: string Domain for the ingress rule to use
func DeepEqualWithNils ¶
func DeepEqualWithNils(x, y interface{}) bool
DeepEqualWithNils returns a deepEquals call that treats nil and zero-length maps, arrays and slices as the same.
func DeterminePodsSafeToUpdate ¶
func DeterminePodsSafeToUpdate(cloud *solr.SolrCloud, outOfDatePods []corev1.Pod, totalPods int, readyPods int, availableUpdatedPodCount int, outOfDatePodsNotStartedCount int, logger logr.Logger, httpHeaders map[string]string) (podsToUpdate []corev1.Pod, retryLater bool)
DeterminePodsSafeToUpdate takes a list of solr Pods and returns a list of pods that are safe to upgrade now. This function MUST be idempotent and return the same list of pods given the same kubernetes/solr state.
NOTE: It is assumed that the list of pods provided are all started. If an out of date pod has a solr container that is not started, it should be accounted for in outOfDatePodsNotStartedCount not outOfDatePods.
TODO:
- Think about caching this for ~250 ms? Not a huge need to send these requests milliseconds apart.
- Might be too much complexity for very little gain.
func GenerateBackupPersistenceJob ¶
func GenerateBackupPersistenceJob(solrBackup *solr.SolrBackup, solrBackupVolume corev1.VolumeSource, backupSubPath string) *batchv1.Job
GenerateBackupPersistenceJob creates a Job that will persist backup data and purge the backup from the solrBackupVolume
func GenerateCommonService ¶
GenerateCommonService returns a new corev1.Service pointer generated for the entire SolrCloud instance solrCloud: SolrCloud instance
func GenerateConfigMap ¶
GenerateConfigMap returns a new corev1.ConfigMap pointer generated for the SolrCloud instance solr.xml solrCloud: SolrCloud instance
func GenerateHeadlessService ¶
GenerateHeadlessService returns a new Headless corev1.Service pointer generated for the SolrCloud instance The PublishNotReadyAddresses option is set as true, because we want each pod to be reachable no matter the readiness of the pod. solrCloud: SolrCloud instance
func GenerateIngress ¶
GenerateIngress returns a new Ingress pointer generated for the entire SolrCloud, pointing to all instances solrCloud: SolrCloud instance nodeStatuses: []SolrNodeStatus the nodeStatuses
func GenerateMetricsConfigMap ¶
func GenerateMetricsConfigMap(solrPrometheusExporter *solr.SolrPrometheusExporter) *corev1.ConfigMap
GenerateMetricsConfigMap returns a new corev1.ConfigMap pointer generated for the Solr Prometheus Exporter instance solr-prometheus-exporter.xml solrPrometheusExporter: SolrPrometheusExporter instance
func GenerateNodeService ¶
GenerateNodeService returns a new External corev1.Service pointer generated for the given Solr Node. The PublishNotReadyAddresses option is set as true, because we want each pod to be reachable no matter the readiness of the pod. solrCloud: SolrCloud instance nodeName: string node
func GeneratePersistenceOptions ¶
func GeneratePersistenceOptions(solrBackup *solr.SolrBackup, solrBackupVolume corev1.VolumeSource) (image solr.ContainerImage, envVars []corev1.EnvVar, command []string, volume *corev1.Volume, volumeMount *corev1.VolumeMount, numRetries *int32)
GeneratePersistenceOptions creates options for a Job that will persist backup data
func GenerateSolrMetricsService ¶
func GenerateSolrMetricsService(solrPrometheusExporter *solr.SolrPrometheusExporter) *corev1.Service
GenerateSolrMetricsService returns a new corev1.Service pointer generated for the SolrCloud Prometheus Exporter deployment Metrics will be collected on this service endpoint, as we don't want to double-tick data if multiple exporters are runnning. solrPrometheusExporter: solrPrometheusExporter instance
func GenerateSolrPrometheusExporterDeployment ¶
func GenerateSolrPrometheusExporterDeployment(solrPrometheusExporter *solr.SolrPrometheusExporter, solrConnectionInfo SolrConnectionInfo, configXmlMd5 string, tls *TLSCerts, basicAuthMd5 string) *appsv1.Deployment
GenerateSolrPrometheusExporterDeployment returns a new appsv1.Deployment pointer generated for the SolrCloud Prometheus Exporter instance solrPrometheusExporter: SolrPrometheusExporter instance
func GenerateStatefulSet ¶
func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCloudStatus, hostNameIPs map[string]string, reconcileConfigInfo map[string]string, tls *TLSCerts) *appsv1.StatefulSet
GenerateStatefulSet returns a new appsv1.StatefulSet pointer generated for the SolrCloud instance object: SolrCloud instance replicas: the number of replicas for the SolrCloud instance storage: the size of the storage for the SolrCloud instance (e.g. 100Gi) zkConnectionString: the connectionString of the ZK instance to connect to
func GenerateZookeeperCluster ¶
func GenerateZookeeperCluster(solrCloud *solr.SolrCloud, zkSpec *solr.ZookeeperSpec) *zk.ZookeeperCluster
GenerateZookeeperCluster returns a new ZookeeperCluster pointer generated for the SolrCloud instance object: SolrCloud instance zkSpec: the spec of the ZookeeperCluster to generate
func GetCustomProbePaths ¶
func IsPVCOrphan ¶
IsPVCOrphan determines whether the given name represents a PVC that is an orphan, or no longer has a pod associated with it.
func OvertakeControllerRef ¶
func OvertakeControllerRef(owner metav1.Object, controlled metav1.Object, scheme *runtime.Scheme) (needsUpdate bool, err error)
OvertakeControllerRef makes sure that the controlled object has the owner as the controller ref. If the object has a different controller, then that ref will be downgraded to an "owner" and the new controller ref will be added
func RemoveString ¶
RemoveString helper function to remove string
func ResolveMaxPodsUnavailable ¶
func ResolveMaxPodsUnavailable(maxPodsUnavailable *intstr.IntOrString, desiredPods int) (int, error)
ResolveMaxPodsUnavailable resolves the maximum number of pods that are allowed to be unavailable, when choosing pods to update.
func ResolveMaxShardReplicasUnavailable ¶
func ResolveMaxShardReplicasUnavailable(maxShardReplicasUnavailable *intstr.IntOrString, shard string, totalShardReplicas map[string]int, cache map[string]int) (int, error)
ResolveMaxShardReplicasUnavailable resolves the maximum number of replicas that are allowed to be unavailable for a given shard, when choosing pods to update.
func RestorePath ¶
func RestoreSubPathForCloud ¶
func RunExecForPod ¶
func ScheduleNextRestart ¶ added in v0.4.0
func SolrNodeName ¶
SolrNodeName takes a cloud and a pod and returns the Solr nodeName for that pod
func ValidateBasicAuthSecret ¶
Types ¶
type SolrConnectionInfo ¶
type SolrConnectionInfo struct {
CloudZkConnnectionInfo *solr.ZookeeperConnectionInfo
StandaloneAddress string
}
SolrConnectionInfo defines how to connect to a cloud or standalone solr instance. One, and only one, of Cloud or Standalone must be provided.
type SolrNodeContents ¶
type SolrNodeContents struct {
// contains filtered or unexported fields
}
func (*SolrNodeContents) InClusterState ¶
func (nodeContents *SolrNodeContents) InClusterState() bool
type TLSCerts ¶ added in v0.4.0
type TLSCerts struct {
// Server cert config
ServerConfig *TLSConfig
// Client cert config
ClientConfig *TLSConfig
// Image used for initContainers that help configure the TLS settings
InitContainerImage *solr.ContainerImage
}
Helper struct for holding server and/or client cert config This struct is intended for internal use only and is only exposed outside the package so that the controllers can access
func TLSCertsForExporter ¶ added in v0.4.0
func TLSCertsForExporter(prometheusExporter *solr.SolrPrometheusExporter) *TLSCerts
Get a TLSCerts struct for reconciling TLS on an Exporter
func TLSCertsForSolrCloud ¶ added in v0.4.0
Get a TLSCerts struct for reconciling TLS on a SolrCloud
type TLSConfig ¶ added in v0.4.0
type TLSConfig struct {
// TLS options provided by the user in the CRD definition
Options *solr.SolrTLSOptions
// Flag to indicate if we need to convert the provided keystore into the p12 format needed by Java
NeedsPkcs12InitContainer bool
// The MD5 hash of the cert, used for restarting Solr pods after the cert updates if so desired
CertMd5 string
// The annotation varies based on the cert type (client or server)
CertMd5Annotation string
// The paths vary based on whether this config is for a client or server cert
KeystorePath string
TruststorePath string
VolumePrefix string
Namespace string
}
Holds TLS options from the user config as well as other config properties determined during reconciliation This struct is intended for internal use only and is only exposed outside the package so that the controllers can access
func (*TLSConfig) VerifyKeystoreAndTruststoreSecretConfig ¶ added in v0.4.0
func (tls *TLSConfig) VerifyKeystoreAndTruststoreSecretConfig(client *client.Client) (*corev1.Secret, error)
Make sure the secret containing the keystore and corresponding password secret exist and have the expected keys Also, set up to watch for updates if desired Also, verifies the configured truststore if provided