fix(temporal): 由 Argo 初始化逻辑命名空间
This commit is contained in:
@@ -252,6 +252,10 @@ function renderManifest(temporal: TemporalConfig, target: TemporalTarget, materi
|
||||
: material;
|
||||
const encoded = (value: string) => Buffer.from(value, "utf8").toString("base64");
|
||||
const namespace = target.namespace;
|
||||
const logicalNamespaceCommands = temporal.runtime.logicalNamespaces.map((item) => `
|
||||
if ! temporal operator namespace describe --address ${server.serviceName}:${server.frontendPort} --namespace ${item.name} >/dev/null 2>&1; then
|
||||
temporal operator namespace create --address ${server.serviceName}:${server.frontendPort} --namespace ${item.name} --retention ${item.retention}
|
||||
fi`).join("");
|
||||
const databaseSecret = includeDatabaseSecret ? `---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
@@ -463,6 +467,41 @@ spec:
|
||||
- name: web-admin-password
|
||||
secret:
|
||||
secretName: ${ui.auth.secretName}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: temporal-logical-namespaces
|
||||
namespace: ${namespace}
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PostSync
|
||||
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation,HookSucceeded
|
||||
labels:
|
||||
app.kubernetes.io/name: temporal-logical-namespaces
|
||||
app.kubernetes.io/part-of: temporal
|
||||
spec:
|
||||
backoffLimit: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: temporal-logical-namespaces
|
||||
app.kubernetes.io/part-of: temporal
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: configure
|
||||
image: ${temporal.images.server}
|
||||
imagePullPolicy: ${temporal.images.pullPolicy}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |
|
||||
attempts=${Math.max(1, Math.ceil(temporal.runtime.rolloutTimeoutSeconds / 5))}
|
||||
until temporal operator cluster health --address ${server.serviceName}:${server.frontendPort} >/dev/null 2>&1; do
|
||||
attempts=$((attempts - 1))
|
||||
test "$attempts" -gt 0
|
||||
sleep 5
|
||||
done${logicalNamespaceCommands}
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user