wip: figuring it out, slowly
This commit is contained in:
@@ -7,11 +7,19 @@
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
services = {
|
services = {
|
||||||
|
|
||||||
atlantis = {
|
atlantis = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoSync = true;
|
autoSync = true;
|
||||||
prune = false;
|
prune = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
openfga = {
|
||||||
|
enable = true;
|
||||||
|
autoSync = true;
|
||||||
|
prune = false;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-41
@@ -1,8 +1,8 @@
|
|||||||
{ lib, config, charts, ... }:
|
{ lib, applib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.openfga;
|
cfg = config.services.openfga;
|
||||||
|
|
||||||
namespace = "openfga";
|
namespace = "${env}-openfga";
|
||||||
env = "prod";
|
env = "prod";
|
||||||
project = "aux";
|
project = "aux";
|
||||||
cluster = "https://kubernetes.default.svc";
|
cluster = "https://kubernetes.default.svc";
|
||||||
@@ -10,37 +10,15 @@ let
|
|||||||
values = lib.attrsets.recursiveUpdate {} cfg.values;
|
values = lib.attrsets.recursiveUpdate {} cfg.values;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.openfga = {
|
options.services.openfga = applib.appOptions {};
|
||||||
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 = {};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = applib.appConfig cfg "${cfg.env}-openfga" {
|
||||||
applications.openfga = {
|
|
||||||
inherit namespace;
|
inherit namespace;
|
||||||
inherit project;
|
inherit project;
|
||||||
|
|
||||||
name = "${env}-openfga";
|
|
||||||
destination.server = cluster;
|
destination.server = cluster;
|
||||||
|
|
||||||
helm.releases.openfga = {
|
helm.releases."${env}-openfga" = {
|
||||||
inherit values;
|
inherit values;
|
||||||
chart = lib.helm.downloadHelmChart {
|
chart = lib.helm.downloadHelmChart {
|
||||||
repo = "https://openfga.github.io/helm-charts";
|
repo = "https://openfga.github.io/helm-charts";
|
||||||
@@ -50,21 +28,10 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
annotations = {
|
annotations = {};
|
||||||
"argocd.argoproj.io/compare-options" = "ServerSideDiff=true";
|
resources = {
|
||||||
|
services.poop.spec = {
|
||||||
};
|
};
|
||||||
|
|
||||||
syncPolicy = {
|
|
||||||
syncOptions = {
|
|
||||||
applyOutOfSyncOnly = true;
|
|
||||||
};
|
|
||||||
autoSync = lib.mkIf cfg.autoSync {
|
|
||||||
prune = cfg.prune;
|
|
||||||
selfHeal = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
resources = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,14 @@
|
|||||||
(flake-utils.lib.eachDefaultSystem (
|
(flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs { inherit system; };
|
||||||
inherit system;
|
applib = import ./modules/lib.nix { inherit pkgs; };
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixidyEnvs = {
|
nixidyEnvs = {
|
||||||
prod = nixidy.lib.mkEnv {
|
prod = nixidy.lib.mkEnv {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
extraSpecialArgs = { inherit applib; };
|
||||||
charts = nixhelm.chartsDerivations.${system};
|
charts = nixhelm.chartsDerivations.${system};
|
||||||
modules = [
|
modules = [
|
||||||
./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