wip: figuring it out, slowly
This commit is contained in:
@@ -7,11 +7,19 @@
|
||||
|
||||
config = {
|
||||
services = {
|
||||
|
||||
atlantis = {
|
||||
enable = true;
|
||||
autoSync = true;
|
||||
prune = false;
|
||||
};
|
||||
|
||||
openfga = {
|
||||
enable = true;
|
||||
autoSync = true;
|
||||
prune = false;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+8
-41
@@ -1,8 +1,8 @@
|
||||
{ lib, config, charts, ... }:
|
||||
{ lib, applib, config, ... }:
|
||||
let
|
||||
cfg = config.services.openfga;
|
||||
|
||||
namespace = "openfga";
|
||||
namespace = "${env}-openfga";
|
||||
env = "prod";
|
||||
project = "aux";
|
||||
cluster = "https://kubernetes.default.svc";
|
||||
@@ -10,37 +10,15 @@ let
|
||||
values = lib.attrsets.recursiveUpdate {} cfg.values;
|
||||
in
|
||||
{
|
||||
options.services.openfga = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable";
|
||||
};
|
||||
autoSync = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Auto sync";
|
||||
};
|
||||
prune = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Prune";
|
||||
};
|
||||
values = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.anything;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
options.services.openfga = applib.appOptions {};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
applications.openfga = {
|
||||
config = applib.appConfig cfg "${cfg.env}-openfga" {
|
||||
inherit namespace;
|
||||
inherit project;
|
||||
|
||||
name = "${env}-openfga";
|
||||
destination.server = cluster;
|
||||
|
||||
helm.releases.openfga = {
|
||||
helm.releases."${env}-openfga" = {
|
||||
inherit values;
|
||||
chart = lib.helm.downloadHelmChart {
|
||||
repo = "https://openfga.github.io/helm-charts";
|
||||
@@ -50,21 +28,10 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
annotations = {
|
||||
"argocd.argoproj.io/compare-options" = "ServerSideDiff=true";
|
||||
};
|
||||
|
||||
syncPolicy = {
|
||||
syncOptions = {
|
||||
applyOutOfSyncOnly = true;
|
||||
};
|
||||
autoSync = lib.mkIf cfg.autoSync {
|
||||
prune = cfg.prune;
|
||||
selfHeal = false;
|
||||
annotations = {};
|
||||
resources = {
|
||||
services.poop.spec = {
|
||||
};
|
||||
};
|
||||
|
||||
resources = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@
|
||||
(flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
applib = import ./modules/lib.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
nixidyEnvs = {
|
||||
prod = nixidy.lib.mkEnv {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = { inherit applib; };
|
||||
charts = nixhelm.chartsDerivations.${system};
|
||||
modules = [
|
||||
./modules
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{ pkgs }:
|
||||
{
|
||||
appOptions = opts: with pkgs.lib; {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable";
|
||||
};
|
||||
|
||||
autoSync = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Auto sync";
|
||||
};
|
||||
|
||||
prune = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Prune";
|
||||
};
|
||||
|
||||
serverSideDiff = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable server-side diffing";
|
||||
};
|
||||
|
||||
values = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
description = "Values";
|
||||
};
|
||||
} // opts;
|
||||
|
||||
appConfig = cfg: name: conf:
|
||||
with pkgs.lib;
|
||||
let
|
||||
app = conf // {
|
||||
createNamespace = true;
|
||||
|
||||
compareOptions = {
|
||||
serverSideDiff = cfg.serverSideDiff;
|
||||
};
|
||||
|
||||
syncPolicy = {
|
||||
syncOptions = {
|
||||
applyOutOfSyncOnly = true;
|
||||
};
|
||||
|
||||
autoSync = mkIf cfg.autoSync {
|
||||
prune = cfg.prune;
|
||||
selfHeal = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in mkIf cfg.enable { applications.${name} = app; };
|
||||
}
|
||||
Reference in New Issue
Block a user