DEVX-178: [BE] Разработать endpoint выдачи информации для подключении фейн-клиентов через gradle/maven

This commit is contained in:
subochev 2026-03-26 13:22:52 +03:00
parent 334ce90058
commit 39e539dcab
8 changed files with 253 additions and 1 deletions

View File

@ -18,6 +18,11 @@ on:
description: 'Версия образа'
required: true
type: number
prefix:
description: 'Префикс URL'
required: true
type: string
default: 'devspace-ui'
jobs:
deploy-dev:
name: 'Deploy to dev'
@ -38,6 +43,89 @@ jobs:
run: |
npm install
npm run build
cat > entrypoint.sh << EOF
#!/bin/sh
set -e
# Применяем переменные окружения к шаблону конфига
envsubst '${PREFIX}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
# Запускаем nginx с переданными аргументами
exec "$@"
EOF
cat > default.conf.template << EOF
server {
listen 80;
server_name localhost;
# Префикс из переменной окружения (по умолчанию devspace-ui)
set $prefix ${PREFIX:-devspace-ui};
# Редирект с /$prefix на /$prefix/
location = /$prefix {
return 301 /$prefix/;
}
# Отдача статики по префиксу
location /$prefix/ {
alias /usr/share/nginx/html/;
autoindex off;
try_files $uri =404;
}
# Health check (всегда 200)
location /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
# Все остальные пути — 404
location / {
return 404;
}
}
EOF
cat > Dockerfile << EOF
FROM nginx:stable-alpine
# Установка gettext для envsubst (уже есть в alpine, но для ясности)
RUN apk add --no-cache gettext
# Удаляем дефолтный конфиг
RUN rm /etc/nginx/conf.d/default.conf
# Создаём папку для шаблонов
WORKDIR /etc/nginx/templates
# Копируем шаблон конфигурации
COPY default.conf.template /etc/nginx/templates/default.conf.template
# Копируем entrypoint-скрипт
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Копируем статические файлы
COPY ./dist /usr/share/nginx/html
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
EOF
- name: Publishing docker
uses: https://git.binom.pw/otp/devops/docker@main
with:
image-name: "otp/${{ github.event.inputs.repo_path }}"
tags: ${{ github.event.inputs.version }}
- name: Kuebrnetus config
run: |
echo '${{ secrets.KUBE_CONFIG }}' > ./ku.yaml
- name: "Install Helm"
uses: azure/setup-helm@v4.3.0
- name: 'Clone Helms'
uses: https://github.com/actions/checkout@v4
with:
repository: otp/devex
path: 'helms'
- name: 'Cleanup'
if: always()
shell: bash

View File

@ -10,7 +10,7 @@ spec:
- host: {{tpl $.Values.ingress.host .}}
http:
paths:
- path: /devspace-api/
- path: {{$.Values.ingress.prefix | default '/'}}
pathType: Prefix
backend:
service:

View File

@ -13,6 +13,7 @@ image:
version: ''
ingress:
host: 'ui.devx.kube.xx'
prefix: '/devspace-api/'
s3:
url: 'https://s3.binom.pw'
accessKey: 'U4onOIzgYuCqsU1cMIhu'

View File

@ -0,0 +1,10 @@
apiVersion: v2
name: devspace-selfkit-ui
description: KuberService
home: https://tlsys.ru/
icon: https://lk.tlsys.org/favicon.png
keywords:
- test
type: application
version: "9.9.9"
appVersion: "9.9.9"

View File

@ -0,0 +1,106 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{$.Release.Name}}-{{$.Chart.Name}}"
annotations:
devspace.isb/name: {{ $.Values.repository.name | quote }}
devspace.isb/branch: {{ $.Values.repository.branch | quote }}
rollme: {{ .Release.Revision | quote }}
labels:
{{- if $.Values.labels}}
{{- toYaml $.Values.labels | nindent 4 }}
{{- end}}
app.kubernetes.io/name: {{$.Chart.Name}}
app.kubernetes.io/instance: {{ $.Release.Name }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
spec:
{{- if not $.Values.autoscaling.enabled }}
{{ if $.Values.replicaCount }}
replicas: {{ $.Values.replicaCount }}
{{ else }}
replicas: 1
{{end}}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{$.Chart.Name}}
app.kubernetes.io/instance: {{ $.Release.Name }}
template:
metadata:
annotations:
rollme: {{ .Release.Revision | quote }}
{{- with $.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{$.Chart.Name}}
app.kubernetes.io/instance: {{ $.Release.Name }}
{{/* app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}*/}}
spec:
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ if $.Values.serviceAccount }}
serviceAccountName: {{ $.Values.serviceAccount.name }}
{{ end }}
volumes:
- name: application-properties-volume
configMap:
name: {{$.Release.Name}}-{{$.Chart.Name}}-main-config
items:
- key: application.yaml
path: application.yaml
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ $.Chart.Name }}
securityContext:
{{- toYaml $.Values.securityContext | nindent 12 }}
image: "{{ $.Values.image.name }}:{{ $.Values.image.version }}"
imagePullPolicy: {{ $.Values.image.pullPolicy }}
env:
- name: SPRING_CONFIG_ADDITIONAL_LOCATION
value: "file:/opt/app/config/application.yaml"
- name: PREFIX
value: "{{$.Values.ingress.prefix}}"
volumeMounts:
- mountPath: '/opt/app/config'
name: application-properties-volume
ports:
- name: http
containerPort: {{ $.Values.port }}
protocol: TCP
- name: management
containerPort: {{ $.Values.managementPort }}
protocol: TCP
livenessProbe:
httpGet:
path: '/actuator/health/liveness'
port: management
initialDelaySeconds: 20
periodSeconds: 10
readinessProbe:
httpGet:
path: '/actuator/health/readiness'
port: management
initialDelaySeconds: 25
periodSeconds: 10
{{- if $.Values.resources}}
resources:
{{- toYaml $.Values.resources | nindent 12}}
{{- else}}
resources: { }
{{end}}
{{- with $.Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{$.Release.Name}}-{{$.Chart.Name}}
namespace: {{$.Release.Namespace}}
annotations:
traefik.ingress.kubernetes.io/router.middlewares: {{$.Release.Namespace}}-{{$.Release.Name}}-cors@kubernetescrd
spec:
rules:
- host: {{tpl $.Values.ingress.host .}}
http:
paths:
- path: {{$.Values.ingress.prefix | default '/'}}
pathType: Prefix
backend:
service:
name: "{{ $.Release.Name }}-{{ $.Chart.Name }}"
port:
number: {{ $.Values.port }}

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: "{{$.Release.Name}}-{{$.Chart.Name}}"
spec:
selector:
app.kubernetes.io/name: {{$.Chart.Name}}
app.kubernetes.io/instance: {{ $.Release.Name }}
ports:
- protocol: TCP
port: {{$.Values.port}} # порт, по которуму сервис будет доступен внутри кластера
targetPort: {{$.Values.port}} # порт, на котором слушает ваше приложение внутри контейнера

View File

@ -0,0 +1,16 @@
replicaCount: 1
autoscaling:
enabled: false
labels: []
securityContext:
privileged: false
port: 80
managementPort: 80
imagePullSecrets: null
image:
name: null
pullPolicy: Always
version: ''
ingress:
host: 'ui.devx.kube.xx'
prefix: '/devspace-ui/'