Test local llm to generate some content
This commit is contained in:
167
README.md
Normal file
167
README.md
Normal file
@@ -0,0 +1,167 @@
|
||||
# Payouts Service
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### User Management
|
||||
|
||||
#### Register User
|
||||
- **Path**: `/api/v1/user/register`
|
||||
- **Method**: POST
|
||||
- **Request Parameters**:
|
||||
```json
|
||||
{
|
||||
"tin": "string",
|
||||
"phone": "string",
|
||||
"password": "string",
|
||||
"password_cfm": "string"
|
||||
}
|
||||
```
|
||||
- **Response Parameters**:
|
||||
```json
|
||||
{
|
||||
"status": "string"
|
||||
}
|
||||
```
|
||||
- **Curl Example**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/v1/user/register \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"tin":"1234567890","phone":"+79991234567","password":"password123","password_cfm":"password123"}'
|
||||
```
|
||||
|
||||
#### User Login
|
||||
- **Path**: `/api/v1/user/login`
|
||||
- **Method**: POST
|
||||
- **Request Parameters**:
|
||||
```json
|
||||
{
|
||||
"phone": "string",
|
||||
"password": "string"
|
||||
}
|
||||
```
|
||||
- **Response Parameters**:
|
||||
```json
|
||||
{
|
||||
"token": "string",
|
||||
"token_ttl": "integer"
|
||||
}
|
||||
```
|
||||
- **Curl Example**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/v1/user/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"phone":"+79991234567","password":"password123"}'
|
||||
```
|
||||
|
||||
### Payout Operations
|
||||
|
||||
#### Get SBP Banks
|
||||
- **Path**: `/api/v1/payout/sbp/banks`
|
||||
- **Method**: GET
|
||||
- **Request Parameters**: None
|
||||
- **Response Parameters**:
|
||||
```json
|
||||
{
|
||||
"type": "string",
|
||||
"items": [
|
||||
{
|
||||
"bank_id": "string",
|
||||
"name": "string",
|
||||
"bic": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
- **Curl Example**:
|
||||
```bash
|
||||
curl -X GET http://localhost:8080/api/v1/payout/sbp/banks
|
||||
```
|
||||
|
||||
#### Create Payout
|
||||
- **Path**: `/api/v1/payout/create`
|
||||
- **Method**: POST
|
||||
- **Request Parameters**:
|
||||
```json
|
||||
{
|
||||
"payout_type": "string (spb or yoo_money)",
|
||||
"account_number": "string (required for yoo_money)",
|
||||
"bank_id": "string (required for spb)",
|
||||
"amount": "float"
|
||||
}
|
||||
```
|
||||
- **Response Parameters**:
|
||||
```json
|
||||
{
|
||||
"payout_id": "string",
|
||||
"payout_status": "string"
|
||||
}
|
||||
```
|
||||
- **Curl Example**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/v1/payout/create \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer <session_token>" \
|
||||
-d '{"payout_type":"spb","bank_id":"123456","amount":1000.00}'
|
||||
```
|
||||
|
||||
#### Payout Callback
|
||||
- **Path**: `/api/v1/payout/callback`
|
||||
- **Method**: POST
|
||||
- **Request Parameters**: YooKassa webhook data (JSON)
|
||||
- **Response Parameters**: None
|
||||
- **Curl Example**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/v1/payout/callback \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"id":"payout_123456","status":"succeeded","amount":{"value":"1000.00","currency":"RUB"}}'
|
||||
```
|
||||
|
||||
## Service Configuration
|
||||
|
||||
### Server Configuration
|
||||
| Property | Description | Default Value |
|
||||
|----------|-------------|---------------|
|
||||
| Server.Tls.Enabled | Enable TLS for the server | true |
|
||||
| Server.Tls.CertFile | Path to TLS certificate file | ../server.pem |
|
||||
| Server.Tls.KeyFile | Path to TLS key file | ../server-key.pem |
|
||||
| Server.Port | Server port | :8080 |
|
||||
| Server.WriteTimeout | Write timeout for requests | 30s |
|
||||
| Server.ReadTimeout | Read timeout for requests | 30s |
|
||||
| Server.EnablePProfEndpoints | Enable pprof debug endpoints | false |
|
||||
|
||||
### Database Configuration
|
||||
| Property | Description | Default Value |
|
||||
|----------|-------------|---------------|
|
||||
| Database.Type | Database type (sqlite, postgres, mysql) | sqlite |
|
||||
| Database.Connection | Database connection string | ../payouts.db |
|
||||
| Database.LogLevel | Database logging level | Debug |
|
||||
| Database.TraceRequests | Enable request tracing | true |
|
||||
|
||||
### YooKassa Configuration
|
||||
| Property | Description | Default Value |
|
||||
|----------|-------------|---------------|
|
||||
| YooKassa.Test | Enable test mode | true |
|
||||
| YooKassa.ApiBaseKey | YooKassa base API key | (empty) |
|
||||
| YooKassa.ApiBaseSecret | YooKassa base API secret | (empty) |
|
||||
| YooKassa.ApiPaymentKey | YooKassa payment API key | (empty) |
|
||||
| YooKassa.ApiPaymentSecret | YooKassa payment API secret | (empty) |
|
||||
| YooKassa.BaseUrl | YooKassa API base URL | https://api.yookassa.ru/v3 |
|
||||
| YooKassa.Timeout | Request timeout | 30s |
|
||||
| YooKassa.CheckAllowedCallbackAddress | Check callback IP addresses | false |
|
||||
| YooKassa.AllowedCallbackSubnets | Allowed callback IP subnets | (empty) |
|
||||
| YooKassa.CallbackProcessTimeout | Callback processing timeout | 5s |
|
||||
| YooKassa.Retry.Enabled | Enable request retries | false |
|
||||
| YooKassa.Retry.Count | Number of retry attempts | 3 |
|
||||
| YooKassa.Retry.WaitTime | Initial wait time between retries | 1s |
|
||||
| YooKassa.Retry.MaxWaitTime | Maximum wait time between retries | 30s |
|
||||
|
||||
### Cache Configuration
|
||||
| Property | Description | Default Value |
|
||||
|----------|-------------|---------------|
|
||||
| Cache.TTL | Session TTL | 1h |
|
||||
|
||||
### Logging Configuration
|
||||
| Property | Description | Default Value |
|
||||
|----------|-------------|---------------|
|
||||
| Log.Level | Log level | info |
|
||||
| Log.Format | Log format (json, text) | json |
|
||||
6
helm-chart/Chart.yaml
Normal file
6
helm-chart/Chart.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: payouts
|
||||
description: A Helm chart for the payouts service
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
92
helm-chart/README.md
Normal file
92
helm-chart/README.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Payouts Helm Chart
|
||||
|
||||
This chart deploys the payouts service to a Kubernetes cluster using Helm.
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a payouts service deployment on a Kubernetes cluster using the Helm package manager.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.19+
|
||||
- Helm 3.0+
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
helm install my-release .
|
||||
```
|
||||
|
||||
The command deploys the payouts service on the Kubernetes cluster in the default configuration. The [Values](#values) section lists the parameters that can be configured during installation.
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
helm delete my-release
|
||||
```
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| replicaCount | int | `1` | Number of replicas |
|
||||
| image.repository | string | `"payouts"` | Image repository |
|
||||
| image.tag | string | `"latest"` | Image tag |
|
||||
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
|
||||
| service.type | string | `"ClusterIP"` | Service type |
|
||||
| service.port | int | `8080` | Service port |
|
||||
| ingress.enabled | bool | `false` | Enable ingress |
|
||||
| ingress.className | string | `""` | Ingress class name |
|
||||
| ingress.hosts[0].host | string | `"chart-example.local"` | Ingress host |
|
||||
| ingress.hosts[0].paths[0].path | string | `"/"` | Ingress path |
|
||||
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | Ingress path type |
|
||||
| server.port | string | `":8080"` | Server port |
|
||||
| server.writeTimeout | string | `"35s"` | Server write timeout |
|
||||
| server.readTimeout | string | `"35s"` | Server read timeout |
|
||||
| server.enablePProfEndpoints | bool | `false` | Enable pprof endpoints |
|
||||
| database.type | string | `""` | Database type |
|
||||
| database.connection | string | `""` | Database connection string |
|
||||
| database.logLevel | string | `"Info"` | Database log level |
|
||||
| database.traceRequests | bool | `false` | Trace database requests |
|
||||
| cache.ttl | string | `"24h"` | Cache TTL |
|
||||
| log.level | string | `"DEBUG"` | Log level |
|
||||
| log.filePath | string | `"./logs/payouts.log"` | Log file path |
|
||||
| log.textOutput | bool | `false` | Text output format |
|
||||
| log.stdoutEnabled | bool | `true` | Enable stdout logging |
|
||||
| log.fileEnabled | bool | `false` | Enable file logging |
|
||||
| log.fluentEnabled | bool | `false` | Enable fluent logging |
|
||||
| metrics.endpoint | string | `"/metrics"` | Metrics endpoint |
|
||||
| metrics.histogramBuckets | string | `"0.001,0.002,0.005,0.01,0.025,0.05,0.1,0.25,0.5,1,2.5,5,10"` | Histogram buckets |
|
||||
| metrics.http.histogramEnabled | bool | `true` | Enable HTTP histogram |
|
||||
| metrics.http.buckets | string | `"0.001,0.002,0.005,0.01,0.025,0.05,0.1,0.25,0.5,1,2.5,5,10"` | HTTP buckets |
|
||||
| yookassa.baseUrl | string | `"https://api.yookassa.ru/v3"` | YooKassa base URL |
|
||||
| yookassa.timeout | string | `"2s"` | YooKassa timeout |
|
||||
| yookassa.retry.enabled | bool | `false` | Enable retry |
|
||||
| yookassa.retry.count | int | `3` | Retry count |
|
||||
| yookassa.retry.waitTime | string | `"200ms"` | Retry wait time |
|
||||
| yookassa.retry.maxWaitTime | string | `"5s"` | Max retry wait time |
|
||||
| yookassa.test | bool | `false` | Test mode |
|
||||
| yookassa.checkAllowedCallbackAddress | bool | `true` | Check callback address |
|
||||
| yookassa.allowedCallbackSubnets | string | `"185.71.76.0/27,185.71.77.0/27,77.75.153.0/25,77.75.156.11/32,77.75.156.35/32,77.75.154.128/25,2a02:5180::/32"` | Allowed callback subnets |
|
||||
| yookassa.callbackProcessTimeout | string | `"1s"` | Callback process timeout |
|
||||
|
||||
## Secrets
|
||||
|
||||
The following secrets are used for sensitive configuration and must be provided via Kubernetes secrets:
|
||||
|
||||
- `yookassa-base-key`: YooKassa base API key
|
||||
- `yookassa-base-secret`: YooKassa base API secret
|
||||
- `yookassa-payment-key`: YooKassa payment API key
|
||||
- `yookassa-payment-secret`: YooKassa payment API secret
|
||||
|
||||
Example to create the secret:
|
||||
```bash
|
||||
kubectl create secret generic payouts-secrets \
|
||||
--from-literal=yookassa-base-key='YOUR_BASE_KEY' \
|
||||
--from-literal=yookassa-base-secret='YOUR_BASE_SECRET' \
|
||||
--from-literal=yookassa-payment-key='YOUR_PAYMENT_KEY' \
|
||||
--from-literal=yookassa-payment-secret='YOUR_PAYMENT_SECRET'
|
||||
29
helm-chart/templates/NOTES.txt
Normal file
29
helm-chart/templates/NOTES.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
Thank you for installing {{ .Chart.Name }}.
|
||||
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To get started with your service, you can:
|
||||
|
||||
1. Check the status of your deployment:
|
||||
helm status {{ .Release.Name }}
|
||||
|
||||
2. Get the service URL:
|
||||
kubectl get svc {{ include "payouts.fullname" . }}
|
||||
|
||||
3. Access your service logs:
|
||||
kubectl logs -l app={{ include "payouts.fullname" . }}
|
||||
|
||||
4. To view the configuration, check the ConfigMap:
|
||||
kubectl get configmap {{ include "payouts.fullname" . }}-config -o yaml
|
||||
|
||||
5. To update your secrets (YooKassa API keys), create a secret with:
|
||||
kubectl create secret generic {{ include "payouts.fullname" . }}-secrets \\
|
||||
--from-literal=yookassa-base-key='YOUR_BASE_KEY' \\
|
||||
--from-literal=yookassa-base-secret='YOUR_BASE_SECRET' \\
|
||||
--from-literal=yookassa-payment-key='YOUR_PAYMENT_KEY' \\
|
||||
--from-literal=yookassa-payment-secret='YOUR_PAYMENT_SECRET'
|
||||
|
||||
6. To access your service via ingress (if enabled), check the ingress rules:
|
||||
kubectl get ingress {{ include "payouts.fullname" . }}
|
||||
|
||||
For more information, please refer to the documentation.
|
||||
61
helm-chart/templates/_helpers.tpl
Normal file
61
helm-chart/templates/_helpers.tpl
Normal file
@@ -0,0 +1,61 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "payouts.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "payouts.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "payouts.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "payouts.labels" -}}
|
||||
helm.sh/chart: {{ include "payouts.chart" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "payouts.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "payouts.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Service account name
|
||||
*/}}
|
||||
{{- define "payouts.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "payouts.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
47
helm-chart/templates/configmap.yaml
Normal file
47
helm-chart/templates/configmap.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "payouts.fullname" . }}-config
|
||||
labels:
|
||||
{{- include "payouts.labels" . | nindent 4 }}
|
||||
data:
|
||||
# Server configuration
|
||||
SERVER_PORT: {{ .Values.server.port | quote }}
|
||||
SERVER_WRITETIMEOUT: {{ .Values.server.writeTimeout | quote }}
|
||||
SERVER_READTIMEOUT: {{ .Values.server.readTimeout | quote }}
|
||||
SERVER_ENABLEPPROFENDPOINTS: {{ .Values.server.enablePProfEndpoints | quote }}
|
||||
|
||||
# Database configuration
|
||||
DATABASE_TYPE: {{ .Values.database.type | quote }}
|
||||
DATABASE_CONNECTION: {{ .Values.database.connection | quote }}
|
||||
DATABASE_LOGLEVEL: {{ .Values.database.logLevel | quote }}
|
||||
DATABASE_TRACEREQUESTS: {{ .Values.database.traceRequests | quote }}
|
||||
|
||||
# Cache configuration
|
||||
CACHE_TTL: {{ .Values.cache.ttl | quote }}
|
||||
|
||||
# Logging configuration
|
||||
LOG_LEVEL: {{ .Values.log.level | quote }}
|
||||
LOG_FILEPATH: {{ .Values.log.filePath | quote }}
|
||||
LOG_TEXTOUTPUT: {{ .Values.log.textOutput | quote }}
|
||||
LOG_STDOUTENABLED: {{ .Values.log.stdoutEnabled | quote }}
|
||||
LOG_FILEENABLED: {{ .Values.log.fileEnabled | quote }}
|
||||
LOG_FLUENTENABLED: {{ .Values.log.fluentEnabled | quote }}
|
||||
|
||||
# Metrics configuration
|
||||
METRICS_ENDPOINT: {{ .Values.metrics.endpoint | quote }}
|
||||
METRICS_HISTOGRAMBUCKETS: {{ .Values.metrics.histogramBuckets | quote }}
|
||||
METRICS_HTTP_HISTOGRAMENABLED: {{ .Values.metrics.http.histogramEnabled | quote }}
|
||||
METRICS_HTTP_BUCKETS: {{ .Values.metrics.http.buckets | quote }}
|
||||
|
||||
# YooKassa configuration
|
||||
YOOKASSA_BASEURL: {{ .Values.yookassa.baseUrl | quote }}
|
||||
YOOKASSA_TIMEOUT: {{ .Values.yookassa.timeout | quote }}
|
||||
YOOKASSA_RETRY_ENABLED: {{ .Values.yookassa.retry.enabled | quote }}
|
||||
YOOKASSA_RETRY_COUNT: {{ .Values.yookassa.retry.count | quote }}
|
||||
YOOKASSA_RETRY_WAITTIME: {{ .Values.yookassa.retry.waitTime | quote }}
|
||||
YOOKASSA_RETRY_MAXWAITTIME: {{ .Values.yookassa.retry.maxWaitTime | quote }}
|
||||
YOOKASSA_TEST: {{ .Values.yookassa.test | quote }}
|
||||
YOOKASSA_CHECKALLOWEDCALLBACKADDRESS: {{ .Values.yookassa.checkAllowedCallbackAddress | quote }}
|
||||
YOOKASSA_ALLOWEDCALLBACKSUBNETS: {{ .Values.yookassa.allowedCallbackSubnets | quote }}
|
||||
YOOKASSA_CALLBACKPROCESSTIMEOUT: {{ .Values.yookassa.callbackProcessTimeout | quote }}
|
||||
151
helm-chart/templates/deployment.yaml
Normal file
151
helm-chart/templates/deployment.yaml
Normal file
@@ -0,0 +1,151 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "payouts.fullname" . }}
|
||||
labels:
|
||||
{{- include "payouts.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "payouts.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "payouts.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "payouts.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.server.port | replace ":" "" }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /ready
|
||||
port: http
|
||||
env:
|
||||
# Server configuration
|
||||
- name: SERVER_PORT
|
||||
value: {{ .Values.server.port | quote }}
|
||||
- name: SERVER_WRITETIMEOUT
|
||||
value: {{ .Values.server.writeTimeout | quote }}
|
||||
- name: SERVER_READTIMEOUT
|
||||
value: {{ .Values.server.readTimeout | quote }}
|
||||
- name: SERVER_ENABLEPPROFENDPOINTS
|
||||
value: {{ .Values.server.enablePProfEndpoints | quote }}
|
||||
|
||||
# Database configuration
|
||||
- name: DATABASE_TYPE
|
||||
value: {{ .Values.database.type | quote }}
|
||||
- name: DATABASE_CONNECTION
|
||||
value: {{ .Values.database.connection | quote }}
|
||||
- name: DATABASE_LOGLEVEL
|
||||
value: {{ .Values.database.logLevel | quote }}
|
||||
- name: DATABASE_TRACEREQUESTS
|
||||
value: {{ .Values.database.traceRequests | quote }}
|
||||
|
||||
# Cache configuration
|
||||
- name: CACHE_TTL
|
||||
value: {{ .Values.cache.ttl | quote }}
|
||||
|
||||
# Logging configuration
|
||||
- name: LOG_LEVEL
|
||||
value: {{ .Values.log.level | quote }}
|
||||
- name: LOG_FILEPATH
|
||||
value: {{ .Values.log.filePath | quote }}
|
||||
- name: LOG_TEXTOUTPUT
|
||||
value: {{ .Values.log.textOutput | quote }}
|
||||
- name: LOG_STDOUTENABLED
|
||||
value: {{ .Values.log.stdoutEnabled | quote }}
|
||||
- name: LOG_FILEENABLED
|
||||
value: {{ .Values.log.fileEnabled | quote }}
|
||||
- name: LOG_FLUENTENABLED
|
||||
value: {{ .Values.log.fluentEnabled | quote }}
|
||||
|
||||
# Metrics configuration
|
||||
- name: METRICS_ENDPOINT
|
||||
value: {{ .Values.metrics.endpoint | quote }}
|
||||
- name: METRICS_HISTOGRAMBUCKETS
|
||||
value: {{ .Values.metrics.histogramBuckets | quote }}
|
||||
- name: METRICS_HTTP_HISTOGRAMENABLED
|
||||
value: {{ .Values.metrics.http.histogramEnabled | quote }}
|
||||
- name: METRICS_HTTP_BUCKETS
|
||||
value: {{ .Values.metrics.http.buckets | quote }}
|
||||
|
||||
# YooKassa configuration
|
||||
- name: YOOKASSA_BASEURL
|
||||
value: {{ .Values.yookassa.baseUrl | quote }}
|
||||
- name: YOOKASSA_TIMEOUT
|
||||
value: {{ .Values.yookassa.timeout | quote }}
|
||||
- name: YOOKASSA_RETRY_ENABLED
|
||||
value: {{ .Values.yookassa.retry.enabled | quote }}
|
||||
- name: YOOKASSA_RETRY_COUNT
|
||||
value: {{ .Values.yookassa.retry.count | quote }}
|
||||
- name: YOOKASSA_RETRY_WAITTIME
|
||||
value: {{ .Values.yookassa.retry.waitTime | quote }}
|
||||
- name: YOOKASSA_RETRY_MAXWAITTIME
|
||||
value: {{ .Values.yookassa.retry.maxWaitTime | quote }}
|
||||
- name: YOOKASSA_TEST
|
||||
value: {{ .Values.yookassa.test | quote }}
|
||||
- name: YOOKASSA_CHECKALLOWEDCALLBACKADDRESS
|
||||
value: {{ .Values.yookassa.checkAllowedCallbackAddress | quote }}
|
||||
- name: YOOKASSA_ALLOWEDCALLBACKSUBNETS
|
||||
value: {{ .Values.yookassa.allowedCallbackSubnets | quote }}
|
||||
- name: YOOKASSA_CALLBACKPROCESSTIMEOUT
|
||||
value: {{ .Values.yookassa.callbackProcessTimeout | quote }}
|
||||
|
||||
# Secrets from Kubernetes secrets
|
||||
- name: YOOKASSA_APIBASEKEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "payouts.fullname" . }}-secrets
|
||||
key: yookassa-base-key
|
||||
- name: YOOKASSA_APIBASESECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "payouts.fullname" . }}-secrets
|
||||
key: yookassa-base-secret
|
||||
- name: YOOKASSA_APIPAYMENTKEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "payouts.fullname" . }}-secrets
|
||||
key: yookassa-payment-key
|
||||
- name: YOOKASSA_APIPAYMENTSECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "payouts.fullname" . }}-secrets
|
||||
key: yookassa-payment-secret
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
41
helm-chart/templates/ingress.yaml
Normal file
41
helm-chart/templates/ingress.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "payouts.fullname" . }}
|
||||
labels:
|
||||
{{- include "payouts.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "payouts.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
13
helm-chart/templates/secret.yaml
Normal file
13
helm-chart/templates/secret.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "payouts.fullname" . }}-secrets
|
||||
labels:
|
||||
{{- include "payouts.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
# YooKassa API keys (these will be base64 encoded when applied)
|
||||
yookassa-base-key: {{ .Values.secrets.yookassa.baseKey | b64enc | quote }}
|
||||
yookassa-base-secret: {{ .Values.secrets.yookassa.baseSecret | b64enc | quote }}
|
||||
yookassa-payment-key: {{ .Values.secrets.yookassa.paymentKey | b64enc | quote }}
|
||||
yookassa-payment-secret: {{ .Values.secrets.yookassa.paymentSecret | b64enc | quote }}
|
||||
15
helm-chart/templates/service.yaml
Normal file
15
helm-chart/templates/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "payouts.fullname" . }}
|
||||
labels:
|
||||
{{- include "payouts.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "payouts.selectorLabels" . | nindent 4 }}
|
||||
110
helm-chart/values.yaml
Normal file
110
helm-chart/values.yaml
Normal file
@@ -0,0 +1,110 @@
|
||||
# Default values for payouts chart
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: payouts
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
className: ""
|
||||
hosts:
|
||||
- host: chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
tls: []
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 100
|
||||
targetCPUUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
# Server configuration
|
||||
server:
|
||||
port: ":8080"
|
||||
writeTimeout: "35s"
|
||||
readTimeout: "35s"
|
||||
enablePProfEndpoints: false
|
||||
|
||||
# Database configuration
|
||||
database:
|
||||
type: ""
|
||||
connection: ""
|
||||
logLevel: "Info"
|
||||
traceRequests: false
|
||||
|
||||
# Cache configuration
|
||||
cache:
|
||||
ttl: "24h"
|
||||
|
||||
# Logging configuration
|
||||
log:
|
||||
level: "DEBUG"
|
||||
filePath: "./logs/payouts.log"
|
||||
textOutput: false
|
||||
stdoutEnabled: true
|
||||
fileEnabled: false
|
||||
fluentEnabled: false
|
||||
|
||||
# Metrics configuration
|
||||
metrics:
|
||||
endpoint: "/metrics"
|
||||
histogramBuckets: "0.001,0.002,0.005,0.01,0.025,0.05,0.1,0.25,0.5,1,2.5,5,10"
|
||||
http:
|
||||
histogramEnabled: true
|
||||
buckets: "0.001,0.002,0.005,0.01,0.025,0.05,0.1,0.25,0.5,1,2.5,5,10"
|
||||
|
||||
# YooKassa configuration
|
||||
yookassa:
|
||||
baseUrl: "https://api.yookassa.ru/v3"
|
||||
timeout: "2s"
|
||||
retry:
|
||||
enabled: false
|
||||
count: 3
|
||||
waitTime: "200ms"
|
||||
maxWaitTime: "5s"
|
||||
test: false
|
||||
checkAllowedCallbackAddress: true
|
||||
allowedCallbackSubnets: "185.71.76.0/27,185.71.77.0/27,77.75.153.0/25,77.75.156.11/32,77.75.156.35/32,77.75.154.128/25,2a02:5180::/32"
|
||||
apiBaseKey: ""
|
||||
apiBaseSecret: ""
|
||||
apiPaymentKey: ""
|
||||
apiPaymentSecret: ""
|
||||
callbackProcessTimeout: "1s"
|
||||
|
||||
# Secrets that should be stored in Kubernetes secrets
|
||||
secrets:
|
||||
# YooKassa API keys (these will be stored in Kubernetes secrets)
|
||||
yookassa:
|
||||
baseKey: ""
|
||||
baseSecret: ""
|
||||
paymentKey: ""
|
||||
paymentSecret: ""
|
||||
Reference in New Issue
Block a user