diff options
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/META-INF/kmodule.xml | 10 | ||||
-rw-r--r-- | src/main/resources/io/trygvis/rules/acme/acme.drl | 30 | ||||
-rw-r--r-- | src/main/resources/io/trygvis/rules/dba/dba.drl | 1 | ||||
-rw-r--r-- | src/main/resources/io/trygvis/rules/machine/machine.drl | 14 |
4 files changed, 55 insertions, 0 deletions
diff --git a/src/main/resources/META-INF/kmodule.xml b/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 0000000..911fdc6 --- /dev/null +++ b/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://www.drools.org/xsd/kmodule" + xsi:schemaLocation="http://www.drools.org/xsd/kmodule https://www.drools.org/xsd/kmodule_7_1.xsd"> + + <kbase packages="io.trygvis.rules,io.trygvis.rules.acme,io.trygvis.rules.dba,io.trygvis.rules.machine" + default="true"> + <ksession name="Default" default="true"/> + </kbase> +</kmodule> diff --git a/src/main/resources/io/trygvis/rules/acme/acme.drl b/src/main/resources/io/trygvis/rules/acme/acme.drl new file mode 100644 index 0000000..2439ddb --- /dev/null +++ b/src/main/resources/io/trygvis/rules/acme/acme.drl @@ -0,0 +1,30 @@ +package io.trygvis.rules.acme; + +import io.trygvis.rules.dba.Cluster; +import io.trygvis.rules.dba.Container; + +rule "Ops" +when + $ops: AcmeOps() +then + var cluster = new Cluster("acme-ops"); + insert(cluster); + insert(new Container(cluster, "app", "pdb", "postgresql", "11")); + insert(new Container(cluster, "app", "n8n", "n8n", "0.84.1")); +end + +rule "MyApp" +when + $app: AcmeMyApp() +then + var cluster = new Cluster("acme-" + $app.environment); + insert(cluster); + + var tag = $app.dockerTag; + insert(new Container(cluster, "app", "statera", "statera", tag)); + insert(new Container(cluster, "app", "statera-console", "statera-console", tag)); + insert(new Container(cluster, "app", "4tune-web", "4tune-web", tag)); + insert(new Container(cluster, "app", "4tune-api", "4tune-api", tag)); + insert(new Container(cluster, "db", "pdb", "postgresql", "13")); + insert(new Container(cluster, "db", "mdb", "mongodb", "3.2")); +end diff --git a/src/main/resources/io/trygvis/rules/dba/dba.drl b/src/main/resources/io/trygvis/rules/dba/dba.drl new file mode 100644 index 0000000..7beceef --- /dev/null +++ b/src/main/resources/io/trygvis/rules/dba/dba.drl @@ -0,0 +1 @@ +package io.trygvis.rules.dba; diff --git a/src/main/resources/io/trygvis/rules/machine/machine.drl b/src/main/resources/io/trygvis/rules/machine/machine.drl new file mode 100644 index 0000000..45df925 --- /dev/null +++ b/src/main/resources/io/trygvis/rules/machine/machine.drl @@ -0,0 +1,14 @@ +package io.trygvis.rules.machine; + +import io.trygvis.rules.dba.Cluster; +import io.trygvis.rules.dba.Container; +import io.trygvis.rules.machine.Machine; +import io.trygvis.rules.dns.DnsEntry; + +rule "New machine" +when + $container: Container() +then + insert(DnsEntry.a($container.name + ".machine.acme.org")); + insert(DnsEntry.aaaa($container.name + ".machine.acme.org")); +end |