Compare commits

..

21 Commits
rmk ... master

Author SHA1 Message Date
ivan
04d9f75d17 uralkal: deploy Vault-backed SpiceDB and prepare staged IAM upgrade 2026-12-03 18:34:57 +05:00
0818b65fb6 ++ use nexus sarex images in nn-dev 2026-12-03 11:16:41 +03:00
ivan
218a59a539 wb: update inspections backend to contour_32f00e42 2026-12-03 12:55:50 +05:00
ivan
ed0fb7a64c wb: use existing dockerhub registry credentials for admin frontend 2026-12-03 12:26:32 +05:00
ivan
55bc42ecbb wb: manage control-interface namespace 2026-12-03 12:25:45 +05:00
ivan
d533095b8f wb: deploy admin frontend and expose Istio route 2026-12-03 12:25:14 +05:00
4dc99af141 ++ enable nn-dev kafka and configurable helm source type 2026-12-02 16:37:24 +03:00
ivan
39e917aa9e wb: update IAM to production_beb901c6 2026-12-01 17:51:56 +05:00
ivan
f576b1a919 wb: deploy IAM with universal Helm chart 2026-12-01 00:14:28 +05:00
ivan
78a123b55b wb: manage existing IAM with Flux and initialize SpiceDB schema 2026-12-01 00:09:17 +05:00
ivan
69c0340cb4 wb: update sarex backend and record target IAM image 2026-11-30 23:54:21 +05:00
ivan
1963a3f2d9 wb: align EAV and message-hub Kafka event contracts and TLS 2026-11-30 20:50:59 +05:00
ivan
fe149fcf8b wb: update EAV to production_2f877421 2026-11-30 20:40:06 +05:00
ivan
8bd8d743e4 wb: provide optional SENTRY_DSN for pdf-markings startup 2026-11-30 20:37:20 +05:00
ivan
4f801b48e9 wb: update application images and enable CDE in documentations 2026-11-30 20:30:45 +05:00
ivan
3a6214f113 uralkal: pass explicit true to Vector require-healthy 2026-11-30 16:51:52 +05:00
ivan
9ce09df7b1 uralkal: enable service logs and validate Collector/Vector configs 2026-11-30 15:32:48 +05:00
ivan
3420f3e5af wb: add flows-worker-scheduler Celery Beat 2026-11-30 13:43:41 +05:00
ivan
88e9084833 wb: update flows backend and worker to production_5b7915a1 2026-11-30 13:41:07 +05:00
ivan
b036f2b644 wb: use public BASE_HOST for export-reviews links 2026-11-30 12:54:33 +05:00
emelinda
018414a676 Add service log collection for Uralkal using OTel agents and an OTLP pipeline to Vector, with Parquet/Zstd output to MinIO, Kubernetes metadata, credential masking, pod-local disk buffers, network policies, and metrics scraping. Document Terraform-managed MinIO and Vault provisioning with 14-day retention, and remove standalone bootstrap scripts and test artifacts. 2026-11-29 22:27:48 +04:00
560 changed files with 2432 additions and 38311 deletions

View File

@ -1,178 +0,0 @@
import copy
import os
import re
import shutil
import subprocess
import sys
import yaml
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CHARTS = os.path.join(REPO, ".rmk-charts")
OUT = os.path.join(REPO, "rmk", "infrastructure")
WORK = os.path.join(REPO, ".rmk-render", "work")
COMPONENTS = {
# component: (chart tgz, overlay patch file, [extra plain yaml files])
"camunda": ("camunda-contour-11.0.14.tgz", "camunda.yaml",
["keycloak-krb5.yaml", "uralkali-ca.yaml", "ldap-debug/pod.yaml"]),
"istio-base": ("istio-base-contour-1.24.0.tgz", None, []),
"istio-config": ("istio-config-contour-0.1.0.tgz", "istio-config.yaml",
["minio-serviceentry.yaml", "zitadel-jwks-serviceentry.yaml"]),
"istio-gateway": ("istio-gateway-contour-1.24.0.tgz", "istio-gateway.yaml", []),
"istio-pilot": ("istiod-contour-1.24.0.tgz", "istio-pilot.yaml", []),
"kafka": ("kafka-contour-0.1.15.tgz", "kafka.yaml", ["kafka-scram-users-job.yaml"]),
"rabbitmq": ("rabbitmq-contour-15.2.4.tgz", "rabbitmq.yaml", []),
"superset": ("superset-prod-0.13.3.tgz", "superset.yaml", []),
"trino": ("trino-prod-0.33.0.tgz", "trino.yaml", []),
"vault": ("vault-contour-0.2.3.tgz", "vault.yaml", []),
"zitadel": ("idp-contour-4.12.13.tgz", "zitadel.yaml", ["uralkali-ca.yaml"]),
}
NAMESPACE_PATCH = {"superset": "superset-namespace.yaml", "trino": "trino-namespace.yaml"}
def load(p):
with open(p, encoding="utf-8") as f:
return yaml.safe_load(f)
def sm_merge(base, overlay):
"""Approximate kustomize strategic merge: dicts recursive, lists of dicts
merged by 'name', everything else replaced."""
if isinstance(base, dict) and isinstance(overlay, dict):
out = copy.deepcopy(base)
for k, v in overlay.items():
out[k] = sm_merge(out[k], v) if k in out else copy.deepcopy(v)
return out
if isinstance(base, list) and isinstance(overlay, list):
if all(isinstance(i, dict) and "name" in i for i in base + overlay) and base and overlay:
out = copy.deepcopy(base)
idx = {i["name"]: n for n, i in enumerate(out)}
for item in overlay:
if item["name"] in idx:
out[idx[item["name"]]] = sm_merge(out[idx[item["name"]]], item)
else:
out.append(copy.deepcopy(item))
return out
return copy.deepcopy(overlay)
return copy.deepcopy(overlay)
def run(cmd, **kw):
r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", **kw)
if r.returncode != 0:
raise RuntimeError(f"FAILED {' '.join(cmd)}\n{r.stdout}\n{r.stderr}")
return r.stdout
def write_docs(yaml_text, outdir, prefix_note=""):
os.makedirs(outdir, exist_ok=True)
written = []
seen = {}
for doc in yaml.safe_load_all(yaml_text):
if not doc or not isinstance(doc, dict) or "kind" not in doc:
continue
kind = doc["kind"].lower()
name = doc.get("metadata", {}).get("name", "unnamed")
fname = f"{kind}-{name}.yaml"
fname = re.sub(r"[^A-Za-z0-9_.-]", "-", fname)
if fname in seen:
ns = doc.get("metadata", {}).get("namespace")
if ns:
fname = f"{kind}-{ns}-{name}.yaml"
fname = re.sub(r"[^A-Za-z0-9_.-]", "-", fname)
if fname in seen:
seen[fname] += 1
fname = fname.replace(".yaml", f"-{seen[fname]}.yaml")
seen[fname] = seen.get(fname, 0) + 1
with open(os.path.join(outdir, fname), "w", encoding="utf-8", newline="\n") as f:
f.write(yaml.safe_dump(doc, allow_unicode=True, sort_keys=False, width=4096))
written.append(fname)
return written
def main():
shutil.rmtree(WORK, ignore_errors=True)
os.makedirs(WORK, exist_ok=True)
summary = {}
for comp, (tgz, patch_file, extras) in COMPONENTS.items():
cdir = os.path.join(REPO, "infrastructure", comp)
hr = load(os.path.join(cdir, "base", "helmrelease.yaml"))
overlay = None
if patch_file:
overlay = load(os.path.join(cdir, "uralkal", patch_file))
hr = sm_merge(hr, overlay)
spec = hr["spec"]
name = spec.get("releaseName") or hr["metadata"]["name"]
ns = hr["metadata"]["namespace"]
values = spec.get("values", {})
wdir = os.path.join(WORK, comp)
os.makedirs(wdir, exist_ok=True)
vfile = os.path.join(wdir, "values.yaml")
with open(vfile, "w", encoding="utf-8", newline="\n") as f:
yaml.safe_dump(values, f, allow_unicode=True, sort_keys=False, width=4096)
chart = os.path.join(CHARTS, tgz)
rendered = run(["helm", "template", name, chart, "-n", ns,
"-f", vfile, "--include-crds", "--kube-version", "1.30.0"])
# apply postRenderers (JSON6902 patches via kubectl kustomize)
prs = spec.get("postRenderers", [])
patches = []
for pr in prs:
for p in pr.get("kustomize", {}).get("patches", []):
patches.append({"target": p["target"], "patch": p["patch"]})
if patches:
with open(os.path.join(wdir, "rendered.yaml"), "w", encoding="utf-8", newline="\n") as f:
f.write(rendered)
kust = {"apiVersion": "kustomize.config.k8s.io/v1beta1",
"kind": "Kustomization",
"resources": ["rendered.yaml"],
"patches": patches}
with open(os.path.join(wdir, "kustomization.yaml"), "w", encoding="utf-8", newline="\n") as f:
yaml.safe_dump(kust, f, sort_keys=False)
rendered = run(["kubectl", "kustomize", wdir])
outdir = os.path.join(OUT, comp)
shutil.rmtree(outdir, ignore_errors=True)
files = write_docs(rendered, outdir)
# base namespace
nsfile = os.path.join(cdir, "base", "namespace.yaml")
if os.path.exists(nsfile):
nsdocs = [d for d in yaml.safe_load_all(open(nsfile, encoding="utf-8")) if d]
nspatch = NAMESPACE_PATCH.get(comp)
if nspatch:
nsdocs = [sm_merge(d, load(os.path.join(cdir, "uralkal", nspatch)))
if d.get("kind") == "Namespace" else d for d in nsdocs]
for d in nsdocs:
fname = re.sub(r"[^A-Za-z0-9_.-]", "-",
f"{d['kind'].lower()}-{d['metadata']['name']}.yaml")
with open(os.path.join(outdir, fname), "w", encoding="utf-8", newline="\n") as f:
yaml.safe_dump(d, f, allow_unicode=True, sort_keys=False)
files.append(fname)
# extra plain resources from overlay
for extra in extras:
src = os.path.join(cdir, "uralkal", extra)
if not os.path.exists(src):
continue
for doc in yaml.safe_load_all(open(src, encoding="utf-8")):
if not doc:
continue
fname = re.sub(r"[^A-Za-z0-9_.-]", "-",
f"{doc['kind'].lower()}-{doc['metadata']['name']}.yaml")
with open(os.path.join(outdir, fname), "w", encoding="utf-8", newline="\n") as f:
yaml.safe_dump(doc, f, allow_unicode=True, sort_keys=False, width=4096)
files.append(fname)
summary[comp] = files
print(f"[{comp}] {len(files)} files")
print("\nDONE")
return summary
if __name__ == "__main__":
main()

View File

@ -0,0 +1,94 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: admin-frontend
namespace: control-interface
spec:
interval: 10m
chart:
spec:
chart: universal-chart
version: "0.1.7"
sourceRef:
kind: HelmRepository
name: yc-oci-charts
namespace: flux-system
interval: 10m
install:
remediation:
retries: 1
upgrade:
remediation:
retries: 1
values:
global:
env: _default
services:
admin-frontend:
enabled: true
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/admin-frontend:uralkal_4d0a3684
pullPolicy:
_default: IfNotPresent
deployment:
enabled: true
name:
_default: admin-frontend
replicaCount:
_default: 1
port:
_default: 80
resources:
requests:
cpu:
_default: 100m
memory:
_default: 100Mi
probes:
liveness:
enabled: false
readiness:
enabled: false
service:
enabled: true
name:
_default: admin-frontend-svc
type:
_default: ClusterIP
port:
_default: 8080
targetPort:
_default: 80
portName:
_default: http
imagePullSecrets:
enabled:
_default: true
name:
_default: dockerhub
commitSha: ""
gitlabUri: ""
gitlabJobUrl: ""
owner: ""

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: control-interface
resources:
- namespace.yaml
- admin-frontend.yaml

View File

@ -1,6 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: control-interface

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_7d0ec48b
_default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_6f5ad8ab
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/sarex-frontend-dev:contour_5.22.3
_default: cr.yandex/crp3ccidau046kdj8g9q/sarex-frontend-dev:contour_5.43.0
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_ee0a6717
_default: cr.yandex/crp3ccidau046kdj8g9q/srx-admin:prod_de4fb6d8
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/documentations:prod_358ca69c
_default: cr.yandex/crp3ccidau046kdj8g9q/documentations:prod_65f44db2
pullPolicy:
_default: IfNotPresent
@ -137,7 +137,11 @@ spec:
- name: CDE_API_ENABLED
value:
_default: "false"
_default: "true"
- name: CDE_API_URL
value:
_default: "http://cde-api.documentations.svc.cluster.local:8000"
- name: ZITADEL_ACCOUNT
value:

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/documentations-api-files:prod_fef3add2
_default: cr.yandex/crp3ccidau046kdj8g9q/documentations-api-files:prod_65f44db2
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/documentation-frontend-app:brusnika_e5f99d7c
_default: cr.yandex/crp3ccidau046kdj8g9q/documentation-frontend-app:brusnika_64155bf6
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/pdf-markings-amqp:prod_9dea5b64
_default: cr.yandex/crp3ccidau046kdj8g9q/pdf-markings-amqp:prod_3ab263be
pullPolicy:
_default: IfNotPresent

View File

@ -106,6 +106,10 @@ spec:
_default: documentations-yc-s3
envs:
- name: SENTRY_DSN
value:
_default: ""
- name: APP_NAME
value:
_default: "pdm_v2"

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/pdmv2:prod_9507c2d5
_default: cr.yandex/crp3ccidau046kdj8g9q/pdmv2:prod_70b31308
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/eav:prod_0dcebba6
_default: cr.yandex/crp3ccidau046kdj8g9q/eav:production_2f877421
pullPolicy:
_default: IfNotPresent
@ -55,12 +55,12 @@ spec:
resources:
limits:
cpu:
_default: 20m
_default: 500m
memory:
_default: 972Mi
requests:
cpu:
_default: 10m
_default: 100m
memory:
_default: 774Mi
@ -131,11 +131,43 @@ spec:
- name: KAFKA_HOST
value:
_default: "wb-stage-kafka-bootstrap.kafka.svc.cluster.local:9093"
_default: "wb-prod-kafka-bootstrap.kafka.svc.cluster.local:9093"
- name: KAFKA_ENABLED
value:
_default: "False"
_default: "True"
- name: SECURITY_PROTOCOL
value:
_default: "SSL"
- name: SASL_MECHANISM
value:
_default: "PLAIN"
- name: KAFKA_TOPIC_ATTRIBUTE_CREATED
value:
_default: "eav.attribute.created.v1"
- name: KAFKA_TOPIC_ATTRIBUTE_UPDATED
value:
_default: "eav.attribute.updated.v1"
- name: KAFKA_TOPIC_ATTRIBUTE_DELETED
value:
_default: "eav.attribute.deleted.v1"
- name: KAFKA_TOPIC_ASSET_CREATED
value:
_default: "eav.asset.created.v1"
- name: KAFKA_TOPIC_ASSET_UPDATED
value:
_default: "eav.asset.updated.v1"
- name: KAFKA_TOPIC_ASSET_DELETED
value:
_default: "eav.asset.deleted.v1"
- name: ASSETS_TOPIC
value:

View File

