Skip to content

Commit

Permalink
[development] Add more services to example helmfile (#3966)
Browse files Browse the repository at this point in the history
This PR makes the following changes:

- Adds the following optional services to the example helmfile:
  - Kafka/Zookeeper
  - Elasticsearch 6 and 7
  - Opensearch 1
  - Choas-mesh
    - This will be a useful networking test tool for development
    - https://chaos-mesh.org/
- Adds the ability for the user to set the `nodePort` on all `es` and
`os` services within the helmfile instead of just opensearch2.
- Updated helm example docs
- Add the ability to create a custom teraslice kind cluster with
configurable services

---------

Co-authored-by: Peter Luitjens <43619525+busma13@users.noreply.github.com>
  • Loading branch information
sotojn and busma13 authored Feb 13, 2025
1 parent e8fe618 commit b76ab48
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ images/*
# helm generated files
helm/helm-repo-site/index.html
helm/helm-repo-site/*.tgz

# examples directory
examples/helm/custom.yaml
2 changes: 1 addition & 1 deletion e2e/helm/templates/es6.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ volumeClaimTemplate:

service:
type: NodePort
nodePort: "30200"
nodePort: {{ .Values | get "elasticsearch6.nodePort" "30200" }}
2 changes: 1 addition & 1 deletion e2e/helm/templates/os1.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image:
service:
type: NodePort
port: 9200
nodePort: 30210
nodePort: {{ .Values | get "opensearch1.nodePort" "30210" }}

config:
opensearch.yml:
Expand Down
2 changes: 1 addition & 1 deletion e2e/helm/templates/os2.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image:
service:
type: NodePort
port: 9200
nodePort: 30210
nodePort: {{ .Values | get "opensearch2.nodePort" "30210" }}

config:
opensearch.yml:
Expand Down
22 changes: 19 additions & 3 deletions examples/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ kind create cluster --config kindConfig.yaml

### Step 2: Building the Teraslice Docker Image

Build the teraslice docker image using the following command. Ensure the image is tagged correctly to match the intended version `dev-nodev22.9.0` in this example:
Build the teraslice docker image using the following command:

```bash
docker build -t ghcr.io/terascope/teraslice:dev-nodev22.9.0 ../../.
docker build -t terascope/teraslice:dev ../../.
```

### Step 3: Loading the Teraslice Docker Image into the Kind Cluster

Load the Teraslice Docker image, built above, into the Kind cluster's control plane:

```bash
kind load docker-image --name k8s-env ghcr.io/terascope/teraslice:dev-nodev22.9.0
kind load docker-image --name k8s-env terascope/teraslice:dev
```

### Step 4: Verifying the Image Load
Expand Down Expand Up @@ -133,3 +133,19 @@ teraslice__jobs open 1 0 5.6kb
random-data-1 open 10000 0 7mb 7mb
teraslice__analytics-2024.11 open 4 0 23.9kb 23.9kb
```

## Advanced Setup

In the cases where a specific scenario is required, you can use a custom configuration file to deploy teraslice in a variety of ways. We can create a custom yaml file template based on the default config by running this command:

_**IMPORTANT:** in order to run the custom scenario correctly, the file MUST be named `custom.yaml` and be in the `teraslice/examples/helm` directory._

```sh
cp values.yaml custom.yaml
```

Once copied, modify the `custom.yaml` file to specific needs. All available options are already provided in the file. Afterwards you can launch it with the following command:

```sh
helmfile -e custom sync
```
10 changes: 0 additions & 10 deletions examples/helm/default-values.yaml

This file was deleted.

96 changes: 68 additions & 28 deletions examples/helm/helmfile.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,89 @@
environments:
default:
values:
- default-values.yaml
- values.yaml
custom:
values:
- custom.yaml
---

repositories:
- name: opensearch
url: https://opensearch-project.github.io/helm-charts/
- name: minio
url: https://charts.min.io/
- name: chaos-mesh
url: https://charts.chaos-mesh.org

helmDefaults:
wait: true

releases:
- name: opensearch1
namespace: ts-dev1
namespace: services-dev1
chart: opensearch/opensearch
version: 2.17.1
installed: {{ .Values | get "opensearch1.enabled" false }}
values:
- ../../e2e/helm/templates/os1.yaml.gotmpl

- name: chaos-mesh
namespace: chaos-mesh
chart: chaos-mesh/chaos-mesh
version: 2.7.0
installed: {{ .Values | get "chaos-mesh.enabled" false }}
values:
- chaosDaemon:
runtime: containerd
socketPath: /run/containerd/containerd.sock
dashboard:
service:
type: NodePort
nodePort: 30333

- name: opensearch2
namespace: services-dev1
chart: opensearch/opensearch
version: 2.17.1
installed: {{ .Values | get "opensearch2.enabled" true }}
values:
- ./templates/os1.yaml.gotmpl
- ../../e2e/helm/templates/os2.yaml.gotmpl

- name: elasticsearch6
namespace: services-dev1
chart: ../../e2e/helm/elasticsearch/elasticsearch-6.8.9.tgz
installed: {{ .Values | get "elasticsearch6.enabled" false }}
values:
- ../../e2e/helm/templates/es6.yaml.gotmpl

- name: elasticsearch7
namespace: services-dev1
chart: ../../e2e/helm/elasticsearch/elasticsearch-7.9.3.tgz
installed: {{ .Values | get "elasticsearch7.enabled" false }}
values:
- ../../e2e/helm/templates/es7.yaml.gotmpl

- name: minio
namespace: services-dev1
chart: minio/minio
version: 5.3.0
installed: {{ .Values | get "minio.enabled" false }}
values:
- ../../e2e/helm/templates/minio.yaml.gotmpl

- name: kafka
namespace: services-dev1
chart: ../../e2e/helm/kafka/cp-helm-charts-0.6.1.tgz
installed: {{ .Values | get "kafka.enabled" false }}
values:
- ../../e2e/helm/templates/kafka.yaml.gotmpl

- name: teraslice
namespace: ts-dev1
version: 0.8.12
chart: ../../helm/teraslice/
chart: ../../helm/teraslice
needs:
- ts-dev1/{{ .Values | get "ts-dev1.stateCluster" "opensearch1" }}
values:
- terafoundation:
connectors:
elasticsearch-next:
default:
node:
- "http://opensearch1.ts-dev1:9200"
service:
nodePort: 30678
type: NodePort
master:
teraslice:
kubernetes_namespace: ts-dev1
cluster_manager_type: kubernetesV2
asset_storage_connection_type: elasticsearch-next
worker:
teraslice:
kubernetes_namespace: ts-dev1
cluster_manager_type: kubernetesV2
asset_storage_connection_type: elasticsearch-next
image:
tag: dev-nodev22.9.0
- services-dev1/{{ .Values | get "teraslice.stateCluster" "opensearch2" }}
values:
- ../../e2e/helm/templates/teraslice.yaml.gotmpl
labels:
app: teraslice
34 changes: 32 additions & 2 deletions examples/helm/kindConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,38 @@ name: k8s-env
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.28.12@sha256:fa0e48b1e83bb8688a5724aa7eebffbd6337abd7909ad089a2700bf08c30c6ea
extraPortMappings:
- containerPort: 30678 # Map internal teraslice api service to host port
- containerPort: 30678 # Map internal teraslice service to host port
hostPort: 5678
- containerPort: 30921 # Map internal opensearch1 service to host port
- containerPort: 30201 # Map internal opensearch1 service to host port
hostPort: 9201
- containerPort: 30202 # Map internal opensearch2 service to host port
hostPort: 9200
- containerPort: 30206 # Map internal elasticsearch6 service to host port
hostPort: 9206
- containerPort: 30207 # Map internal elasticsearch7 service to host port
hostPort: 9207
- containerPort: 30092 # Map internal kafka service to host port
hostPort: 9092
- containerPort: 30094 # Map external kafka service to host port
hostPort: 9094
- containerPort: 30900 # Map internal minio service to host port
hostPort: 9000
- containerPort: 30901 # Map internal minio-ui service to host port
hostPort: 9001
- containerPort: 30333 # Map internal chaos-mesh-ui service to host port
hostPort: 2333
extraMounts:
- hostPath: ./e2e/autoload
containerPath: /autoload

###
# Uncomment the code below for a multi-node kind cluster
# For more than 2 nodes, just copy it and paste it again to add nodes
###
# - role: worker
# image: kindest/node:v1.28.12@sha256:fa0e48b1e83bb8688a5724aa7eebffbd6337abd7909ad089a2700bf08c30c6ea
# extraMounts:
# - hostPath: ./e2e/autoload
# containerPath: /autoload
36 changes: 0 additions & 36 deletions examples/helm/templates/os1.yaml.gotmpl

This file was deleted.

93 changes: 93 additions & 0 deletions examples/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
opensearch1:
# If false, opensearch1 will be excluded on helmfile sync
enabled: false
version: 1.3.11
esJavaOpts: -Xmx512M -Xms512M
memoryLimit: 100Mi
persistentVolumeSize: 8Gi
# The number of replicas
instances: 1
nodePort: 30201

opensearch2:
# If false, opensearch2 will be excluded on helmfile sync
enabled: true
version: 2.15.0
esJavaOpts: -Xmx512M -Xms512M
memoryLimit: 100Mi
persistentVolumeSize: 8Gi
# The number of replicas
instances: 1
nodePort: 30202

elasticsearch6:
# If false, elasticsearch6 will be excluded on helmfile sync
enabled: false
version: 6.8.6
# Overrides default image. Useful when loading in arm image that es doesn't support
# image: elasticsearch
# The number of replicas
instances: 1
esJavaOpts: -Xms512m -Xmx512m
memoryLimit: 1Gi
persistentVolumeSize: 8Gi
nodePort: 30206


elasticsearch7:
# If false, elasticsearch7 will be excluded on helmfile sync
enabled: false
# It's not recommended to deviate from es versions 7.9. The chart is tied to this specific version.
version: 7.9.3
# The number of replicas
instances: 1
esJavaOpts: -Xms512m -Xmx512m
# Es7 recommends at least a gig of memory.
memoryLimit: 1Gi
persistentVolumeSize: 8Gi
nodePort: 30207

minio:
# If false, minio will be excluded on helmfile sync
enabled: false
version: RELEASE.2024-08-29T01-40-52Z
instances: 1
rootUser: minioadmin
rootPassword: minioadmin
memoryLimit: 256Mi
persistentVolumeSize: 50Gi
# tls: <-- Not implemented yet
# enabled: false
# certSecret: ""
# publicCrt: public.crt
# privateKey: private.key

kafka:
# If false, kafka will be excluded on helmfile sync
enabled: false
version: 7.7.1
brokers: 1
offsets:
topic:
replication:
factor: 1

zookeeper:
# If false, zookeeper will be excluded on helmfile sync
enabled: false
version: 7.7.1
instances: 1

teraslice:
image:
repository: terascope/teraslice
# Overrides the image tag whose default is the chart appVersion.
tag: dev
stateCluster: opensearch2

chaos-mesh:
# When enabled, the choas-mesh dashboard will be available in browser
# at http://localhost:2333
# Documentation on how to create "experiments":
# https://chaos-mesh.org/docs/run-a-chaos-experiment/
enabled: false

0 comments on commit b76ab48

Please sign in to comment.