feat(test-env): add 1C test environment (#11)
* feat(test-env): add 1C test environment manifests (#11) - PostgreSQL 18.x-2.1C StatefulSet with ru_RU.UTF-8 locale init - 1C server (ragent+crserver+ras) StatefulSet with stable hostname - Gitea runner Deployment with edt label for apk-ci-ng - NodePort services for external 1C access (31540-31545) - Deploy/verify script: dev/deploy-test-env.sh - config.yaml for ApplicationSet integration - test-env only in dev cluster (not in prod AppSet) * fix(test-env): use initContainer for PG data + remove custom entrypoint PVC mount on /var/lib/postgresql wipes the image's pre-built cluster. Solution: initContainer copies cluster data from image to PVC on first run. Removed custom pg-entrypoint.sh ConfigMap — image has its own. * feat(test-env): DinD sidecar for runner + auto-registration Job - Add Docker-in-Docker sidecar to gitea-runner Deployment - Add register-job.yaml: Job that obtains Gitea runner token via API, creates Secret, and scales runner to 1 - RBAC: ServiceAccount + Role/ClusterRole for cross-namespace secret access - Runner labels: edt (for apk-ci-ng), ubuntu-latest --------- Co-authored-by: XoR <xor@benadis.ru>
This commit is contained in:
10
test-env/postgres/configmap.yaml
Normal file
10
test-env/postgres/configmap.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
# PostgreSQL ConfigMap
|
||||
# The benadis/pg-1c image has a built-in entrypoint that:
|
||||
# 1. Configures postgresql.conf with 1C optimizations on first run
|
||||
# 2. Sets pg_hba.conf for network access
|
||||
# 3. Creates usr1cv8 superuser
|
||||
# 4. Starts PostgreSQL
|
||||
#
|
||||
# No additional configuration needed — all settings are baked into the image.
|
||||
# This file is kept as documentation placeholder.
|
||||
# If custom settings are needed in the future, mount them via ConfigMap.
|
||||
16
test-env/postgres/service.yaml
Normal file
16
test-env/postgres/service.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: postgres
|
||||
namespace: test-env
|
||||
labels:
|
||||
app: test-pg
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: test-pg
|
||||
ports:
|
||||
- name: postgres
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
protocol: TCP
|
||||
93
test-env/postgres/statefulset.yaml
Normal file
93
test-env/postgres/statefulset.yaml
Normal file
@@ -0,0 +1,93 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: test-pg
|
||||
namespace: test-env
|
||||
labels:
|
||||
app: test-pg
|
||||
spec:
|
||||
serviceName: postgres
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test-pg
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test-pg
|
||||
spec:
|
||||
initContainers:
|
||||
# On first run the PVC is empty — copy the pre-built PG cluster
|
||||
# from the image so the main entrypoint can configure and start it.
|
||||
- name: init-pgdata
|
||||
image: benadis/pg-1c:18.1-2.1C
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
if [ ! -d /data/18/main ]; then
|
||||
echo "Initializing PG data from image..."
|
||||
cp -a /var/lib/postgresql/. /data/
|
||||
echo "Done."
|
||||
else
|
||||
echo "PG data already exists, skipping init."
|
||||
fi
|
||||
volumeMounts:
|
||||
- name: pg-data
|
||||
mountPath: /data
|
||||
containers:
|
||||
- name: postgres
|
||||
image: benadis/pg-1c:18.1-2.1C
|
||||
# Use the image's built-in entrypoint (configures 1C on first run)
|
||||
env:
|
||||
- name: LANG
|
||||
value: "ru_RU.UTF-8"
|
||||
- name: LC_ALL
|
||||
value: "ru_RU.UTF-8"
|
||||
- name: TZ
|
||||
value: "Europe/Moscow"
|
||||
ports:
|
||||
- name: postgres
|
||||
containerPort: 5432
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: pg-data
|
||||
mountPath: /var/lib/postgresql
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 4Gi
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- su
|
||||
- "-"
|
||||
- postgres
|
||||
- "-c"
|
||||
- "/usr/lib/postgresql/18/bin/pg_isready"
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- su
|
||||
- "-"
|
||||
- postgres
|
||||
- "-c"
|
||||
- "/usr/lib/postgresql/18/bin/pg_isready"
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: pg-data
|
||||
spec:
|
||||
storageClassName: local-path
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
Reference in New Issue
Block a user