@ -1,4 +1,3 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
@ -7,32 +6,32 @@ metadata:
data:
kafka.crt: |
-----BEGIN CERTIFICATE-----
MIIFLTCCAxWgAwIBAgIUA5L48eHPMqNFYE5wIgaOmWgG3okwDQYJKoZIhvcNAQEN
MIIFLTCCAxWgAwIBAgIUa4PO/BPk4+3iuMHChzLzNWLuzjowDQYJKoZIhvcNAQEN
BQAwLTETMBEGA1UECgwKaW8uc3RyaW16aTEWMBQGA1UEAwwNY2x1c3Rlci1jYSB2
MDAeFw0yNTA2MDQxMTMzMTRaFw0yNjA2MDQxMTMzMTRaMC0xEzARBgNVBAoMCmlv
MDAeFw0yNjExMTYxNDM1MDlaFw0yNzExMTYxNDM1MDlaMC0xEzARBgNVBAoMCmlv
LnN0cmltemkxFjAUBgNVBAMMDWNsdXN0ZXItY2EgdjAwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQDV2NBVwnXISH9i8K4KxSd2AThwgQyRKyeIfcqeYZ4F
7FguEUI7uEtoWd4uO8DsIzoMoLYv5L1DfhNYUFWN3XYQd4XVFnwYQYbwspdC1L8G
u0T7943gRRRomcNP8n5nycfeZgZgmz9IS8vmxgRh4ao0kcCW49uBQMd706087UAI
qaRJTcabTZq1LTeoH9AOAyT/nawKm+1H5VmrMUBjzz9xKVXF0sCrhjYoZoM4x+fY
AphtxZDB21ZhEcHBbytEQkEm0QTbUP4xbu95yqY6goYi9S9R1uMgVZ9DoJVwyqLm
/3ZGPjd9VmdBPO/zE/Bj890DjyKS7AXo9d+Iyv4M2QD1jA+5j4JyHzk7Lroz+HTg
mwVpcVGafBWIC4qFt7C3UYt6IV64/MA2v9gxTIdJvOBZxKUiMl7f65jKNEntF6is
86QCkjhvt34AThEoGx8SPjVr3sOBuneqcybeSYLyEWFg9Z1mWfMLHlA/Fp/Y2wpM
w1ZXj6uAa/UNUAIfkaLTOKHHaCCVD2G3Vkm94NHOJmDj6ze8P0J0H+Ub6ULD7hHr
8obOSk9OvxoxVzE+UW7DyEL6YD8MBVUQKJIQVgZmpT4akWyz8bNhFRzgTnKAhwNN
ATrGmjfX/wj7tCpy/PoJjEiu54sXW5xplBIz/ZgYHrPkyrbhQxsRozgQ+UIMIIbJ
/wIDAQABo0UwQzAdBgNVHQ4EFgQUkU4HKndgWxhcXMAe5XBc4OJwSgcwEgYDVR0T
AQUAA4ICDwAwggIKAoICAQCfzDZhEzw2pbU5Xpu8OzD+3iQG+DVjU8PQWWQEF27h
yjohDkUr3zCZtW7xMKWKUNxBgrKsfe4TDOQN8cij3cS9sy0So+UhMeF7Bq9PU1Yd
bmTRq8q1PiuNUkiCGJ5wrb3+NZvVxZLJUIFgiealsRw80MgMWWSzy0I35T2Edn/a
DU4jhlgQxyzQ621+oGP0n28gCjmm6pCq2tkj/Z8WTdu1gOWyRdK02a2uE2Ts2nLa
Di32GaZrIbIuD/WUd6Ek66uCeJvh2CT7s+SqgtMbtT7gibUuPQ3hk1VGQsjy22l3
hUNpLu86nrwbuf21mY55KnLOcaVq1ag1TpIIKfZAL/KWFCGZ6H6kwEIbCAL0Hei7
cJ2Wm2/qlzKUeU869M7YybZAfXl/t6XT4QgFgje+42N980vy5A4GhWi1Z7lPqqOe
jPGBstkRZybKz1sTk87+oJx82iQU/ozVmzjSEK1SoYRNbvug8PNpxmPoPnJ2flgG
t2q2+2ZQP3f1aAHVcZ3U5+hWlRmKPXzjrJv7gnhuvqJl7OwB50y+yWiVfZ9xrYl2
EpX+yHuFFK+9NnB5taUK8Fz+hQaLU8J4q7P0bRqkoI+LdcEErjuDT/eI2d5+Ql8K
/JkV823hX2WNB9bdaQ24BelVUbsxGpR7ms6KWrM11kHnbzUlEM+AxZES6F7Qbr55
TwIDAQABo0UwQzAdBgNVHQ4EFgQUM7hshx7e9TFEN82Pf446aBrJUA4wEgYDVR0T
AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIB
AFLi5QLawZollou3+m5kYcBe5F8xKG5NlgNmKyIREnwD2AP4xrr2tNFbmP2hpEl4
bWJJ84IHlKjpYxFLboWzgtW/JvdxcEh0K/x8/7cOD3Kk9d/LR9muj57mFYSQGlbo
g0+lHNuLam8xGcnGVV5VdfcjFz72/q92ndTlJmz+v6OneTJvIypKoBmNKF25alz9
pR2sTwoG0Pcwm30u/uS6pOewQ4sTiniOcc1MFYF7tl/Zz9Mqza8Rer0B5nm8lE/J
Yo9UaEXyVLM8Y5kSOkxMlOK+8/UMeY/lcQYpd5tYVpvarnoPCjmUjt4iVw26ZsAH
y4/vNW+wX+Uauarik1jHL/SauAjS3FbJoH06BBnji7J/Rud2DtSd+vVZrIBLJkaH
+Xg/roD3xKx0XmhLJmPvxGrkyehbhkbJkPKCHa9P56rnev3MYjyy+SV7Vp8Dq+HF
Wkswl3QUPWx9reuvF2KMyt04Tw94UAxCUGkX5qg7Dq5d0Fj/AcIrFdLTCV8eG/UI
1kKRxmZ2/ALINBOlfJOVVovKBlWpPACs8iy6XreOXtoQfzoG2F9Vo3Jmzjpqsmz0
9Ao4s2vcz3UuDtBhpwGp4N3zroyst/kQjtZirj4cS7fu75tB5N5mQ/tTwg0Tiw+Y
XIdxeE73V5DAf4Dd5V1VdCbA6oQv5qJYvinYydyx4x3V
AIZDUvQeimpvHncASAoBxQ6VBfGOYRKRnK7a8yK33M7X0CiZl0FtQM68mM/tkrMV
RT7KzTIg2wLCMaQ6RJHOHHD0mevAcsGzqDIvIOk/FH57AWnrD41qJFTnWRBkbWzM
Q/qke9H1+Z0LTt6gJ4qZpoYi33FaPZZ+Q6aMvNYnf1y1SsQy7jBXK/ifB0az8FWI
C8/QxoGjEhG+/w/8Z0fVOeuU7QQFgefQdZQnS2hfFhs9kGqwg6BKtAt056v/BMGq
ONqCNS5mhfZpXYB17oYAixSxGxYsbOAuX9dpvfYeNBAMpGc8+ooU8D6lEBCrgyS0
HusnOGHDSBAdj+AiaytZ2+G3oJ/Herx25OPClt9yIpxSeapaVomNeItzegC5DH36
lYIJW0htvpctqV/vXTFS6zUdOzMazDCTch9f8eBizEpsIiH8AamTDqq5/Q5Kn8Sz
oW6XkxF5DDopzGTXjtI2HJfbCEMe04d7yW3bQ9amIOl3jWpKzRJvWT/FXHcf29s+
viEBP5kybgewVPK7HoKYbHyLvxbTYyauh8aeFrLgklZjK8lQvd0yNPaVYRAJ6C4m
eBBW+JAJOAELDtC+adA2ucoUmbROaXF3u1hAA9JWbqL9w+1AsX4plinC6ojPFajl
H1L4iq3Pjsfnqnc1VuthdgkPq3qGmybH5a+lCpWecpxV
-----END CERTIFICATE-----

View File

@ -97,7 +97,7 @@ spec:
envs:
- name: BASE_HOST
value:
_default: "http://frontend-service.django.svc.cluster.local:80"
_default: "https://srx.wb.ru"
- name: DJANGO_HOST
value:

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-backend:production_81d0fa17
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-backend:production_5b7915a1
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-backend_worker:production_81d0fa17
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-backend_worker:production_5b7915a1
pullPolicy:
_default: IfNotPresent

View File

@ -0,0 +1,399 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: flows-worker-scheduler
namespace: flows
spec:
interval: 10m
chart:
spec:
chart: universal-chart
version: "0.1.7"
sourceRef:
kind: HelmRepository
name: yc-oci-charts
namespace: flux-system
interval: 10m
install:
remediation:
retries: 3
upgrade:
remediation:
retries: 3
values:
global:
env: _default
services:
flows-worker-scheduler:
enabled: true
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-backend_worker:production_5b7915a1
pullPolicy:
_default: IfNotPresent
deployment:
enabled: true
name:
_default: flows-worker-scheduler
replicaCount:
_default: 1
port:
_default: 8000
command:
_default: ["celery", "-A", "src.worker", "beat", "-l", "INFO"]
resources:
limits:
cpu:
_default: 60m
memory:
_default: 465Mi
requests:
cpu:
_default: 30m
memory:
_default: 372Mi
probes:
liveness:
enabled: false
readiness:
enabled: false
service:
enabled: false
imagePullSecrets:
enabled:
_default: true
name:
_default: dockerhub
volumes:
_default:
- name: kafka-configmap
mountPath:
_default: /opt/src/flow/kafka.py
subPath:
_default: kafka.py
readOnly:
_default: true
configMap:
name:
_default: kafka-configmap
items:
- key: kafka.py
path:
_default: kafka.py
envs:
- name: KAFKA_HOST
value:
_default: "wb-prod-kafka-bootstrap.kafka.svc.cluster.local:9093"
- name: KAFKA_SSL_CERT
value:
_default: |
-----BEGIN CERTIFICATE-----
MIIFLTCCAxWgAwIBAgIUYDZPxGRsr7IiqHEmfd07QTQlOKYwDQYJKoZIhvcNAQEN
BQAwLTETMBEGA1UECgwKaW8uc3RyaW16aTEWMBQGA1UEAwwNY2x1c3Rlci1jYSB2
MDAeFw0yNTEyMTYxNDM0NTVaFw0yNjEyMTYxNDM0NTVaMC0xEzARBgNVBAoMCmlv
LnN0cmltemkxFjAUBgNVBAMMDWNsdXN0ZXItY2EgdjAwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCfzDZhEzw2pbU5Xpu8OzD+3iQG+DVjU8PQWWQEF27h
yjohDkUr3zCZtW7xMKWKUNxBgrKsfe4TDOQN8cij3cS9sy0So+UhMeF7Bq9PU1Yd
bmTRq8q1PiuNUkiCGJ5wrb3+NZvVxZLJUIFgiealsRw80MgMWWSzy0I35T2Edn/a
DU4jhlgQxyzQ621+oGP0n28gCjmm6pCq2tkj/Z8WTdu1gOWyRdK02a2uE2Ts2nLa
Di32GaZrIbIuD/WUd6Ek66uCeJvh2CT7s+SqgtMbtT7gibUuPQ3hk1VGQsjy22l3
hUNpLu86nrwbuf21mY55KnLOcaVq1ag1TpIIKfZAL/KWFCGZ6H6kwEIbCAL0Hei7
cJ2Wm2/qlzKUeU869M7YybZAfXl/t6XT4QgFgje+42N980vy5A4GhWi1Z7lPqqOe
jPGBstkRZybKz1sTk87+oJx82iQU/ozVmzjSEK1SoYRNbvug8PNpxmPoPnJ2flgG
t2q2+2ZQP3f1aAHVcZ3U5+hWlRmKPXzjrJv7gnhuvqJl7OwB50y+yWiVfZ9xrYl2
EpX+yHuFFK+9NnB5taUK8Fz+hQaLU8J4q7P0bRqkoI+LdcEErjuDT/eI2d5+Ql8K
/JkV823hX2WNB9bdaQ24BelVUbsxGpR7ms6KWrM11kHnbzUlEM+AxZES6F7Qbr55
TwIDAQABo0UwQzAdBgNVHQ4EFgQUM7hshx7e9TFEN82Pf446aBrJUA4wEgYDVR0T
AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIB
AFNHFGPDxY966fz0dxDFFSfeo47y7XQZMK9xAwH73cQoSeqx+IMxzgM8nfJQ9XMN
PeLwVRZ7pvRee2ZhUPglBSTHnW2rvfmLBOO9xyKZxRsCkoFxuHH9xfM7bFWb96R6
fGrOdEZDB3yj00T+tkubwqt+/dUhQUj8juwyPs55WMb/0BIbapaoQ6QOP13CaXDV
ZmAfsEEIBkNxfq7GTr/z0Rq0B4+9FxAf3Jrsmi/dYoFD/prHsvBDkYw1daoFyp5C
tbctvB9wtphnCCynekt8UBvpVKHUU/xaUa09TQTToXjBbV1SZeIOHNG0MNbWa4sz
AL/cpXdq1EAxiTeAVT9XhCwhe/xJvFZIWuFLmW3J+ZxrOUCKieCYpTqBY2tBkkDY
//egic787yTR6zxqQNSzvNU5LhzrN7lu+KHGM06T35+HvpzgPPiRCzsxO62p63op
mq04K31yYZgLiqeAj5W+rioRGJNn4TXJpH9KIrzmGM7lVWLYWMAKeZU4r1lDUdcu
7jsBH8BRJWJeVK3xVw2HB3lk7Xn0WrR92adeYQ3f0vKbMIAVUnSJ3yCKJ4NMFSki
j78nx2mi/G0RhUPGZ9hhLXQKj9BtbpEnwpbGWtf0ShtVOxD/HKLCr7koBtW9TMPS
9K0sJhE5VjsQLkDDu9p3GdRcuLNA/oa7xFvRFtqGFsLj
-----END CERTIFICATE-----
- name: LOG_LEVEL
value:
_default: "DEBUG"
- name: FLOWS_HOST
value:
_default: "http://backend-service.flows.svc.cluster.local:8000"
- name: DOCUMENTATION_PG_PORT
value:
_default: "5432"
- name: DOCUMENTATION_PG_DATABASE
value:
_default: "documentations_db"
- name: DOCUMENTATION_PG_HOST
value:
_default: "sarex-vpsql-01.xc.wb.ru"
- name: BASE_HOST
value:
_default: "https://lk.srx.wb.ru:30443"
- name: CELERY_QUEUE
value:
_default: "flow"
- name: RESOURCES_HOST
value:
_default: "http://iams.iam.svc.cluster.local:8080"
- name: DJANGO_HOST
value:
_default: "http://backend.django.svc.cluster.local:8000/api"
- name: DOCUMENTATION_HOST
value:
_default: "http://documentations-api.documentations.svc.cluster.local:8080/internal/v1"
- name: DOCUMENTATION_EXTERNAL_HOST
value:
_default: "http://documentations-api.documentations.svc.cluster.local:8080/api/v1"
- name: ENABLE_ANALYTICS
value:
_default: "1"
- name: FLOWS_DB_HOST
value:
_default: "sarex-vpsql-01.xc.wb.ru"
- name: FLOWS_DB_PORT
value:
_default: "5432"
- name: ISSUES_DB_PORT
value:
_default: "5432"
- name: ISSUES_DB_HOST
value:
_default: "sarex-vpsql-01.xc.wb.ru"
- name: ENABLE_CELERY
value:
_default: "1"
- name: ENABLE_MAILGUN
value:
_default: "0"
- name: ENABLE_METRICS
value:
_default: "0"
- name: FROM_EMAIL
value:
_default: "wb@wb.ru"
- name: GATEWAY_URL
value:
_default: "http://pdm-api.documentations.svc.cluster.local:8080"
- name: PG_HOST
value:
_default: "sarex-vpsql-01.xc.wb.ru"
- name: PG_PORT
value:
_default: "5432"
- name: RABBITMQ_HOST
value:
_default: "rabbitmq.rabbitmq.svc.cluster.local"
- name: RABBITMQ_PORT
value:
_default: "5672"
- name: DJANGO_BASE_HOST
value:
_default: "https://srx.wb.ru"
- name: RESOURCE_URL
value:
_default: "http://iams.iam.svc.cluster.local:8080"
- name: SERVICE_HOST
value:
_default: "https://lk.srx.wb.ru:30443/flows/api/v1"
- name: SMTP_HOST
value:
_default: "smtp-relay.wb.com"
- name: SMTP_PORT
value:
_default: "587"
- name: SYNC_RESOURCE_ID
value:
_default: "1"
- name: TIMEOUT
value:
_default: "120"
- name: WORKFLOWS_HOST
value:
_default: "http://workflows-api-service.workflow.svc.cluster.local:8000/api/v1"
- name: WORKFLOWS_TIMEOUT
value:
_default: "60"
- name: DOCUMENTATION_TIMEOUT
value:
_default: "60"
secretEnvs:
- name: ADMIN_PANEL_SECRET_KEY
secretName:
_default: "admin-secret"
secretKey: "key"
- name: JWT_PUBLIC_KEY
secretName:
_default: "jwt-secret"
secretKey: "public_key"
- name: DOCUMENTATION_PG_USERNAME
secretName:
_default: "postgres-secret-documentations"
secretKey: "username"
- name: DOCUMENTATION_PG_PASSWORD
secretName:
_default: "postgres-secret-documentations"
secretKey: "password"
- name: FLOWS_DB_DB
secretName:
_default: "postgres-secret"
secretKey: "database"
- name: FLOWS_DB_USERNAME
secretName:
_default: "postgres-secret"
secretKey: "username"
- name: FLOWS_DB_PASSWORD
secretName:
_default: "postgres-secret"
secretKey: "password"
- name: ISSUES_DB_DB
secretName:
_default: "postgres-secret-issues"
secretKey: "database"
- name: ISSUES_DB_USERNAME
secretName:
_default: "postgres-secret-issues"
secretKey: "username"
- name: ISSUES_DB_PASSWORD
secretName:
_default: "postgres-secret-issues"
secretKey: "password"
- name: DJANGO_AUTH
secretName:
_default: "django-secret"
secretKey: "token"
- name: DJANGO_TOKEN
secretName:
_default: "django-secret"
secretKey: "token"
- name: PG_DB
secretName:
_default: "postgres-secret"
secretKey: "database"
- name: PG_LOGIN
secretName:
_default: "postgres-secret"
secretKey: "username"
- name: PG_PASSWORD
secretName:
_default: "postgres-secret"
secretKey: "password"
- name: RABBITMQ_USERNAME
secretName:
_default: "rabbitmq-secret"
secretKey: "username"
- name: RABBITMQ_PASSWORD
secretName:
_default: "rabbitmq-secret"
secretKey: "password"
- name: RABBITMQ_VHOST
secretName:
_default: "rabbitmq-secret"
secretKey: "vhost"
- name: KAFKA_USERNAME
secretName:
_default: "kafka-secret"
secretKey: "username"
- name: KAFKA_PASSWORD
secretName:
_default: "kafka-secret"
secretKey: "password"
commitSha: ""
gitlabUri: ""
gitlabJobUrl: ""
owner: ""
postRenderers:
- kustomize:
patches:
- target:
group: apps
version: v1
kind: Deployment
name: flows-worker-scheduler
patch: |-
- op: add
path: /spec/strategy
value:
type: Recreate

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-frontend:contour_4652ff61
_default: cr.yandex/crp3ccidau046kdj8g9q/flows-frontend:contour_33428cef
pullPolicy:
_default: IfNotPresent

