fix: isolate OpenFGA migration from Argo sync
This commit is contained in:
@@ -908,37 +908,13 @@ function v02OpenFgaManifest({ profile = "v02", source, deploy = null }) {
|
||||
{ name: "OPENFGA_HTTP_ADDR", value: "0.0.0.0:8080" },
|
||||
{ name: "OPENFGA_GRPC_ADDR", value: "0.0.0.0:8081" }
|
||||
];
|
||||
const migrationEnv = env.filter((entry) => entry.name === "OPENFGA_DATASTORE_ENGINE" || entry.name === "OPENFGA_DATASTORE_URI");
|
||||
const templateLabels = { ...labels, ...selector };
|
||||
const runtimeAnnotations = { ...annotations, "argocd.argoproj.io/sync-wave": "2" };
|
||||
return {
|
||||
apiVersion: "v1",
|
||||
kind: "List",
|
||||
items: [
|
||||
{
|
||||
apiVersion: "batch/v1",
|
||||
kind: "Job",
|
||||
metadata: {
|
||||
name: `${name}-migrate`,
|
||||
namespace,
|
||||
labels,
|
||||
annotations: {
|
||||
...annotations,
|
||||
"argocd.argoproj.io/hook": "Sync",
|
||||
"argocd.argoproj.io/sync-wave": "1",
|
||||
"argocd.argoproj.io/hook-delete-policy": "BeforeHookCreation,HookSucceeded"
|
||||
}
|
||||
},
|
||||
spec: {
|
||||
backoffLimit: 3,
|
||||
template: {
|
||||
metadata: { labels: templateLabels, annotations },
|
||||
spec: {
|
||||
restartPolicy: "OnFailure",
|
||||
containers: [{ name: "openfga-migrate", image, imagePullPolicy: "IfNotPresent", args: ["migrate"], env }]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
apiVersion: "apps/v1",
|
||||
kind: "Deployment",
|
||||
@@ -949,6 +925,14 @@ function v02OpenFgaManifest({ profile = "v02", source, deploy = null }) {
|
||||
template: {
|
||||
metadata: { labels: templateLabels, annotations },
|
||||
spec: {
|
||||
initContainers: [{
|
||||
name: "openfga-migrate",
|
||||
image,
|
||||
imagePullPolicy: "IfNotPresent",
|
||||
args: ["migrate"],
|
||||
env: migrationEnv,
|
||||
resources: { requests: { cpu: "50m", memory: "64Mi" }, limits: { cpu: "500m", memory: "256Mi" } }
|
||||
}],
|
||||
containers: [{
|
||||
name: "openfga",
|
||||
image,
|
||||
|
||||
Reference in New Issue
Block a user