Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7a9d4a1a6 | ||
|
|
9499c2ac8d | ||
|
|
bb5e699c77 | ||
|
|
11d311748a | ||
|
|
699f4a6cb1 | ||
|
|
44f382230e | ||
|
|
fa73db2b9c | ||
|
|
b007a2fde5 | ||
|
|
e35900f219 | ||
|
|
a0957377ab | ||
|
|
25ebffa020 | ||
|
|
d05b231e83 | ||
|
|
6b1e47804a | ||
|
|
421a2e8e31 | ||
|
|
83f5d28d79 | ||
|
|
073b3a3bf3 | ||
|
|
877e3f33bf | ||
|
|
3676fac91b | ||
|
|
482134dfc9 | ||
|
|
6ece72f728 | ||
|
|
99c95bbf01 | ||
|
|
5007cbaa21 | ||
|
|
5779875cc1 |
No files matched your search
@@ -0,0 +1,25 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: mixingx-network-agent
|
||||||
|
namespace: argocd
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
sources:
|
||||||
|
- repoURL: https://gitee.com/mixing-tech/mixingx.hub.chart.git
|
||||||
|
targetRevision: master
|
||||||
|
path: release-charts/mixingx-network-agent
|
||||||
|
helm:
|
||||||
|
releaseName: mixingx-network-agent
|
||||||
|
valueFiles:
|
||||||
|
- $values/environments/basic-test/image-version.yaml
|
||||||
|
- $values/environments/basic-test/network-agent-values.yaml
|
||||||
|
- repoURL: https://gitee.com/mixing-tech/mixingx.deploy.git
|
||||||
|
targetRevision: develop/basic-test
|
||||||
|
ref: values
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: mixingx
|
||||||
|
syncPolicy:
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
@@ -35,6 +35,11 @@ spec:
|
|||||||
site: "{{ .id }}"
|
site: "{{ .id }}"
|
||||||
description: "{{ .description }}"
|
description: "{{ .description }}"
|
||||||
phaseType: "{{ .phaseType }}"
|
phaseType: "{{ .phaseType }}"
|
||||||
|
sharedInfra:
|
||||||
|
postgres:
|
||||||
|
appUsername: "{{ .databaseUsername }}"
|
||||||
|
credentialsSecret:
|
||||||
|
name: "{{ .postgresCredentialsSecret }}"
|
||||||
{{- if hasKey . "nodeLabel" }}
|
{{- if hasKey . "nodeLabel" }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
mixingx.io/edge-node: "{{ .nodeLabel }}"
|
mixingx.io/edge-node: "{{ .nodeLabel }}"
|
||||||
|
|||||||
File renamed without changes.
@@ -33,6 +33,7 @@ spec:
|
|||||||
- $values/environments/demo/edge-common-values.yaml
|
- $values/environments/demo/edge-common-values.yaml
|
||||||
values: |
|
values: |
|
||||||
site: "{{ .id }}"
|
site: "{{ .id }}"
|
||||||
|
idWorkerId: {{ .idWorkerId }}
|
||||||
description: "{{ .description }}"
|
description: "{{ .description }}"
|
||||||
{{- if hasKey . "nodeLabel" }}
|
{{- if hasKey . "nodeLabel" }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ spec:
|
|||||||
site: "{{ .id }}"
|
site: "{{ .id }}"
|
||||||
description: "{{ .description }}"
|
description: "{{ .description }}"
|
||||||
phaseType: "{{ .phaseType }}"
|
phaseType: "{{ .phaseType }}"
|
||||||
|
sharedInfra:
|
||||||
|
postgres:
|
||||||
|
appUsername: "{{ .databaseUsername }}"
|
||||||
|
credentialsSecret:
|
||||||
|
name: "{{ .postgresCredentialsSecret }}"
|
||||||
{{- if .nodeLabel }}
|
{{- if .nodeLabel }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
mixingx.io/edge-node: "{{ .nodeLabel }}"
|
mixingx.io/edge-node: "{{ .nodeLabel }}"
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ spec:
|
|||||||
- $values/environments/dev/edge-common-values.yaml
|
- $values/environments/dev/edge-common-values.yaml
|
||||||
values: |
|
values: |
|
||||||
site: "{{ .id }}"
|
site: "{{ .id }}"
|
||||||
|
idWorkerId: {{ .idWorkerId }}
|
||||||
description: "{{ .description }}"
|
description: "{{ .description }}"
|
||||||
{{- if .nodeLabel }}
|
{{- if .nodeLabel }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# network-agent(设备网络控制台):每节点 DaemonSet,提供主机网口与 WiFi 配置 API(:9750)
|
||||||
|
# 前置条件:节点已执行 chart 仓 scripts/provision-host.sh(安装并托管 NetworkManager)
|
||||||
|
image:
|
||||||
|
tag: develop-v.1.0.1-202609040715-3
|
||||||
|
|
||||||
|
# 鉴权令牌:为空 = 不鉴权(仅限内网联调)。
|
||||||
|
# 配置后前端弹窗请求头需带 Authorization: Bearer <token>(当前前端未实现,保持为空)
|
||||||
|
authToken: ""
|
||||||
|
|
||||||
|
corsOrigins: "*"
|
||||||
|
rollbackTimeoutSeconds: 60
|
||||||
|
k3sRestartOnIpChange: true
|
||||||
@@ -16,9 +16,13 @@ images:
|
|||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
postgres:
|
||||||
username: postgres
|
adminUsername: postgres
|
||||||
password: "Admin12345"
|
|
||||||
port: 5432
|
port: 5432
|
||||||
|
idleInTransactionSessionTimeout: 60s
|
||||||
|
credentialsSecret:
|
||||||
|
adminPasswordKey: admin-password
|
||||||
|
appPasswordKey: app-password
|
||||||
|
connectionStringKey: connection-string
|
||||||
redis:
|
redis:
|
||||||
host: redis-service
|
host: redis-service
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -28,3 +32,15 @@ sharedInfra:
|
|||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
|
||||||
|
mqttCredentials:
|
||||||
|
- credentialRef: "edge-demo-mqtt"
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
- credentialRef: "edge-demo-2-mqtt"
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
|
||||||
|
audit:
|
||||||
|
publisher:
|
||||||
|
enabled: true
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# Agent PostgreSQL runtime role rollout
|
||||||
|
|
||||||
|
The demo Agent uses a dedicated PostgreSQL login. Passwords and the complete
|
||||||
|
connection string are stored only in a Kubernetes Secret and are not committed.
|
||||||
|
|
||||||
|
## Prepare the Secret
|
||||||
|
|
||||||
|
Load the administrator password already used by the Agent PostgreSQL instance
|
||||||
|
and a distinct application password from the approved vault into the operator
|
||||||
|
shell environment, then run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AGENT_POSTGRES_ADMIN_PASSWORD='<from-vault>' \
|
||||||
|
AGENT_POSTGRES_APP_PASSWORD='<from-vault>' \
|
||||||
|
./scripts/upsert-agent-postgres-credentials.sh mixingx demo-2 agent_demo_2
|
||||||
|
```
|
||||||
|
|
||||||
|
The script is idempotent. Do not place either value in a values file, command
|
||||||
|
argument, or shell history. It writes short-lived mode-`0700` input files and
|
||||||
|
removes them on exit, so the values are not exposed through `kubectl` process
|
||||||
|
arguments. The generated Secret contains `admin-password`, `app-password`, and
|
||||||
|
a `connection-string` whose username is `agent_demo_2`.
|
||||||
|
|
||||||
|
## Roll out
|
||||||
|
|
||||||
|
1. Sync `mixingx-agent-demo-2` in Argo CD. The PostgreSQL StatefulSet consumes
|
||||||
|
the administrator password; the Agent init container waits for PostgreSQL,
|
||||||
|
provisions the runtime role, transfers existing `public` objects, and applies
|
||||||
|
the database-local timeout.
|
||||||
|
2. When rotating an existing Secret, restart the Agent deployment explicitly:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl --namespace mixingx rollout restart deployment/agent-demo-2-deployment
|
||||||
|
kubectl --namespace mixingx rollout status deployment/agent-demo-2-deployment --timeout=300s
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Verify the backend container receives only the application connection string.
|
||||||
|
The administrator login remains reserved for provisioning, backup, and manual
|
||||||
|
maintenance. Startup EF Core migrations run as the database-owning application
|
||||||
|
role; `statement_timeout` and `lock_timeout` are explicitly left unset.
|
||||||
|
|
||||||
|
## Verify
|
||||||
|
|
||||||
|
Run the following through a temporary `psql` Pod or an approved database client,
|
||||||
|
using the application credential from the Secret:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SHOW idle_in_transaction_session_timeout;
|
||||||
|
SHOW statement_timeout;
|
||||||
|
SHOW lock_timeout;
|
||||||
|
SELECT rolname, rolsuper, rolcreatedb, rolcreaterole
|
||||||
|
FROM pg_roles
|
||||||
|
WHERE rolname = current_user;
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected values are `1min`, `0`, `0`, and all three privilege flags `false`.
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
agents:
|
agents:
|
||||||
- id: demo
|
|
||||||
description: Demo Agent
|
|
||||||
phaseType: DieCasting
|
|
||||||
- id: demo-2
|
- id: demo-2
|
||||||
description: Demo Agent 2
|
description: Demo Agent 2
|
||||||
phaseType: DieCasting
|
phaseType: DieCasting
|
||||||
|
databaseUsername: agent_demo_2
|
||||||
|
postgresCredentialsSecret: agent-demo-2-postgres-credentials
|
||||||
@@ -1,20 +1,33 @@
|
|||||||
|
storage:
|
||||||
|
className: longhorn-platform
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
mongo:
|
postgres:
|
||||||
host: mongo-service
|
image: 192.168.1.119:8888/docker-proxy/library/postgres:17
|
||||||
port: 27017
|
username: postgres
|
||||||
username: admin
|
|
||||||
password: "Admin12345"
|
password: "Admin12345"
|
||||||
database: mixingx_audit
|
port: 5432
|
||||||
rabbitmq:
|
|
||||||
host: messaging-service
|
|
||||||
port: 5672
|
|
||||||
username: guest
|
|
||||||
password: guest
|
|
||||||
otlp:
|
otlp:
|
||||||
endpoint: http://k8s-dashboard-service:18889
|
endpoint: http://k8s-dashboard-service:18889
|
||||||
protocol: grpc
|
protocol: grpc
|
||||||
|
|
||||||
audit:
|
audit:
|
||||||
enabled: true
|
enabled: true
|
||||||
port: 5600
|
port: 5900
|
||||||
replicas: 2
|
replicas: 2
|
||||||
|
database: audit-db
|
||||||
|
pgStorage: 5Gi
|
||||||
|
jwt:
|
||||||
|
ssoBaseUrl: "http://sso-service:8080"
|
||||||
|
mqtt:
|
||||||
|
image: "emqx/nanomq:0.25.2-2"
|
||||||
|
brokerHost: "audit-nanomq-service"
|
||||||
|
brokerPort: 1883
|
||||||
|
managementPort: 8081
|
||||||
|
managementUsername: "admin"
|
||||||
|
managementPassword: "public"
|
||||||
|
consume:
|
||||||
|
queueCapacity: 128
|
||||||
|
queueMaxWaitMs: 5000
|
||||||
|
dbWriteTimeoutMs: 3000
|
||||||
|
concurrency: 4
|
||||||
@@ -10,15 +10,8 @@ images:
|
|||||||
frontend:
|
frontend:
|
||||||
repository: edge-web
|
repository: edge-web
|
||||||
tag: ""
|
tag: ""
|
||||||
postgres:
|
|
||||||
repository: 192.168.1.119:8888/docker-proxy/library/postgres
|
|
||||||
tag: "17"
|
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
|
||||||
username: postgres
|
|
||||||
password: "Admin12345"
|
|
||||||
port: 5432
|
|
||||||
redis:
|
redis:
|
||||||
host: redis-service
|
host: redis-service
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -28,3 +21,12 @@ sharedInfra:
|
|||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
image:
|
||||||
|
repository: emqx/nanomq
|
||||||
|
tag: 0.25.2-2
|
||||||
|
|
||||||
|
audit:
|
||||||
|
publisher:
|
||||||
|
enabled: true
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
edges:
|
edges:
|
||||||
- id: demo
|
- id: demo
|
||||||
|
idWorkerId: 17
|
||||||
description: Demo Edge
|
description: Demo Edge
|
||||||
- id: demo-2
|
- id: demo-2
|
||||||
|
idWorkerId: 18
|
||||||
description: Demo Edge 2
|
description: Demo Edge 2
|
||||||
@@ -4,47 +4,47 @@ timezone: Asia/Shanghai
|
|||||||
images:
|
images:
|
||||||
gateway:
|
gateway:
|
||||||
repository: gateway
|
repository: gateway
|
||||||
tag: master-202607130641-4
|
tag: develop-v.1.0.1-202608050744-6
|
||||||
sso:
|
sso:
|
||||||
repository: sso
|
repository: sso
|
||||||
tag: develop-v.1.0.1-202607141448-14
|
tag: develop-v.1.0.1-202608050742-21
|
||||||
ssoWeb:
|
ssoWeb:
|
||||||
repository: sso-web
|
repository: sso-web
|
||||||
tag: develop-v.1.0.1-202607141448-14
|
tag: develop-v.1.0.1-202608050742-21
|
||||||
ultra:
|
ultra:
|
||||||
repository: ultra
|
repository: ultra
|
||||||
tag: develop-v.1.0.1-202607141448-10
|
tag: develop-v.1.0.1-202608050746-12
|
||||||
ultraWeb:
|
ultraWeb:
|
||||||
repository: ultra-web
|
repository: ultra-web
|
||||||
tag: develop-v.1.0.1-202607141448-10
|
tag: develop-v.1.0.1-202608050746-12
|
||||||
audit:
|
audit:
|
||||||
repository: audit
|
repository: audit
|
||||||
tag: develop-v.1.0.1-202607100612-4
|
tag: develop-v.1.0.1-202607100612-4
|
||||||
edge:
|
edge:
|
||||||
repository: edge
|
repository: edge
|
||||||
tag: develop-v.1.0.1-202607141446-17
|
tag: develop-v.1.0.1-202608050745-19
|
||||||
edgeWeb:
|
edgeWeb:
|
||||||
repository: edge-web
|
repository: edge-web
|
||||||
tag: develop-v.1.0.1-202607141446-17
|
tag: develop-v.1.0.1-202608050745-19
|
||||||
agent:
|
agent:
|
||||||
repository: agent
|
repository: agent
|
||||||
tag: develop-v.1.0.1-202607141540-23
|
tag: develop-v.1.0.1-202608050748-25
|
||||||
agentWeb:
|
agentWeb:
|
||||||
repository: agent-web
|
repository: agent-web
|
||||||
tag: develop-v.1.0.1-202607141540-23
|
tag: develop-v.1.0.1-202608050748-25
|
||||||
protocol:
|
protocol:
|
||||||
opcua:
|
opcua:
|
||||||
repository: opcua
|
repository: opcua
|
||||||
tag: develop-v.1.0.1-202607141324-12
|
tag: develop-v.1.0.1-202608050747-15
|
||||||
modbus:
|
modbus:
|
||||||
repository: modbus
|
repository: modbus
|
||||||
tag: develop-v.1.0.1-202607141324-12
|
tag: develop-v.1.0.1-202608050747-15
|
||||||
ads:
|
ads:
|
||||||
repository: ads
|
repository: ads
|
||||||
tag: develop-v.1.0.1-202607141324-12
|
tag: develop-v.1.0.1-202608050747-15
|
||||||
s7:
|
s7:
|
||||||
repository: s7
|
repository: s7
|
||||||
tag: develop-v.1.0.1-202607141324-12
|
tag: develop-v.1.0.1-202608050747-15
|
||||||
s7-diecast:
|
s7-diecast:
|
||||||
repository: s7-diecast
|
repository: s7-diecast
|
||||||
tag: develop-v.1.0.1-202607141324-12
|
tag: develop-v.1.0.1-202608050747-15
|
||||||
@@ -23,6 +23,12 @@ sharedDatastores:
|
|||||||
port: 5672
|
port: 5672
|
||||||
storage: 2Gi
|
storage: 2Gi
|
||||||
mountPath: /var/lib/rabbitmq
|
mountPath: /var/lib/rabbitmq
|
||||||
|
- name: audit-nanomq
|
||||||
|
image: emqx/nanomq:0.25.2-2
|
||||||
|
port: 1883
|
||||||
|
storage: 1Gi
|
||||||
|
mountPath: /var/lib/nanomq
|
||||||
|
managementPort: 8081
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
postgres:
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ servers:
|
|||||||
image: opcua
|
image: opcua
|
||||||
port: 4840
|
port: 4840
|
||||||
scene: /scenes/opcua/equipment-status-2.json
|
scene: /scenes/opcua/equipment-status-2.json
|
||||||
|
- id: opcua-diecast-params
|
||||||
|
type: opcua
|
||||||
|
image: opcua
|
||||||
|
port: 4840
|
||||||
|
scene: /scenes/opcua/diecast-parameters.json
|
||||||
- id: modbus-basic-1
|
- id: modbus-basic-1
|
||||||
type: modbus
|
type: modbus
|
||||||
image: modbus
|
image: modbus
|
||||||
|
|||||||
@@ -29,3 +29,7 @@ sso:
|
|||||||
replicas: 2
|
replicas: 2
|
||||||
description: "统一登录"
|
description: "统一登录"
|
||||||
webBasePath: /sso/
|
webBasePath: /sso/
|
||||||
|
|
||||||
|
audit:
|
||||||
|
publisher:
|
||||||
|
enabled: true
|
||||||
@@ -29,3 +29,7 @@ ultra:
|
|||||||
replicas: 2
|
replicas: 2
|
||||||
description: "Ultra 看板"
|
description: "Ultra 看板"
|
||||||
webBasePath: /ultra/
|
webBasePath: /ultra/
|
||||||
|
|
||||||
|
audit:
|
||||||
|
publisher:
|
||||||
|
enabled: true
|
||||||
@@ -4,15 +4,23 @@ storage:
|
|||||||
keep: true
|
keep: true
|
||||||
|
|
||||||
images:
|
images:
|
||||||
backend: agent
|
backend:
|
||||||
frontend: agent-web
|
repository: agent
|
||||||
postgres: 192.168.1.119:8888/docker-proxy/library/postgres:17
|
frontend:
|
||||||
|
repository: agent-web
|
||||||
|
postgres:
|
||||||
|
repository: 192.168.1.119:8888/docker-proxy/library/postgres
|
||||||
|
tag: "17"
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
postgres:
|
||||||
username: postgres
|
adminUsername: postgres
|
||||||
password: "Admin12345"
|
|
||||||
port: 5432
|
port: 5432
|
||||||
|
idleInTransactionSessionTimeout: 60s
|
||||||
|
credentialsSecret:
|
||||||
|
adminPasswordKey: admin-password
|
||||||
|
appPasswordKey: app-password
|
||||||
|
connectionStringKey: connection-string
|
||||||
redis:
|
redis:
|
||||||
host: redis-service
|
host: redis-service
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -22,3 +30,8 @@ sharedInfra:
|
|||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
|
||||||
|
mqttCredentials:
|
||||||
|
- credentialRef: "edge-demo-mqtt"
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
@@ -3,3 +3,5 @@ agents:
|
|||||||
description: Dev Agent
|
description: Dev Agent
|
||||||
phaseType: DieCasting # 工序类型(注入 AGENT_PHASE_TYPE),对应 apphost WithPhaseType
|
phaseType: DieCasting # 工序类型(注入 AGENT_PHASE_TYPE),对应 apphost WithPhaseType
|
||||||
nodeLabel: node1
|
nodeLabel: node1
|
||||||
|
databaseUsername: agent_dev
|
||||||
|
postgresCredentialsSecret: agent-demo-postgres-credentials
|
||||||
@@ -4,15 +4,12 @@ storage:
|
|||||||
keep: true
|
keep: true
|
||||||
|
|
||||||
images:
|
images:
|
||||||
backend: edge
|
backend:
|
||||||
frontend: edge-web
|
repository: edge
|
||||||
postgres: 192.168.1.119:8888/docker-proxy/library/postgres:17
|
frontend:
|
||||||
|
repository: edge-web
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
|
||||||
username: postgres
|
|
||||||
password: "Admin12345"
|
|
||||||
port: 5432
|
|
||||||
redis:
|
redis:
|
||||||
host: redis-service
|
host: redis-service
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -22,3 +19,8 @@ sharedInfra:
|
|||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
image:
|
||||||
|
repository: emqx/nanomq
|
||||||
|
tag: 0.25.2-2
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
edges:
|
edges:
|
||||||
- id: demo
|
- id: demo
|
||||||
|
idWorkerId: 17
|
||||||
description: Dev Edge
|
description: Dev Edge
|
||||||
nodeLabel: node2
|
nodeLabel: node2
|
||||||
@@ -23,6 +23,12 @@ sharedDatastores:
|
|||||||
port: 5672
|
port: 5672
|
||||||
storage: 2Gi
|
storage: 2Gi
|
||||||
mountPath: /var/lib/rabbitmq
|
mountPath: /var/lib/rabbitmq
|
||||||
|
- name: audit-nanomq
|
||||||
|
image: emqx/nanomq:0.25.2-2
|
||||||
|
port: 1883
|
||||||
|
storage: 1Gi
|
||||||
|
mountPath: /var/lib/nanomq
|
||||||
|
managementPort: 8081
|
||||||
|
|
||||||
sharedInfra:
|
sharedInfra:
|
||||||
postgres:
|
postgres:
|
||||||
|
|||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
namespace="${1:?usage: $0 <namespace> <site> <app-username>}"
|
||||||
|
site="${2:?usage: $0 <namespace> <site> <app-username>}"
|
||||||
|
app_username="${3:?usage: $0 <namespace> <site> <app-username>}"
|
||||||
|
|
||||||
|
: "${AGENT_POSTGRES_ADMIN_PASSWORD:?set AGENT_POSTGRES_ADMIN_PASSWORD}"
|
||||||
|
: "${AGENT_POSTGRES_APP_PASSWORD:?set AGENT_POSTGRES_APP_PASSWORD}"
|
||||||
|
|
||||||
|
database_name="agent-db-${site}"
|
||||||
|
postgres_host="agent-${site}-postgres-service"
|
||||||
|
secret_name="agent-${site}-postgres-credentials"
|
||||||
|
escaped_app_password=${AGENT_POSTGRES_APP_PASSWORD//\"/\"\"}
|
||||||
|
connection_string="Host=${postgres_host};Port=5432;Username=${app_username};Password=\"${escaped_app_password}\";Database=${database_name}"
|
||||||
|
|
||||||
|
credentials_directory=$(mktemp -d)
|
||||||
|
trap 'rm -rf -- "${credentials_directory}"' EXIT
|
||||||
|
chmod 700 "${credentials_directory}"
|
||||||
|
printf '%s' "${AGENT_POSTGRES_ADMIN_PASSWORD}" > "${credentials_directory}/admin-password"
|
||||||
|
printf '%s' "${AGENT_POSTGRES_APP_PASSWORD}" > "${credentials_directory}/app-password"
|
||||||
|
printf '%s' "${connection_string}" > "${credentials_directory}/connection-string"
|
||||||
|
|
||||||
|
kubectl --namespace "${namespace}" create secret generic "${secret_name}" \
|
||||||
|
--from-file=admin-password="${credentials_directory}/admin-password" \
|
||||||
|
--from-file=app-password="${credentials_directory}/app-password" \
|
||||||
|
--from-file=connection-string="${credentials_directory}/connection-string" \
|
||||||
|
--dry-run=client \
|
||||||
|
--output=yaml \
|
||||||
|
| kubectl apply --filename=-
|
||||||
|
|
||||||
|
echo "Updated ${namespace}/${secret_name}; restart the Agent Deployment to consume changed values."
|
||||||
Reference in new issue
Block a user