Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
Signed-off-by: Ashraful Haque Tani <[email protected]>
  • Loading branch information
AshrafulHaqueToni committed Oct 22, 2024
1 parent fc98e51 commit 928e294
Show file tree
Hide file tree
Showing 22 changed files with 268 additions and 15 deletions.
1 change: 0 additions & 1 deletion docs/guides/singlestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ SingleStore, a distributed SQL database for real-time analytics, transactional w

KubeDB supports the following SingleSore Versions.
- `8.1.32`
- `8.5.7`
- `8.5.30`
- `8.7.10`

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/singlestore/autoscaler/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: sdb-auto-scaling
name: Autoscaling
parent: guides-singlestore
weight: 47
weight: 46
menu_name: docs_{{ .version }}
---
2 changes: 1 addition & 1 deletion docs/guides/singlestore/autoscaler/compute/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: SingleStore Compute Autoscaling Overview
menu:
docs_{{ .version }}:
identifier: sdb-auto-scaling-cluster
name: Cluster
name: SingleStore Compute
parent: sdb-compute-auto-scaling
weight: 20
menu_name: docs_{{ .version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/singlestore/autoscaler/storage/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: SingleStore Cluster Autoscaling
menu:
docs_{{ .version }}:
identifier: sdb-storage-auto-scaling-cluster
name: Cluster
name: SingleStore Storage
parent: sdb-storage-auto-scaling
weight: 20
menu_name: docs_{{ .version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/singlestore/backup/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-backup
name: Backup & Restore
parent: guides-singlestore
weight: 70
weight: 40
menu_name: docs_{{ .version }}
---
2 changes: 1 addition & 1 deletion docs/guides/singlestore/clustering/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: sdb-clustering
name: Clustering
parent: guides-singlestore
weight: 30
weight: 25
menu_name: docs_{{ .version }}
---
2 changes: 1 addition & 1 deletion docs/guides/singlestore/configuration/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-configuration
name: Custom Configuration
parent: guides-singlestore
weight: 80
weight: 30
menu_name: docs_{{ .version }}
---
197 changes: 197 additions & 0 deletions docs/guides/singlestore/configuration/podtemplating/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
---
title: Run SingleStore with Custom PodTemplate
menu:
docs_{{ .version }}:
identifier: guides-sdb-configuration-using-podtemplate
name: Customize PodTemplate
parent: guides-sdb-configuration
weight: 15
menu_name: docs_{{ .version }}
section_menu_id: guides
---

> New to KubeDB? Please start [here](/docs/README.md).
# Run SingleStore with Custom PodTemplate

KubeDB supports providing custom configuration for SingleStore via [PodTemplate](/docs/guides/singlestore/concepts/singlestore.md#spec.topology). This tutorial will show you how to use KubeDB to run a SingleStore database with custom configuration using PodTemplate.

## Before You Begin

- At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/).

- Now, install KubeDB cli on your workstation and KubeDB operator in your cluster following the steps [here](/docs/setup/README.md).

- To keep things isolated, this tutorial uses a separate namespace called `demo` throughout this tutorial.

```bash
$ kubectl create ns demo
namespace/demo created
```

> Note: YAML files used in this tutorial are stored in [docs/guides/singlestore/configuration/podtemplating/yamls](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/guides/singlestore/configuration/podtemplating/yamls) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs).
## Overview

KubeDB allows providing a template for `leaf` and `aggregator` pod through `spec.topology.aggregator.podTemplate` and `spec.topology.leaf.podTemplate`. KubeDB operator will pass the information provided in `spec.topology.aggregator.podTemplate` and `spec.topology.leaf.podTemplate` to the `aggregator` and `leaf` PetSet created for SingleStore database.

KubeDB accept following fields to set in `podTemplate:`

- metadata:
- annotations (pod's annotation)
- controller:
- annotations (petset's annotation)
- spec:
- env
- resources
- initContainers
- imagePullSecrets
- nodeSelector
- affinity
- schedulerName
- tolerations
- priorityClassName
- priority
- securityContext

Read about the fields in details in [PodTemplate concept](/docs/guides/mysql/concepts/database/index.md#specpodtemplate),

## CRD Configuration

Below is the YAML for the SingleStore created in this example. Here, [`spec.topology.aggregator/leaf.podTemplate.spec.args`](/docs/guides/mysql/concepts/database/index.md#specpodtemplatespecargs) provides extra arguments.

```yaml
apiVersion: kubedb.com/v1alpha2
kind: Singlestore
metadata:
name: sdb-misc-config
namespace: demo
spec:
version: "8.7.10"
topology:
aggregator:
replicas: 1
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
args:
- --character-set-server=utf8mb4
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
leaf:
replicas: 2
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
args:
- --character-set-server=utf8mb4
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
licenseSecret:
name: license-secret
storageType: Durable
deletionPolicy: WipeOut
```
```bash
$ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/singlestore/configuration/podtemplating/yamls/sdb-misc-config.yaml
singlestore.kubedb.com/sdb-misc-config created
```

Now, wait a few minutes. KubeDB operator will create necessary PVC, petset, services, secret etc. If everything goes well, we will see that a pod with the name `sdb-misc-config-aggregator-0` has been created.

Check that the petset's pod is running

```bash
$ kubectl get pod -n demo
NAME READY STATUS RESTARTS AGE
sdb-misc-config-aggregator-0 2/2 Running 0 4m51s
sdb-misc-config-leaf-0 2/2 Running 0 4m48s
sdb-misc-config-leaf-1 2/2 Running 0 4m30s
```

Now, we will check if the database has started with the custom configuration we have provided.

```bash
$ kubectl exec -it -n demo sdb-misc-config-aggregator-0 -- bash
Defaulted container "singlestore" out of: singlestore, singlestore-coordinator, singlestore-init (init)
[memsql@sdb-misc-config-aggregator-0 /]$ memsql -uroot -p$ROOT_PASSWORD
singlestore-client: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 311
Server version: 5.7.32 SingleStoreDB source distribution (compatible; MySQL Enterprise & MySQL Commercial)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

singlestore> SHOW VARIABLES LIKE 'char%';
+--------------------------+------------------------------------------------------+
| Variable_name | Value |
+--------------------------+------------------------------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /opt/memsql-server-8.7.10-95e2357384/share/charsets/ |
+--------------------------+------------------------------------------------------+
8 rows in set (0.00 sec)

singlestore> exit
Bye

```

Here we can see the character_set_server value is utf8mb4.

## Cleaning up

To cleanup the Kubernetes resources created by this tutorial, run:

```bash
kubectl delete singlestore -n demo sdb-misc-config

kubectl delete ns demo
```

If you would like to uninstall KubeDB operator, please follow the steps [here](/docs/setup/README.md).

## Next Steps

- [Quickstart SingleStore](/docs/guides/singlestore/quickstart/quickstart.md) with KubeDB Operator.
- Initialize [SingleStore with Script](/docs/guides/singlestore/initialization).
- Detail concepts of [SingleStore object](/docs/guides/singlestore/concepts/singlestore.md).
- Want to hack on KubeDB? Check our [contribution guidelines](/docs/CONTRIBUTING.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: kubedb.com/v1alpha2
kind: Singlestore
metadata:
name: sdb-misc-config
namespace: demo
spec:
version: "8.7.10"
topology:
aggregator:
replicas: 1
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
args:
- --character-set-server=utf8mb4
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
leaf:
replicas: 2
podTemplate:
spec:
containers:
- name: singlestore
resources:
limits:
memory: "2Gi"
cpu: "600m"
requests:
memory: "2Gi"
cpu: "600m"
args:
- --character-set-server=utf8mb4
storage:
storageClassName: "standard"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
licenseSecret:
name: license-secret
storageType: Durable
deletionPolicy: WipeOut

2 changes: 1 addition & 1 deletion docs/guides/singlestore/initialization/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-initialization
name: Initialization
parent: guides-singlestore
weight: 80
weight: 41
menu_name: docs_{{ .version }}
---
2 changes: 1 addition & 1 deletion docs/guides/singlestore/monitoring/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-monitoring
name: Monitoring
parent: guides-singlestore
weight: 120
weight: 50
menu_name: docs_{{ .version }}
---
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Reconfigure SingleStore Configuration
menu:
docs_{{ .version }}:
identifier: guides-sdb-reconfigure-reconfigure-steps
name: Cluster
name: Reconfigure OpsRequest
parent: guides-sdb-reconfigure
weight: 20
menu_name: docs_{{ .version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Horizontal Scaling SingleStore
menu:
docs_{{ .version }}:
identifier: guides-sdb-scaling-horizontal-cluster
name: Cluster
name: Horizontal Scaling OpsRequest
parent: guides-sdb-scaling-horizontal
weight: 20
menu_name: docs_{{ .version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Vertical Scaling SingleStore Cluster
menu:
docs_{{ .version }}:
identifier: guides-sdb-scaling-vertical-cluster
name: Cluster
name: Vertical Scaling OpsRequest
parent: guides-sdb-scaling-vertical
weight: 30
menu_name: docs_{{ .version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/singlestore/tls/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-tls
name: TLS/SSL Encryption
parent: guides-singlestore
weight: 110
weight: 45
menu_name: docs_{{ .version }}
---
2 changes: 1 addition & 1 deletion docs/guides/singlestore/update-version/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
identifier: guides-sdb-updating
name: UpdateVersion
parent: guides-singlestore
weight: 45
weight: 42
menu_name: docs_{{ .version }}
---
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Updating SingleStore Cluster
menu:
docs_{{ .version }}:
identifier: guides-sdb-updating-cluster
name: Cluster
name: Update Version OpsRequest
parent: guides-sdb-updating
weight: 30
menu_name: docs_{{ .version }}
Expand Down

0 comments on commit 928e294

Please sign in to comment.