Documentation ¶
Index ¶
- Constants
- Variables
- func AddACLsToEnv(allACL *solrv1beta1.ZookeeperACL, readOnlyACL *solrv1beta1.ZookeeperACL) (hasACLs bool, envVars []corev1.EnvVar)
- func AddAuthToContext(ctx context.Context, client *client.Client, solrCloud *solr.SolrCloud) (context.Context, error)
- func AdditionalRepoLibs(repo *solrv1beta1.SolrBackupRepository) (libs []string)
- func AsyncIdForCollectionBackup(collection string, backupName string) string
- func BackupLocationPath(repo *solrv1beta1.SolrBackupRepository, backupLocation string) string
- func BackupRestoreSubPathForCloud(directoryOverride string, cloud string) string
- func BackupSubPathForCloud(directoryOverride string, cloud string, backupName string) string
- func BalanceReplicasForCluster(ctx context.Context, solrCloud *solr.SolrCloud, ...) (balanceComplete bool, requestInProgress bool, retryLaterDuration time.Duration, ...)
- func BasicAuthEnvVars(secretName string) []corev1.EnvVar
- func CheckBackupForCollection(ctx context.Context, cloud *solr.SolrCloud, collection string, ...) (finished bool, success bool, asyncStatus string, err error)
- func ContainsString(slice []string, s string) bool
- func CopyConfigMapFields(from, to *corev1.ConfigMap, logger logr.Logger) bool
- func CopyContainerResourceList(fromPtr, toPtr *corev1.ResourceList, basePath string, logger logr.Logger) (requireUpdate 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 CopyPodDisruptionBudgetFields(from, to *policyv1.PodDisruptionBudget, logger logr.Logger) bool
- func CopyPodTemplates(from, to *corev1.PodTemplateSpec, basePath string, logger logr.Logger) (requireUpdate bool)
- func CopyPodVolumes(fromPtr, toPtr *[]corev1.Volume, basePath string, logger logr.Logger) (requireUpdate bool)
- func CopyResources(from, to *corev1.ResourceRequirements, 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 *zkApi.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(ctx context.Context, cloud *solr.SolrCloud, collection string, ...) (err error)
- func DeterminePodsSafeToUpdate(cloud *solr.SolrCloud, totalPods int, outOfDatePods OutOfDatePodSegmentation, ...) (podsToUpdate []corev1.Pod, retryLater bool)
- func DuplicateLabelsOrAnnotations(from map[string]string) map[string]string
- func EnsureDirectoryForBackup(solrCloud *solr.SolrCloud, backupRepository *solr.SolrBackupRepository, ...) (err error)
- func EvictReplicasForPodIfNecessary(ctx context.Context, solrCloud *solr.SolrCloud, pod *corev1.Pod, ...) (err error, canDeletePod bool, requestInProgress bool)
- func FullCollectionBackupName(collection string, backupName string) string
- func GcsRepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string
- func GenerateAdditionalLibXMLPart(solrModules []string, additionalLibs []string) string
- func GenerateBackupRepositoriesForSolrXml(backupRepos []solrv1beta1.SolrBackupRepository) (repoXML string, solrModules []string, additionalLibs []string)
- 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 GeneratePodDisruptionBudget(cloud *solr.SolrCloud, selector map[string]string) *policyv1.PodDisruptionBudget
- func GenerateQueryParamsForBackup(backupRepository *solr.SolrBackupRepository, backup *solr.SolrBackup, ...) url.Values
- func GenerateSolrMetricsService(solrPrometheusExporter *solr.SolrPrometheusExporter) *corev1.Service
- func GenerateSolrPrometheusExporterDeployment(solrPrometheusExporter *solr.SolrPrometheusExporter, ...) *appsv1.Deployment
- func GenerateSolrXMLString(backupSection string, solrModules []string, additionalLibs []string) string
- func GenerateSolrXMLStringForCloud(solrCloud *solr.SolrCloud) string
- func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCloudStatus, ...) *appsv1.StatefulSet
- func GenerateZookeeperCluster(solrCloud *solrv1beta1.SolrCloud, zkSpec *solrv1beta1.ZookeeperSpec) *zkApi.ZookeeperCluster
- func GetAllManagedSolrNodeNames(solrCloud *solr.SolrCloud) map[string]bool
- func GetAvailableBackupRepos(pod *corev1.Pod) (repos map[string]bool)
- func GetBackupRepositoryByName(backupRepos []solr.SolrBackupRepository, repositoryName string) *solr.SolrBackupRepository
- func GetCustomProbePaths(solrCloud *solr.SolrCloud) []string
- func GetManagedSolrNodeNames(solrCloud *solr.SolrCloud, currentlyConfiguredPodCount int) map[string]bool
- func IsPVCOrphan(pvcName string, replicas int32) bool
- func IsRepoVolume(repo *solrv1beta1.SolrBackupRepository) bool
- func ListAllSolrCollections(ctx context.Context, cloud *solr.SolrCloud, logger logr.Logger) (collections []string, err error)
- func MaintainPreservedStatefulSetFields(expected, found *appsv1.StatefulSet)
- 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 Replicas(num int) *int32
- func RepoEnvVars(repo *solrv1beta1.SolrBackupRepository) (envVars []corev1.EnvVar)
- func RepoSolrModules(repo *solrv1beta1.SolrBackupRepository) (libs []string)
- func RepoVolumeName(repo *solrv1beta1.SolrBackupRepository) string
- func RepoVolumeSourceAndMount(repo *solrv1beta1.SolrBackupRepository, solrCloudName string) (source *corev1.VolumeSource, mount *corev1.VolumeMount)
- func RepoXML(repo *solrv1beta1.SolrBackupRepository) (xml string)
- func ResolveMaxPodsUnavailable(maxPodsUnavailable *intstr.IntOrString, desiredPods int) (int, error)
- func ResolveMaxShardReplicasUnavailable(maxShardReplicasUnavailable *intstr.IntOrString, shard string, ...) (int, error)
- func RunExecForPod(podName string, namespace string, command []string, config *rest.Config) (err error)
- func S3RepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string
- func ScheduleNextBackup(restartSchedule string, lastBackupTime time.Time) (nextBackup time.Time, err error)
- func ScheduleNextRestart(restartSchedule string, podTemplateAnnotations map[string]string) (nextRestart string, reconcileWaitDuration *time.Duration, err error)
- func SetAvailableBackupRepos(solrCloud *solrv1beta1.SolrCloud, podAnnotations map[string]string) map[string]string
- func SolrNodeName(solrCloud *solr.SolrCloud, podName string) string
- func StartBackupForCollection(ctx context.Context, cloud *solr.SolrCloud, ...) (success bool, err error)
- func UpdateStatusOfCollectionBackups(backupStatus *solr.IndividualSolrBackupStatus) (allFinished bool)
- func ValidateBasicAuthSecret(basicAuthSecret *corev1.Secret) error
- func VolumeRepoVolumeMountPath(repo *solrv1beta1.SolrBackupRepository) string
- type NodeReplicaState
- type OutOfDatePodSegmentation
- type SecurityConfig
- type SolrConnectionInfo
- type SolrNodeContents
- type TLSCerts
- type TLSConfig
Constants ¶
const ( SolrMetricsPort = 8080 SolrMetricsPortName = "solr-metrics" ExtSolrMetricsPort = 80 SolrPrometheusExporterContainer = "solr-prometheus-exporter" DefaultPrometheusExporterEntrypoint = "/opt/solr/contrib/prometheus-exporter/bin/solr-exporter" PrometheusExporterConfigMapKey = "solr-prometheus-exporter.xml" PrometheusExporterConfigXmlMd5Annotation = "solr.apache.org/exporterConfigXmlMd5" )
const ( BaseBackupRestorePath = "/var/solr/data/backup-restore" GCSCredentialSecretKey = "service-account-key.json" S3CredentialFileName = "credentials" SolrBackupRepositoriesAnnotation = "solr.apache.org/backupRepositories" )
const ( SecurityJsonFile = "security.json" BasicAuthMd5Annotation = "solr.apache.org/basicAuthMd5" DefaultStartupProbePath = "/admin/info/system" DefaultLivenessProbePath = DefaultStartupProbePath DefaultReadinessProbePath = "/admin/info/health" )
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" InitdbInitContainer = "generate-init-db" InitdbPath = "/docker-entrypoint-initdb.d" DefaultPkcs12KeystoreFile = "keystore.p12" DefaultPkcs12TruststoreFile = "truststore.p12" DefaultKeystorePasswordFile = "keystore-password" )
const ( SolrScheduledRestartAnnotation = "solr.apache.org/nextScheduledRestart" )
const ( SolrClientPortName = "solr-client" 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" // Protected StatefulSet annotations // These are to be saved on a statefulSet update ClusterOpsLockAnnotation = "solr.apache.org/clusterOpsLock" ClusterOpsRetryQueueAnnotation = "solr.apache.org/clusterOpsRetryQueue" SolrIsNotStoppedReadinessCondition = "solr.apache.org/isNotStopped" SolrReplicasNotEvictedReadinessCondition = "solr.apache.org/replicasNotEvicted" DefaultStatefulSetPodManagementPolicy = appsv1.ParallelPodManagement DistLibs = "/opt/solr/dist" ContribLibs = "/opt/solr/contrib/%s/lib" SysPropLibPlaceholder = "${solr.sharedLib:}" )
const DefaultSolrXML = `` /* 1161-byte string literal not displayed */
Variables ¶
var ( SecretReadOnlyPermissions int32 = 440 PublicReadOnlyPermissions int32 = 444 )
var ( DefaultSolrVolumePrepInitContainerMemory = resource.NewScaledQuantity(50, 6) DefaultSolrVolumePrepInitContainerCPU = resource.NewMilliQuantity(50, resource.DecimalExponent) DefaultSolrZKPrepInitContainerMemory = resource.NewScaledQuantity(200, 6) DefaultSolrZKPrepInitContainerCPU = resource.NewMilliQuantity(400, resource.DecimalExponent) )
Functions ¶
func AddACLsToEnv ¶
func AddACLsToEnv(allACL *solrv1beta1.ZookeeperACL, readOnlyACL *solrv1beta1.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 AddAuthToContext ¶ added in v0.5.0
func AddAuthToContext(ctx context.Context, client *client.Client, solrCloud *solr.SolrCloud) (context.Context, error)
Similar to security.AddAuthToContext but we need to lookup the secret containing the authn credentials first
func AdditionalRepoLibs ¶ added in v0.5.0
func AdditionalRepoLibs(repo *solrv1beta1.SolrBackupRepository) (libs []string)
func BackupLocationPath ¶ added in v0.5.0
func BackupLocationPath(repo *solrv1beta1.SolrBackupRepository, backupLocation string) string
func BackupSubPathForCloud ¶
func BalanceReplicasForCluster ¶ added in v0.8.0
func BalanceReplicasForCluster(ctx context.Context, solrCloud *solr.SolrCloud, statefulSet *appsv1.StatefulSet, balanceReason string, balanceCmdUniqueId string, logger logr.Logger) (balanceComplete bool, requestInProgress bool, retryLaterDuration time.Duration, err error)
BalanceReplicasForCluster takes a SolrCloud and balances all replicas across the Pods that are currently alive.
Note: unlike EvictReplicasForPodIfNecessary, the only way we know that we are done balancingReplicas is by seeing a successful status returned from the command. So if we delete the asyncStatus, and then something happens in the operator, and we lose our state, then we will need to retry the balanceReplicas command. This should be ok since calling balanceReplicas multiple times should not be bad when the replicas for the cluster are already balanced.
func BasicAuthEnvVars ¶ added in v0.5.0
func ContainsString ¶
ContainsString helper function to test string contains
func CopyConfigMapFields ¶
CopyConfigMapFields copies the owned fields from one ConfigMap to another
func CopyContainerResourceList ¶ added in v0.5.1
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 CopyPodDisruptionBudgetFields ¶ added in v0.7.0
func CopyPodDisruptionBudgetFields(from, to *policyv1.PodDisruptionBudget, logger logr.Logger) bool
CopyPodDisruptionBudgetFields copies the owned fields from one PodDisruptionBudget to another
func CopyPodTemplates ¶
func CopyPodVolumes ¶ added in v0.5.0
func CopyResources ¶ added in v0.5.1
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 *zkApi.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, totalPods int, outOfDatePods OutOfDatePodSegmentation, state NodeReplicaState, availableUpdatedPodCount int, logger logr.Logger) (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 EnsureDirectoryForBackup ¶
func EnsureDirectoryForBackup(solrCloud *solr.SolrCloud, backupRepository *solr.SolrBackupRepository, backup *solr.SolrBackup, config *rest.Config) (err error)
func EvictReplicasForPodIfNecessary ¶ added in v0.6.0
func EvictReplicasForPodIfNecessary(ctx context.Context, solrCloud *solr.SolrCloud, pod *corev1.Pod, podHasReplicas bool, evictionReason string, logger logr.Logger) (err error, canDeletePod bool, requestInProgress bool)
EvictReplicasForPodIfNecessary takes a solr Pod and migrates all replicas off of that Pod. For updates this will only be called for pods using ephemeral data. For scale-down operations, this can be called for pods using ephemeral or persistent data.
func FullCollectionBackupName ¶ added in v0.5.0
func GcsRepoSecretMountPath ¶ added in v0.5.0
func GcsRepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string
func GenerateAdditionalLibXMLPart ¶ added in v0.5.0
func GenerateBackupRepositoriesForSolrXml ¶ added in v0.5.0
func GenerateBackupRepositoriesForSolrXml(backupRepos []solrv1beta1.SolrBackupRepository) (repoXML string, solrModules []string, additionalLibs []string)
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 GeneratePodDisruptionBudget ¶ added in v0.7.0
func GenerateQueryParamsForBackup ¶ added in v0.5.0
func GenerateQueryParamsForBackup(backupRepository *solr.SolrBackupRepository, backup *solr.SolrBackup, collection string) url.Values
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, solrCloudImage *solr.ContainerImage, 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 GenerateSolrXMLString ¶ added in v0.5.0
func GenerateSolrXMLStringForCloud ¶ added in v0.5.0
func GenerateStatefulSet ¶
func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCloudStatus, hostNameIPs map[string]string, reconcileConfigInfo map[string]string, tls *TLSCerts, security *SecurityConfig) *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 *solrv1beta1.SolrCloud, zkSpec *solrv1beta1.ZookeeperSpec) *zkApi.ZookeeperCluster
GenerateZookeeperCluster returns a new ZookeeperCluster pointer generated for the SolrCloud instance object: SolrCloud instance zkSpec: the spec of the ZookeeperCluster to generate
func GetAllManagedSolrNodeNames ¶ added in v0.5.0
func GetAvailableBackupRepos ¶ added in v0.5.0
func GetBackupRepositoryByName ¶ added in v0.5.0
func GetBackupRepositoryByName(backupRepos []solr.SolrBackupRepository, repositoryName string) *solr.SolrBackupRepository
func GetCustomProbePaths ¶
func GetManagedSolrNodeNames ¶ added in v0.8.1
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 IsRepoVolume ¶ added in v0.5.0
func IsRepoVolume(repo *solrv1beta1.SolrBackupRepository) bool
func ListAllSolrCollections ¶ added in v0.7.0
func MaintainPreservedStatefulSetFields ¶ added in v0.8.0
func MaintainPreservedStatefulSetFields(expected, found *appsv1.StatefulSet)
MaintainPreservedStatefulSetFields makes sure that certain fields in the SolrCloud statefulSet are preserved across updates to the statefulSet. The code that generates an "idempotent" statefulSet might not have the information that was used when these values were populated, so they must be saved when the new "expected" statefulSet overwrites all the information on the new "found" statefulSet.
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 RepoEnvVars ¶ added in v0.5.0
func RepoEnvVars(repo *solrv1beta1.SolrBackupRepository) (envVars []corev1.EnvVar)
func RepoSolrModules ¶ added in v0.5.0
func RepoSolrModules(repo *solrv1beta1.SolrBackupRepository) (libs []string)
func RepoVolumeName ¶ added in v0.5.0
func RepoVolumeName(repo *solrv1beta1.SolrBackupRepository) string
func RepoVolumeSourceAndMount ¶ added in v0.5.0
func RepoVolumeSourceAndMount(repo *solrv1beta1.SolrBackupRepository, solrCloudName string) (source *corev1.VolumeSource, mount *corev1.VolumeMount)
func RepoXML ¶ added in v0.5.0
func RepoXML(repo *solrv1beta1.SolrBackupRepository) (xml 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 RunExecForPod ¶
func S3RepoSecretMountPath ¶ added in v0.5.0
func S3RepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string
func ScheduleNextBackup ¶ added in v0.5.0
func ScheduleNextRestart ¶ added in v0.4.0
func SetAvailableBackupRepos ¶ added in v0.5.0
func SolrNodeName ¶
SolrNodeName takes a cloud and a pod and returns the Solr nodeName for that pod
func UpdateStatusOfCollectionBackups ¶ added in v0.5.0
func UpdateStatusOfCollectionBackups(backupStatus *solr.IndividualSolrBackupStatus) (allFinished bool)
func ValidateBasicAuthSecret ¶
func VolumeRepoVolumeMountPath ¶ added in v0.5.0
func VolumeRepoVolumeMountPath(repo *solrv1beta1.SolrBackupRepository) string
Types ¶
type NodeReplicaState ¶ added in v0.8.0
type NodeReplicaState struct { // A map of Solr node name (not pod name) to the contents of that Solr Node NodeContents map[string]*SolrNodeContents // A map of unique shard name (collection + shard) to the number of replicas for that shard TotalShardReplicas map[string]int // A map of unique shard name (collection + shard) to the number of non-active replicas for that shard ShardReplicasNotActive map[string]int // Whether all pods are live in the cluster state AllManagedPodsLive bool }
func GetNodeReplicaState ¶ added in v0.8.0
func (NodeReplicaState) PodContents ¶ added in v0.8.0
func (state NodeReplicaState) PodContents(cloud *solr.SolrCloud, podName string) (contents *SolrNodeContents, isInClusterState bool)
PodContents is a helper method to get the node contents for a particular pod
func (NodeReplicaState) PodHasReplicas ¶ added in v0.8.0
func (state NodeReplicaState) PodHasReplicas(cloud *solr.SolrCloud, podName string) bool
PodHasReplicas is a helper method to retrieve whether a pod has replicas living on it
type OutOfDatePodSegmentation ¶ added in v0.7.0
type OutOfDatePodSegmentation struct { NotStarted []corev1.Pod ScheduledForDeletion []corev1.Pod Running []corev1.Pod }
func (OutOfDatePodSegmentation) IsEmpty ¶ added in v0.8.0
func (seg OutOfDatePodSegmentation) IsEmpty() bool
type SecurityConfig ¶ added in v0.5.0
type SecurityConfig struct { SolrSecurity *solr.SolrSecurityOptions CredentialsSecret *corev1.Secret SecurityJson string SecurityJsonSrc *corev1.EnvVarSource }
Utility struct holding security related config and objects resolved at runtime needed during reconciliation, such as the secret holding credentials the operator should use to make calls to secure Solr
func ReconcileSecurityConfig ¶ added in v0.5.0
func ReconcileSecurityConfig(ctx context.Context, client *client.Client, instance *solr.SolrCloud) (*SecurityConfig, error)
Given a SolrCloud instance and an API service client, produce a SecurityConfig needed to enable Solr security
func (*SecurityConfig) AddAuthToContext ¶ added in v0.5.0
Add auth data to the supplied Context using secrets already resolved (stored in the SecurityConfig)
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