util

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	BaseBackupRestorePath = "/var/solr/data/backup-restore"

	GCSCredentialSecretKey = "service-account-key.json"
	S3CredentialFileName   = "credentials"

	SolrBackupRepositoriesAnnotation = "solr.apache.org/backupRepositories"
)
View Source
const (
	SecurityJsonFile          = "security.json"
	BasicAuthMd5Annotation    = "solr.apache.org/basicAuthMd5"
	DefaultStartupProbePath   = "/admin/info/system"
	DefaultLivenessProbePath  = DefaultStartupProbePath
	DefaultReadinessProbePath = "/admin/info/health"
)
View Source
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"
)
View Source
const (
	DefaultMaxPodsUnavailable          = "25%"
	DefaultMaxShardReplicasUnavailable = 1

	SolrScheduledRestartAnnotation = "solr.apache.org/nextScheduledRestart"
)
View Source
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:}"
)
View Source
const DefaultSolrXML = `` /* 1161-byte string literal not displayed */

Variables

View Source
var (
	SecretReadOnlyPermissions int32 = 440
	PublicReadOnlyPermissions int32 = 444
)
View Source
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 AsyncIdForCollectionBackup

func AsyncIdForCollectionBackup(collection string, backupName string) string

func BackupLocationPath added in v0.5.0

func BackupLocationPath(repo *solrv1beta1.SolrBackupRepository, backupLocation string) string

func BackupRestoreSubPathForCloud

func BackupRestoreSubPathForCloud(directoryOverride string, cloud string) string

func BackupSubPathForCloud

func BackupSubPathForCloud(directoryOverride string, cloud string, backupName string) string

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 BasicAuthEnvVars(secretName string) []corev1.EnvVar

func CheckBackupForCollection

func CheckBackupForCollection(ctx context.Context, cloud *solr.SolrCloud, collection string, backupName string, logger logr.Logger) (finished bool, success bool, asyncStatus string, err error)

func ContainsString

func ContainsString(slice []string, s string) bool

ContainsString helper function to test string contains

func CopyConfigMapFields

func CopyConfigMapFields(from, to *corev1.ConfigMap, logger logr.Logger) bool

CopyConfigMapFields copies the owned fields from one ConfigMap to another

func CopyContainerResourceList added in v0.5.1

func CopyContainerResourceList(fromPtr, toPtr *corev1.ResourceList, basePath string, logger logr.Logger) (requireUpdate bool)

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

func CopyIngressFields(from, to *netv1.Ingress, logger logr.Logger) bool

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 CopyPodContainers(fromPtr, toPtr *[]corev1.Container, basePath string, logger logr.Logger) (requireUpdate bool)

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 CopyPodTemplates(from, to *corev1.PodTemplateSpec, basePath string, logger logr.Logger) (requireUpdate bool)

func CopyPodVolumes added in v0.5.0

func CopyPodVolumes(fromPtr, toPtr *[]corev1.Volume, basePath string, logger logr.Logger) (requireUpdate bool)

func CopyResources added in v0.5.1

func CopyResources(from, to *corev1.ResourceRequirements, basePath string, logger logr.Logger) (requireUpdate bool)

func CopyServiceFields

func CopyServiceFields(from, to *corev1.Service, logger logr.Logger) bool

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 DeleteAsyncInfoForBackup

func DeleteAsyncInfoForBackup(ctx context.Context, cloud *solr.SolrCloud, collection string, backupName string, logger logr.Logger) (err error)

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 DuplicateLabelsOrAnnotations

func DuplicateLabelsOrAnnotations(from map[string]string) map[string]string

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 FullCollectionBackupName(collection string, backupName string) string

func GcsRepoSecretMountPath added in v0.5.0

func GcsRepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string

func GenerateAdditionalLibXMLPart added in v0.5.0

func GenerateAdditionalLibXMLPart(solrModules []string, additionalLibs []string) string

func GenerateBackupRepositoriesForSolrXml added in v0.5.0

func GenerateBackupRepositoriesForSolrXml(backupRepos []solrv1beta1.SolrBackupRepository) (repoXML string, solrModules []string, additionalLibs []string)

func GenerateCommonService

func GenerateCommonService(solrCloud *solr.SolrCloud) *corev1.Service

GenerateCommonService returns a new corev1.Service pointer generated for the entire SolrCloud instance solrCloud: SolrCloud instance

func GenerateConfigMap

