59 lines
2.1 KiB
YAML
59 lines
2.1 KiB
YAML
# services/logging/opensearch-single-node-tune-check-job.yaml
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: opensearch-single-node-tune-check-2
|
|
namespace: logging
|
|
spec:
|
|
backoffLimit: 0
|
|
activeDeadlineSeconds: 300
|
|
template:
|
|
spec:
|
|
restartPolicy: Never
|
|
nodeSelector:
|
|
node-role.kubernetes.io/worker: 'true'
|
|
hardware: rpi5
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: hardware
|
|
operator: In
|
|
values:
|
|
- rpi5
|
|
containers:
|
|
- name: tune
|
|
image: python:3.11-alpine
|
|
command:
|
|
- python
|
|
- -c
|
|
env:
|
|
- name: OPENSEARCH_URL
|
|
value: http://opensearch-master.logging.svc.cluster.local:9200
|
|
resources:
|
|
requests:
|
|
cpu: 10m
|
|
memory: 32Mi
|
|
limits:
|
|
cpu: 200m
|
|
memory: 128Mi
|
|
volumeMounts:
|
|
- name: scripts
|
|
mountPath: /scripts
|
|
args:
|
|
- "import runpy\nscope = runpy.run_path(\"/scripts/tune.py\")\nrequest = scope[\"\
|
|
request_json\"]\nallocation = request(\"/_cat/allocation?format=json&bytes=b\"\
|
|
)\nassert allocation and all(int(row[\"disk.percent\"]) < 80 for row in\
|
|
\ allocation), \"Capacity guard failed\"\nsettings = request(\"/_cluster/settings?include_defaults=true&flat_settings=true\"\
|
|
)\nassert settings.get(\"defaults\", {}).get(\"cluster.blocks.create_index.auto_release\"\
|
|
) == \"true\", \"Automatic release guard failed\"\nif settings.get(\"persistent\"\
|
|
, {}).get(\"cluster.blocks.create_index\") == \"true\":\n scope[\"put\"\
|
|
](\"/_cluster/settings\", {\"persistent\": {\"cluster.blocks.create_index\"\
|
|
: None}})\n print(\"capacity_block_released_after_verified_expansion\"\
|
|
, flush=True)\nscope[\"main\"]()\n"
|
|
volumes:
|
|
- name: scripts
|
|
configMap:
|
|
name: opensearch-single-node-tune-script
|