View File

@ -7,4 +7,5 @@ resources:
- kafka-configmap.yaml
- backend.yaml
- celery.yaml
- flows-worker-scheduler.yaml
- frontend.yaml

View File

@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: iam-spicedb-schema
namespace: iam
data:
schema.json: '{"schema": "definition auth_group {\n\trelation grants: django_permission\n}\n\n// Org structure.
department \u0431\u0435\u0437 parent \u043c\u0435\u0436\u0434\u0443 department.\ndefinition department {\n\trelation
tenant: tenant\n\trelation member: user\n\trelation service_account: service_account\n\trelation groups: auth_group\n\tpermission
group_grants = groups->grants\n}\n\ndefinition django_permission {}\n\ndefinition position {\n\trelation tenant:
tenant\n\trelation department: department\n\trelation holder: user\n\trelation service_account: service_account\n\trelation
groups: auth_group\n\trelation scoped_resource: resource\n\tpermission group_grants = groups->grants\n}\n\ndefinition
resource {\n\trelation tenant: tenant\n\trelation parent: resource\n\n\trelation read: service_account | service_account#member\n\trelation
write: service_account | service_account#member\n\trelation admin: service_account | service_account#member\n\trelation
view: service_account | service_account#member\n\n\tpermission inherited_read = read + write + admin + parent->inherited_read\n\tpermission
inherited_write = write + admin + parent->inherited_write\n\tpermission inherited_admin = admin + parent->inherited_admin\n\n\tpermission
allow_read = inherited_read + view + tenant->unrestricted\n\tpermission allow_write = inherited_write\n\tpermission
allow_admin = inherited_admin\n}\n\ndefinition service_account {\n\trelation direct_member: user\n\tpermission
member = direct_member\n}\n\ndefinition tenant {\n\trelation unrestricted: service_account | service_account#member\n}\n\ndefinition
user {\n\trelation direct: django_permission\n\trelation member: auth_group\n\trelation holder: position\n\trelation
department_member: department\n\tpermission global_grant = direct + member->grants + holder->group_grants +
department_member->group_grants\n\tpermission resource_position_grant = holder->group_grants\n}\n"}'

View File

@ -0,0 +1,153 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: iam-backend
namespace: iam
spec:
values:
services:
backend:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/iams:production_beb901c6
deployment:
args:
_default:
- |
set -a
[ -f /vault/secrets/iam-db ] && . /vault/secrets/iam-db
[ -f /vault/secrets/iam-zitadel ] && . /vault/secrets/iam-zitadel
[ -f /vault/secrets/iam-kafka ] && . /vault/secrets/iam-kafka
[ -f /vault/secrets/iam-s3 ] && . /vault/secrets/iam-s3
[ -f /vault/secrets/iam-spicedb ] && . /vault/secrets/iam-spicedb
set +a
exec ./server
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
probes:
readiness:
enabled: true
httpGet:
path:
_default: /api/health
port:
_default: 8080
periodSeconds:
_default: 5
timeoutSeconds:
_default: 3
envs:
- name: ENVIRONMENT
value:
_default: prod
- name: LOG_LEVEL
value:
_default: debug
- name: AUTH_ENABLED
value:
_default: 'true'
- name: HTTP_PORT
value:
_default: '8080'
- name: HTTP_READ_BUFFER_SIZE
value:
_default: '131072'
- name: DB_MIGRATIONS_PATH
value:
_default: migrations
- name: ZITADEL_ENABLED
value:
_default: 'true'
- name: ZITADEL_HOST
value:
_default: https://login.sarex.local.uralkali.com
- name: ZITADEL_ORG_RULES_FILE
value:
_default: config/zitadel/org-rules-prod.json
- name: S3_ENABLED
value:
_default: 'true'
- name: S3_ENDPOINT_URL
value:
_default: http://s3-proxy.s3-proxy.svc.cluster.local
- name: S3_BUCKET_NAME
value:
_default: iam
- name: ZITADEL_TLS_INSECURE_SKIP_VERIFY
value:
_default: 'true'
- name: S3_REGION
value:
_default: ru-central1
- name: S3_PRESIGN_EXPIRES
value:
_default: 1h
- name: KAFKA_ENABLED
value:
_default: 'false'
- name: KAFKA_SSL_CAFILE
value:
_default: /etc/ca-certificates/Yandex/ca-cert
- name: KAFKA_TOPIC_LEGACY_AMS_SYNC
value:
_default: ams-sync
- name: SPICEDB_ENDPOINT
value:
_default: spicedb.spicedb.svc.cluster.local:50051
- name: SPICEDB_INSECURE
value:
_default: 'true'
podAnnotations:
_default:
vault.hashicorp.com/agent-inject-secret-iam-spicedb: secrets/data/apps/spicedb/auth
vault.hashicorp.com/agent-inject-template-iam-spicedb: |-
{{- with secret "secrets/data/apps/spicedb/auth" -}}
SPICEDB_TOKEN='{{ index .Data.data "preshared_key" }}'
{{- end -}}
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411,8200,8443,50051
vault.hashicorp.com/agent-image: cr.yandex/crp3ccidau046kdj8g9q/vault/vault:1.21.2
postRenderers:
- kustomize:
patches:
- target:
kind: Deployment
name: iam-backend
patch: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: iam-backend
spec:
template:
metadata:
annotations:
checksum/spicedb-schema: 72606779239bef9fe18170545d8fb3d70581581048aeea55a390d414197f1ce6
spec:
initContainers:
- name: spicedb-schema
image: cr.yandex/crp3ccidau046kdj8g9q/vault/vault:1.21.2
command:
- /bin/sh
- -ec
args:
- ". /vault/secrets/iam-spicedb\nfor attempt in $(seq 1 60); do\n if wget\
\ -qO /tmp/schema-result.json --header=\"Authorization: Bearer $SPICEDB_TOKEN\"\
\ --header=\"Content-Type: application/json\" --post-file=/schema/schema.json\
\ http://spicedb.spicedb.svc.cluster.local:8443/v1/schema/write; then\n\
\ echo \"SpiceDB schema loaded\"\n exit 0\n fi\n sleep 2\ndone\n\
exit 1\n"
resources:
requests:
cpu: 25m
memory: 32Mi
volumeMounts:
- name: spicedb-schema
mountPath: /schema
readOnly: true
volumes:
- name: spicedb-schema
configMap:
name: iam-spicedb-schema

View File

@ -1,91 +0,0 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: iam-backend
namespace: iam
spec:
values:
services:
backend:
deployment:
resources:
limits:
cpu:
_default: 20m
memory:
_default: 89Mi
requests:
cpu:
_default: 10m
memory:
_default: 64Mi
envs:
- name: ENVIRONMENT
value:
_default: "prod"
- name: LOG_LEVEL
value:
_default: "debug"
- name: AUTH_ENABLED
value:
_default: "true"
- name: HTTP_PORT
value:
_default: "8080"
- name: HTTP_READ_BUFFER_SIZE
value:
_default: "131072"
- name: DB_MIGRATIONS_PATH
value:
_default: "migrations"
- name: ZITADEL_ENABLED
value:
_default: "true"
- name: ZITADEL_HOST
value:
_default: "https://sarex-login.uralmine.com"
- name: ZITADEL_ORG_RULES_FILE
value:
_default: "config/zitadel/org-rules-prod.json"
- name: S3_ENABLED
value:
_default: "true"
- name: S3_ENDPOINT_URL
value:
_default: "http://10.49.10.90:9000"
- name: S3_BUCKET_NAME
value:
_default: "sarex-media-storage"
- name: S3_REGION
value:
_default: "ru-central1"
- name: S3_PRESIGN_EXPIRES
value:
_default: "1h"
- name: KAFKA_ENABLED
value:
_default: "false"
- name: KAFKA_SSL_CAFILE
value:
_default: "/etc/ca-certificates/Yandex/ca-cert"
- name: KAFKA_TOPIC_LEGACY_AMS_SYNC
value:
_default: "ams-sync"

212
apps/iam/wb/backend.yaml Normal file
View File

@ -0,0 +1,212 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: iams
namespace: iam
spec:
interval: 10m
releaseName: iams
chart:
spec:
chart: universal-chart
version: 0.1.9
sourceRef:
kind: HelmRepository
name: yc-oci-charts
namespace: flux-system
interval: 10m
install:
remediation:
retries: 3
upgrade:
remediation:
retries: 3
values:
global:
env: _default
services:
iams:
enabled: true
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/iams:production_beb901c6
pullPolicy:
_default: IfNotPresent
deployment:
enabled: true
name:
_default: iams
replicaCount:
_default: 1
port:
_default: 8080
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
progressDeadlineSeconds:
_default: 600
revisionHistoryLimit:
_default: 10
terminationGracePeriodSeconds:
_default: 30
probes:
liveness:
enabled: false
readiness:
enabled: true
httpGet:
path:
_default: /api/health
port:
_default: http
initialDelaySeconds:
_default: 5
periodSeconds:
_default: 10
timeoutSeconds:
_default: 8
failureThreshold:
_default: 3
service:
enabled: true
name:
_default: iams
type:
_default: ClusterIP
port:
_default: 8080
targetPort:
_default: 8080
portName:
_default: http
imagePullSecrets:
enabled:
_default: true
name:
_default: dockerhub
podAnnotations:
_default:
proxy.istio.io/config: "tracing:\n sampling: 100\n zipkin:\n address: signoz-otel-collector-external.signoz.svc.cluster.local:9411\n custom_tags:\n k8s.pod.name:\n environment:\n name: POD_NAME\n k8s.namespace.name:\n environment:\n name: POD_NAMESPACE\n k8s.pod.ip:\n environment:\n name: INSTANCE_IP\n"
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411
checksum/spicedb-schema: 72606779239bef9fe18170545d8fb3d70581581048aeea55a390d414197f1ce6
envs:
- name: SPICEDB_ENDPOINT
value:
_default: spicedb.spicedb.svc.cluster.local:50051
- name: SPICEDB_INSECURE
value:
_default: 'true'
- name: ENVIRONMENT
value:
_default: prod
- name: LOG_LEVEL
value:
_default: debug
- name: AUTH_ENABLED
value:
_default: 'true'
- name: HTTP_PORT
value:
_default: '8080'
- name: HTTP_READ_BUFFER_SIZE
value:
_default: '131072'
- name: DB_MIGRATIONS_PATH
value:
_default: migrations
- name: ZITADEL_ENABLED
value:
_default: 'true'
- name: ZITADEL_HOST
value:
_default: https://zitadel-srx.wb.ru
- name: ZITADEL_ORG_RULES_FILE
value:
_default: config/zitadel/org-rules-prod.json
- name: S3_ENABLED
value:
_default: 'false'
- name: S3_ENDPOINT_URL
value:
_default: https://storage.yandoud.net
- name: S3_BUCKET_NAME
value:
_default: sarex-media-storage
- name: S3_REGION
value:
_default: ru-central1
- name: S3_PRESIGN_EXPIRES
value:
_default: 1h
- name: KAFKA_ENABLED
value:
_default: 'false'
- name: KAFKA_SECURITY_PROTOCOL
value:
_default: SASL_SSL
- name: KAFKA_SASL_MECHANISM
value:
_default: SCRAM-SHA-512
- name: KAFKA_BROKERS
value:
_default: rc1d-s0a1ujcbj6fdk26b.mdb.yandexcloud.net:9091
- name: KAFKA_SSL_CAFILE
value:
_default: /etc/ca-certificates/Yandex/ca-cert
- name: KAFKA_TOPIC_LEGACY_AMS_SYNC
value:
_default: ams-sync
secretEnvs:
- name: SPICEDB_TOKEN
secretName:
_default: spicedb-secret
secretKey: grpc-preshared-key
- name: DB_DSN
secretName:
_default: iams-secret
secretKey: db-dsn
- name: ZITADEL_ACCESS_TOKEN
secretName:
_default: iams-secret
secretKey: zitadel-access-token
- name: KAFKA_SASL_PLAIN_USERNAME
secretName:
_default: iams-secret
secretKey: kafka-sasl-plain-username
- name: KAFKA_SASL_PLAIN_PASSWORD
secretName:
_default: iams-secret
secretKey: kafka-sasl-plain-password
- name: S3_ACCESS_KEY_ID
secretName:
_default: yc-s3-secret
secretKey: key_id
- name: S3_SECRET_ACCESS_KEY
secretName:
_default: yc-s3-secret
secretKey: access_key
volumes:
_default:
- mountPath: /etc/ca-certificates/Yandex
name: kafka-ca
readOnly: true
secret:
defaultMode: 420
secretName: ya-ca-secret
- mountPath: /config/zitadel/org-rules-prod.json
name: zitadel-rules
readOnly: true
subPath: org-rules-prod.json
configMap:
defaultMode: 420
name: iam-zitadel-org-rules
postRenderers:
- kustomize:
patches:
- target:
kind: Deployment
name: iams
patch: "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: iams\n namespace: iam\nspec:\n template:\n spec:\n initContainers:\n - name: spicedb-schema\n image: cr.yandex/crp3ccidau046kdj8g9q/authzed/zed:v1.2.0\n imagePullPolicy: IfNotPresent\n command:\n - /usr/local/bin/zed\n args:\n - --insecure\n - --skip-version-check\n - --max-retries\n - '60'\n - schema\n - write\n - /schema/iam.zed\n env:\n - name: ZED_ENDPOINT\n value: spicedb.spicedb.svc.cluster.local:50051\n - name: ZED_TOKEN\n valueFrom:\n secretKeyRef:\n name: spicedb-secret\n key: grpc-preshared-key\n volumeMounts:\n - name: spicedb-schema\n mountPath: /schema\n readOnly: true\n resources:\n requests:\n cpu: 25m\n memory: 32Mi\n limits:\n cpu: 250m\n\
\ memory: 128Mi\n volumes:\n - name: spicedb-schema\n configMap:\n name: iam-spicedb-schema\n"

View File

@ -1,11 +1,7 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: iam
resources:
- ../base
patches:
- path: backend-s3.yaml
target:
kind: HelmRelease
name: iam-backend
- org-rules.yaml
- spicedb-schema.yaml
- backend.yaml

View File

@ -1,11 +1,13 @@
apiVersion: v1
data:
org-rules-prod.json: |
{
"default_org_id": "383923292894987370",
"rules": []
}
kind: ConfigMap
metadata:
name: iam-zitadel-org-rules
namespace: iam
labels:
app.kubernetes.io/managed-by: kustomize
data:
org-rules-prod.json: |
{
"default_org_id": "362899668818023622",
"rules": []
}

View File

@ -0,0 +1,23 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: iam-spicedb-schema
namespace: iam
data:
iam.zed: "definition auth_group {\n\trelation grants: django_permission\n}\n\n// Org structure. department без\
\ parent между department.\ndefinition department {\n\trelation tenant: tenant\n\trelation member: user\n\t\
relation service_account: service_account\n\trelation groups: auth_group\n\tpermission group_grants = groups->grants\n\
}\n\ndefinition django_permission {}\n\ndefinition position {\n\trelation tenant: tenant\n\trelation department:\
\ department\n\trelation holder: user\n\trelation service_account: service_account\n\trelation groups: auth_group\n\
\trelation scoped_resource: resource\n\tpermission group_grants = groups->grants\n}\n\ndefinition resource {\n\
\trelation tenant: tenant\n\trelation parent: resource\n\n\trelation read: service_account | service_account#member\n\
\trelation write: service_account | service_account#member\n\trelation admin: service_account | service_account#member\n\
\trelation view: service_account | service_account#member\n\n\tpermission inherited_read = read + write + admin\
\ + parent->inherited_read\n\tpermission inherited_write = write + admin + parent->inherited_write\n\tpermission\
\ inherited_admin = admin + parent->inherited_admin\n\n\tpermission allow_read = inherited_read + view + tenant->unrestricted\n\
\tpermission allow_write = inherited_write\n\tpermission allow_admin = inherited_admin\n}\n\ndefinition service_account\
\ {\n\trelation direct_member: user\n\tpermission member = direct_member\n}\n\ndefinition tenant {\n\trelation\
\ unrestricted: service_account | service_account#member\n}\n\ndefinition user {\n\trelation direct: django_permission\n\
\trelation member: auth_group\n\trelation holder: position\n\trelation department_member: department\n\tpermission\
\ global_grant = direct + member->grants + holder->group_grants + department_member->group_grants\n\tpermission\
\ resource_position_grant = holder->group_grants\n}\n"

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/sarex-inspections:production_1a33f6f4
_default: cr.yandex/crp3ccidau046kdj8g9q/inspections-backend:contour_32f00e42
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/issues:production_bbb9d29a
_default: cr.yandex/crp3ccidau046kdj8g9q/issues:production_2b20944c
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/issues:production_bbb9d29a
_default: cr.yandex/crp3ccidau046kdj8g9q/issues:production_2b20944c
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/contour_issues-frontend:b56b9da1
_default: cr.yandex/crp3ccidau046kdj8g9q/contour_issues-frontend:a377d409
pullPolicy:
_default: IfNotPresent

View File

@ -1,4 +1,3 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
@ -7,9 +6,9 @@ metadata:
data:
kafka.crt: |
-----BEGIN CERTIFICATE-----
MIIFLTCCAxWgAwIBAgIUYDZPxGRsr7IiqHEmfd07QTQlOKYwDQYJKoZIhvcNAQEN
MIIFLTCCAxWgAwIBAgIUa4PO/BPk4+3iuMHChzLzNWLuzjowDQYJKoZIhvcNAQEN
BQAwLTETMBEGA1UECgwKaW8uc3RyaW16aTEWMBQGA1UEAwwNY2x1c3Rlci1jYSB2
MDAeFw0yNTEyMTYxNDM0NTVaFw0yNjEyMTYxNDM0NTVaMC0xEzARBgNVBAoMCmlv
MDAeFw0yNjExMTYxNDM1MDlaFw0yNzExMTYxNDM1MDlaMC0xEzARBgNVBAoMCmlv
LnN0cmltemkxFjAUBgNVBAMMDWNsdXN0ZXItY2EgdjAwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCfzDZhEzw2pbU5Xpu8OzD+3iQG+DVjU8PQWWQEF27h
yjohDkUr3zCZtW7xMKWKUNxBgrKsfe4TDOQN8cij3cS9sy0So+UhMeF7Bq9PU1Yd
@ -24,15 +23,15 @@ data:
/JkV823hX2WNB9bdaQ24BelVUbsxGpR7ms6KWrM11kHnbzUlEM+AxZES6F7Qbr55
TwIDAQABo0UwQzAdBgNVHQ4EFgQUM7hshx7e9TFEN82Pf446aBrJUA4wEgYDVR0T
AQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQENBQADggIB
AFNHFGPDxY966fz0dxDFFSfeo47y7XQZMK9xAwH73cQoSeqx+IMxzgM8nfJQ9XMN
PeLwVRZ7pvRee2ZhUPglBSTHnW2rvfmLBOO9xyKZxRsCkoFxuHH9xfM7bFWb96R6
fGrOdEZDB3yj00T+tkubwqt+/dUhQUj8juwyPs55WMb/0BIbapaoQ6QOP13CaXDV
ZmAfsEEIBkNxfq7GTr/z0Rq0B4+9FxAf3Jrsmi/dYoFD/prHsvBDkYw1daoFyp5C
tbctvB9wtphnCCynekt8UBvpVKHUU/xaUa09TQTToXjBbV1SZeIOHNG0MNbWa4sz
AL/cpXdq1EAxiTeAVT9XhCwhe/xJvFZIWuFLmW3J+ZxrOUCKieCYpTqBY2tBkkDY
//egic787yTR6zxqQNSzvNU5LhzrN7lu+KHGM06T35+HvpzgPPiRCzsxO62p63op
mq04K31yYZgLiqeAj5W+rioRGJNn4TXJpH9KIrzmGM7lVWLYWMAKeZU4r1lDUdcu
7jsBH8BRJWJeVK3xVw2HB3lk7Xn0WrR92adeYQ3f0vKbMIAVUnSJ3yCKJ4NMFSki
j78nx2mi/G0RhUPGZ9hhLXQKj9BtbpEnwpbGWtf0ShtVOxD/HKLCr7koBtW9TMPS
9K0sJhE5VjsQLkDDu9p3GdRcuLNA/oa7xFvRFtqGFsLj
AIZDUvQeimpvHncASAoBxQ6VBfGOYRKRnK7a8yK33M7X0CiZl0FtQM68mM/tkrMV
RT7KzTIg2wLCMaQ6RJHOHHD0mevAcsGzqDIvIOk/FH57AWnrD41qJFTnWRBkbWzM
Q/qke9H1+Z0LTt6gJ4qZpoYi33FaPZZ+Q6aMvNYnf1y1SsQy7jBXK/ifB0az8FWI
C8/QxoGjEhG+/w/8Z0fVOeuU7QQFgefQdZQnS2hfFhs9kGqwg6BKtAt056v/BMGq
ONqCNS5mhfZpXYB17oYAixSxGxYsbOAuX9dpvfYeNBAMpGc8+ooU8D6lEBCrgyS0
HusnOGHDSBAdj+AiaytZ2+G3oJ/Herx25OPClt9yIpxSeapaVomNeItzegC5DH36
lYIJW0htvpctqV/vXTFS6zUdOzMazDCTch9f8eBizEpsIiH8AamTDqq5/Q5Kn8Sz
oW6XkxF5DDopzGTXjtI2HJfbCEMe04d7yW3bQ9amIOl3jWpKzRJvWT/FXHcf29s+
viEBP5kybgewVPK7HoKYbHyLvxbTYyauh8aeFrLgklZjK8lQvd0yNPaVYRAJ6C4m
eBBW+JAJOAELDtC+adA2ucoUmbROaXF3u1hAA9JWbqL9w+1AsX4plinC6ojPFajl
H1L4iq3Pjsfnqnc1VuthdgkPq3qGmybH5a+lCpWecpxV
-----END CERTIFICATE-----

View File

@ -8,8 +8,6 @@ data:
kafka.py: |
from ssl import SSLContext
import ssl
from aiokafka.helpers import create_ssl_context
from faststream.kafka import KafkaBroker
from faststream.security import BaseSecurity, SASLPlaintext, SASLScram512
@ -33,8 +31,6 @@ data:
def get_ssl_context(self) -> SSLContext:
context = create_ssl_context(cafile=self.SSL_CAFILE)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
return context
def get_security(self) -> BaseSecurity | None:

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/message-hub:production_e8010fe4
_default: cr.yandex/crp3ccidau046kdj8g9q/message-hub:production_cc5b0b3a
pullPolicy:
_default: IfNotPresent
@ -124,7 +124,7 @@ spec:
- name: SETTINGS_TOPICS
value:
_default: '{"planning": "message-hub-prod", "assets":"assets_broadcast","issues": "issues_broadcast_prod", "resources_updated": "iam.resource.updated.v2", "resources_deleted": "iam.resource.deleted.v2"}'
_default: '{"planning": "message-hub-prod", "issues": "issues_broadcast_prod", "resources_updated": "iam.resource.updated.v2", "resources_deleted": "iam.resource.deleted.v2", "attributes_created": "eav.attribute.created.v1", "attributes_updated": "eav.attribute.updated.v1", "attributes_deleted": "eav.attribute.deleted.v1", "assets_created": "eav.asset.created.v1", "assets_updated": "eav.asset.updated.v1", "assets_deleted": "eav.asset.deleted.v1", "users_updated": "iam.user.updated.v1", "departments_updated": "iam.department.updated.v1", "positions_updated": "iam.position.updated.v1"}'
- name: PDF_CONVERTER_HOST
value:

View File

@ -39,7 +39,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/pm-backend:production_fa0f1551
_default: cr.yandex/crp3ccidau046kdj8g9q/pm-backend:production_eab2d16c
pullPolicy:
_default: IfNotPresent

View File

@ -36,7 +36,7 @@ spec:
image:
name:
_default: cr.yandex/crp3ccidau046kdj8g9q/pm-backend:production_fa0f1551
_default: cr.yandex/crp3ccidau046kdj8g9q/pm-backend:production_eab2d16c
pullPolicy:
_default: IfNotPresent

View File

@ -0,0 +1,48 @@
tests:
- name: json-and-attributes-masking
inputs:
- insert_at: normalize_logs
type: log
log_fields:
message: '{"message":"synthetic healthy","password":"SYNTH_BODY","level":"info"}'
timestamp: '2026-11-30T10:00:00Z'
resources:
service.name: synthetic-svc
k8s.namespace.name: synthetic-ns
k8s.pod.name: synthetic-pod
attributes:
token: SYNTH_ATTR
safe: retained
outputs:
- extract_from: normalize_logs
conditions:
- type: vrl
source: 'assert_eq!(.namespace, "synthetic-ns")
assert_eq!(.service_name, "synthetic-svc")
assert_eq!(.severity, "INFO")
assert!(!contains(encode_json(.), "SYNTH_"))
assert!(contains!(.attributes_json, "retained"))
true'
- name: bearer-and-jwt-masking
inputs:
- insert_at: normalize_logs
type: log
log_fields:
message: healthy Bearer SYNTH_BEARER aaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbb.cccccccccccccccccccc
resources:
service.name: synthetic-svc
k8s.namespace.name: synthetic-ns
outputs:
- extract_from: normalize_logs
conditions:
- type: vrl
source: 'assert!(!contains(encode_json(.), "SYNTH_BEARER"))
assert!(contains!(.message, "healthy"))
true'

View File

@ -0,0 +1,100 @@
#!/usr/bin/env python3
from pathlib import Path
import yaml,json,subprocess,tempfile,time,socket,urllib.request
import argparse
import os
parser = argparse.ArgumentParser(description="Local service-log config/masking tests; no cluster or real S3 access")
parser.add_argument('--collector-bin', required=True)
parser.add_argument('--vector-bin', required=True)
args = parser.parse_args()
repo = Path(__file__).resolve().parents[2]
temporary = tempfile.TemporaryDirectory(prefix='service-log-check-')
root = Path(temporary.name)
with socket.socket() as port_socket:
port_socket.bind(('127.0.0.1', 0))
port = port_socket.getsockname()[1]
cfg=yaml.safe_load((repo / 'infrastructure/opentelemetry-collector/uralkal/opentelemetry-collector.yaml').read_text())['spec']['values']['alternateConfig']
config={'receivers':{'otlp':{'protocols':{'http':{'endpoint':'127.0.0.1:' + str(port)}}}},'processors':{'transform/mask_logs':cfg['processors']['transform/mask_logs']},'exporters':{'file/test':{'path':str(root/'masked.json')}},'service':{'pipelines':{'logs':{'receivers':['otlp'],'processors':['transform/mask_logs'],'exporters':['file/test']}},'telemetry':{'logs':{'level':'warn'},'metrics':{'level':'none'}}}}
p=root/'collector-test.yaml';p.write_text(yaml.safe_dump(config,sort_keys=False))
bin=args.collector_bin
r=subprocess.run([bin,'validate','--config',str(p)],capture_output=True,text=True);print('validate',r.returncode);print(r.stderr[:3000] if r.returncode else '');assert not r.returncode
(root/'masked.json').unlink(missing_ok=True)
errors=open(root/'collector-stderr.txt','w')
proc=subprocess.Popen([bin,'--config',str(p)],stdout=subprocess.DEVNULL,stderr=errors)
try:
for i in range(100):
if proc.poll() is not None:raise RuntimeError((root/'collector-stderr.txt').read_text()[:3000])
try:
with socket.create_connection(('127.0.0.1',port),timeout=.2):break
except OSError:time.sleep(.1)
def v(x):
if isinstance(x,str):return {'stringValue':x}
if isinstance(x,dict):return {'kvlistValue':{'values':[{'key':k,'value':v(a)} for k,a in x.items()]}}
if isinstance(x,list):return {'arrayValue':{'values':[v(a) for a in x]}}
if isinstance(x,int):return {'intValue':str(x)}
jwt='a'*24+'.'+'b'*24+'.'+'c'*20
bodies=[
'healthy-msg password="SYNTH_PWD" token=SYNTH_TOKEN Authorization: Bearer SYNTH_BEARER '+jwt+' https://synthetic-user:SYNTH_URL@local/path',
json.dumps({'message':'healthy-json','nested':{'password':'SYNTH_JSON'},'cookie':'SYNTH_COOKIE'}),
{'message':'healthy-map','nested':{'client_secret':'SYNTH_MAP'},'token':834891},
]
resource={'service.name':'mask-test','k8s.namespace.name':'synthetic-ns','nested':{'password':'SYNTH_RESOURCE','keep':'visible'},'url':'https://u:SYNTH_RESOURCE_URL@local/path'}
attrs={'nested':{'api_key':'SYNTH_ATTR_KEY','keep':'retained'},'cookies':['SYNTH_ARRAY_COOKIE'],'message':'Bearer SYNTH_ATTR_BEARER','count':42}
data={'resourceLogs':[{'resource':{'attributes':[{'key':k,'value':v(a)} for k,a in resource.items()]},'scopeLogs':[{'scope':{'name':'offline-mask-test'},'logRecords':[{'timeUnixNano':str(time.time_ns()),'body':v(body),'attributes':[{'key':k,'value':v(a)} for k,a in attrs.items()]} for body in bodies]}]}]}
req=urllib.request.Request('http://127.0.0.1:' + str(port) + '/v1/logs',data=json.dumps(data).encode(),headers={'Content-Type':'application/json'},method='POST')
with urllib.request.urlopen(req,timeout=10) as response:print('OTLP HTTP',response.status,response.read().decode())
for _ in range(100):
if (root/'masked.json').exists() and (root/'masked.json').stat().st_size>0:break
time.sleep(.1)
finally:
proc.terminate();proc.wait(timeout=10);errors.close()
text=(root/'masked.json').read_text()
for value in ['SYNTH_PWD','SYNTH_TOKEN','SYNTH_BEARER',jwt,'SYNTH_URL','SYNTH_JSON','SYNTH_COOKIE','SYNTH_MAP','834891','SYNTH_RESOURCE','SYNTH_RESOURCE_URL','SYNTH_ATTR_KEY','SYNTH_ARRAY_COOKIE','SYNTH_ATTR_BEARER']:
assert value not in text,'Unmasked synthetic value: '+value
for value in ['healthy-msg','healthy-json','healthy-map','synthetic-ns','mask-test','visible','retained']:
assert value in text,'Lost nonsensitive value: '+value
print('Synthetic redaction and metadata preservation: PASS')
# Validate the complete gateway/agent configs with only synthetic Kafka credentials/CA.
subprocess.run(['openssl', 'req', '-x509', '-newkey', 'rsa:2048', '-nodes',
'-keyout', str(root / 'synthetic.key'), '-out', str(root / 'synthetic-ca.crt'),
'-days', '1', '-subj', '/CN=synthetic-offline-validation'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
kafka = cfg['exporters']['kafka/traces']
kafka['auth']['sasl']['username'] = 'synthetic'
kafka['auth']['sasl']['password'] = 'synthetic'
kafka['auth']['tls']['ca_file'] = str(root / 'synthetic-ca.crt')
full = root / 'gateway-full.yaml'
full.write_text(yaml.safe_dump(cfg, sort_keys=False))
env = dict(os.environ, MY_POD_IP='127.0.0.1', CONTOUR='uralkal',
KAFKA_BROKERS='127.0.0.1:19092', S3_BUCKET='service-logs',
S3_ENDPOINT='http://127.0.0.1:19000')
for path in [full, repo / 'infrastructure/opentelemetry-agent/base/collector.yaml']:
subprocess.run([bin, 'validate', '--config', str(path)], env=env, check=True)
vector = yaml.safe_load((repo / 'infrastructure/vector/base/vector.yaml').read_text())
vector['data_dir'] = str(root / 'vector-data')
(root / 'vector-data').mkdir()
vector['sinks']['minio_logs']['batch_encoding']['schema_file'] = str(repo / 'infrastructure/vector/base/logs.schema')
credentials = root / 'synthetic-aws-credentials'
credentials.write_text('[default]\naws_access_key_id = synthetic\naws_secret_access_key = synthetic\n')
credentials.chmod(0o600)
vector['sinks']['minio_logs']['auth']['credentials_file'] = str(credentials)
vector['tests'] = yaml.safe_load((repo / 'ci/security/service-log-vector-tests.yaml').read_text())['tests']
path = root / 'vector-check.yaml'
path.write_text(yaml.safe_dump(vector, sort_keys=False))
subprocess.run([args.vector_bin, 'validate', '--skip-healthchecks', str(path)], env=env, check=True)
subprocess.run([args.vector_bin, 'test', str(path)], env=env, check=True)
# Exercise the actual pod argv, stopping at a deliberately missing config before any listeners/sinks start.
statefulset = next(d for d in yaml.safe_load_all((repo / 'infrastructure/vector/base/statefulset.yaml').read_text()) if d.get('kind') == 'StatefulSet')
container = next(c for c in statefulset['spec']['template']['spec']['containers'] if c['name'] == 'vector')
startup_args = list(container['args'])
missing_config = root / 'missing-vector-startup-config.yaml'
startup_args[startup_args.index('--config') + 1] = str(missing_config)
startup = subprocess.run([args.vector_bin, *startup_args], env=env, text=True, capture_output=True, timeout=10)
assert startup.returncode != 0 and str(missing_config) in startup.stdout + startup.stderr, \
'Vector pod arguments were rejected before config loading: ' + startup.stdout + startup.stderr
print('Vector pod CLI arguments accepted')
temporary.cleanup()
print('All local service-log checks passed. Live MinIO/Vault/registry delivery is not tested.')

View File

@ -5,7 +5,7 @@ metadata:
name: yc-oci-charts
namespace: flux-system
spec:
type: oci
type: ${CHART_REPO_TYPE:=oci}
interval: 10m0s
url: ${CHART_REPO:=oci://cr.yandex/crp3ccidau046kdj8g9q/charts}
secretRef:

View File

@ -3,3 +3,5 @@ kind: Kustomization
resources:
- ./helm-repositories.yaml
- ../../../infrastructure/vault/contour-template
patches:
- path: nexus-images-vault.yaml

View File

@ -0,0 +1,51 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: vault
namespace: vault
spec:
values:
backup:
image:
repository: nexus.npr.nornick.ru/sarex/contour/minio/mc
injector:
image:
repository: nexus.npr.nornick.ru/sarex/vault/vault-k8s
agentImage:
repository: nexus.npr.nornick.ru/sarex/vault/vault
server:
image:
repository: nexus.npr.nornick.ru/sarex/vault/vault
extraContainers:
- command:
- /bin/sh
- -c
- "while true; do\n if vault status >/dev/null 2>&1; then\n :\n else\n\
\ rc=$?\n if [ \"$rc\" -eq 2 ]; then\n if [ -s /vault/unseal-keys/key1\
\ ] && [ -s /vault/unseal-keys/key2 ] && [ -s /vault/unseal-keys/key3 ];\
\ then\n for k in key1 key2 key3; do\n vault operator unseal\
\ \"$(cat /vault/unseal-keys/$k)\" >/dev/null 2>&1 || echo \"unseal call\
\ failed\"\n done\n if vault status >/dev/null 2>&1; then\
\ echo \"unsealed\"; else echo \"still sealed\"; fi\n else\n \
\ echo \"sealed, keys not mounted\"\n fi\n fi\n fi\n sleep 10\n\
done\n"
env:
- name: VAULT_ADDR
value: http://127.0.0.1:8200
image: nexus.npr.nornick.ru/sarex/vault/vault:1.21.2
imagePullPolicy: IfNotPresent
name: unsealer
resources:
limits:
memory: 64Mi
requests:
cpu: 10m
memory: 16Mi
volumeMounts:
- mountPath: /vault/unseal-keys
name: unseal-keys
readOnly: true
csi:
agent:
image:
repository: nexus.npr.nornick.ru/sarex/vault/vault

View File

@ -24,3 +24,6 @@ patches:
- op: add
path: /spec/values/_internal_defaults_do_not_set/service/loadBalancerIP
value: "${BALANCER_IP:=}"
patches:
- path: nexus-images-cert-manager.yaml
- path: nexus-images-istiod.yaml

View File

@ -0,0 +1,19 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: cert-manager
namespace: cert-manager
spec:
values:
controller:
image:
registry: nexus.npr.nornick.ru/sarex/cert-manager
acmesolver:
image:
registry: nexus.npr.nornick.ru/sarex/cert-manager
webhook:
image:
registry: nexus.npr.nornick.ru/sarex/cert-manager
cainjector:
image:
registry: nexus.npr.nornick.ru/sarex/cert-manager

View File

@ -0,0 +1,9 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: istiod
namespace: istio-system
spec:
values:
global:
hub: nexus.npr.nornick.ru/sarex/contour/istio

View File

@ -2,4 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../infrastructure/postgresql/contour-template
- ../../../infrastructure/kafka/contour-template
- ../../../infrastructure/rabbitmq/contour-template
patches:
- path: nexus-images-kafka.yaml
- path: nexus-images-postgresql.yaml
- path: nexus-images-rabbitmq.yaml

View File

@ -0,0 +1,24 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: kafka
namespace: kafka
spec:
values:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/kafka-nn/kafka
defaultInitContainers:
volumePermissions:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/kafka-nn/os-shell
autoDiscovery:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/kafka-nn/kubectl
metrics:
jmx:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/kafka-nn/jmx-exporter

View File

@ -0,0 +1,17 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: postgresql
namespace: postgresql
spec:
values:
image:
registry: nexus.npr.nornick.ru/sarex
volumePermissions:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/postgresql/os-shell
metrics:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/postgresql/postgres-exporter

View File

@ -0,0 +1,14 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: rabbitmq
namespace: rabbitmq
spec:
values:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/rabbitmq/rabbitmq
volumePermissions:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/rabbitmq/os-shell

View File

@ -3,3 +3,18 @@ kind: Kustomization
resources:
- ../../../infrastructure/zitadel/contour-template
- ../../../infrastructure/camunda/contour-template
patches:
- path: nexus-images-camunda.yaml
- path: nexus-images-zitadel.yaml
- target:
kind: HelmRelease
name: camunda
patch: |-
- op: add
path: /spec/postRenderers/-
value:
kustomize:
images:
- name: busybox
newName: nexus.npr.nornick.ru/sarex/kubespray/library/busybox
newTag: "1.37.0"

View File

@ -0,0 +1,85 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: camunda
namespace: camunda
spec:
values:
global:
image:
registry: nexus.npr.nornick.ru
console:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/console
zeebe:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/zeebe
zeebeGateway:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/zeebe
operate:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/operate
tasklist:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/tasklist
optimize:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/optimize
executionIdentity:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/camunda
identity:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/identity
identityPostgresql:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/postgresql
identityKeycloak:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/keycloak
postgresql:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/postgresql
webModeler:
image:
registry: nexus.npr.nornick.ru
restapi:
image:
repository: sarex/contour/camunda/web-modeler-restapi
webapp:
image:
repository: sarex/contour/camunda/web-modeler-webapp
websockets:
image:
repository: sarex/contour/camunda/web-modeler-websockets
postgresql:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/postgresql
connectors:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/connectors-bundle
elasticsearch:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/elasticsearch
sysctlImage:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/os-shell
metrics:
image:
registry: nexus.npr.nornick.ru
repository: sarex/contour/camunda/elasticsearch-exporter

View File

@ -0,0 +1,16 @@
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: zitadel
namespace: zitadel
spec:
values:
login:
image:
repository: nexus.npr.nornick.ru/sarex/contour/zitadel/zitadel-login
image:
repository: nexus.npr.nornick.ru/sarex/contour/zitadel/zitadel
setupJob:
machinekeyWriter:
image:
repository: nexus.npr.nornick.ru/sarex/contour/zitadel/kubectl

View File

@ -11,3 +11,12 @@ patches:
- op: add
path: /spec/template/spec/containers/0/args/-
value: --feature-gates=CancelHealthCheckOnNewRevision=true
images:
- name: cr.yandex/crp3ccidau046kdj8g9q/fluxcd/source-controller
newName: nexus.npr.nornick.ru/sarex/fluxcd/source-controller
- name: cr.yandex/crp3ccidau046kdj8g9q/fluxcd/kustomize-controller
newName: nexus.npr.nornick.ru/sarex/fluxcd/kustomize-controller
- name: cr.yandex/crp3ccidau046kdj8g9q/fluxcd/helm-controller
newName: nexus.npr.nornick.ru/sarex/fluxcd/helm-controller
- name: cr.yandex/crp3ccidau046kdj8g9q/fluxcd/notification-controller
newName: nexus.npr.nornick.ru/sarex/fluxcd/notification-controller

View File

@ -11,6 +11,7 @@ resources:
- ../../infrastructure/rabbitmq/uralkal
- ../../infrastructure/kafka/uralkal
- ../../infrastructure/postgresql/uralkal
- ../../infrastructure/spicedb/uralkal
- ../../infrastructure/zitadel/uralkal
- ../../infrastructure/camunda/uralkal
- ../../infrastructure/superset/uralkal
@ -18,6 +19,8 @@ resources:
- ../../infrastructure/istio-config/uralkal
- ../../infrastructure/s3-proxy/uralkal
- ../../infrastructure/opentelemetry-collector/uralkal
- ../../infrastructure/opentelemetry-agent/uralkal
- ../../infrastructure/vector/uralkal
- ../../infrastructure/security-audit/uralkal
- ../../infrastructure/vmstack/uralkal
- ../../infrastructure/local-path-provisioner/uralkal

View File

@ -82,6 +82,20 @@ spec:
tls:
credentialName: istio-gateway-wildcard-cert
virtualServices:
admin-frontend:
name: admin-frontend-virt-service
namespace: control-interface
hosts:
- srx.wb.ru
- lk.srx.wb.ru
gateways:
- istio-system/main-gateway
routes:
- path:
prefix: /admin-frontend/static/
rewrite: /
service: admin-frontend-svc.control-interface.svc.cluster.local
port: 8080
gitea-vs:
namespace: gitea
hosts:

View File

@ -6,7 +6,7 @@ resources:
- ./infrastructure
# apps
#- ../../apps/iam/wb
- ../../apps/iam/wb
- ../../apps/notes/wb
- ../../apps/rfi/wb
- ../../apps/eav/wb
@ -34,3 +34,4 @@ resources:
- ../../apps/transmittal/wb
- ../../apps/bi/wb
- ../../apps/premises/wb
- ../../apps/control-interface/wb

View File

@ -0,0 +1,95 @@
extensions:
health_check: {endpoint: "0.0.0.0:13133"}
file_storage/checkpoints:
directory: /var/lib/otelcol-service-logs/checkpoints
create_directory: true
fsync: true
file_storage/queue:
directory: /var/lib/otelcol-service-logs/queue
create_directory: true
fsync: true
compaction:
on_start: true
directory: /var/lib/otelcol-service-logs/queue
receivers:
filelog/pods:
include: [/var/log/pods/*/*/*.log]
exclude:
# Avoid collecting this pipeline's own errors, including audit S3 debug echoes.
- /var/log/pods/opentelemetry-agent_*/*/*.log
- /var/log/pods/opentelemetry-collector_*/*/*.log
- /var/log/pods/vector_*/*/*.log
- /var/log/pods/security-audit_*/*/*.log
start_at: end
include_file_path: true
storage: file_storage/checkpoints
max_log_size: 1MiB
poll_interval: 1s
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 30s
max_elapsed_time: 0s
operators:
# Detect CRI/Docker format and reassemble runtime partial records.
- {type: container, id: container-parser}
- type: json_parser
id: application-json
if: 'body matches "^\\s*\\{"'
parse_to: attributes["app"]
on_error: send
processors:
memory_limiter: {check_interval: 1s, limit_mib: 600, spike_limit_mib: 100}
k8sattributes:
auth_type: serviceAccount
passthrough: false
filter:
node_from_env_var: K8S_NODE_NAME
extract:
metadata:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- k8s.node.name
- k8s.container.name
labels:
- {tag_name: service.name, key: app.kubernetes.io/name, from: pod}
- {tag_name: app, key: app, from: pod}
pod_association:
- sources:
- {from: resource_attribute, name: k8s.pod.uid}
- sources:
- {from: resource_attribute, name: k8s.namespace.name}
- {from: resource_attribute, name: k8s.pod.name}
exporters:
otlp/logs:
endpoint: otel-collector.opentelemetry-collector.svc.cluster.local:4317
tls: {insecure: true}
compression: gzip
# Vector acknowledges only after S3 upload; this must exceed its 300s batch age.
timeout: 660s
sending_queue:
enabled: true
storage: file_storage/queue
num_consumers: 8
queue_size: 2048
retry_on_failure:
enabled: true
initial_interval: 5s
max_interval: 30s
max_elapsed_time: 0s
service:
extensions: [health_check, file_storage/checkpoints, file_storage/queue]
pipelines:
logs:
receivers: [filelog/pods]
# No batch processor: do not acknowledge a read before the persistent queue.
processors: [memory_limiter, k8sattributes]
exporters: [otlp/logs]
telemetry:
logs: {level: info}
metrics: {address: "0.0.0.0:8888"}

View File

@ -0,0 +1,62 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: otel-agent
spec:
selector:
matchLabels: {app.kubernetes.io/name: otel-agent}
updateStrategy:
type: RollingUpdate
rollingUpdate: {maxUnavailable: 1}
template:
metadata:
labels:
app.kubernetes.io/name: otel-agent
sidecar.istio.io/inject: "false"
annotations:
sidecar.istio.io/inject: "false"
spec:
serviceAccountName: otel-agent
nodeSelector: {kubernetes.io/os: linux}
tolerations:
- {operator: Exists}
imagePullSecrets:
- name: regcred
terminationGracePeriodSeconds: 60
securityContext:
runAsUser: 0
runAsGroup: 0
seccompProfile: {type: RuntimeDefault}
containers:
- name: otel-agent
image: cr.yandex/crp3ccidau046kdj8g9q/opentelemetry-collector/opentelemetry-collector-contrib:0.121.0-amd64
args: ["--config=/etc/otelcol/config.yaml"]
env:
- name: K8S_NODE_NAME
valueFrom: {fieldRef: {fieldPath: spec.nodeName}}
ports:
- {name: health, containerPort: 13133}
- {name: metrics, containerPort: 8888}
readinessProbe:
httpGet: {path: /, port: health}
livenessProbe:
httpGet: {path: /, port: health}
resources:
requests: {cpu: 100m, memory: 256Mi}
limits: {cpu: "1", memory: 768Mi}
securityContext:
runAsNonRoot: false
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities: {drop: [ALL]}
volumeMounts:
- {name: config, mountPath: /etc/otelcol, readOnly: true}
- {name: pod-logs, mountPath: /var/log/pods, readOnly: true}
- {name: storage, mountPath: /var/lib/otelcol-service-logs}
volumes:
- name: config
configMap: {name: otel-agent-config}
- name: pod-logs
hostPath: {path: /var/log/pods, type: Directory}
- name: storage
hostPath: {path: /var/lib/otelcol-service-logs, type: DirectoryOrCreate}

View File

@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: opentelemetry-agent
resources:
- namespace.yaml
- rbac.yaml
- daemonset.yaml
configMapGenerator:
- name: otel-agent-config
files:
- config.yaml=collector.yaml

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Namespace
metadata:
name: opentelemetry-agent
labels:
istio-injection: disabled
# hostPath and root are needed to read container log files owned by root.
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/warn: baseline

View File

@ -0,0 +1,26 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: otel-agent
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: otel-agent-pod-metadata
rules:
- apiGroups: [""]
resources: [pods, namespaces]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: otel-agent-pod-metadata
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: otel-agent-pod-metadata
subjects:
- kind: ServiceAccount
name: otel-agent
namespace: opentelemetry-agent

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- base

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: opentelemetry-agent
resources:
- ../base
- networkpolicy.yaml

View File

@ -0,0 +1,42 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: otel-agent
spec:
podSelector:
matchLabels: {app.kubernetes.io/name: otel-agent}
policyTypes: [Ingress, Egress]
ingress:
- ports:
- {port: 13133, protocol: TCP}
- from:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: vmstack}
ports:
- {port: 8888, protocol: TCP}
egress:
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: kube-system}
podSelector:
matchLabels: {k8s-app: kube-dns}
- ipBlock: {cidr: 169.254.25.10/32}
ports:
- {port: 53, protocol: UDP}
- {port: 53, protocol: TCP}
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: opentelemetry-collector}
podSelector:
matchLabels: {telemetry/collector: traces}
ports:
- {port: 4317, protocol: TCP}
# Kubernetes service / control-plane addresses depend on the live cluster.
# Restrict to private networks; verify both service and post-DNAT API ports.
- to:
- ipBlock: {cidr: 10.0.0.0/8}
- ipBlock: {cidr: 172.16.0.0/12}
- ipBlock: {cidr: 192.168.0.0/16}
ports:
- {port: 443, protocol: TCP}
- {port: 6443, protocol: TCP}

View File

@ -1,4 +1,4 @@
# Коллектору нужны только DNS, приём трейсов из mesh и egress в Kafka.
# Трейсы уходят в Kafka, сервисные логи — по OTLP в Vector.
# По образцу security-audit/base/networkpolicy*.yaml.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
@ -33,3 +33,10 @@ spec:
matchLabels: {kubernetes.io/metadata.name: kafka}
ports:
- {port: 9092, protocol: TCP}
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: vector}
podSelector:
matchLabels: {app.kubernetes.io/name: vector-logs}
ports:
- {port: 4317, protocol: TCP}

View File

@ -167,6 +167,28 @@ spec:
attributes:
- {action: insert, key: k8s.cluster.name, value: "${env:CONTOUR}"}
- {action: insert, key: deployment.environment, value: "${env:CONTOUR}"}
transform/mask_logs:
error_mode: propagate
log_statements:
- context: log
statements:
- set(log.body, String(log.body)) where not IsString(log.body)
- replace_pattern(log.body, "(?i)Bearer\\s+[A-Za-z0-9._~+/-]+=*", "Bearer ***") where IsString(log.body)
- replace_pattern(log.body, "(?i)[\"']?(password|passwd|pwd|token|secret|client_secret|api[_-]?key|authorization|cookies?|signature|x-amz-signature)[\"']?\\s*[:=]\\s*(\"(\\\\.|[^\"\\\\])*\"|'[^']*'|[^,;\\s}]+)", "[REDACTED]") where IsString(log.body)
- replace_pattern(log.body, "[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{10,}", "***jwt***") where IsString(log.body)
- replace_pattern(log.body, "(?i)([a-z][a-z0-9+.-]*://)[^/@\\s]+:[^/@\\s]+@", "$$1***@") where IsString(log.body)
- flatten(log.attributes)
- delete_matching_keys(log.attributes, "(?i)(^|[._-])(password|passwd|pwd|token|secret|client[._-]?secret|api[._-]?key|access[._-]?key|authorization|cookies?|signature|x[._-]amz[._-]signature)([._-]|$$)")
- replace_all_patterns(log.attributes, "value", "(?i)Bearer\\s+[A-Za-z0-9._~+/-]+=*", "Bearer ***")
- replace_all_patterns(log.attributes, "value", "(?i)[\"']?(password|passwd|pwd|token|secret|client_secret|api[_-]?key|authorization|cookies?|signature|x-amz-signature)[\"']?\\s*[:=]\\s*(\"(\\\\.|[^\"\\\\])*\"|'[^']*'|[^,;\\s}]+)", "[REDACTED]")
- replace_all_patterns(log.attributes, "value", "[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{10,}", "***jwt***")
- replace_all_patterns(log.attributes, "value", "(?i)([a-z][a-z0-9+.-]*://)[^/@\\s]+:[^/@\\s]+@", "$$1***@")
- flatten(resource.attributes)
- delete_matching_keys(resource.attributes, "(?i)(^|[._-])(password|passwd|pwd|token|secret|client[._-]?secret|api[._-]?key|access[._-]?key|authorization|cookies?|signature|x[._-]amz[._-]signature)([._-]|$$)")
- replace_all_patterns(resource.attributes, "value", "(?i)Bearer\\s+[A-Za-z0-9._~+/-]+=*", "Bearer ***")
- replace_all_patterns(resource.attributes, "value", "(?i)[\"']?(password|passwd|pwd|token|secret|client_secret|api[_-]?key|authorization|cookies?|signature|x-amz-signature)[\"']?\\s*[:=]\\s*(\"(\\\\.|[^\"\\\\])*\"|'[^']*'|[^,;\\s}]+)", "[REDACTED]")
- replace_all_patterns(resource.attributes, "value", "[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{10,}", "***jwt***")
- replace_all_patterns(resource.attributes, "value", "(?i)([a-z][a-z0-9+.-]*://)[^/@\\s]+:[^/@\\s]+@", "$$1***@")
# Маскирование (п.23), строже access-collector: значения чувствительных параметров
# (password=, client_secret, token=, signature, X-Amz-Signature — в т.ч. в query
# http.url/http.target, т.к. спаны несут URL с query), Bearer-токены и JWT.
@ -187,6 +209,15 @@ spec:
- replace_pattern(span.attributes["http.target"], "[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{20,}\\.[A-Za-z0-9_-]{10,}", "***jwt***")
batch: {send_batch_size: 1024, send_batch_max_size: 2048, timeout: 5s}
exporters:
otlp/logs:
endpoint: vector-logs.vector.svc.cluster.local:4317
tls: {insecure: true}
compression: gzip
# Longer than Vector's 300s flush interval: S3 completion acknowledges OTLP.
timeout: 600s
# Synchronous forwarding lets the agent retain its durable queue until S3.
sending_queue: {enabled: false}
retry_on_failure: {enabled: false}
kafka/traces:
brokers: ["${env:KAFKA_BROKERS}"]
protocol_version: 2.8.0
@ -202,6 +233,11 @@ spec:
service:
extensions: [health_check]
pipelines:
logs:
receivers: [otlp]
# No batch/memory queue at this hop: preserve upstream retry on failure.
processors: [memory_limiter, resource, transform/mask_logs]
exporters: [otlp/logs]
traces:
receivers: [otlp, zipkin]
processors: [memory_limiter, resource, transform/mask, batch]

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- spicedb.yaml

View File

@ -0,0 +1,153 @@
apiVersion: v1
kind: Namespace
metadata:
name: spicedb
labels:
istio-injection: disabled
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: spicedb-vault
namespace: spicedb
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: spicedb
namespace: spicedb
spec:
replicas: 1
selector:
matchLabels:
app: spicedb
template:
metadata:
labels:
app: spicedb
annotations:
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-init-first: 'true'
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/agent-requests-cpu: 25m
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: spicedb
vault.hashicorp.com/agent-inject-secret-spicedb-db: secrets/data/apps/spicedb/postgres
vault.hashicorp.com/agent-inject-template-spicedb-db: |-
{{- with secret "secrets/data/apps/spicedb/postgres" -}}
SPICEDB_DATASTORE_CONN_URI='postgres://{{ index .Data.data "username" }}:{{ index .Data.data "password" }}@{{ index .Data.data "host" }}:{{ index .Data.data "port" }}/{{ index .Data.data "database" }}?sslmode=disable'
{{- end -}}
vault.hashicorp.com/agent-inject-secret-spicedb-auth: secrets/data/apps/spicedb/auth
vault.hashicorp.com/agent-inject-template-spicedb-auth: |-
{{- with secret "secrets/data/apps/spicedb/auth" -}}
SPICEDB_GRPC_PRESHARED_KEY='{{ index .Data.data "preshared_key" }}'
{{- end -}}
vault.hashicorp.com/agent-image: cr.yandex/crp3ccidau046kdj8g9q/vault/vault:1.21.2
spec:
serviceAccountName: spicedb-vault
initContainers:
- name: vault-runtime
image: cr.yandex/crp3ccidau046kdj8g9q/vault/vault:1.21.2
command:
- /bin/sh
- -ec
args:
- cp /bin/busybox /lib/ld-musl-x86_64.so.1 /vault-runtime/
resources:
requests:
cpu: 25m
memory: 16Mi
volumeMounts:
- name: vault-runtime
mountPath: /vault-runtime
- name: spicedb-migrate
image: cr.yandex/crp3ccidau046kdj8g9q/spicedb-prod:v1.54.0
command:
- /vault-runtime/ld-musl-x86_64.so.1
- /vault-runtime/busybox
- sh
- -ec
args:
- |
set -a
. /vault/secrets/spicedb-db
. /vault/secrets/spicedb-auth
set +a
exec spicedb datastore migrate head --datastore-engine postgres
volumeMounts:
- name: vault-runtime
mountPath: /vault-runtime
readOnly: true
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 1Gi
containers:
- name: spicedb
image: cr.yandex/crp3ccidau046kdj8g9q/spicedb-prod:v1.54.0
command:
- /vault-runtime/ld-musl-x86_64.so.1
- /vault-runtime/busybox
- sh
- -ec
args:
- |
set -a
. /vault/secrets/spicedb-db
. /vault/secrets/spicedb-auth
set +a
exec spicedb serve --datastore-engine postgres --http-enabled --datastore-conn-pool-read-max-open 10 --datastore-conn-pool-read-min-open 1 --datastore-conn-pool-write-max-open 5 --datastore-conn-pool-write-min-open 1
ports:
- name: grpc
containerPort: 50051
- name: http
containerPort: 8443
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
memory: 1Gi
volumeMounts:
- name: vault-runtime
mountPath: /vault-runtime
readOnly: true
startupProbe:
grpc:
port: 50051
periodSeconds: 5
failureThreshold: 60
readinessProbe:
grpc:
port: 50051
periodSeconds: 5
volumes:
- name: vault-runtime
emptyDir: {}
nodeSelector:
dedicated: generic
imagePullSecrets:
- name: regcred
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
---
apiVersion: v1
kind: Service
metadata:
name: spicedb
namespace: spicedb
spec:
selector:
app: spicedb
ports:
- name: grpc
port: 50051
targetPort: grpc
- name: http
port: 8443
targetPort: http

View File

@ -0,0 +1,145 @@
# Сервисные логи УралКалия
Поток: контейнерный stdout/stderr → OTel Agent на узле → существующий OTel gateway
→ OTLP gRPC → Vector → MinIO, Parquet/Zstd. Логи не проходят через Kafka.
Существующий pipeline трейсов продолжает работать через Kafka/audit-processor.
## Компоненты и параметры
| Компонент | Настройка |
|---|---|
| Agent | DaemonSet `opentelemetry-agent/otel-agent`, образ contrib `0.121.0-amd64` |
| Источник | `/var/log/pods/*/*/*.log`, CRI/Docker parser, сборка частичных записей runtime |
| Метаданные | namespace, pod/UID, container, node, service из `app.kubernetes.io/name`, fallback `app`/container |
| Gateway | `opentelemetry-collector/otel-collector`, отдельный pipeline `logs` |
| Writer | StatefulSet `vector/vector-logs`, две реплики Vector `0.56.0-debian` |
| Буфер | У каждой реплики Vector локальный `emptyDir` до `12Gi`, дисковая очередь `10Gi`; переполнение блокирует приём |
| Файлы | Фиксированная схема `base/logs.schema`, Zstd 3, 300 секунд либо 64 MiB входных событий |
| Хранилище | `http://10.133.0.245:9000/service-logs`, объекты под `logs/` |
| Retention | Lifecycle удаляет текущие объекты через 14 дней; отдельные правила для предыдущих версий и delete markers |
| Секрет | Vault KV v2 `secrets/apps/vector/minio`, поля `access_key`, `secret_key` и `bucket` |
| Доступ Vault | Kubernetes Auth role/policy `vector-logs`, только SA `vector-logs` в namespace `vector` |
Пример ключа:
```text
logs/contour=uralkal/date=2026-11-29/hour=18/<timestamp>-<uuid>.parquet
```
Дата/час вычисляются из времени события в UTC. Все метки сохраняются колонками,
произвольные resource/log attributes — строкой `attributes_json`.
S3 object tags: `contour=uralkal`, `signal=logs`, `retention=14d`.
Тег сам по себе ничего не удаляет: удалением управляет lifecycle по префиксу `logs/`.
Строки времени в Parquet — RFC3339, при запросах их можно привести к TIMESTAMPTZ.
## Перед раскаткой
1. Зеркалировать официальный образ Vector в registry, доступный УралКалию:
```bash
docker pull timberio/vector:0.56.0-debian
docker tag timberio/vector:0.56.0-debian cr.yandex/crp3ccidau046kdj8g9q/vector:0.56.0-debian
docker push cr.yandex/crp3ccidau046kdj8g9q/vector:0.56.0-debian
```
Новый образ нужно доставить в фактическое зеркало закрытого контура так же,
как остальные образы. Запуск не должен зависеть от доступа узлов в Docker Hub.
Vector до 0.56.0 не подходит для этого конфига без проверки наличия Parquet
в конкретной сборке.
2. Применить конфигурацию окружения `uralkal` в репозитории `infra/terraform`.
Terraform управляет бакетом `service-logs`, lifecycle для `logs/` на 14 дней,
отдельным пользователем MinIO с правами записи, секретом
`secrets/apps/vector/minio` и policy/role Vault `vector-logs`.
Порядок применения стеков описан в README Terraform-репозитория.
3. Распространение `regcred` в namespace `vector` и `opentelemetry-agent`
выполняется Terraform. Сами namespace объявлены в этом репозитории и
создаются Flux; в Terraform для них используется `manage: false` и
`image_pull_secret: true`.
4. Для Vector нужны generic-узлы с доступным ephemeral storage. У каждой реплики
`emptyDir` ограничен `12Gi`; контейнер запрашивает `1Gi` ephemeral storage,
лимит — `14Gi` с учётом буфера, временных файлов и логов контейнера.
Проверить доступ Vault Agent init к Vault:8200. API egress агента сейчас
разрешён на private CIDR TCP 443/6443: после получения адресов API контура
сузить `opentelemetry-agent/uralkal/networkpolicy.yaml` до service/control-plane IP.
На узлах с Docker, если pod log files ссылаются за пределы `/var/log/pods`,
дополнительно понадобится read-only mount `/var/lib/docker/containers`.
5. Передать изменения в GitOps обычным способом. Новые компоненты уже включены
в `clusters/uralkal/kustomization.yaml`. Временное отсутствие Vector не должно
ломать readiness gateway: приложение/трейсы и доставка логов независимы.
## Наблюдение и ограничения
`vmstack/uralkal` дополнен scrape jobs для OTel Agent:8888 и Vector:9598.
Контролировать `up` этих jobs, рост `otelcol_exporter_queue_size`,
`otelcol_exporter_enqueue_failed_log_records`, `component_errors_total`,
`component_discarded_events_total`, заполнение дискового буфера Vector и свободное
место на узлах. Алертинг в vmstack сейчас отключён; новые метрики доступны в
существующей Grafana, но подключение канала оповещений — отдельная настройка.
Agent начинает читать новые файлы с конца; накопленная история при первом
подключении не импортируется. CRI partial records собираются в одно событие;
произвольные многострочные stack traces приложений требуют правил конкретного
формата (либо JSON-логирования со stack trace в одном поле).
Namespace этого конвейера и `security-audit` исключены из файлового сбора, чтобы
не собирать собственные ошибки и S3 debug echoes по кругу.
У gateway нет batch processor/асинхронной очереди логов: upstream подтверждается
после ответа Vector, который ждёт успешной записи в S3. Поэтому таймауты gateway
600s и агента 660s больше flush interval 300s. Доставка at-least-once; это не
exactly-once. При длительной недоступности, заполнении очередей, ротации
непрочитанных файлов или потере узла возможна потеря данных.
Очередь агента ограничена числом запросов, а не байтами; hostPath требует контроля
свободного места. Буфер Vector находится в `emptyDir` на диске узла; отдельные
PV/PVC не создаются. Буфер переживает перезапуск контейнера в том же поде,
но удаляется при пересоздании пода, в том числе при rollout или переносе на другой
узел. До успешной отправки в S3 записи также остаются в очереди агента.
Секреты подставляются Vault Agent один раз при старте. После ротации ключей
нужно перезапустить StatefulSet Vector. Текущий MinIO endpoint использует HTTP,
как существующий pipeline трейсов; TLS потребует серверного endpoint и CA.
Маскирование распространённых ключей/Bearer выполняется в logs pipeline gateway
до отправки в Vector и повторно в Vector. Вложенные log/resource attributes
в gateway переводятся в плоские dotted keys; чувствительные ключи удаляются.
Нестроковый body приводится к строке. Ошибки обработки gateway возвращаются
отправителю для повторной доставки, а не отправляют немаскированную запись дальше.
Это дополнительная защита, не замена запрету записи секретов приложениями.
Expiration 14 дней считается от создания объекта, не от даты в ключе.
Удаление асинхронное. На новом бакете versioning не включается; если его
включить позднее, предыдущие версии удаляются через 14 дней после перехода в
noncurrent. Следовательно, versioning может увеличить фактический срок хранения.
Object Lock/Legal Hold могут блокировать удаление.
## Локальная проверка перед раскаткой
Проверено официальными бинарниками Collector `0.121.0` и Vector `0.56.0`:
```bash
python3 ci/security/verify-service-logs.py \
--collector-bin /path/to/otelcol-contrib \
--vector-bin /path/to/vector
```
Требуются Python 3, PyYAML и openssl. Проверка запускает временный Collector
на случайном localhost-порту, отправляет только синтетические OTLP-логи и
проверяет маскирование текста/JSON/body-map, вложенных атрибутов, cookies-массивов,
Bearer/JWT и credentials в URL. Проверяет сохранение обычных полей и metadata,
валидирует полный gateway/agent config и запускает VRL-тесты из фактического
Vector-конфига. Используются временные файлы и фиктивные credentials/CA;
к кластеру, Vault и реальному MinIO скрипт не подключается.
Локальная проверка не подтверждает доступность образов в закрытом registry,
получение ключей из Vault и фактическую запись/retention Parquet в MinIO.
Эти сценарии проверяются оператором после раскатки.
## Источники
- https://opentelemetry.io/docs/platforms/kubernetes/collector/components/
- https://vector.dev/releases/0.56.0/
- https://vector.dev/docs/reference/configuration/sources/opentelemetry/
- https://vector.dev/docs/reference/configuration/sinks/aws_s3/
- https://docs.min.io/aistor/administration/object-lifecycle-management/

View File

@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: vector
resources:
- namespace.yaml
- statefulset.yaml
- service.yaml
configMapGenerator:
- name: vector-logs-config
files:
- vector.yaml
- logs.schema

View File

@ -0,0 +1,19 @@
message service_logs {
REQUIRED BINARY event_time (UTF8);
REQUIRED BINARY observed_time (UTF8);
REQUIRED BINARY contour (UTF8);
REQUIRED BINARY namespace (UTF8);
REQUIRED BINARY service_name (UTF8);
REQUIRED BINARY pod (UTF8);
REQUIRED BINARY pod_uid (UTF8);
REQUIRED BINARY container (UTF8);
REQUIRED BINARY node (UTF8);
REQUIRED BINARY severity (UTF8);
REQUIRED INT64 severity_number;
REQUIRED BINARY trace_id (UTF8);
REQUIRED BINARY span_id (UTF8);
REQUIRED BINARY message (UTF8);
REQUIRED BINARY attributes_json (UTF8);
REQUIRED BINARY partition_date (UTF8);
REQUIRED BINARY partition_hour (UTF8);
}

View File

@ -1,6 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: trino
name: vector
labels:
istio-injection: disabled

View File

@ -0,0 +1,23 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: vector-logs
---
apiVersion: v1
kind: Service
metadata:
name: vector-logs
spec:
selector: {app.kubernetes.io/name: vector-logs}
ports:
- {name: grpc-otlp, port: 4317, targetPort: otlp, appProtocol: grpc}
---
apiVersion: v1
kind: Service
metadata:
name: vector-logs-headless
spec:
clusterIP: None
selector: {app.kubernetes.io/name: vector-logs}
ports:
- {name: grpc-otlp, port: 4317, targetPort: otlp}

View File

@ -0,0 +1,100 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: vector-logs
spec:
serviceName: vector-logs-headless
replicas: 2
podManagementPolicy: Parallel
selector:
matchLabels: {app.kubernetes.io/name: vector-logs}
template:
metadata:
labels:
app.kubernetes.io/name: vector-logs
sidecar.istio.io/inject: "false"
annotations:
sidecar.istio.io/inject: "false"
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-init-first: "true"
vault.hashicorp.com/agent-pre-populate-only: "true"
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: vector-logs
vault.hashicorp.com/agent-run-as-user: "10001"
vault.hashicorp.com/agent-run-as-group: "10001"
vault.hashicorp.com/agent-inject-secret-aws-credentials: secrets/data/apps/vector/minio
vault.hashicorp.com/agent-inject-perms-aws-credentials: "0400"
vault.hashicorp.com/agent-inject-template-aws-credentials: |
{{- with secret "secrets/data/apps/vector/minio" -}}
[default]
aws_access_key_id = {{ index .Data.data "access_key" }}
aws_secret_access_key = {{ index .Data.data "secret_key" }}
{{- end -}}
spec:
serviceAccountName: vector-logs
imagePullSecrets:
- name: regcred
terminationGracePeriodSeconds: 90
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
seccompProfile: {type: RuntimeDefault}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels: {app.kubernetes.io/name: vector-logs}
containers:
- name: vector
image: timberio/vector:0.56.0-debian
args: ["--config", "/etc/vector/vector.yaml", "--require-healthy", "true"]
env:
- {name: VECTOR_LOG, value: info}
- {name: AWS_EC2_METADATA_DISABLED, value: "true"}
ports:
- {name: otlp, containerPort: 4317}
- {name: api, containerPort: 8686}
- {name: metrics, containerPort: 9598}
startupProbe:
httpGet: {path: /health, port: api}
failureThreshold: 60
periodSeconds: 10
readinessProbe:
httpGet: {path: /health, port: api}
livenessProbe:
httpGet: {path: /health, port: api}
periodSeconds: 20
resources:
requests: {cpu: 250m, memory: 512Mi, ephemeral-storage: 1Gi}
limits: {cpu: "2", memory: 2Gi, ephemeral-storage: 14Gi}
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities: {drop: [ALL]}
volumeMounts:
- {name: config, mountPath: /etc/vector, readOnly: true}
- {name: data, mountPath: /var/lib/vector}
- {name: tmp, mountPath: /tmp}
volumes:
- name: config
configMap: {name: vector-logs-config}
- name: data
# Node disk, scoped to this pod; removed when the pod is recreated.
# Keep headroom above Vector's 10Gi buffer for disk-buffer bookkeeping.
emptyDir: {sizeLimit: 12Gi}
- name: tmp
emptyDir: {sizeLimit: 128Mi}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: vector-logs
spec:
minAvailable: 1
selector:
matchLabels: {app.kubernetes.io/name: vector-logs}

View File

@ -0,0 +1,111 @@
data_dir: /var/lib/vector
api:
enabled: true
address: 0.0.0.0:8686
sources:
otlp:
type: opentelemetry
grpc: {address: "0.0.0.0:4317"}
http: {address: "0.0.0.0:4318"}
# Default native decoding exposes .message, .resources, .attributes.
internal_metrics:
type: internal_metrics
transforms:
normalize_logs:
type: remap
inputs: [otlp.logs]
# A transformation failure is exported unchanged rather than silently dropped;
# all conversions below have fallbacks to keep the fixed schema valid.
source: |
resources = object(.resources) ?? {}
attributes = object(.attributes) ?? {}
app = object(attributes.app) ?? {}
text = string(.message) ?? encode_json(.message)
parsed = parse_json(text) ?? {}
if is_object(parsed) && is_empty(app) {
app = object!(parsed)
}
ts = timestamp(.timestamp) ?? parse_timestamp(string(.timestamp) ?? "", format: "%+") ?? now()
observed = timestamp(.observed_timestamp) ?? parse_timestamp(string(.observed_timestamp) ?? "", format: "%+") ?? ts
service_name = string(resources."service.name") ?? string(resources.app) ?? string(resources."k8s.container.name") ?? "unknown"
if service_name == "" {
service_name = string(resources.app) ?? string(resources."k8s.container.name") ?? "unknown"
}
severity = upcase(string(.severity_text) ?? string(app.level) ?? string(app.levelname) ?? "UNSPECIFIED")
if severity == "" {
severity = upcase(string(app.level) ?? string(app.levelname) ?? "UNSPECIFIED")
}
trace_id = string(.trace_id) ?? ""
span_id = string(.span_id) ?? ""
if trace_id == "" || trace_id == "00000000000000000000000000000000" {
trace_id = string(app.trace_id) ?? ""
}
if span_id == "" || span_id == "0000000000000000" {
span_id = string(app.span_id) ?? ""
}
# Redact common credentials in both the original message and nested attributes.
text = replace(text, r'(?i)Bearer\s+[A-Za-z0-9._~+/-]+=*', "Bearer ***")
text = replace(text, r'(?i)"?(password|passwd|pwd|token|secret|client_secret|api[_-]?key|authorization|cookie|signature|x-amz-signature)"?\s*[:=]\s*("(\\.|[^"\\])*"|[^,;\s}]+)', "[REDACTED]")
text = replace(text, r'[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}', "***jwt***")
safe_attributes = encode_json({"resource": resources, "log": attributes})
safe_attributes = replace(safe_attributes, r'(?i)"(password|passwd|pwd|token|secret|client_secret|api[_-]?key|authorization|cookie|signature|x-amz-signature)"\s*:\s*"(\\.|[^"\\])*"', "\"redacted\":\"***\"")
safe_attributes = replace(safe_attributes, r'(?i)Bearer\s+[A-Za-z0-9._~+/-]+=*', "Bearer ***")
safe_attributes = replace(safe_attributes, r'[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}', "***jwt***")
. = {
"event_time": format_timestamp!(ts, format: "%+"),
"observed_time": format_timestamp!(observed, format: "%+"),
"contour": "${CONTOUR}",
"namespace": string(resources."k8s.namespace.name") ?? "unknown",
"service_name": service_name,
"pod": string(resources."k8s.pod.name") ?? "",
"pod_uid": string(resources."k8s.pod.uid") ?? "",
"container": string(resources."k8s.container.name") ?? "",
"node": string(resources."k8s.node.name") ?? "",
"severity": severity,
"severity_number": to_int(.severity_number) ?? 0,
"trace_id": trace_id,
"span_id": span_id,
"message": text,
"attributes_json": safe_attributes,
"partition_date": format_timestamp!(ts, format: "%F", timezone: "UTC"),
"partition_hour": format_timestamp!(ts, format: "%H", timezone: "UTC")
}
sinks:
minio_logs:
type: aws_s3
inputs: [normalize_logs]
bucket: "${S3_BUCKET}"
endpoint: "${S3_ENDPOINT}"
region: us-east-1
force_path_style: true
auth:
credentials_file: /vault/secrets/aws-credentials
key_prefix: "logs/contour={{ contour }}/date={{ partition_date }}/hour={{ partition_hour }}/"
filename_append_uuid: true
compression: none
encoding: {codec: text}
batch_encoding:
codec: parquet
schema_file: /etc/vector/logs.schema
schema_mode: strict
compression: {algorithm: zstd, level: 3}
batch:
max_bytes: 67108864
timeout_secs: 300
buffer:
type: disk
max_size: 10737418240
when_full: block
# Retain the upstream agent queue until the S3 request succeeds.
acknowledgements: {enabled: true}
tags:
contour: "${CONTOUR}"
signal: logs
retention: 14d
metrics:
type: prometheus_exporter
inputs: [internal_metrics]
address: 0.0.0.0:9598

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- base

View File

@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: vector
resources:
- ../base
- networkpolicy.yaml
images:
- name: timberio/vector
newName: cr.yandex/crp3ccidau046kdj8g9q/vector
newTag: 0.56.0-debian
patches:
- path: statefulset.yaml

View File

@ -0,0 +1,43 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: vector-logs
spec:
podSelector:
matchLabels: {app.kubernetes.io/name: vector-logs}
policyTypes: [Ingress, Egress]
ingress:
- from:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: opentelemetry-collector}
podSelector:
matchLabels: {telemetry/collector: traces}
ports:
- {port: 4317, protocol: TCP}
# Kubelet probes originate from the node and are allowed by NetworkPolicy.
# Do not expose Vector's GraphQL/tap API (8686) to other pods.
- from:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: vmstack}
ports:
- {port: 9598, protocol: TCP}
egress:
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: kube-system}
podSelector:
matchLabels: {k8s-app: kube-dns}
- ipBlock: {cidr: 169.254.25.10/32}
ports:
- {port: 53, protocol: UDP}
- {port: 53, protocol: TCP}
- to:
- ipBlock: {cidr: 10.133.0.245/32}
ports:
- {port: 9000, protocol: TCP}
# Vault Agent init container authenticates before Vector starts.
- to:
- namespaceSelector:
matchLabels: {kubernetes.io/metadata.name: vault}
ports:
- {port: 8200, protocol: TCP}

View File

@ -0,0 +1,14 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: vector-logs
spec:
template:
spec:
nodeSelector: {dedicated: generic}
containers:
- name: vector
env:
- {name: CONTOUR, value: uralkal}
- {name: S3_BUCKET, value: service-logs}
- {name: S3_ENDPOINT, value: "http://10.133.0.245:9000"}

View File

@ -130,6 +130,36 @@ spec:
remoteWrite:
- url: http://vmsingle-vmstack.vmstack.svc.cluster.local.:8428/api/v1/write
scrapeInterval: 30s
# The operator appends these jobs; no new CRD resources are needed at bootstrap.
inlineScrapeConfig: |
- job_name: service-logs-otel-agent
kubernetes_sd_configs:
- role: pod
namespaces:
names: [opentelemetry-agent]
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
regex: otel-agent
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_name]
regex: metrics
action: keep
- source_labels: [__meta_kubernetes_pod_node_name]
target_label: node
- job_name: service-logs-vector
kubernetes_sd_configs:
- role: pod
namespaces:
names: [vector]
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
regex: vector-logs
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_name]
regex: metrics
action: keep
- source_labels: [__meta_kubernetes_pod_name]
target_label: pod
resources:
requests:
cpu: 50m

View File

@ -1,154 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ams-sync
labels:
app: ams-sync
service: backend
namespace: ams-sync
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: ams-sync
template:
metadata:
labels:
app: ams-sync
service: backend
monitoring: prometheus
annotations:
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411,8200
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
vault.hashicorp.com/agent-init-first: 'true'
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: ams-sync
vault.hashicorp.com/agent-inject-secret-ams-sync-db: secrets/data/apps/ams-sync/postgres
vault.hashicorp.com/agent-inject-template-ams-sync-db: |-
{{- with secret "secrets/data/apps/ams-sync/postgres" -}}
USER_DB_HOST={{ index .Data.data "host" }}
USER_DB_PORT={{ index .Data.data "port" }}
USER_DB_NAME={{ index .Data.data "database" }}
USER_DB_USER={{ index .Data.data "username" }}
USER_DB_PASSWORD={{ index .Data.data "password" }}
{{- end -}}
vault.hashicorp.com/agent-inject-secret-ams-sync-kafka: secrets/data/kafka/apps/ams-sync
vault.hashicorp.com/agent-inject-template-ams-sync-kafka: |-
{{- with secret "secrets/data/kafka/apps/ams-sync" -}}
KAFKA_BOOTSTRAP_SERVERS={{ with index .Data.data "auth" }}{{ index . "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers" }}{{ end }}
KAFKA_SASL_PLAIN_USERNAME={{ index .Data.data "username" }}
KAFKA_SASL_PLAIN_PASSWORD={{ index .Data.data "password" }}
KAFKA_SSL_CAFILE={{ index .Data.data "ca_file" }}
{{- end -}}
vault.hashicorp.com/agent-inject-secret-ams-sync-zitadel: secrets/data/zitadel/setup
vault.hashicorp.com/agent-inject-template-ams-sync-zitadel: |-
{{- with secret "secrets/data/zitadel/setup" -}}
ZITADEL_HOST={{ index .Data.data "host" }}
ZITADEL_SERVICE_ACCESS_TOKEN={{ index .Data.data "ams_sync_zitadel_access_token" }}
{{- end -}}
vault.hashicorp.com/agent-inject-secret-ams-sync-auth: secrets/data/apps/ams-sync/auth
vault.hashicorp.com/agent-inject-template-ams-sync-auth: |-
{{- with secret "secrets/data/apps/ams-sync/auth" -}}
AUTH_ADMIN_USERNAME={{ index .Data.data "admin-username" }}
AUTH_ADMIN_PASSWORD={{ index .Data.data "admin-password" }}
{{- end -}}
vault.hashicorp.com/agent-inject-secret-ams-sync-telegram: secrets/data/apps/ams-sync/telegram
vault.hashicorp.com/agent-inject-template-ams-sync-telegram: |-
{{- with secret "secrets/data/apps/ams-sync/telegram" -}}
TELEGRAM_TOKEN={{ index .Data.data "telegram-token" }}
TELEGRAM_GROUP_ID={{ index .Data.data "telegram-group-id" }}
{{- end -}}
spec:
serviceAccountName: ams-sync-vault
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: backend
tolerations:
- key: dedicated
operator: Equal
value: backend
effect: NoSchedule
containers:
- name: backend
image: cr.yandex/crp3ccidau046kdj8g9q/ams-sync:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -ec
args:
- |
set -a
[ -f /vault/secrets/ams-sync-db ] && . /vault/secrets/ams-sync-db
[ -f /vault/secrets/ams-sync-kafka ] && . /vault/secrets/ams-sync-kafka
[ -f /vault/secrets/ams-sync-zitadel ] && . /vault/secrets/ams-sync-zitadel
[ -f /vault/secrets/ams-sync-auth ] && . /vault/secrets/ams-sync-auth
[ -f /vault/secrets/ams-sync-telegram ] && . /vault/secrets/ams-sync-telegram
set +a
exec python3 cmd.py run
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
- name: AMS_SYNC_TOPIC
value: ams-sync
- name: ENVIRONMENT
value: PRODUCTION
- name: HOST_ORGANIZATION_ID
value: '368536846176636704'
- name: ALERT_ENABLED
value: 'False'
- name: USER_SERVER_HOST
value: https://sarex.stand.sarex.tech
- name: AUTH_HOST
value: https://sarex.stand.sarex.tech
- name: VERIFY_USERS
value: 'True'
- name: KAFKA_SECURITY_PROTOCOL
value: SSL
- name: KAFKA_SASL_MECHANISM
value: SCRAM-SHA-512
volumeMounts:
- name: cm-ya-ca-cert
mountPath: /etc/ca-certificates/Yandex/
readOnly: true
resources: null
volumes:
- name: cm-ya-ca-cert
configMap:
name: kafka-cert
items:
- key: YandexInternalRootCA.crt
path: YandexInternalRootCA.crt

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: ams-sync

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: ams-sync
labels: {}
namespace: ams-sync
spec:
type: ClusterIP
selector:
app: ams-sync
ports:
- name: http
port: 8000
targetPort: 8000

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: ams-sync-vault
labels: {}
namespace: ams-sync

View File

@ -1,122 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: attachments
labels:
app: attachments
service: attachments
namespace: attachments
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: attachments
template:
metadata:
labels:
app: attachments
service: attachments
annotations:
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411,8200
vault.hashicorp.com/agent-init-first: 'true'
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-secret-attachments-db: secrets/data/apps/attachments/postgres
vault.hashicorp.com/agent-inject-secret-attachments-s3: secrets/data/minio/apps/attachments
vault.hashicorp.com/agent-inject-template-attachments-db: |-
{{- with secret "secrets/data/apps/attachments/postgres" -}}
DATABASE_HOST={{ index .Data.data "host" }}
DATABASE_PORT={{ index .Data.data "port" }}
DATABASE_NAME={{ index .Data.data "database" }}
DATABASE_USER={{ index .Data.data "username" }}
DATABASE_PASSWORD={{ index .Data.data "password" }}
DATABASE_SSL_MODE=disable
{{- end -}}
vault.hashicorp.com/agent-inject-template-attachments-s3: |-
{{- with secret "secrets/data/minio/apps/attachments" -}}
YANDEX_S3_ENDPOINT_URL=minio.minio:9000
YANDEX_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
YANDEX_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
YANDEX_S3_USE_SSL=true
YANDEX_S3_REGION=ru-central
YANDEX_S3_VERIFY=false
BUCKET_NAME=attachments
{{- end -}}
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: attachments
spec:
serviceAccountName: attachments-vault
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: backend
tolerations:
- key: dedicated
operator: Equal
value: backend
effect: NoSchedule
containers:
- name: attachments
image: cr.yandex/crp3ccidau046kdj8g9q/att9:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -ec
args:
- |
set -a
[ -f /vault/secrets/attachments-db ] && . /vault/secrets/attachments-db
[ -f /vault/secrets/attachments-s3 ] && . /vault/secrets/attachments-s3
set +a
mkdir -p /etc/sarex/yc-s3-storage
cat > /etc/sarex/yc-s3-storage/yc-s3-service-account.json <<EOF
{
"endpoint": "${YANDEX_S3_ENDPOINT_URL}",
"access_key_id": "${YANDEX_S3_ACCESS_KEY_ID}",
"secret_access_key": "${YANDEX_S3_SECRET_ACCESS_KEY}",
"use_ssl": ${YANDEX_S3_USE_SSL}
}
EOF
exec /opt/attachments/entrypoint.sh
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
- name: POSTGRES_POOL_SIZE
value: '10'
- name: YANDEX_S3_ACCOUNT_PATH
value: /etc/sarex/yc-s3-storage/yc-s3-service-account.json
- name: API_ADDRESS
value: 0.0.0.0:8000
resources: null

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: attachments

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: attachments-service
labels: {}
namespace: attachments
spec:
type: ClusterIP
selector:
app: attachments
ports:
- name: http
port: 8000
targetPort: 8000

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: attachments-vault
labels: {}
namespace: attachments

View File

@ -1,73 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
labels:
app: frontend
service: frontend
namespace: auth-flow
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
service: frontend
annotations:
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
spec:
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: frontend
tolerations:
- key: dedicated
operator: Equal
value: frontend
effect: NoSchedule
containers:
- name: frontend
image: cr.yandex/crp3ccidau046kdj8g9q/auth-flow-frontend:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
resources:
requests:
memory: 100Mi
cpu: 25m

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: auth-flow

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: frontend-svc
labels: {}
namespace: auth-flow
spec:
type: ClusterIP
selector:
app: frontend
ports:
- name: http
port: 80
targetPort: 80

View File

@ -1,126 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: bi-backend
labels:
app: bi-backend
service: main
namespace: bi
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: bi-backend
template:
metadata:
labels:
app: bi-backend
service: main
annotations:
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
traffic.sidecar.istio.io/excludeOutboundPorts: '8200'
vault.hashicorp.com/agent-init-first: 'true'
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-secret-bi-db: secrets/data/apps/bi/postgres
vault.hashicorp.com/agent-inject-template-bi-db: |-
{{- with secret "secrets/data/apps/bi/postgres" -}}
DB_HOST={{ index .Data.data "host" }}
DB_PORT={{ index .Data.data "port" }}
DB_DATABASE={{ index .Data.data "database" }}
DB_USERNAME={{ index .Data.data "username" }}
DB_PASSWORD={{ index .Data.data "password" }}
{{- end -}}
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: bi
spec:
serviceAccountName: bi-vault
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: backend
tolerations:
- key: dedicated
operator: Equal
value: backend
effect: NoSchedule
containers:
- name: main
image: cr.yandex/crp3ccidau046kdj8g9q/bi-backend:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -ec
args:
- |
set -a
[ -f /vault/secrets/bi-db ] && . /vault/secrets/bi-db
set +a
exec /opt/entrypoint.sh
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
- name: SETTINGS_DEBUG
value: '0'
- name: SETTINGS_VERIFY_SSL
value: '1'
- name: SETTINGS_API_V1_PREFIX
value: /api/v1
- name: AUTH_HOST
value: http://backend-svc.django.svc.cluster.local
- name: WORKER_TIMEOUT
value: '120'
- name: PYTHONPATH
value: src
- name: ISSUES_SERVICE_HOST
value: http://backend-svc.issues.svc.cluster.local
- name: EAV_SERVICE_HOST
value: http://backend-svc.eav.svc.cluster.local
- name: PM_SERVICE_HOST
value: http://backend-svc.pm.svc.cluster.local:8000
- name: SUPERSET_SYSTEM_WIDGETS
value: '{"MDR": {"id": "e7343f21-1ee0-4a87-b712-e8cfd413cc49","name": "MDR"},"SC":
{"id": "d63d25e4-eab6-452f-8b31-065094bc2cb6","name": "Стройконтроль"}}'
- name: SUPERSET_DOCUMENTATION_URL
value: https://sarex.rcc-group.ru/documentations/
- name: KAFKA_BOOTSTRAP_SERVERS
value: '["kafka-kafka-contour.kafka.svc.cluster.local:9092"]'
- name: KAFKA_TOPICS
value: '{"planning": "message-hub-prod"}'
- name: KAFKA_ENABLE
value: '0'
resources:
requests:
memory: 128Mi
cpu: 25m

View File

@ -1,91 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: bi-frontend
labels:
app: bi-frontend
service: frontend
namespace: bi
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: bi-frontend
template:
metadata:
labels:
app: bi-frontend
service: frontend
annotations:
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
traffic.sidecar.istio.io/excludeOutboundPorts: 4317,4318,9411
spec:
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: frontend
tolerations:
- key: dedicated
operator: Equal
value: frontend
effect: NoSchedule
containers:
- name: frontend
image: cr.yandex/crp3ccidau046kdj8g9q/bi-frontend:latest
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
resources:
requests:
memory: 128Mi
cpu: 100m

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: bi

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: bi-backend-service
labels: {}
namespace: bi
spec:
type: ClusterIP
selector:
app: bi-backend
ports:
- name: http
port: 80
targetPort: 8000

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: bi-frontend-frontend-svc
labels: {}
namespace: bi
spec:
type: ClusterIP
selector:
app: bi-frontend
ports:
- name: http
port: 80
targetPort: 80

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: bi-vault
labels: {}
namespace: bi

View File

@ -1,157 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
labels:
app: backend
service: backend
namespace: bim
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
service: backend
annotations:
proxy.istio.io/config: |
tracing:
sampling: 100
zipkin:
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
custom_tags:
k8s.pod.name:
environment:
name: POD_NAME
k8s.namespace.name:
environment:
name: POD_NAMESPACE
k8s.pod.ip:
environment:
name: INSTANCE_IP
traffic.sidecar.istio.io/excludeOutboundPorts: '8200'
vault.hashicorp.com/agent-init-first: 'true'
vault.hashicorp.com/agent-inject: 'true'
vault.hashicorp.com/agent-inject-secret-bim-postgresql: secrets/data/apps/bim/postgres
vault.hashicorp.com/agent-inject-template-bim-postgresql: |-
{{- with secret "secrets/data/apps/bim/postgres" -}}
POSTGRES_ADDRESS={{ index .Data.data "host" }}
POSTGRES_ADDRESS_2={{ index .Data.data "host" }}
POSTGRES_ADDRESS_3={{ index .Data.data "host" }}
POSTGRES_ADDRESS_4={{ index .Data.data "host" }}
POSTGRES_ADDRESS_5={{ index .Data.data "host" }}
POSTGRES_PORT={{ index .Data.data "port" }}
POSTGRES_PORT_2={{ index .Data.data "port" }}
POSTGRES_PORT_3={{ index .Data.data "port" }}
POSTGRES_PORT_4={{ index .Data.data "port" }}
POSTGRES_PORT_5={{ index .Data.data "port" }}
POSTGRES_DB={{ index .Data.data "database" }}
POSTGRES_DB_2={{ index .Data.data "database" }}
POSTGRES_DB_3={{ index .Data.data "database" }}
POSTGRES_DB_4={{ index .Data.data "database" }}
POSTGRES_DB_5={{ index .Data.data "database" }}
POSTGRES_USER={{ index .Data.data "username" }}
POSTGRES_USER_2={{ index .Data.data "username" }}
POSTGRES_USER_3={{ index .Data.data "username" }}
POSTGRES_USER_4={{ index .Data.data "username" }}
POSTGRES_USER_5={{ index .Data.data "username" }}
POSTGRES_PASSWORD={{ index .Data.data "password" }}
POSTGRES_PASSWORD_2={{ index .Data.data "password" }}
POSTGRES_PASSWORD_3={{ index .Data.data "password" }}
POSTGRES_PASSWORD_4={{ index .Data.data "password" }}
POSTGRES_PASSWORD_5={{ index .Data.data "password" }}
{{- end -}}
vault.hashicorp.com/agent-pre-populate-only: 'true'
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: bim
spec:
serviceAccountName: bim-vault
imagePullSecrets:
- name: regcred
nodeSelector:
dedicated: backend
tolerations:
- key: dedicated
operator: Equal
value: backend
effect: NoSchedule
containers:
- name: backend
image: cr.yandex/crp3ccidau046kdj8g9q/bim-api:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -ec
args:
- |
set -a
[ -f /vault/secrets/bim-postgresql ] && . /vault/secrets/bim-postgresql
set +a
exec ./httpserver
ports:
- name: http
containerPort: 8000
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: 8000
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 10
readinessProbe:
httpGet:
path: /ping
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 20
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
- name: LAST_MASTER_BIM
value: '100000'
- name: LAST_MASTER_BIM_V3
value: '100000'
- name: DB_CERT_PATH_4
value: /root/yandex_pg.pem
- name: DB_CERT_PATH_3
value: /root/yandex_pg.pem
- name: DB_CERT_PATH_2
value: /root/yandex_pg.pem
- name: LAST_SLAVE_1_BIM
value: '1000000'
- name: POSTGRES_POOL_SIZE
value: '30'
- name: API_ADDRESS
value: 0.0.0.0:8000
- name: DJANGO_HOST
value: http://backend-svc.django.svc.cluster.local:80
- name: ENABLE_SQL_QUERY
value: '0'
- name: ENABLE_SSL
value: '0'
resources:
requests:
memory: 100Mi
cpu: 25m

View File

@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: bim

View File

@ -1,14 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: backend-svc
labels: {}
namespace: bim
spec:
type: ClusterIP
selector:
app: backend
ports:
- name: http
port: 80
targetPort: 8000

Some files were not shown because too many files have changed in this diff Show More