func GenerateConfigMap(solrCloud *solr.SolrCloud) *corev1.ConfigMap

GenerateConfigMap returns a new corev1.ConfigMap pointer generated for the SolrCloud instance solr.xml solrCloud: SolrCloud instance

func GenerateHeadlessService

func GenerateHeadlessService(solrCloud *solr.SolrCloud) *corev1.Service

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

func GenerateIngress(solrCloud *solr.SolrCloud, nodeNames []string) (ingress *netv1.Ingress)

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

func GenerateNodeService(solrCloud *solr.SolrCloud, nodeName string) *corev1.Service

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 GeneratePodDisruptionBudget(cloud *solr.SolrCloud, selector map[string]string) *policyv1.PodDisruptionBudget

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 GenerateSolrXMLString(backupSection string, solrModules []string, additionalLibs []string) string

func GenerateSolrXMLStringForCloud added in v0.5.0

func GenerateSolrXMLStringForCloud(solrCloud *solr.SolrCloud) string

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 GetAllManagedSolrNodeNames(solrCloud *solr.SolrCloud) map[string]bool

func GetAvailableBackupRepos added in v0.5.0

func GetAvailableBackupRepos(pod *corev1.Pod) (repos map[string]bool)

func GetBackupRepositoryByName added in v0.5.0

func GetBackupRepositoryByName(backupRepos []solr.SolrBackupRepository, repositoryName string) *solr.SolrBackupRepository

func GetCustomProbePaths

func GetCustomProbePaths(solrCloud *solr.SolrCloud) []string

func GetManagedSolrNodeNames added in v0.8.1

func GetManagedSolrNodeNames(solrCloud *solr.SolrCloud, currentlyConfiguredPodCount int) map[string]bool

func IsPVCOrphan

func IsPVCOrphan(pvcName string, replicas int32) bool

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 ListAllSolrCollections(ctx context.Context, cloud *solr.SolrCloud, logger logr.Logger) (collections []string, err error)

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 MergeLabelsOrAnnotations

func MergeLabelsOrAnnotations(base, additional map[string]string) map[string]string

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

func RemoveString(slice []string, s string) (result []string)

RemoveString helper function to remove string

func Replicas added in v0.5.0

func Replicas(num int) *int32

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 RunExecForPod(podName string, namespace string, command []string, config *rest.Config) (err error)

func S3RepoSecretMountPath added in v0.5.0

func S3RepoSecretMountPath(repo *solrv1beta1.SolrBackupRepository) string

func ScheduleNextBackup added in v0.5.0

func ScheduleNextBackup(restartSchedule string, lastBackupTime time.Time) (nextBackup time.Time, err error)

func ScheduleNextRestart added in v0.4.0

func ScheduleNextRestart(restartSchedule string, podTemplateAnnotations map[string]string) (nextRestart string, reconcileWaitDuration *time.Duration, err error)

func SetAvailableBackupRepos added in v0.5.0

func SetAvailableBackupRepos(solrCloud *solrv1beta1.SolrCloud, podAnnotations map[string]string) map[string]string

func SolrNodeName

func SolrNodeName(solrCloud *solr.SolrCloud, podName string) string

SolrNodeName takes a cloud and a pod and returns the Solr nodeName for that pod

func StartBackupForCollection

func StartBackupForCollection(ctx context.Context, cloud *solr.SolrCloud, backupRepository *solr.SolrBackupRepository, backup *solr.SolrBackup, collection string, logger logr.Logger) (success bool, err error)

func UpdateStatusOfCollectionBackups added in v0.5.0

func UpdateStatusOfCollectionBackups(backupStatus *solr.IndividualSolrBackupStatus) (allFinished bool)

func ValidateBasicAuthSecret

func ValidateBasicAuthSecret(basicAuthSecret *corev1.Secret) error

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 GetNodeReplicaState(ctx context.Context, cloud *solr.SolrCloud, statefulSet *appsv1.StatefulSet, hasReadyPod bool, logger logr.Logger) (state NodeReplicaState, retryLater bool, err error)

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

func (security *SecurityConfig) AddAuthToContext(ctx context.Context) (context.Context, error)

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

func TLSCertsForSolrCloud(instance *solr.SolrCloud) *TLSCerts

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

func (*TLSConfig) VerifyTruststoreOnly added in v0.4.0

func (tls *TLSConfig) VerifyTruststoreOnly(client *client.Client) error

Special case where the user only configured a truststore for the exporter (no keystore)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL