### Get All Resources for a Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/resource-constants.md Example command to retrieve all Kubernetes resources associated with a specific cluster instance using its label selector. ```bash # Get all resources for a cluster kubectl get all -l app.kubernetes.io/instance=ts-production ``` -------------------------------- ### Example Code Block Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/README.md Illustrates the standard format for code blocks within the documentation, including type definitions, configuration examples, and command references. ```markdown ```language // Type definitions // Configuration examples // Command reference ``` ``` -------------------------------- ### Get Pods for a Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/resource-constants.md Example command to list all pods belonging to a specific cluster instance by filtering on the 'app.kubernetes.io/instance' label. ```bash # Get pods for a cluster kubectl get pods -l app.kubernetes.io/instance=ts-production ``` -------------------------------- ### Get Typesense Pods Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/resource-constants.md Example command to specifically retrieve only the Typesense pods for a cluster using a different label selector. ```bash # Get only Typesense pods kubectl get pods -l app=ts-production-sts ``` -------------------------------- ### Install Typesense Operator with Helm Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Install the Typesense Operator using Helm. Ensure you have Helm installed and configured. ```bash # Install the Operator helm repo add tyko https://akyriako.github.io/typesense-operator/ helm repo update helm upgrade --install typesense-operator tyko/typesense-operator -n typesense-system --create-namespace ``` -------------------------------- ### Get Services in Namespace Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list existing services in a namespace, helpful for diagnosing Service creation failures. ```bash kubectl get services -n ``` -------------------------------- ### Get Namespace Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to check if a namespace exists and is accessible, relevant for HttpRoute creation. ```bash kubectl get namespace ``` -------------------------------- ### Get Gateways Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list existing Gateways in all namespaces, necessary for HttpRoute parent references. ```bash kubectl get gateways -A ``` -------------------------------- ### Get Storage Classes Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list available StorageClasses in the cluster, essential for StatefulSet creation when persistent storage is required. ```bash kubectl get storageclass ``` -------------------------------- ### Get Ingress Classes Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list available IngressClasses in the cluster, necessary for Ingress creation. ```bash kubectl get ingressclasses ``` -------------------------------- ### Get Ingress Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list Ingress resources in a namespace, useful for identifying conflicting ingress rules. ```bash kubectl get ingress -n ``` -------------------------------- ### Get Nodes with Labels Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list nodes and their labels, used to verify node selector matches for StatefulSet pods. ```bash kubectl get nodes --show-labels ``` -------------------------------- ### Check for Ingress Controller Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to verify if an Ingress controller is installed and running in the cluster. ```bash kubectl get deployments -A | grep ingress ``` -------------------------------- ### Typesense Cluster Metrics Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Example YAML configuration to enable metrics collection for a Typesense cluster, specifying the release and collection interval. ```yaml spec: metrics: release: promstack interval: 15 ``` -------------------------------- ### Get HttpRoute RoleBindings Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to check RoleBindings related to httproutes, ensuring necessary RBAC permissions for HttpRoute creation. ```bash kubectl get rolebindings -A | grep httproute ``` -------------------------------- ### TypesenseCluster for GCP Source: https://github.com/akyriako/typesense-operator/blob/main/README.md Example configuration for a TypesenseCluster on Google Cloud Platform (GCP) using standard-rwo storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-gcp spec: image: typesense/typesense:30.0 replicas: 3 storage: storageClassName: standard-rwo ``` -------------------------------- ### Deploy TypesenseCluster on GCP Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example of a TypesenseCluster manifest for GCP. Specifies the image, replica count, and storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-gcp spec: image: typesense/typesense:29.0 replicas: 3 storage: storageClassName: standard-rwo ``` -------------------------------- ### Get Additional Server Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Converts a reference to an additional server configuration ConfigMap into an environment source. Returns an empty slice if `spec.additionalServerConfiguration` is not set. ```go func (s *TypesenseClusterSpec) GetAdditionalServerConfiguration() []corev1.EnvFromSource ``` ```go spec := TypesenseClusterSpec{ AdditionalServerConfiguration: &corev1.LocalObjectReference{ Name: "ts-config", }, } envSource := spec.GetAdditionalServerConfiguration() // Use for pod spec: // pod.Spec.Containers[0].EnvFrom = envSource ``` -------------------------------- ### Deploy TypesenseCluster on Kind with local path storage Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example manifest for deploying a TypesenseCluster on Kind, including a local path StorageClass definition. Specifies image, replica count, storage size, and storage class. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: typesense-local-path provisioner: rancher.io/local-path reclaimPolicy: Delete allowVolumeExpansion: true volumeBindingMode: WaitForFirstConsumer --- apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-kind spec: image: typesense/typesense:29.0 replicas: 3 storage: size: 150Mi storageClassName: typesense-local-path ``` -------------------------------- ### TypesenseCluster for Open Telekom Cloud CCE Source: https://github.com/akyriako/typesense-operator/blob/main/README.md Example configuration for a TypesenseCluster on Open Telekom Cloud CCE using default storage. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-otc-1 spec: image: typesense/typesense:30.0 replicas: 3 storage: storageClassName: csi-disk ``` -------------------------------- ### TypesenseCluster for Azure AKS Source: https://github.com/akyriako/typesense-operator/blob/main/README.md Example configuration for a TypesenseCluster on Azure AKS using managed-csi storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-azure spec: image: typesense/typesense:30.0 replicas: 3 storage: storageClassName: managed-csi ``` -------------------------------- ### Typesense Cluster with Ingress and TLS Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/README.md Configure a Typesense cluster with ingress support, specifying the host, ingress class, and a cluster issuer for TLS certificates. This example also allows for custom storage size and class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: name: ts-prod spec: image: typesense/typesense:26.0 replicas: 3 storage: size: 50Gi storageClassName: fast-ssd ingress: host: typesense.example.com ingressClassName: nginx clusterIssuer: letsencrypt-prod ``` -------------------------------- ### Typesense Cluster with Ingress Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/typesense-cluster-crd.md Configure a Typesense cluster with ingress support for external access. This example specifies the number of replicas, API port, storage details, and ingress settings including host, class, and issuer. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: name: ts-cluster spec: image: typesense/typesense:26.0 replicas: 3 apiPort: 8108 storage: size: 10Gi storageClassName: fast-ssd ingress: host: typesense.example.com ingressClassName: nginx clusterIssuer: letsencrypt-prod ``` -------------------------------- ### Get CPU and Memory Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves CPU and memory resource requests and limits for Typesense containers. Provides default values if `spec.resources` is not set. ```go func (s *TypesenseClusterSpec) GetResources() corev1.ResourceRequirements ``` ```text Requests: CPU: 100m Memory: 256Mi Limits: CPU: 1000m Memory: 512Mi ``` ```go spec := TypesenseClusterSpec{...} resources := spec.GetResources() // Use for pod specification: // container.Resources = resources ``` -------------------------------- ### Get Pods in Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Use this command to list all pods belonging to a specific Typesense cluster instance within a namespace. ```bash kubectl get pods -l app.kubernetes.io/instance= -n ``` -------------------------------- ### Deploy TypesenseCluster on bare metal K3s with Democratic CSI Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example of a TypesenseCluster manifest for bare metal K3s using Democratic CSI. Specifies the image, replica count, and storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-bm-k3s spec: image: typesense/typesense:29.0 replicas: 3 storage: storageClassName: nfs ``` -------------------------------- ### Get Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/controller-reconciliation.md Retrieves the current 'Ready' condition status from a TypesenseCluster resource. Returns a pointer to the condition or nil if not found. ```go func (r *TypesenseClusterReconciler) getConditionReady(ts *tsv1alpha1.TypesenseCluster) *metav1.Condition ``` -------------------------------- ### Get Default Metrics Exporter Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the default configuration for the metrics exporter. This is used when the spec.metrics field is not set. ```go func (s *TypesenseClusterSpec) GetMetricsExporterSpecs() MetricsExporterSpec ``` ```text Release: "promstack" Image: "quay.io/akyriako/typesense-prometheus-exporter:0.1.9" IntervalInSeconds: 15 ``` ```go spec := TypesenseClusterSpec{} metrics := spec.GetMetricsExporterSpecs() // Returns default metrics configuration ``` -------------------------------- ### TypesenseCluster for Open Telekom Cloud CCE with OBS S3 Source: https://github.com/akyriako/typesense-operator/blob/main/README.md Example configuration for a TypesenseCluster on Open Telekom Cloud CCE with OBS S3 support. Requires specific annotations for CSI. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-otc-2 spec: image: typesense/typesense:30.0 replicas: 3 storage: storageClassName: csi-obs accessMode: ReadWriteMany annotations: csi.storage.k8s.io/fstype: obsfs volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner csi.storage.k8s.io/node-publish-secret-name: otc-aksk csi.storage.k8s.io/node-publish-secret-namespace: default everest.io/csi.volume-name-prefix: c-otc-2 ``` -------------------------------- ### Deploy TypesenseCluster on Azure AKS Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example of a TypesenseCluster manifest for Azure AKS. Specifies the image, replica count, and storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-azure spec: image: typesense/typesense:29.0 replicas: 3 storage: storageClassName: managed-csi ``` -------------------------------- ### Nodes List ConfigMap Content Structure Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Example structure of the data within the nodes list ConfigMap, showing FQDN and peering port for each node. ```yaml data: nodes: | ts-cluster-sts-0.ts-cluster-sts-svc.default.svc.cluster.local:8107 ts-cluster-sts-1.ts-cluster-sts-svc.default.svc.cluster.local:8107 ts-cluster-sts-2.ts-cluster-sts-svc.default.svc.cluster.local:8107 ``` -------------------------------- ### Deploy TypesenseCluster on AWS EKS Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example of a TypesenseCluster manifest for AWS EKS. Specifies the image, replica count, storage size, and storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-aws spec: image: typesense/typesense:29.0 replicas: 3 storage: size: 100Mi storageClassName: gp2 ``` -------------------------------- ### Get Metrics Exporter Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves default resource requests and limits for the metrics exporter. Use this when the metrics exporter resources are not explicitly configured. ```go func (s *TypesenseClusterSpec) GetMetricsExporterResources() corev1.ResourceRequirements ``` ```text Requests: CPU: 100m Memory: 32Mi Limits: CPU: 100m Memory: 64Mi ``` ```go spec := TypesenseClusterSpec{ Metrics: &MetricsExporterSpec{...}, } resources := spec.GetMetricsExporterResources() ``` -------------------------------- ### TypesenseCluster for Open Telekom Cloud CCE with SFS Turbo S3 Source: https://github.com/akyriako/typesense-operator/blob/main/README.md Example configuration for a TypesenseCluster on Open Telekom Cloud CCE with SFS Turbo S3 support. Note the different annotations for S3FS. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-otc-3 spec: image: typesense/typesense:30.0 replicas: 3 storage: storageClassName: csi-obs accessMode: ReadWriteMany annotations: everest.io/obs-volume-type: STANDARD csi.storage.k8s.io/fstype: s3fs volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner csi.storage.k8s.io/node-publish-secret-name: otc-aksk csi.storage.k8s.io/node-publish-secret-namespace: default everest.io/csi.volume-name-prefix: c-otc-3 ``` -------------------------------- ### Get Default Pod Security Context Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the default pod-level security context. This includes settings like RunAsUser, RunAsGroup, FSGroup, and RunAsNonRoot. ```go func (s *TypesenseClusterSpec) GetPodSecurityContext() *corev1.PodSecurityContext ``` ```go spec := TypesenseClusterSpec{} podSC := spec.GetPodSecurityContext() // Use for pod specification: // pod.Spec.SecurityContext = podSC ``` -------------------------------- ### Get Reverse Proxy Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves default resource requests and limits for the Nginx reverse proxy. Use this when the ingress.resources field is not explicitly set. ```go func (s *IngressSpec) GetReverseProxyResources() corev1.ResourceRequirements ``` ```text Requests: CPU: 100m Memory: 32Mi Limits: CPU: 150m Memory: 64Mi ``` ```go ingress := IngressSpec{...} resources := ingress.GetReverseProxyResources() // Use for reverse proxy container: // container.Resources = resources ``` -------------------------------- ### Get Topology Spread Constraints with Default Labels Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Applies default label selectors to topology spread constraints. If a constraint lacks a LabelSelector, the provided labels are applied. ```go func (s *TypesenseClusterSpec) GetTopologySpreadConstraints(labels map[string]string) []corev1.TopologySpreadConstraint ``` ```go spec := TypesenseClusterSpec{ TopologySpreadConstraints: []corev1.TopologySpreadConstraint{ { MaxSkew: 1, TopologyKey: "topology.kubernetes.io/zone", WhenUnsatisfiable: "DoNotSchedule", }, }, } labels := map[string]string{ "app.kubernetes.io/instance": "ts-cluster", } constraints := spec.GetTopologySpreadConstraints(labels) // Returned constraint now includes label selector ``` -------------------------------- ### Get Scraper Config Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Generates DocSearch scraper configuration JSON. It either returns user-provided configuration, generates it automatically based on `Name`, `Host`, and `Protocol`, or returns an empty string if neither is set. ```go func (s *DocSearchScraperSpec) GetScraperConfig() string ``` ```json { "index_name": "", "start_urls": ["https://"], "sitemap_urls": ["https:///sitemap.xml"], "sitemap_alternate_links": false, "stop_urls": ["/tests"], "selectors": { "lvl0": "nav.menu a.menu__link--active, .navbar__item.navbar__link--active", "lvl1": "article h1, header h1", "lvl2": "article h2", "lvl3": "article h3", "lvl4": "article h4", "lvl5": "article h5", "lvl6": "article h6", "text": "article p, article li, article td" }, "strip_chars": " .,;:#", "custom_settings": { "separatorsToIndex": "_", "attributesForFaceting": ["language", "version", "type", "docusaurus_tag"], "attributesToRetrieve": ["hierarchy", "content", "anchor", "url", "url_without_anchor", "type"] } } ``` ```go // Automatic configuration from host scraper := DocSearchScraperSpec{ Name: "api-docs", Host: stringPtr("api.example.com"), Protocol: "https", } config := scraper.GetScraperConfig() // config contains auto-generated JSON // Manual configuration scraperManual := DocSearchScraperSpec{ Name: "custom-docs", Config: stringPtr(`{...custom JSON...}`), } customConfig := scraperManual.GetScraperConfig() // customConfig returns the provided JSON ``` -------------------------------- ### Deploy TypesenseCluster on Open Telekom Cloud CCE Source: https://github.com/akyriako/typesense-operator/blob/main/charts/typesense-operator/README.md Example of a TypesenseCluster manifest for Open Telekom Cloud CCE. Specifies the image, replica count, and storage class. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: labels: app.kubernetes.io/name: typesense-operator app.kubernetes.io/managed-by: kustomize name: ts-cce spec: image: typesense/typesense:29.0 replicas: 3 storage: storageClassName: csi-disk ``` -------------------------------- ### Three Node Cluster Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Specifies the recommended minimum configuration for production clusters with three replicas. This setup allows for one node failure while maintaining quorum. ```yaml spec: replicas: 3 ``` -------------------------------- ### Create a Basic Typesense Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/typesense-cluster-crd.md Apply a TypesenseCluster manifest to create a new cluster. Ensure the image, replica count, and storage configurations are set according to your needs. ```bash kubectl apply -f - < -n -o json | \ jq '.status.conditions[] | select(.type=="Ready")' ``` -------------------------------- ### Resource Constants Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/COMPLETION_REPORT.txt Lists and explains the resource naming patterns used by the Typesense Operator for various Kubernetes resources. ```APIDOC ## Resource Constants ### Description This section outlines the various resource naming patterns and conventions used by the Typesense Operator for Kubernetes resources it manages. ### Naming Patterns - 15+ resource naming patterns documented. - Covers names for ConfigMap, Secret, Service, StatefulSet, Ingress, reverse proxy, and Gateway API resources. - Includes naming for metrics, monitoring, and CronJobs. - Details owner references and labels. - Mentions resource discovery commands. ``` -------------------------------- ### Get Health Check Sidecar Specs Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Returns the default health check sidecar configuration. Use this when the `spec.healthcheck` is not explicitly set. ```go func (s *TypesenseClusterSpec) GetHealthCheckSidecarSpecs() HealthCheckSpec ``` ```go spec := TypesenseClusterSpec{} healthCheck := spec.GetHealthCheckSidecarSpecs() // Returns default health check configuration ``` -------------------------------- ### List ConfigMaps in Namespace Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to list ConfigMaps in a specific namespace, useful for diagnosing ConfigMap creation failures. ```bash kubectl get configmaps -n ``` -------------------------------- ### Define Security Context Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/types.md Configure pod and container security contexts for the Typesense cluster. This includes settings for the pod itself, the Typesense container, and its sidecars. ```go type SecurityContextSpec struct { PodSecurityContext *corev1.PodSecurityContext TypesenseSecurityContext *corev1.SecurityContext HealthcheckSecurityContext *corev1.SecurityContext MetricsSecurityContext *corev1.SecurityContext } ``` -------------------------------- ### Describe StatefulSet Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to describe a StatefulSet, providing details for troubleshooting resource requests and other StatefulSet-specific issues. ```bash kubectl describe statefulset -sts -n ``` -------------------------------- ### Check Gateway API CRDs Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to verify if Gateway API Custom Resource Definitions (CRDs) are installed, required for HttpRoute creation. ```bash kubectl get crd | grep gateway ``` -------------------------------- ### Scale Typesense Cluster Replicas Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/INDEX.md Patch a TypesenseCluster resource to change the number of replicas. Monitor the scaling process using kubectl get. ```bash kubectl patch typesensecluster --type merge -p '{"spec":{"replicas":5}}' ``` ```bash kubectl get typesensecluster -w ``` -------------------------------- ### Monitor Services Not Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Condition to monitor for Service creation failures, indicating services are not ready. ```json status.conditions[?(@.type=="Ready")].reason == "ServicesNotReady" ``` -------------------------------- ### Get Health Check Sidecar Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Returns the default resource requests and limits for the health check sidecar. Use this when resources are not explicitly configured. ```go func (s *TypesenseClusterSpec) GetHealthCheckSidecarResources() corev1.ResourceRequirements ``` ```go spec := TypesenseClusterSpec{ HealthCheck: &HealthCheckSpec{...}, } resources := spec.GetHealthCheckSidecarResources() ``` -------------------------------- ### Verify Service Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Inspect the configuration of the Kubernetes Service for the Typesense cluster. This helps in verifying network accessibility and port configurations. ```bash kubectl get svc -svc -n ``` -------------------------------- ### Discover All Resources for a Typesense Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/resource-constants.md Use these kubectl commands to find various Kubernetes resources associated with a specific Typesense cluster by its instance label. Replace `` and `` with your cluster's details. ```bash # By label kubectl get all -l app.kubernetes.io/instance= -n ``` ```bash # Secrets kubectl get secrets -l app.kubernetes.io/instance= -n ``` ```bash # ConfigMaps kubectl get configmaps -l app.kubernetes.io/instance= -n ``` ```bash # StatefulSet and pods kubectl get statefulset -sts -n kubectl get pods -l app=-sts -n ``` ```bash # Services kubectl get svc -l app.kubernetes.io/instance= -n ``` ```bash # Ingress kubectl get ingress -l app.kubernetes.io/instance= -n ``` ```bash # Monitoring kubectl get podmonitors -l app.kubernetes.io/instance= -n ``` ```bash # Scrapers kubectl get cronjobs -l app.kubernetes.io/instance= -n ``` -------------------------------- ### Initialize Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/controller-reconciliation.md Initializes the 'Ready' condition on a TypesenseCluster resource during its first reconciliation. ```go func (r *TypesenseClusterReconciler) initConditions(ctx context.Context, ts *tsv1alpha1.TypesenseCluster) error ``` -------------------------------- ### Get Default Storage Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the default storage configuration for a Typesense cluster. This is used when no specific storage configuration is provided in the cluster spec. ```go func (s *TypesenseClusterSpec) GetStorage() StorageSpec ``` ```go spec := TypesenseClusterSpec{} storage := spec.GetStorage() // Returns default StorageSpec ``` -------------------------------- ### Describe Namespace for Quotas Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to check namespace quotas, which can cause ConfigMap creation failures. ```bash kubectl describe namespace ``` -------------------------------- ### Get Current Phase of a Typesense Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Retrieve the current operational phase of the Typesense cluster. This provides a quick overview of the cluster's state. ```bash kubectl get typesensecluster -n -o jsonpath='{.status.phase}' ``` -------------------------------- ### Initialize Conditions Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/controller-reconciliation.md Initializes status conditions on the first reconciliation. Sets the 'Ready' condition to 'Unknown' with the reason 'ReconciliationInProgress'. ```go err := r.initConditions(ctx, &ts) ``` -------------------------------- ### Describe Service Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to describe a specific Kubernetes Service, useful for troubleshooting Service creation issues. ```bash kubectl describe svc -svc -n ``` -------------------------------- ### Get Metrics Container Security Context Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the container-level security context for the metrics exporter container. Returns the configured context if available, otherwise nil. ```go func (s *TypesenseClusterSpec) GetMetricsSecurityContext() *corev1.SecurityContext ``` ```go containerSC := spec.GetMetricsSecurityContext() // Use for metrics exporter container in deployment ``` -------------------------------- ### Typesense Cluster with Metrics and Security Context Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/README.md Deploy a Typesense cluster with integrated metrics collection and specific security contexts for pods. This includes defining the metrics release and interval, as well as pod security settings like runAsUser and fsGroup. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: name: ts-secure spec: image: typesense/typesense:26.0 storage: storageClassName: standard metrics: release: promstack interval: 15 securityContext: pod: runAsUser: 1000 fsGroup: 2000 runAsNonRoot: true ``` -------------------------------- ### Get Healthcheck Container Security Context Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the container-level security context for the health check sidecar. Returns the configured context if available, otherwise nil. ```go func (s *TypesenseClusterSpec) GetHealthcheckSecurityContext() *corev1.SecurityContext ``` ```go containerSC := spec.GetHealthcheckSecurityContext() // Use for health check container in pod spec ``` -------------------------------- ### Describe Node Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Command to describe a Kubernetes node, useful for verifying image accessibility and resource availability for StatefulSet pods. ```bash kubectl describe node ``` -------------------------------- ### Get Typesense Container Security Context Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Retrieves the container-level security context specifically for the Typesense container. It returns the configured context if set, otherwise nil. ```go func (s *TypesenseClusterSpec) GetTypesenseSecurityContext() *corev1.SecurityContext ``` ```go spec := TypesenseClusterSpec{ SecurityContext: &SecurityContextSpec{ TypesenseSecurityContext: &corev1.SecurityContext{ AllowPrivilegeEscalation: boolPtr(false), ReadOnlyRootFilesystem: boolPtr(true), }, }, } containerSC := spec.GetTypesenseSecurityContext() ``` -------------------------------- ### Describe PVC for Pending Issues Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Get detailed information and events related to a Persistent Volume Claim (PVC). This is crucial for diagnosing why a PVC might not be binding. ```bash kubectl describe pvc -n ``` -------------------------------- ### View All Conditions of a Typesense Cluster Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Use this command to inspect all current conditions of a Typesense cluster. This helps in understanding the overall health and status of the cluster. ```bash kubectl get typesensecluster -n -o json | jq '.status.conditions' ``` -------------------------------- ### Verify Node Resources with kubectl Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Monitor node and pod resource utilization (CPU, memory) to identify potential causes of quorum loss due to resource exhaustion. ```bash kubectl top nodes ``` ```bash kubectl top pods -n ``` -------------------------------- ### Examine Nodes List ConfigMap Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Fetches the 'nodes' data from the cluster's ConfigMap, formatted as JSON. This is used to verify that all expected nodes are correctly listed with their Fully Qualified Domain Names (FQDNs). ```bash kubectl get cm -nodeslist -n -o jsonpath='{.data.nodes}' ``` -------------------------------- ### Get Scraper Auth Configuration Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/helper-methods.md Converts a reference to a scraper authentication secret into an environment source. Returns a slice with a single SecretEnvSource if `authConfiguration` is set, otherwise returns an empty slice. ```go func (s *DocSearchScraperSpec) GetScraperAuthConfiguration() []corev1.EnvFromSource ``` ```go scraper := DocSearchScraperSpec{ Name: "docs", AuthConfiguration: &corev1.LocalObjectReference{ Name: "scraper-auth", }, } envSource := scraper.GetScraperAuthConfiguration() // Use for CronJob pod spec: // job.Spec.Template.Spec.Containers[0].EnvFrom = envSource ``` -------------------------------- ### Check Cluster Resources Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md List all Kubernetes resources associated with a specific Typesense cluster instance. This helps in verifying that all components are running. ```bash kubectl get all -n -l app.kubernetes.io/instance= ``` -------------------------------- ### Monitor Typesense Cluster Status Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/typesense-cluster-crd.md Use kubectl commands to monitor the status and details of your Typesense cluster. Watch for real-time updates, get detailed descriptions, or view the status in JSON format. ```bash # Watch status updates kubectl get typesensecluster my-cluster -w ``` ```bash # Get full details kubectl describe typesensecluster my-cluster ``` ```bash # View JSON status kubectl get typesensecluster my-cluster -o json | jq '.status' ``` -------------------------------- ### Reconcile Ingress Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/controller-reconciliation.md Creates or updates the Ingress for HTTP reverse proxy access. This involves managing the Ingress resource, reverse proxy ConfigMap, and reverse proxy Deployment. The Deployment is updated if the image changes, and the ConfigMap is recreated. Failure results in the 'IngressNotReady' reason. ```go err = r.ReconcileIngress(ctx, &ts) ``` -------------------------------- ### Typesense Cluster with Metrics and Scraper Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/typesense-cluster-crd.md Set up a Typesense cluster with Prometheus metrics collection and a health check scraper. This configuration includes custom labels, replica count, storage, metrics interval, healthcheck image, and a scraper for indexing documentation. ```yaml apiVersion: ts.opentelekomcloud.com/v1alpha1 kind: TypesenseCluster metadata: name: ts-cluster labels: app: search-engine spec: image: typesense/typesense:26.0 replicas: 3 storage: size: 50Gi storageClassName: csi-disk metrics: release: promstack interval: 30 healthcheck: image: quay.io/akyriako/typesense-healthcheck:0.2.0 scrapers: - name: docs-index protocol: https host: docs.example.com schedule: "0 2 * * *" service: type: LoadBalancer ``` -------------------------------- ### Monitor Ingress Not Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Condition to monitor for Ingress creation failures, indicating the Ingress resource is not ready. ```json status.conditions[?(@.type=="Ready")].reason == "IngressNotReady" ``` -------------------------------- ### Health Check Sidecar Pod Definition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/api-reference/quorum-health.md Example Kubernetes Pod definition showing the inclusion of a health check sidecar container alongside the main Typesense server container. The sidecar is configured with a specific image. ```yaml apiVersion: v1 kind: Pod metadata: name: ts-cluster-sts-0 spec: containers: - name: typesense # Typesense server - name: healthcheck image: quay.io/akyriako/typesense-healthcheck:0.2.0 # Monitors cluster health ``` -------------------------------- ### Monitor StatefulSet Not Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Condition to monitor for StatefulSet creation failures, indicating the StatefulSet is not ready. ```json status.conditions[?(@.type=="Ready")].reason == "StatefulSetNotReady" ``` -------------------------------- ### Check Persistent Volumes with kubectl Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Verify the status and details of Persistent Volumes (PV) and Persistent Volume Claims (PVC) to troubleshoot storage-related quorum issues. ```bash kubectl get pv ``` ```bash kubectl get pvc -n ``` ```bash kubectl describe pvc -sts-0 -n ``` -------------------------------- ### Monitor HttpRoute Not Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Condition to monitor for HttpRoute creation failures, indicating the HttpRoute is not ready. ```json status.conditions[?(@.type=="Ready")].reason == "HttpRouteNotReady" ``` -------------------------------- ### Enable ReferenceGrant for Cross-Namespace Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Configuration option to enable ReferenceGrant when HttpRoutes need to reference resources in different namespaces. ```yaml spec.httpRoutes[].referenceGrant: true ``` -------------------------------- ### Check Metrics Exporter Deployment Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Inspect the Prometheus metrics exporter Deployment and its logs to troubleshoot issues with metrics collection. Verify accessibility of the Typesense API and configuration details. ```bash kubectl get deployment -prometheus-exporter -n ``` ```bash kubectl logs -n -l app=-prometheus-exporter ``` -------------------------------- ### Monitor ConfigMap Not Ready Condition Source: https://github.com/akyriako/typesense-operator/blob/main/_autodocs/errors.md Condition to monitor for ConfigMap creation failures, indicating the ConfigMap is not ready. ```json status.conditions[?(@.type=="Ready")].reason == "ConfigMapNotReady" ```