wip: well, looking better
This commit is contained in:
+24
-96
@@ -1,106 +1,34 @@
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.apps.atlantis;
|
||||
env = config.apps.env;
|
||||
values = lib.apps.appValues {
|
||||
inherit env;
|
||||
base = ../values/atlantis;
|
||||
extraValues = {};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.apps.atlantis = {
|
||||
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";
|
||||
};
|
||||
options.apps.atlantis = lib.apps.appOptions {
|
||||
revision = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "main";
|
||||
description = "Revision";
|
||||
};
|
||||
|
||||
hostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if env == "prod"
|
||||
then "maps.oceanbox.io"
|
||||
else "atlantis.beta.oceanbox.io";
|
||||
description = "Revision";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
applications.atlantis.resources = {
|
||||
applicationSets = {
|
||||
atlantis.spec = {
|
||||
goTemplate = true;
|
||||
generators = [
|
||||
{
|
||||
list = {
|
||||
elements = [
|
||||
{
|
||||
env = "prod";
|
||||
namespace = "atlantis";
|
||||
project = "atlantis";
|
||||
cluster = "https://kubernetes.default.svc";
|
||||
hostname = "atlantis.srv.oceanbox.io";
|
||||
revision = "main";
|
||||
autoSync = cfg.autoSync;
|
||||
prune = cfg.prune;
|
||||
}
|
||||
{
|
||||
env = "staging";
|
||||
namespace = "atlantis";
|
||||
project = "atlantis";
|
||||
cluster = "https://staging-vcluster.staging-vcluster";
|
||||
hostname = "atlantis.beta.oceanbox.io";
|
||||
revision = "main";
|
||||
autoSync = cfg.autoSync;
|
||||
prune = cfg.prune;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
template = {
|
||||
metadata = {
|
||||
name = "{{ .env }}-atlantis";
|
||||
annotations = {
|
||||
"argocd.argoproj.io/compare-options" = "ServerSideDiff=true";
|
||||
};
|
||||
};
|
||||
spec = {
|
||||
destination = {
|
||||
namespace = "{{`{{.namespace}}`}}";
|
||||
server = "{{ .cluster }}";
|
||||
};
|
||||
project = "{{`{{.project}}`}}";
|
||||
sources = [
|
||||
{
|
||||
repoURL = "https://gitlab.com/oceanbox/manifests.git";
|
||||
targetRevision = "{{`{{.revision}}`}}";
|
||||
path = "values/atlantis";
|
||||
plugin = {
|
||||
name = "kustomize-helm-with-rewrite";
|
||||
parameters = [
|
||||
{
|
||||
name = "env";
|
||||
string = "{{ .env }}";
|
||||
}
|
||||
{
|
||||
name = "hostname";
|
||||
string = "{{ .hostname }}";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
syncPolicy = {
|
||||
syncOptions = [
|
||||
"CreateNamespace=true"
|
||||
"ApplyOutOfSyncOnly=true"
|
||||
];
|
||||
automated = lib.mkIf cfg.autoSync {
|
||||
prune = cfg.prune;
|
||||
selfHeal = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.apps.appConfig cfg "${env}-atlantis" {
|
||||
helm.releases."${env}-atlantis" = {
|
||||
inherit values;
|
||||
chart = ../charts/atlantis;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ in
|
||||
{
|
||||
options.apps.openfga = lib.apps.appOptions {};
|
||||
|
||||
config = lib.apps.appConfig cfg "openfga" {
|
||||
config = lib.apps.appConfig cfg "${env}-openfga" {
|
||||
helm.releases."${env}-openfga" = {
|
||||
inherit values;
|
||||
chart = lib.helm.downloadHelmChart {
|
||||
|
||||
Reference in New Issue
Block a user