Skip to main content

CRDs

important

The operator is bundled with the Custom Resource Definitions (CRDs) and cannot be deployed separately. Updating the operator will automatically update the respective CRDs.

TypesenseCluster

Typesense Kubernetes Operator is controlling the lifecycle of multiple Typesense instances in the same Kubernetes cluster by introducing TypesenseCluster, a new Custom Resource Definition:

TypesenseClusterSpec

NameDescriptionOptionalDefault
imageTypesense image
adminApiKeyReference to the Secret to be used for bootstrapX
replicasSize of the cluster (allowed 1, 3, 5 or 7)3
apiPortREST/API port8108
peeringPortPeering port8107
resetPeersOnErrorautomatic reset of peers on errortrue
enableCorsenables CORSXfalse
corsDomainscomma separated list of domains allowed for CORSX
resourcesresource request & limitXcheck specs
affinitygroup of affinity scheduling rulesX
nodeSelectornode selection constraintX
tolerationsschedule pods with matching taintsX
additionalServerConfigurationa reference to a ConfigMap holding extra configurationX
storagecheck StorageSpec below
ingresscheck IngressSpec belowX
scrapersarray of DocSearchScraperSpec; check belowX
metricscheck MetricsSpec belowX
topologySpreadConstraintshow to spread a group of pods across topology domainsX
incrementalQuorumRecoveryadd nodes gradually to the statefulset while recoveringXfalse
note
  • Add additional Typesense server configuration variables in a ConfigMap, using additionalServerConfiguration as described in: https://typesense.org/docs/28.0/api/server-configuration.html#using-environment-variables.
  • Any Typesense server configuration variable that is defined in TypesenseClusterSpec is overriding any additional reference of the same variable in additionalServerConfiguration. You can find an example of providing an additional NodesListConfigMap in: config/samples/ts_v1alpha1_typesensecluster_kind.yaml.
  • In heavy datasets is advised to set incrementalQuorumRecovery to true and let the controller reconstruct the quorum node by node. That will smooth the leader election process while new nodes are joining but it will make recovery process last longer.

StorageSpec (optional)

NameDescriptionOptionalDefault
sizeSize of the underlying PVX100Mi
storageClassNameStorageClass to be usedstandard

IngressSpec (optional)

NameDescriptionOptionalDefault
refererFQDN allowed to access reverse proxyX
HttpDirectivesNginx Proxy HttpDirectivesX
serverDirectivesNginx Proxy serverDirectivesX
locationDirectivesNginx Proxy locationDirectivesX
hostIngress Host
clusterIssuercert-manager ClusterIssuerX
tlsSecretNameTLS secret name to useX
ingressClassNameIngress to be used
annotationsUser-Defined annotationsX
resourcesresource request & limitXcheck specs
note

This feature makes use of the existence of cert-manager in the cluster, but does not actively enforce it with an error. If no clusterIssuer is specified a valid certificate must be stored in a secret and the secret name must be provided in the tlsSecretName config.

If you are targeting Open Telekom Cloud, you might be interested in provisioning additionally the designated DNS solver webhook for Open Telekom Cloud. You can find it here.

caution

Although in official Typesense documentation under Production Best Practices -> Configuration is stated:

"Typesense comes built-in with a high performance HTTP server that is used by likes of Fastly in their edge servers at scale. So Typesense can be directly exposed to incoming public-facing internet traffic, without the need to place it behind another web server like Nginx/Apache or your backend API."

It is highly recommended, from this operator's perspective, to always expose Typesense behind a reverse proxy (using the referer option).

DocSearchScraperSpec (optional)

NameDescriptionOptionalDefault
namename of the scraper
imagecontainer image to use
configconfig to use
schedulecron expression; no timezone; no seconds
authConfigurationa reference to a Secret holding auth configurationX
note

If you need to scrape a target that requires authentication, you can add the authentication configuration as environment variables via authConfiguration. In order to see which options are supported currently out of the box, consult the official documentation: https://typesense.org/docs/guide/docsearch.html#authentication

MetricsSpec (optional)

NameDescriptionOptionalDefault
imagecontainer image to useXakyriako78/typesense-prometheus-exporter:0.1.7
releasePrometheus release to become a target of
intervalinterval in seconds between two scrapesX15
resourcesresource request & limitXcheck specs
tip

If you've provisioned Prometheus via kube-prometheus-stack, you can find the corresponding release value of your Prometheus instance by checking the labels of the Prometheus operator pod e.g:

kubectl describe pod {kube-prometheus-stack-operator-pod} -n {kube-prometheus-stack-namespace}

name: promstack-kube-prometheus-operator-755485dc68-dmkw2
Namespace: monitoring
[...]
Labels: app=kube-prometheus-stack-operator
app.kubernetes.io/component=prometheus-operator
app.kubernetes.io/instance=promstack
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=kube-prometheus-stack-prometheus-operator
app.kubernetes.io/part-of=kube-prometheus-stack
app.kubernetes.io/version=67.8.0
chart=kube-prometheus-stack-67.8.0
heritage=Helm
pod-template-hash=755485dc68
release=promstack
[...]

TypesenseClusterStatus

NameDescription
phaseTypesense Cluster/Controller Operational Phase
conditionsmetav1.Conditions related to the outcome of the reconciliation (see table below)

Conditions Summary

ConditionValueReasonDescription
ConditionReadytrueQuorumReadyCluster is Operational
falseQuorumNotReadyCluster is not Operational
falseQuorumNotReadyWaitATermCluster is not Operational; Waits a Terms
falseQuorumDowngradedCluster is not Operational; Scheduled to Single-Instance
falseQuorumUpgradedCluster is Operational; Scheduled to Original Size
falseQuorumNeedsInterventionXXXCluster is not Operational; Administrative Action Required