Skip to content

Commit 86a8cf8

Browse files
perhammanton.voskresensky
andauthored
fix example
Co-authored-by: anton.voskresensky <anton.voskresensky@flant.com>
1 parent e15416a commit 86a8cf8

File tree

16 files changed

+762
-1
lines changed

16 files changed

+762
-1
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{{- if .Values.curator.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: osctl-configmap
6+
annotations:
7+
argocd.argoproj.io/sync-options: Replace=true
8+
data:
9+
config.yml: |-
10+
---
11+
# Common settings shared across all commands
12+
opensearch_url: "https://opendistro:{{ .Values.opendistro.port_http }}"
13+
cert_file: "/etc/ssl/certs/admin-crt.pem"
14+
key_file: "/etc/ssl/certs/admin-key.pem"
15+
ca_file: ""
16+
timeout: "300s"
17+
retry_attempts: 3
18+
date_format: {{ .Values.osctl.date_format | default "%Y.%m.%d" | quote }}
19+
dry_run: false
20+
{{- $snapshot_repo := "" }}
21+
{{- range .Values.opendistro.s3_backup.repos }}
22+
{{- if eq .client "default" }}
23+
{{- $snapshot_repo = .repository }}
24+
{{- end }}
25+
{{- end }}
26+
snapshot_repo: {{ $snapshot_repo | default "" | quote }}
27+
28+
# madison alerts settings
29+
madison_url: "https://madison.flant.com/api/events/custom/"
30+
{{- $madison_key := "" }}
31+
{{- if and (hasKey .Values "admin") (hasKey .Values.admin "madison_key") }}
32+
{{- $madison_key = .Values.admin.madison_key }}
33+
{{- else if and (hasKey .Values "madison") (hasKey .Values.madison "key") }}
34+
{{- $madison_key = .Values.madison.key }}
35+
{{- end }}
36+
madison_key: {{ $madison_key | quote }}
37+
osd_url: "https://{{ .Values.kibana.host }}"
38+
39+
# Command-specific configurations
40+
41+
# coldstorage
42+
{{- if hasKey .Values "coldCluster" }}
43+
cold_attribute: {{ .Values.coldCluster.coldAttribute | default "cold" | quote }}
44+
hot_count: {{ .Values.coldCluster.hotCount | default 4 | quote }}
45+
{{- else }}
46+
cold_attribute: ""
47+
hot_count: ""
48+
{{- end }}
49+
50+
# danglingchecker
51+
52+
# datasource
53+
datasource_name: {{ .Values.datasource.datasource_name | default "recoverer" | quote }}
54+
kibana_user: {{ .Values.apiuser.elasticsearch.username | quote }}
55+
kibana_pass: {{ .Values.apiuser.elasticsearch.password | quote }}
56+
datasource_kibana_multitenancy: {{ .Values.security.multitenancy | default false | quote }}
57+
{{- if .Values.kibana.multidomain.enabled }}
58+
kube_namespace: {{ .Release.Namespace | quote }}
59+
{{- if hasKey .Values.kibana.multidomain "remote_crt" }}
60+
datasource_remote_crt: {{ join "|" .Values.kibana.multidomain.remote_crt | quote }}
61+
{{- else }}
62+
datasource_remote_crt: ""
63+
{{- end }}
64+
{{- else }}
65+
kube_namespace: ""
66+
datasource_remote_crt: ""
67+
{{- end }}
68+
datasource_kibana_multidomain_enabled: {{ .Values.kibana.multidomain.enabled | default false | quote }}
69+
70+
# dereplicator:
71+
dereplicator_days_count: {{ .Values.dereplicator.days_count | default 2 | quote }}
72+
dereplicator_use_snapshot: {{ .Values.dereplicator.use_snapshot | default false | quote }}
73+
74+
# extracteddelete:
75+
{{- if .Values.recoverer.enabled }}
76+
opensearch_recoverer_url: "https://opendistro-recoverer:9200"
77+
{{- else }}
78+
opensearch_recoverer_url: "https://opendistro:{{ .Values.opendistro.port_http }}"
79+
{{- end }}
80+
extracted_pattern: {{ .Values.extracteddelete.extracted_pattern | default "extracted_" | quote }}
81+
extracted_days: {{ .Values.extracteddelete.extracted_days | default 2 | quote }}
82+
recoverer_date_format: {{ .Values.extracteddelete.recoverer_date_format | default "%d-%m-%Y" | quote }}
83+
84+
# indexpatterns:
85+
kibana_index_regex: "^([\\w-]+)-([\\w-]*)(\\d{4}[\\.-]\\d{2}[\\.-]\\d{2}(?:[\\.-]\\d{2})*)$"
86+
indexpatterns_kibana_multitenancy: {{ .Values.security.multitenancy | default false | quote }}
87+
{{- if and (.Values.security.multitenancy | default false) (.Values.recoverer.enabled | default false) }}
88+
indexpatterns_recoverer_enabled: false
89+
{{- else if (.Values.recoverer.enabled | default false) }}
90+
indexpatterns_recoverer_enabled: true
91+
{{- else }}
92+
indexpatterns_recoverer_enabled: false
93+
{{- end }}
94+
95+
# indicesdelete:
96+
97+
# retention:
98+
retention_threshold: {{ .Values.retention.threshold | default 75.0 | quote }}
99+
100+
# sharding:
101+
sharding_target_size_gib: {{ .Values.sharding.target_size_gib | default 25 | quote }}
102+
exclude_sharding: {{ .Values.sharding.exclude_indices | default "" | quote }}
103+
104+
# snapshots:
105+
106+
# snapshotschecker:
107+
108+
# snapshotsdelete:
109+
110+
# snapshotmanual:
111+
112+
osctlindicesconfig.yml: |-
113+
{{- if .Values.curator.enabled }}
114+
---
115+
{{ toYaml .Values.curator | indent 4 }}
116+
{{- end }}
117+
osctltenants.yml: |-
118+
{{- if and (.Values.security.multitenancy | default false) (hasKey .Values.security "tenants") }}
119+
---
120+
tenants:
121+
{{ toYaml .Values.security.tenants | indent 4 }}
122+
{{- end }}
123+
124+
{{- end }}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
{{- define "osctl_volumes" }}
3+
- name: osctl-config
4+
configMap:
5+
name: osctl-configmap
6+
defaultMode: 420
7+
- name: osctl-tenants
8+
configMap:
9+
name: osctltenants
10+
defaultMode: 420
11+
- name: osctl-indices-config
12+
configMap:
13+
name: osctlindicesconfig
14+
defaultMode: 420
15+
{{- include "osctl_cert_volumes" . }}
16+
{{- end }}
17+
18+
{{- define "osctl_cert_volumes" }}
19+
{{- if eq .Values.opendistro.certificates.type "custom" }}
20+
- name: certs
21+
secret:
22+
secretName: opendistro-tls-data
23+
defaultMode: 420
24+
{{- else if eq .Values.opendistro.certificates.type "cluster" }}
25+
- name: certs
26+
secret:
27+
secretName: opendistro-certs
28+
defaultMode: 420
29+
- name: admin-certs
30+
secret:
31+
secretName: opendistro-admin-certs
32+
defaultMode: 420
33+
{{- end }}
34+
{{- end }}
35+
36+
{{- define "osctl_volume_mounts" }}
37+
- name: osctl-config
38+
mountPath: /app/config.yaml
39+
subPath: config.yml
40+
readOnly: true
41+
- name: osctl-config
42+
mountPath: /app/osctltenants.yaml
43+
subPath: osctltenants.yml
44+
readOnly: true
45+
- name: osctl-config
46+
mountPath: /app/osctlindicesconfig.yaml
47+
subPath: osctlindicesconfig.yml
48+
readOnly: true
49+
{{- include "osctl_cert_volume_mounts" . }}
50+
{{- end }}
51+
52+
{{- define "osctl_cert_volume_mounts" }}
53+
{{- if eq .Values.opendistro.certificates.type "custom" }}
54+
- mountPath: /etc/ssl/certs/admin-crt.pem
55+
name: certs
56+
subPath: admin-crt.pem
57+
readOnly: true
58+
- mountPath: /etc/ssl/certs/admin-key.pem
59+
name: certs
60+
subPath: admin-key.pem
61+
readOnly: true
62+
{{- else if eq .Values.opendistro.certificates.type "cluster" }}
63+
- mountPath: /etc/ssl/certs/admin-crt.pem
64+
name: admin-certs
65+
subPath: tls.crt
66+
readOnly: true
67+
- mountPath: /etc/ssl/certs/admin-key.pem
68+
name: admin-certs
69+
subPath: tls.key
70+
readOnly: true
71+
{{- end }}
72+
{{- end }}
73+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{{- if hasKey .Values "coldCluster" }}
2+
{{- if hasKey .Values.coldCluster "enabled" }}
3+
{{- if and .Values.opendistro.enabled .Values.curator.enabled .Values.coldCluster.enabled }}
4+
---
5+
apiVersion: batch/v1
6+
kind: CronJob
7+
metadata:
8+
name: cold-storage
9+
labels:
10+
job: cold-storage
11+
service: osctl
12+
spec:
13+
schedule: {{ .Values.coldCluster.schedule | quote }}
14+
concurrencyPolicy: Forbid
15+
successfulJobsHistoryLimit: 1
16+
jobTemplate:
17+
metadata:
18+
labels:
19+
job: cold-storage
20+
service: osctl
21+
spec:
22+
ttlSecondsAfterFinished: {{ .Values.osctl.ttlSecondsAfterFinished | default 3600 }}
23+
template:
24+
metadata:
25+
labels:
26+
job: cold-storage
27+
service: osctl
28+
spec:
29+
{{- include "toleration_common" . | indent 10 }}
30+
affinity:
31+
{{- include "nodeselector_common" . | indent 10 }}
32+
volumes:
33+
{{- include "osctl_volumes" . | indent 10 }}
34+
containers:
35+
- name: app
36+
image: {{ printf "%s%s:%s" .Values.osctl.image.repo .Values.osctl.image.name .Values.osctl.image.tag }}
37+
imagePullPolicy: {{ .Values.imagePullPolicy }}
38+
command:
39+
- /app/osctl
40+
args:
41+
- coldstorage
42+
workingDir: /app
43+
volumeMounts:
44+
{{- include "osctl_volume_mounts" . | indent 12 }}
45+
restartPolicy: Never
46+
{{- end }}
47+
{{- end }}
48+
{{- end }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if .Values.danglingChecker.enabled }}
2+
---
3+
apiVersion: batch/v1
4+
kind: CronJob
5+
metadata:
6+
name: dangling-checker
7+
labels:
8+
job: dangling-checker
9+
spec:
10+
schedule: {{ .Values.danglingChecker.schedule | quote }}
11+
concurrencyPolicy: Forbid
12+
successfulJobsHistoryLimit: 1
13+
jobTemplate:
14+
metadata:
15+
labels:
16+
job: dangling-checker
17+
spec:
18+
ttlSecondsAfterFinished: {{ .Values.osctl.ttlSecondsAfterFinished | default 3600 }}
19+
template:
20+
metadata:
21+
labels:
22+
job: dangling-checker
23+
spec:
24+
{{- include "toleration_common" . | indent 10 }}
25+
affinity:
26+
{{- include "nodeselector_common" . | indent 10 }}
27+
volumes:
28+
{{- include "osctl_volumes" . | indent 10 }}
29+
containers:
30+
- name: app
31+
image: {{ printf "%s%s:%s" .Values.osctl.image.repo .Values.osctl.image.name .Values.osctl.image.tag }}
32+
imagePullPolicy: {{ .Values.imagePullPolicy }}
33+
command:
34+
- /app/osctl
35+
args:
36+
- danglingchecker
37+
workingDir: /app
38+
volumeMounts:
39+
{{- include "osctl_volume_mounts" . | indent 12 }}
40+
restartPolicy: Never
41+
{{- end }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if and .Values.opendistro.enabled .Values.kibana.enabled .Values.recoverer.enabled .Values.opendistro.s3_backup.enabled .Values.kibana.multidomain.enabled }}
2+
---
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: osctl-restarter-{{ .Release.Namespace }}
7+
namespace: {{ .Release.Namespace }}
8+
---
9+
kind: ClusterRole
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
metadata:
12+
name: osctl-restarter-role-{{ .Release.Namespace }}
13+
rules:
14+
- apiGroups: ["","apps"]
15+
resources: ["statefulsets","pods","deployments","secrets"]
16+
verbs: ["get", "patch", "watch", "update", "list", "create", "delete"]
17+
---
18+
kind: ClusterRoleBinding
19+
apiVersion: rbac.authorization.k8s.io/v1
20+
metadata:
21+
name: osctl-restarter-rb-{{ .Release.Namespace }}
22+
subjects:
23+
- kind: ServiceAccount
24+
name: osctl-restarter-{{ .Release.Namespace }}
25+
namespace: {{ .Release.Namespace }}
26+
roleRef:
27+
kind: ClusterRole
28+
name: osctl-restarter-role-{{ .Release.Namespace }}
29+
apiGroup: rbac.authorization.k8s.io
30+
{{- end }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{{- if and .Values.opendistro.enabled .Values.kibana.enabled .Values.recoverer.enabled .Values.opendistro.s3_backup.enabled }}
2+
---
3+
apiVersion: batch/v1
4+
kind: CronJob
5+
metadata:
6+
name: datasource
7+
labels:
8+
job: datasource
9+
service: kibana
10+
spec:
11+
schedule: {{ .Values.datasource.schedule | quote }}
12+
concurrencyPolicy: Forbid
13+
successfulJobsHistoryLimit: 1
14+
jobTemplate:
15+
metadata:
16+
labels:
17+
job: datasource
18+
service: kibana
19+
spec:
20+
ttlSecondsAfterFinished: {{ .Values.osctl.ttlSecondsAfterFinished | default 3600 }}
21+
template:
22+
metadata:
23+
labels:
24+
job: datasource
25+
service: kibana
26+
spec:
27+
{{- include "toleration_common" . | indent 10 }}
28+
affinity:
29+
{{- include "nodeselector_common" . | indent 10 }}
30+
{{- if .Values.kibana.multidomain.enabled }}
31+
serviceAccountName: osctl-restarter-{{ .Release.Namespace }}
32+
{{- end }}
33+
volumes:
34+
{{- include "osctl_volumes" . | indent 10 }}
35+
containers:
36+
- name: app
37+
image: {{ printf "%s%s:%s" .Values.osctl.image.repo .Values.osctl.image.name .Values.osctl.image.tag }}
38+
imagePullPolicy: {{ .Values.imagePullPolicy }}
39+
command:
40+
- /app/osctl
41+
args:
42+
- datasource
43+
workingDir: /app
44+
volumeMounts:
45+
{{- include "osctl_volume_mounts" . | indent 12 }}
46+
restartPolicy: Never
47+
{{- end }}

0 commit comments

Comments
 (0)