diff --git a/deployment/k8/aws/ack-resource-setup/.helmignore b/deployment/k8/aws/ack-resource-setup/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/deployment/k8/aws/ack-resource-setup/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployment/k8/aws/ack-resource-setup/Chart.yaml b/deployment/k8/aws/ack-resource-setup/Chart.yaml new file mode 100644 index 000000000..0a8045d46 --- /dev/null +++ b/deployment/k8/aws/ack-resource-setup/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: ack-resource-setup +description: A Helm chart for deploying required AWS resources for running the Migration Assistant +version: 0.1.0 +appVersion: "3.5.0" +dependencies: + - name: strimzi-kafka-operator + version: 0.43.0 + repository: https://strimzi.io/charts/ diff --git a/deployment/k8/aws/ack-resource-setup/templates/kafka-single-node.yaml b/deployment/k8/aws/ack-resource-setup/templates/kafka-single-node.yaml new file mode 100644 index 000000000..018ba3090 --- /dev/null +++ b/deployment/k8/aws/ack-resource-setup/templates/kafka-single-node.yaml @@ -0,0 +1,51 @@ +#https://github.com/strimzi/strimzi-kafka-operator/blob/release-0.43.x/examples/kafka/kraft/kafka-single-node.yaml +apiVersion: kafka.strimzi.io/v1beta2 +kind: KafkaNodePool +metadata: + name: dual-role + labels: + strimzi.io/cluster: kafka-cluster +spec: + replicas: 1 + roles: + - controller + - broker + storage: + type: jbod + volumes: + - id: 0 + type: persistent-claim + size: 10Gi + deleteClaim: true + kraftMetadata: shared +--- + +apiVersion: kafka.strimzi.io/v1beta2 +kind: Kafka +metadata: + name: kafka-cluster + annotations: + strimzi.io/node-pools: enabled + strimzi.io/kraft: enabled +spec: + kafka: + version: 3.8.0 + metadataVersion: 3.8-IV0 + listeners: + - name: plain + port: 9092 + type: internal + tls: false + - name: tls + port: 9093 + type: internal + tls: true + config: + offsets.topic.replication.factor: 1 + transaction.state.log.replication.factor: 1 + transaction.state.log.min.isr: 1 + default.replication.factor: 1 + min.insync.replicas: 1 + entityOperator: + topicOperator: {} + userOperator: {} diff --git a/deployment/k8/aws/ack-resource-setup/values.yaml b/deployment/k8/aws/ack-resource-setup/values.yaml new file mode 100644 index 000000000..01cce5cc2 --- /dev/null +++ b/deployment/k8/aws/ack-resource-setup/values.yaml @@ -0,0 +1,38 @@ +# Configuration for Strimzi Kafka Operator +#strimzi-kafka-operator: +# You can add operator-specific configurations here if needed +# For example, enabling metrics, RBAC settings, etc. + +## Configuration for the Kafka Cluster +#kafka: +# name: kafka-cluster +# version: "3.6.0" # Kafka version supporting KRaft +# replicas: 1 +# config: +# processRoles: "broker,controller" +# nodeId: 1 +# controllerQuorumVoters: "1@kafka-cluster-0.kafka-cluster-bootstrap:9093" +# interBrokerProtocolVersion: "3.5" +# logMessageFormatVersion: "3.5" +# autoCreateTopicsEnable: "true" +# storage: +# type: "ephemeral" # Use "persistent-claim" for persistent storage +# size: "20Gi" +# class: "managed-nfs-storage" # Set to empty string "" if not using a specific storage class +# deleteClaim: false +# +## Configuration for the Controller +#controller: +# replicas: 1 +# resources: +# limits: +# memory: "2Gi" +# cpu: "1000m" +# requests: +# memory: "1Gi" +# cpu: "500m" +# storage: +# type: "ephemeral" # Use "persistent-claim" for persistent storage +# size: "10Gi" +# class: "managed-nfs-storage" # Set to empty string "" if not using a specific storage class +# deleteClaim: false diff --git a/deployment/k8/capture-proxy/templates/deployment.yml b/deployment/k8/capture-proxy/templates/deployment.yml index ea666c8f7..ec5190224 100644 --- a/deployment/k8/capture-proxy/templates/deployment.yml +++ b/deployment/k8/capture-proxy/templates/deployment.yml @@ -40,10 +40,7 @@ spec: protocol: {{ .protocol | default "TCP" }} {{- end }} restartPolicy: {{ .Values.otelCollectorSidecar.restartPolicy }} - {{- if .Values.otelCollectorSidecar.command }} - command: - - "/bin/sh" - - "-c" - - "{{ .Values.otelCollectorSidecar.command }}" + {{- if .Values.otelCollectorSidecar.args }} + args: {{ .Values.otelCollectorSidecar.args }} {{- end }} {{- end }} diff --git a/deployment/k8/capture-proxy/values.yaml b/deployment/k8/capture-proxy/values.yaml index b346a5794..bf1986918 100644 --- a/deployment/k8/capture-proxy/values.yaml +++ b/deployment/k8/capture-proxy/values.yaml @@ -29,8 +29,8 @@ otelCollectorSidecar: name: otel-collector enabled: true restartPolicy: "Always" - #command: "--config=/etc/otel-config-debug-only.yaml" - #command: "--config=/etc/otel-config-aws.yaml" + #args: "--config=/etc/otel-config-debug-only.yaml" + #args: ["--config=/etc/otel-config-prometheus-jaeger.yaml"] image: repository: migrations/otel_collector pullPolicy: IfNotPresent @@ -48,3 +48,9 @@ otelCollectorSidecar: - name: otlp-receiver containerPort: 4317 protocol: TCP +# - name: prom-metrics +# containerPort: 8888 +# protocol: TCP +# - name: prom-exporter +# containerPort: 8889 +# protocol: TCP diff --git a/deployment/k8/elasticsearch/values.yaml b/deployment/k8/elasticsearch/values.yaml index eebe4dde4..6b46a3ad3 100644 --- a/deployment/k8/elasticsearch/values.yaml +++ b/deployment/k8/elasticsearch/values.yaml @@ -28,9 +28,4 @@ env: snapshotVolume: volumeName: snapshot-vol mountPath: /storage # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true pvcClaimName: snapshot-vol-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 5Gi diff --git a/deployment/k8/environments/full-environment/Chart.lock b/deployment/k8/environments/full-environment/Chart.lock index 52d3af6d5..a3b4b73ee 100644 --- a/deployment/k8/environments/full-environment/Chart.lock +++ b/deployment/k8/environments/full-environment/Chart.lock @@ -20,5 +20,11 @@ dependencies: - name: reindex-from-snapshot repository: file://../../reindex-from-snapshot version: 0.1.0 -digest: sha256:f150a39fb9de82b31d6dcf1c56c6469e206dd24412de5a12d8183c365f7c2738 -generated: "2024-10-16T17:08:42.54601-05:00" +- name: shared-logs-vol + repository: file://../../shared/shared-logs-vol + version: 0.1.0 +- name: snapshot-vol + repository: file://../../shared/snapshot-vol + version: 0.1.0 +digest: sha256:3e79f502ad2dd012fbd9b3428374a310f2106026e0ab7feb7fd1ab1e6fd0e3f5 +generated: "2024-10-18T22:56:42.045426-05:00" diff --git a/deployment/k8/environments/full-environment/Chart.yaml b/deployment/k8/environments/full-environment/Chart.yaml index 2abb0b141..1b06104b5 100644 --- a/deployment/k8/environments/full-environment/Chart.yaml +++ b/deployment/k8/environments/full-environment/Chart.yaml @@ -23,3 +23,18 @@ dependencies: - name: reindex-from-snapshot version: "0.1.0" repository: "file://../../reindex-from-snapshot" + - name: shared-logs-vol + version: "0.1.0" + repository: "file://../../shared/shared-logs-vol" + - name: snapshot-vol + version: "0.1.0" + repository: "file://../../shared/snapshot-vol" +# - name: jaeger +# version: "0.1.0" +# repository: "file://../../jaeger" +# - name: prometheus +# version: "0.1.0" +# repository: "file://../../prometheus" +# - name: grafana +# version: "0.1.0" +# repository: "file://../../grafana" diff --git a/deployment/k8/grafana/Chart.lock b/deployment/k8/grafana/Chart.lock new file mode 100644 index 000000000..23e9f4fec --- /dev/null +++ b/deployment/k8/grafana/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: grafana + repository: https://grafana.github.io/helm-charts + version: 8.5.0 +digest: sha256:9a11b7ae0a252d66e7bb0db397b666f2a205f644aa0d0b2a79db35358e38015c +generated: "2024-10-17T23:02:18.615764-05:00" diff --git a/deployment/k8/grafana/Chart.yaml b/deployment/k8/grafana/Chart.yaml new file mode 100644 index 000000000..8ad83f9fe --- /dev/null +++ b/deployment/k8/grafana/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: grafana +description: A Helm chart for deploying Grafana +appVersion: "3.5.0" +version: 0.1.0 +dependencies: + - name: grafana + version: "8.5.0" + repository: "https://grafana.github.io/helm-charts" diff --git a/deployment/k8/grafana/templates/configmap.yaml b/deployment/k8/grafana/templates/configmap.yaml new file mode 100644 index 000000000..3de2b1bfa --- /dev/null +++ b/deployment/k8/grafana/templates/configmap.yaml @@ -0,0 +1,136 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: prometheus-metrics-dashboard + labels: + grafana_dashboard: "1" +data: + prometheus-metrics-dashboard.json: | + { + "id": null, + "title": "Prometheus Metrics Dashboard", + "tags": [], + "timezone": "browser", + "schemaVersion": 30, + "version": 1, + "refresh": "5s", + "panels": [ + { + "type": "graph", + "title": "CPU Usage", + "datasource": "Prometheus", + "targets": [ + { + "expr": "sum(rate(node_cpu_seconds_total{mode!=\"idle\"}[5m])) by (instance)", + "legendFormat": "thing", + "refId": "A" + } + ], + "xaxis": { + "mode": "time" + }, + "yaxes": [ + { + "format": "percent", + "label": "CPU Usage" + } + ], + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + } + }, + { + "type": "graph", + "title": "Memory Usage", + "datasource": "Prometheus", + "targets": [ + { + "expr": "node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes", + "legendFormat": "Memory Usage", + "refId": "A" + } + ], + "xaxis": { + "mode": "time" + }, + "yaxes": [ + { + "format": "percent", + "label": "Memory Usage" + } + ], + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + } + }, + { + "type": "graph", + "title": "Disk I/O", + "datasource": "Prometheus", + "targets": [ + { + "expr": "rate(node_disk_io_time_seconds_total[5m])", + "legendFormat": "thing - thing2", + "refId": "A" + } + ], + "xaxis": { + "mode": "time" + }, + "yaxes": [ + { + "format": "s", + "label": "I/O Time" + } + ], + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 8 + } + }, + { + "type": "singlestat", + "title": "Total Requests", + "datasource": "Prometheus", + "targets": [ + { + "expr": "sum(rate(http_requests_total[5m]))", + "refId": "A" + } + ], + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 16 + }, + "format": "none" + }, + { + "type": "singlestat", + "title": "Up Time", + "datasource": "Prometheus", + "targets": [ + { + "expr": "time() - node_boot_time_seconds", + "refId": "A" + } + ], + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 16 + }, + "format": "s" + } + ] + } \ No newline at end of file diff --git a/deployment/k8/grafana/values.yaml b/deployment/k8/grafana/values.yaml new file mode 100644 index 000000000..4bc84f74b --- /dev/null +++ b/deployment/k8/grafana/values.yaml @@ -0,0 +1,40 @@ +grafana: + service: + type: LoadBalancer + port: 3000 + targetPort: 3000 + grafana.ini: + auth: + # Disable login form so anonymous users won't be prompted to log in + disable_login_form: true + auth.anonymous: + # Enable anonymous access + enabled: true + # Set the role for anonymous users (e.g., Viewer, Editor) + org_role: Editor + ## Grafana data sources configuration + datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus-server + isDefault: true + editable: true + - name: Jaeger + type: jaeger + access: proxy + url: http://jaeger-query:16686 + isDefault: false + editable: true + + ## Set up the sidecar to import data sources (usually enabled by default) + sidecar: + datasources: + enabled: true + dashboards: + enabled: true + label: grafana_dashboard + diff --git a/deployment/k8/jaeger/Chart.lock b/deployment/k8/jaeger/Chart.lock new file mode 100644 index 000000000..1e746c04d --- /dev/null +++ b/deployment/k8/jaeger/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: jaeger + repository: https://jaegertracing.github.io/helm-charts + version: 3.2.0 +digest: sha256:41ac5fc4455e3fbdd08464f77e94d308ccab23dfde20a1c8f44b168bcbc38194 +generated: "2024-10-18T11:21:05.929732-05:00" diff --git a/deployment/k8/jaeger/Chart.yaml b/deployment/k8/jaeger/Chart.yaml new file mode 100644 index 000000000..ebfcc5be9 --- /dev/null +++ b/deployment/k8/jaeger/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: jaeger +description: A Helm chart for deploying Jaeger +appVersion: "3.5.0" +version: 0.1.0 +dependencies: + - name: jaeger + version: "3.2.0" + repository: "https://jaegertracing.github.io/helm-charts" diff --git a/deployment/k8/jaeger/values.yaml b/deployment/k8/jaeger/values.yaml new file mode 100644 index 000000000..f1658bb75 --- /dev/null +++ b/deployment/k8/jaeger/values.yaml @@ -0,0 +1,13 @@ +jaeger: + allInOne: + enabled: true + provisionDataStore: + cassandra: false + storage: + type: memory + agent: + enabled: false + collector: + enabled: false + query: + enabled: false diff --git a/deployment/k8/localSetupMini.sh b/deployment/k8/localSetupMini.sh deleted file mode 100755 index f41191ab6..000000000 --- a/deployment/k8/localSetupMini.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# To have running during local development - -# Allow executing this script from any dir -script_abs_path=$(readlink -f "$0") -script_dir_abs_path=$(dirname "$script_abs_path") -cd "$script_dir_abs_path" || exit - -cd ../.. || exit - -helm repo add opensearch-operator https://opensearch-project.github.io/opensearch-k8s-operator/ -helm repo add strimzi https://strimzi.io/charts/ - -minikube mount .:/opensearch-migrations > /dev/null 2>&1 & -minikube tunnel > /dev/null 2>&1 & diff --git a/deployment/k8/migration-console/Chart.lock b/deployment/k8/migration-console/Chart.lock new file mode 100644 index 000000000..1157df320 --- /dev/null +++ b/deployment/k8/migration-console/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: migrations-lib + repository: file://../migrations-lib + version: 0.1.0 +digest: sha256:16ba79c267bb045bbee80921a6d838f88f8bd9d4d7d2549b82ac700691a91236 +generated: "2024-10-19T00:23:01.6744-05:00" diff --git a/deployment/k8/migration-console/Chart.yaml b/deployment/k8/migration-console/Chart.yaml index 8acc01ea8..d97fe9a2e 100644 --- a/deployment/k8/migration-console/Chart.yaml +++ b/deployment/k8/migration-console/Chart.yaml @@ -4,3 +4,9 @@ description: A Helm chart to install the Migration Console type: application version: 0.1.0 appVersion: "1.16.0" +dependencies: + - name: migrations-lib + version: "0.1.0" + repository: "file://../migrations-lib" + import-values: + - "otelCollector" diff --git a/deployment/k8/migration-console/templates/deployment.yml b/deployment/k8/migration-console/templates/deployment.yml index ae756fbb5..69f03feb3 100644 --- a/deployment/k8/migration-console/templates/deployment.yml +++ b/deployment/k8/migration-console/templates/deployment.yml @@ -31,25 +31,7 @@ spec: mountPath: {{ .Values.servicesYamlVolume.mountPath }} - name: {{ .Values.snapshotVolume.volumeName }} mountPath: {{ .Values.snapshotVolume.mountPath }} - {{- if .Values.otelCollectorSidecar.enabled }} - initContainers: - - name: {{ .Values.otelCollectorSidecar.name}} - image: "{{ .Values.otelCollectorSidecar.image.repository }}:{{ .Values.otelCollectorSidecar.image.tag }}" - imagePullPolicy: {{ .Values.otelCollectorSidecar.image.pullPolicy }} - ports: - {{- range .Values.otelCollectorSidecar.ports }} - - name: {{ .name }} - containerPort: {{ .containerPort }} - protocol: {{ .protocol | default "TCP" }} - {{- end }} - restartPolicy: {{ .Values.otelCollectorSidecar.restartPolicy }} - {{- if .Values.otelCollectorSidecar.command }} - command: - - "/bin/sh" - - "-c" - - "{{ .Values.otelCollectorSidecar.command }}" - {{- end }} - {{- end }} + {{- include "migrations-lib.otel-sidecar" . | indent 8 }} volumes: - name: {{ .Values.sharedLogVolume.volumeName }} persistentVolumeClaim: diff --git a/deployment/k8/migration-console/templates/pvc.yml b/deployment/k8/migration-console/templates/pvc.yml deleted file mode 100644 index b6caf6ef6..000000000 --- a/deployment/k8/migration-console/templates/pvc.yml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.sharedLogVolume.createPvc }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ .Values.sharedLogVolume.pvcClaimName }} -spec: - accessModes: - - {{ .Values.sharedLogVolume.accessMode }} - resources: - requests: - storage: {{ .Values.sharedLogVolume.size }} - {{- if .Values.sharedLogVolume.storageClass }} - storageClassName: {{ .Values.sharedLogVolume.storageClass }} - {{- end }} -{{- end }} - ---- -{{- if .Values.snapshotVolume.createPvc }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ .Values.snapshotVolume.pvcClaimName }} -spec: - accessModes: - - {{ .Values.snapshotVolume.accessMode }} - resources: - requests: - storage: {{ .Values.snapshotVolume.size }} - {{- if .Values.snapshotVolume.storageClass }} - storageClassName: {{ .Values.snapshotVolume.storageClass }} - {{- end }} -{{- end }} diff --git a/deployment/k8/migration-console/values.yaml b/deployment/k8/migration-console/values.yaml index 46e9d731b..678cb366e 100644 --- a/deployment/k8/migration-console/values.yaml +++ b/deployment/k8/migration-console/values.yaml @@ -28,44 +28,11 @@ servicesYamlVolume: sharedLogVolume: volumeName: shared-logs mountPath: /shared-logs-output # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true # This should only be created once and shared between services pvcClaimName: shared-logs-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 10Gi snapshotVolume: volumeName: snapshot-vol mountPath: /storage # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true pvcClaimName: snapshot-vol-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 5Gi - -otelCollectorSidecar: - name: otel-collector - enabled: true - restartPolicy: "Always" - #command: "--config=/etc/otel-config-debug-only.yaml" - #command: "--config=/etc/otel-config-aws.yaml" - image: - repository: migrations/otel_collector - pullPolicy: IfNotPresent - tag: "latest" - ports: - - name: pprof - containerPort: 1888 - protocol: TCP - - name: health-check - containerPort: 13133 - protocol: TCP - - name: zpages - containerPort: 55679 - protocol: TCP - - name: otlp-receiver - containerPort: 4317 - protocol: TCP +test: true diff --git a/deployment/k8/migrations-lib/.helmignore b/deployment/k8/migrations-lib/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/deployment/k8/migrations-lib/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployment/k8/migrations-lib/Chart.yaml b/deployment/k8/migrations-lib/Chart.yaml new file mode 100644 index 000000000..ca274fc0d --- /dev/null +++ b/deployment/k8/migrations-lib/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: migrations-lib +version: 0.1.0 +description: A migrations shared library chart +type: library diff --git a/deployment/k8/migrations-lib/templates/_otel-collector.yml b/deployment/k8/migrations-lib/templates/_otel-collector.yml new file mode 100644 index 000000000..acd2e5eb1 --- /dev/null +++ b/deployment/k8/migrations-lib/templates/_otel-collector.yml @@ -0,0 +1,15 @@ +{{- define "migrations-lib.otel-sidecar" -}} +- name: {{ .Values.otelCollector.name}} + image: "{{ .Values.otelCollector.image.repository }}:{{ .Values.otelCollector.image.tag }}" + imagePullPolicy: {{ .Values.otelCollector.image.pullPolicy }} + ports: + {{- range .Values.otelCollector.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + protocol: {{ .protocol | default "TCP" }} + {{- end }} + restartPolicy: {{ .Values.otelCollector.restartPolicy }} + {{- if .Values.otelCollector.args }} + args: {{ .Values.otelCollector.args }} + {{- end }} +{{- end }} diff --git a/deployment/k8/migrations-lib/values.yaml b/deployment/k8/migrations-lib/values.yaml new file mode 100644 index 000000000..8a81608a2 --- /dev/null +++ b/deployment/k8/migrations-lib/values.yaml @@ -0,0 +1,28 @@ +otelCollector: + name: otel-collector + restartPolicy: "Always" + #args: "--config=/etc/otel-config-debug-only.yaml" + #args: ["--config=/etc/otel-config-prometheus-jaeger.yaml"] + image: + repository: migrations/otel_collector + pullPolicy: IfNotPresent + tag: "latest" + ports: + - name: pprof + containerPort: 1888 + protocol: TCP + - name: health-check + containerPort: 13133 + protocol: TCP + - name: zpages + containerPort: 55679 + protocol: TCP + - name: otlp-receiver + containerPort: 4317 + protocol: TCP +# - name: prom-metrics +# containerPort: 8888 +# protocol: TCP +# - name: prom-exporter +# containerPort: 8889 +# protocol: TCP diff --git a/deployment/k8/minikubeTool.sh b/deployment/k8/minikubeTool.sh new file mode 100755 index 000000000..7dd1d2eeb --- /dev/null +++ b/deployment/k8/minikubeTool.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# To have running during local development + +usage() { + echo "Usage: $0 [--start | --pause | --delete]" + exit 1 +} + +kill_minikube_processes() { + mount_process_id=$(pgrep -f "minikube mount") + if [ -n "$mount_process_id" ]; then + kill "$mount_process_id" + fi + tunnel_process_id=$(pgrep -f "minikube tunnel") + if [ -n "$tunnel_process_id" ]; then + kill "$tunnel_process_id" + fi +} + +start() { + helm repo add opensearch-operator https://opensearch-project.github.io/opensearch-k8s-operator/ + helm repo add strimzi https://strimzi.io/charts/ + + minikube start + minikube mount .:/opensearch-migrations > /dev/null 2>&1 & + minikube tunnel > /dev/null 2>&1 & +} + +pause() { + kill_minikube_processes + minikube pause +} + +delete() { + kill_minikube_processes + minikube delete +} + +# Check if the script was called with no arguments +if [ $# -eq 0 ]; then + usage +fi + +# Allow executing this script from any dir +script_abs_path=$(readlink -f "$0") +script_dir_abs_path=$(dirname "$script_abs_path") +cd "$script_dir_abs_path" || exit + +cd ../.. || exit + +# Parse the argument and call the appropriate function +case "$1" in + --start) + start + ;; + --pause) + pause + ;; + --delete) + delete + ;; + *) + echo "Invalid option: $1" + usage + ;; +esac + diff --git a/deployment/k8/prometheus/Chart.lock b/deployment/k8/prometheus/Chart.lock new file mode 100644 index 000000000..3dae47c0c --- /dev/null +++ b/deployment/k8/prometheus/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: prometheus + repository: https://prometheus-community.github.io/helm-charts + version: 25.27.0 +digest: sha256:30e4a566c45c3dd4ce80a501e9c4d0903d1364a2810aaba965e8796a703a2093 +generated: "2024-10-17T23:31:30.225286-05:00" diff --git a/deployment/k8/prometheus/Chart.yaml b/deployment/k8/prometheus/Chart.yaml new file mode 100644 index 000000000..7a4fa048e --- /dev/null +++ b/deployment/k8/prometheus/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: prometheus +description: A Helm chart for deploying Prometheus +appVersion: "3.5.0" +version: 0.1.0 +dependencies: + - name: prometheus + version: "25.27.0" + repository: "https://prometheus-community.github.io/helm-charts" diff --git a/deployment/k8/prometheus/values.yaml b/deployment/k8/prometheus/values.yaml new file mode 100644 index 000000000..208967dd3 --- /dev/null +++ b/deployment/k8/prometheus/values.yaml @@ -0,0 +1 @@ +#prometheus: diff --git a/deployment/k8/reindex-from-snapshot/templates/deployment.yml b/deployment/k8/reindex-from-snapshot/templates/job.yml similarity index 91% rename from deployment/k8/reindex-from-snapshot/templates/deployment.yml rename to deployment/k8/reindex-from-snapshot/templates/job.yml index 1fe59eafa..bd3fd75d2 100644 --- a/deployment/k8/reindex-from-snapshot/templates/deployment.yml +++ b/deployment/k8/reindex-from-snapshot/templates/job.yml @@ -5,7 +5,7 @@ metadata: labels: app: {{ .Chart.Name }} spec: - parallelism: 0 + parallelism: {{ .Values.parallelCount }} completions: 1000 # Temporary until direction decided here ttlSecondsAfterFinished: 30 # Clean up finished Jobs (either Complete or Failed) automatically after this time template: @@ -45,11 +45,8 @@ spec: protocol: {{ .protocol | default "TCP" }} {{- end }} restartPolicy: {{ .Values.otelCollectorSidecar.restartPolicy }} - {{- if .Values.otelCollectorSidecar.command }} - command: - - "/bin/sh" - - "-c" - - "{{ .Values.otelCollectorSidecar.command }}" + {{- if .Values.otelCollectorSidecar.args }} + args: {{ .Values.otelCollectorSidecar.args }} {{- end }} {{- end }} volumes: diff --git a/deployment/k8/reindex-from-snapshot/templates/pvc.yml b/deployment/k8/reindex-from-snapshot/templates/pvc.yml deleted file mode 100644 index b6caf6ef6..000000000 --- a/deployment/k8/reindex-from-snapshot/templates/pvc.yml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.sharedLogVolume.createPvc }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ .Values.sharedLogVolume.pvcClaimName }} -spec: - accessModes: - - {{ .Values.sharedLogVolume.accessMode }} - resources: - requests: - storage: {{ .Values.sharedLogVolume.size }} - {{- if .Values.sharedLogVolume.storageClass }} - storageClassName: {{ .Values.sharedLogVolume.storageClass }} - {{- end }} -{{- end }} - ---- -{{- if .Values.snapshotVolume.createPvc }} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ .Values.snapshotVolume.pvcClaimName }} -spec: - accessModes: - - {{ .Values.snapshotVolume.accessMode }} - resources: - requests: - storage: {{ .Values.snapshotVolume.size }} - {{- if .Values.snapshotVolume.storageClass }} - storageClassName: {{ .Values.snapshotVolume.storageClass }} - {{- end }} -{{- end }} diff --git a/deployment/k8/reindex-from-snapshot/values.yaml b/deployment/k8/reindex-from-snapshot/values.yaml index acef18f22..09bce96db 100644 --- a/deployment/k8/reindex-from-snapshot/values.yaml +++ b/deployment/k8/reindex-from-snapshot/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 0 +parallelCount: 0 image: repository: migrations/reindex_from_snapshot @@ -37,8 +37,8 @@ otelCollectorSidecar: name: otel-collector enabled: true restartPolicy: "Always" - #command: "--config=/etc/otel-config-debug-only.yaml" - #command: "--config=/etc/otel-config-aws.yaml" + #args: "--config=/etc/otel-config-debug-only.yaml" + #args: ["--config=/etc/otel-config-prometheus-jaeger.yaml"] image: repository: migrations/otel_collector pullPolicy: IfNotPresent @@ -56,23 +56,19 @@ otelCollectorSidecar: - name: otlp-receiver containerPort: 4317 protocol: TCP +# - name: prom-metrics +# containerPort: 8888 +# protocol: TCP +# - name: prom-exporter +# containerPort: 8889 +# protocol: TCP sharedLogVolume: volumeName: shared-logs mountPath: /shared-logs-output # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true # This should only be created once and shared between services pvcClaimName: shared-logs-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 10Gi snapshotVolume: volumeName: snapshot-vol mountPath: /storage # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true pvcClaimName: snapshot-vol-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 5Gi diff --git a/deployment/k8/replayer/templates/deployment.yml b/deployment/k8/replayer/templates/deployment.yml index a6567d6f8..7d90f8a2a 100644 --- a/deployment/k8/replayer/templates/deployment.yml +++ b/deployment/k8/replayer/templates/deployment.yml @@ -43,11 +43,8 @@ spec: protocol: {{ .protocol | default "TCP" }} {{- end }} restartPolicy: {{ .Values.otelCollectorSidecar.restartPolicy }} - {{- if .Values.otelCollectorSidecar.command }} - command: - - "/bin/sh" - - "-c" - - "{{ .Values.otelCollectorSidecar.command }}" + {{- if .Values.otelCollectorSidecar.args }} + args: {{ .Values.otelCollectorSidecar.args }} {{- end }} {{- end }} volumes: diff --git a/deployment/k8/replayer/values.yaml b/deployment/k8/replayer/values.yaml index a5816507e..99beaca5b 100644 --- a/deployment/k8/replayer/values.yaml +++ b/deployment/k8/replayer/values.yaml @@ -36,8 +36,8 @@ otelCollectorSidecar: name: otel-collector enabled: true restartPolicy: "Always" - #command: "--config=/etc/otel-config-debug-only.yaml" - #command: "--config=/etc/otel-config-aws.yaml" + #args: "--config=/etc/otel-config-debug-only.yaml" + #args: ["--config=/etc/otel-config-prometheus-jaeger.yaml"] image: repository: migrations/otel_collector pullPolicy: IfNotPresent @@ -55,13 +55,14 @@ otelCollectorSidecar: - name: otlp-receiver containerPort: 4317 protocol: TCP +# - name: prom-metrics +# containerPort: 8888 +# protocol: TCP +# - name: prom-exporter +# containerPort: 8889 +# protocol: TCP sharedLogVolume: volumeName: shared-logs mountPath: /shared-logs-output # Path inside the container where the volume should be mounted - # Persistent volume claim settings - createPvc: true # This should only be created once and shared between services pvcClaimName: shared-logs-pvc - storageClass: "" - accessMode: ReadWriteOnce - size: 10Gi diff --git a/deployment/k8/shared/shared-logs-vol/.helmignore b/deployment/k8/shared/shared-logs-vol/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/deployment/k8/shared/shared-logs-vol/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployment/k8/shared/shared-logs-vol/Chart.yaml b/deployment/k8/shared/shared-logs-vol/Chart.yaml new file mode 100644 index 000000000..f3cc08c3f --- /dev/null +++ b/deployment/k8/shared/shared-logs-vol/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: shared-logs-vol +description: A utility Helm chart to create a shared logs volume +type: application +version: 0.1.0 +appVersion: "1.16.0" diff --git a/deployment/k8/replayer/templates/pvc.yml b/deployment/k8/shared/shared-logs-vol/templates/pvc.yml similarity index 87% rename from deployment/k8/replayer/templates/pvc.yml rename to deployment/k8/shared/shared-logs-vol/templates/pvc.yml index 31c5d69f2..d11e04912 100644 --- a/deployment/k8/replayer/templates/pvc.yml +++ b/deployment/k8/shared/shared-logs-vol/templates/pvc.yml @@ -1,4 +1,3 @@ -{{- if .Values.sharedLogVolume.createPvc }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -12,4 +11,3 @@ spec: {{- if .Values.sharedLogVolume.storageClass }} storageClassName: {{ .Values.sharedLogVolume.storageClass }} {{- end }} -{{- end }} diff --git a/deployment/k8/shared/shared-logs-vol/values.yaml b/deployment/k8/shared/shared-logs-vol/values.yaml new file mode 100644 index 000000000..d9a3fc7c4 --- /dev/null +++ b/deployment/k8/shared/shared-logs-vol/values.yaml @@ -0,0 +1,8 @@ +sharedLogVolume: + volumeName: shared-logs + mountPath: /shared-logs-output # Path inside the container where the volume should be mounted + # Persistent volume claim settings + pvcClaimName: shared-logs-pvc + storageClass: "" + accessMode: ReadWriteOnce + size: 10Gi diff --git a/deployment/k8/shared/snapshot-vol/.helmignore b/deployment/k8/shared/snapshot-vol/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/deployment/k8/shared/snapshot-vol/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployment/k8/shared/snapshot-vol/Chart.yaml b/deployment/k8/shared/snapshot-vol/Chart.yaml new file mode 100644 index 000000000..c00dad454 --- /dev/null +++ b/deployment/k8/shared/snapshot-vol/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: snapshot-vol +description: A utility Helm chart to create a storage volume for snapshots +type: application +version: 0.1.0 +appVersion: "1.16.0" diff --git a/deployment/k8/elasticsearch/templates/pvc.yml b/deployment/k8/shared/snapshot-vol/templates/pvc.yml similarity index 87% rename from deployment/k8/elasticsearch/templates/pvc.yml rename to deployment/k8/shared/snapshot-vol/templates/pvc.yml index 0c4371864..636c9021f 100644 --- a/deployment/k8/elasticsearch/templates/pvc.yml +++ b/deployment/k8/shared/snapshot-vol/templates/pvc.yml @@ -1,4 +1,3 @@ -{{- if .Values.snapshotVolume.createPvc }} apiVersion: v1 kind: PersistentVolumeClaim metadata: @@ -12,4 +11,3 @@ spec: {{- if .Values.snapshotVolume.storageClass }} storageClassName: {{ .Values.snapshotVolume.storageClass }} {{- end }} -{{- end }} diff --git a/deployment/k8/shared/snapshot-vol/values.yaml b/deployment/k8/shared/snapshot-vol/values.yaml new file mode 100644 index 000000000..b0a2a5b7d --- /dev/null +++ b/deployment/k8/shared/snapshot-vol/values.yaml @@ -0,0 +1,8 @@ +snapshotVolume: + volumeName: snapshot-vol + mountPath: /storage # Path inside the container where the volume should be mounted + # Persistent volume claim settings + pvcClaimName: snapshot-vol-pvc + storageClass: "" + accessMode: ReadWriteOnce + size: 5Gi