diff --git a/.gitignore b/.gitignore index dc4eb223377..22ab7a03b45 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/e2e/helm/templates/es6.yaml.gotmpl b/e2e/helm/templates/es6.yaml.gotmpl index 897888df768..fb09251e9e7 100644 --- a/e2e/helm/templates/es6.yaml.gotmpl +++ b/e2e/helm/templates/es6.yaml.gotmpl @@ -28,4 +28,4 @@ volumeClaimTemplate: service: type: NodePort - nodePort: "30200" + nodePort: {{ .Values | get "elasticsearch6.nodePort" "30200" }} diff --git a/e2e/helm/templates/os1.yaml.gotmpl b/e2e/helm/templates/os1.yaml.gotmpl index 91132be24e3..9e7bcf79a07 100644 --- a/e2e/helm/templates/os1.yaml.gotmpl +++ b/e2e/helm/templates/os1.yaml.gotmpl @@ -12,7 +12,7 @@ image: service: type: NodePort port: 9200 - nodePort: 30210 + nodePort: {{ .Values | get "opensearch1.nodePort" "30210" }} config: opensearch.yml: diff --git a/e2e/helm/templates/os2.yaml.gotmpl b/e2e/helm/templates/os2.yaml.gotmpl index a7762b90719..04e306ab399 100644 --- a/e2e/helm/templates/os2.yaml.gotmpl +++ b/e2e/helm/templates/os2.yaml.gotmpl @@ -12,7 +12,7 @@ image: service: type: NodePort port: 9200 - nodePort: 30210 + nodePort: {{ .Values | get "opensearch2.nodePort" "30210" }} config: opensearch.yml: diff --git a/examples/helm/README.md b/examples/helm/README.md index bbdb56714cd..fa4dee3d238 100644 --- a/examples/helm/README.md +++ b/examples/helm/README.md @@ -36,10 +36,10 @@ 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 @@ -47,7 +47,7 @@ docker build -t ghcr.io/terascope/teraslice:dev-nodev22.9.0 ../../. 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 @@ -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 +``` diff --git a/examples/helm/default-values.yaml b/examples/helm/default-values.yaml deleted file mode 100644 index fc35c960587..00000000000 --- a/examples/helm/default-values.yaml +++ /dev/null @@ -1,10 +0,0 @@ -opensearch1: - # If false, opensearch1 will be excluded on helmfile sync - enabled: true - version: 1.3.14 - esJavaOpts: -Xmx512M -Xms512M - memoryLimit: 100Mi - persistentVolumeSize: 8Gi - # The number of replicas - instances: 1 - diff --git a/examples/helm/helmfile.yaml b/examples/helm/helmfile.yaml index a9d85ad35d8..9cc01a15a82 100644 --- a/examples/helm/helmfile.yaml +++ b/examples/helm/helmfile.yaml @@ -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 diff --git a/examples/helm/kindConfig.yaml b/examples/helm/kindConfig.yaml index ace1176da79..2f4b51de055 100644 --- a/examples/helm/kindConfig.yaml +++ b/examples/helm/kindConfig.yaml @@ -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 diff --git a/examples/helm/templates/os1.yaml.gotmpl b/examples/helm/templates/os1.yaml.gotmpl deleted file mode 100644 index bd217d5d40a..00000000000 --- a/examples/helm/templates/os1.yaml.gotmpl +++ /dev/null @@ -1,36 +0,0 @@ -replicas: {{ .Values | get "opensearch1.instances" 1 }} - -{{- if eq (.Values | get "opensearch1.instances" 1) 1 }} -singleNode: true -{{- else }} -singleNode: false -{{- end }} - -image: - tag: {{ .Values | get "opensearch1.version" "1.3.14" }} - -service: - type: NodePort - port: 9200 - nodePort: 30921 - -config: - opensearch.yml: - plugins: - security: - disabled: true - {{- if eq (.Values | get "opensearch1.instances" 1) 1 }} - discovery.type: single-node - {{- end }} - -clusterName: opensearch1-cluster - -masterService: "opensearch1" - -resources: - requests: - cpu: "1000m" - memory: {{ .Values | get "opensearch1.memoryLimit" "100Mi" }} - -persistence: - size: {{ .Values | get "opensearch1.persistentVolumeSize" "8Gi" }} diff --git a/examples/helm/values.yaml b/examples/helm/values.yaml new file mode 100644 index 00000000000..763095d5395 --- /dev/null +++ b/examples/helm/values.yaml @@ -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