* INFRA-2333 | Ashvin | Format jsonnet * INFRA-2333 | Ashvin | Add busybox image for local sandbox * INFRA-2333 | Ashvin | Disable startup probe for local sandbox
123 lines
4.6 KiB
Jsonnet
123 lines
4.6 KiB
Jsonnet
local chart = import 'chart.jsonnet';
|
|
local common = import 'common.jsonnet';
|
|
local deployment_manifest = import 'deployment_manifest.jsonnet';
|
|
local deployment = deployment_manifest.deployment;
|
|
|
|
if deployment_manifest.deployment.elasticSearch.enabled == true then {
|
|
apiVersion: 'batch/v1',
|
|
kind: 'Job',
|
|
metadata: {
|
|
name: deployment.elasticSearch.instance.instanceName + '-elasticsearch' + '-init-snapshots',
|
|
namespace: deployment_manifest.environment + '-datastores',
|
|
labels: deployment.elasticSearch.esLabels,
|
|
annotations: common.annotations,
|
|
},
|
|
spec: {
|
|
template: {
|
|
spec: {
|
|
initContainers: [
|
|
{
|
|
name: 'elasticsearch-s3-repository',
|
|
image: '193044292705.dkr.ecr.ap-south-1.amazonaws.com/common/centos:7-custom',
|
|
imagePullPolicy: 'IfNotPresent',
|
|
volumeMounts: [
|
|
{
|
|
name: 'es-basic-auth',
|
|
mountPath: '/mnt/elastic/es-basic-auth',
|
|
},
|
|
],
|
|
env: [
|
|
{
|
|
name: 'ES_HOST',
|
|
value: deployment.elasticSearch.instance.instanceName + '-elasticsearch-es-http.' + deployment_manifest.environment + '-datastores.' + 'svc.cluster.local',
|
|
},
|
|
{
|
|
name: 'ES_PORT',
|
|
value: '9200',
|
|
},
|
|
{
|
|
name: 'ES_REPOSITORY',
|
|
value: 'snapshots',
|
|
},
|
|
{
|
|
name: 'S3_REGION',
|
|
value: 'ap-south-1',
|
|
},
|
|
{
|
|
name: 'S3_BUCKET',
|
|
valueFrom: {
|
|
secretKeyRef: {
|
|
name: 's3-bucket-es-backup',
|
|
key: 'bucket',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: 'S3_BASE_PATH',
|
|
value: deployment.elasticSearch.instance.instanceName,
|
|
},
|
|
{
|
|
name: 'S3_COMPRESS',
|
|
value: 'true',
|
|
},
|
|
{
|
|
name: 'S3_STORAGE_CLASS',
|
|
value: 'standard',
|
|
},
|
|
],
|
|
command: [
|
|
'/bin/sh',
|
|
'-c',
|
|
],
|
|
args: [
|
|
"dockerize -wait tcp://${ES_HOST}:${ES_PORT} -timeout 600s && curl -s -i -k -u \"elastic:$(</mnt/elastic/es-basic-auth/elastic)\" -XPUT -H \"Content-Type: application/json\" http://${ES_HOST}:${ES_PORT}/_snapshot/${ES_REPOSITORY} -d '{\n \"type\": \"s3\",\n \"settings\": {\n \"bucket\": \"'\"${S3_BUCKET}\"'\",\n \"base_path\": \"'\"${S3_BASE_PATH}\"'\",\n \"region\": \"'\"${S3_REGION}\"'\",\n \"compress\": \"'\"${S3_COMPRESS}\"'\",\n \"storage_class\": \"'\"${S3_STORAGE_CLASS}\"'\"\n }\n}'\n",
|
|
],
|
|
},
|
|
],
|
|
containers: [
|
|
{
|
|
name: 'slm',
|
|
image: '193044292705.dkr.ecr.ap-south-1.amazonaws.com/common/centos:7-custom',
|
|
volumeMounts: [
|
|
{
|
|
name: 'es-basic-auth',
|
|
mountPath: '/mnt/elastic/es-basic-auth',
|
|
},
|
|
],
|
|
env: [
|
|
{
|
|
name: 'ES_HOST',
|
|
value: deployment.elasticSearch.instance.instanceName + '-elasticsearch-es-http.' + deployment_manifest.environment + '-datastores.' + 'svc.cluster.local',
|
|
},
|
|
{
|
|
name: 'ES_PORT',
|
|
value: '9200',
|
|
},
|
|
{
|
|
name: 'ES_REPOSITORY',
|
|
value: 'snapshots',
|
|
},
|
|
],
|
|
command: [
|
|
'/bin/bash',
|
|
'-c',
|
|
],
|
|
args: [
|
|
"curl -s -i -k -u \"elastic:$(</mnt/elastic/es-basic-auth/elastic)\" -XPUT \"http://${ES_HOST}:${ES_PORT}/_slm/policy/daily-snapshots?pretty\" -H 'Content-Type: application/json' -d '{\n \"schedule\": \"'\"0 59 23 * * ?\"'\",\n \"name\": \"'\"<daily-snap-{now/d}>\"'\",\n \"repository\": \"'\"${ES_REPOSITORY}\"'\",\n \"config\": {\n \"indices\": \"'\"*\"'\",\n \"include_global_state\": \"'\"true\"'\"\n },\n \"retention\": {\n \"expire_after\": \"7d\",\n \"min_count\": 7,\n \"max_count\": 14\n }\n}'\n",
|
|
],
|
|
},
|
|
],
|
|
restartPolicy: 'Never',
|
|
volumes: [
|
|
{
|
|
name: 'es-basic-auth',
|
|
secret: {
|
|
secretName: deployment.elasticSearch.instance.instanceName + '-elasticsearch' + '-es-elastic-user',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
}
|