more refactoring

master
jem 3 years ago
parent af2f16714e
commit a900551a58

@ -1,5 +1,5 @@
# convention 4 kubernetes: c4k-keycloak # convention 4 kubernetes: c4k-keycloak
[![Clojars Project](https://img.shields.io/clojars/v/dda/k8s-keycloak.svg)](https://clojars.org/org.domaindrivenarchitecture/c4k-keycloak) [![pipeline status](https://gitlab.com/domaindrivenarchitecture/c4k-keycloak/badges/master/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/c4k-keycloak/-/commits/master) [![Clojars Project](https://img.shields.io/clojars/v/dda/c4k-keycloak.svg)](https://clojars.org/org.domaindrivenarchitecture/c4k-keycloak) [![pipeline status](https://gitlab.com/domaindrivenarchitecture/c4k-keycloak/badges/master/pipeline.svg)](https://gitlab.com/domaindrivenarchitecture/c4k-keycloak/-/commits/master)
[<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org) [<img src="https://domaindrivenarchitecture.org/img/delta-chat.svg" width=20 alt="DeltaChat"> chat over e-mail](mailto:buero@meissa-gmbh.de?subject=community-chat) | [<img src="https://meissa-gmbh.de/img/community/Mastodon_Logotype.svg" width=20 alt="team@social.meissa-gmbh.de"> team@social.meissa-gmbh.de](https://social.meissa-gmbh.de/@team) | [Website & Blog](https://domaindrivenarchitecture.org)
@ -9,7 +9,7 @@ c4k-keycloak ....
## Rational ## Rational
There are many comparable solutions for creating k8s deployments like helm or kustomize. Why do we need another one? There are many comparable solutions for creating c4k deployments like helm or kustomize. Why do we need another one?
* We like the simplicity of kustomize. Yaml in, yaml out, the ability to lint the result and the option to split large yaml files into objects. But a simple overwriting per environment may not be enough ... * We like the simplicity of kustomize. Yaml in, yaml out, the ability to lint the result and the option to split large yaml files into objects. But a simple overwriting per environment may not be enough ...
* We like helm packages. A package encapsulates the setup for an application. On the one hand, but on the other hand we don't like the idea of having to program and debug in a template language. We can program much better in real programming languages. * We like helm packages. A package encapsulates the setup for an application. On the one hand, but on the other hand we don't like the idea of having to program and debug in a template language. We can program much better in real programming languages.

@ -58,18 +58,18 @@ sudo ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
sudo apt-get install build-essential libz-dev zlib1g-dev sudo apt-get install build-essential libz-dev zlib1g-dev
# build # build
cd ~/repo/dda/k8s-keycloak cd ~/repo/dda/c4k-keycloak
lein uberjar lein uberjar
mkdir -p target/graalvm mkdir -p target/graalvm
lein native lein native
# execute # execute
./target/graalvm/k8s-keycloak -h ./target/graalvm/c4k-keycloak -h
./target/graalvm/k8s-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn ./target/graalvm/c4k-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn
./target/graalvm/k8s-keycloak src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn ./target/graalvm/c4k-keycloak src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn
``` ```
## k8s-setup ## c4k-setup
### install kubectl ### install kubectl
``` ```
@ -89,10 +89,10 @@ tar -xf /tmp/kubeconform.tar.gz
sudo cp kubeconform /usr/local/bin sudo cp kubeconform /usr/local/bin
``` ```
### remote access to k8s ### remote access to c4k
``` ```
scp -r root@devops.test.meissa-gmbh.de:/home/k8s/.kube ~/ scp -r root@devops.test.meissa-gmbh.de:/home/c4k/.kube ~/
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test.meissa-gmbh.de -L 8002:localhost:8002 -L 6443:192.168.5.1:6443 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test.meissa-gmbh.de -L 8002:localhost:8002 -L 6443:192.168.5.1:6443
# add in /etc/hosts "127.0.0.1 kubernetes" # add in /etc/hosts "127.0.0.1 kubernetes"
@ -105,6 +105,6 @@ kubectl get pods
### deploy keycloak ### deploy keycloak
``` ```
java -jar target/uberjar/k8s-keycloak-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate - java -jar target/uberjar/c4k-keycloak-standalone.jar valid-config.edn valid-auth.edn | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
java -jar target/uberjar/k8s-keycloak-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f - java -jar target/uberjar/c4k-keycloak-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
``` ```

@ -1,10 +1,10 @@
{ {
"name": "c4k-keycloak", "name": "c4k-keycloak",
"description": "Generate k8s yaml for a keycloak deployment.", "description": "Generate c4k yaml for a keycloak deployment.",
"author": "meissa GmbH", "author": "meissa GmbH",
"version": "0.1.5-SNAPSHOT", "version": "0.1.5-SNAPSHOT",
"homepage": "https://gitlab.com/domaindrivenarchitecture/k8s-keycloak#readme", "homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-keycloak#readme",
"repository": "https://www.npmjs.com/package/k8s-keycloak", "repository": "https://www.npmjs.com/package/c4k-keycloak",
"license": "APACHE2", "license": "APACHE2",
"main": "c4k-keycloak.js", "main": "c4k-keycloak.js",
"bin": { "bin": {
@ -14,12 +14,13 @@
"cljs", "cljs",
"keycloak", "keycloak",
"k8s", "k8s",
"c4k",
"deplyoment", "deplyoment",
"yaml", "yaml",
"convention4kubernetes" "convention4kubernetes"
], ],
"bugs": { "bugs": {
"url": "https://gitlab.com/domaindrivenarchitecture/k8s-keycloak/issues" "url": "https://gitlab.com/domaindrivenarchitecture/c4k-keycloak/issues"
}, },
"dependencies": { "dependencies": {
"js-base64": "^3.6.1", "js-base64": "^3.6.1",

@ -1,5 +1,5 @@
(defproject org.domaindrivenarchitecture/c4k-keycloak "0.1.0-SNAPSHOT" (defproject org.domaindrivenarchitecture/c4k-keycloak "0.1.0-SNAPSHOT"
:description "keycloak k8s-installation package" :description "keycloak c4k-installation package"
:url "https://domaindrivenarchitecture.org" :url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0" :license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
@ -23,7 +23,7 @@
:dev {:plugins [[lein-shell "0.5.0"]]} :dev {:plugins [[lein-shell "0.5.0"]]}
:uberjar {:aot :all :uberjar {:aot :all
:main dda.c4k-keycloak.uberjar :main dda.c4k-keycloak.uberjar
:uberjar-name "k8s-keycloak-standalone.jar" :uberjar-name "c4k-keycloak-standalone.jar"
:dependencies [[org.clojure/tools.cli "1.0.206"] :dependencies [[org.clojure/tools.cli "1.0.206"]
[ch.qos.logback/logback-classic "1.3.0-alpha4" [ch.qos.logback/logback-classic "1.3.0-alpha4"
:exclusions [com.sun.mail/javax.mail]] :exclusions [com.sun.mail/javax.mail]]
@ -38,7 +38,7 @@
"native-image" "native-image"
"--report-unsupported-elements-at-runtime" "--report-unsupported-elements-at-runtime"
"--initialize-at-build-time" "--initialize-at-build-time"
"-jar" "target/uberjar/k8s-keycloak-standalone.jar" "-jar" "target/uberjar/c4k-keycloak-standalone.jar"
"-H:ResourceConfigurationFiles=graalvm-resource-config.json" "-H:ResourceConfigurationFiles=graalvm-resource-config.json"
"-H:Log=registerResource" "-H:Log=registerResource"
"-H:Name=target/graalvm/${:name}"]}) "-H:Name=target/graalvm/${:name}"]})

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>k8s-mastodon-bot</title> <title>c4k-mastodon-bot</title>
<link href="https://domaindrivenarchitecture.org/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="https://domaindrivenarchitecture.org/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://domaindrivenarchitecture.org/css/fonts/fontawesome/fontawesome.css" rel="stylesheet" type="text/css" /> <link href="https://domaindrivenarchitecture.org/css/fonts/fontawesome/fontawesome.css" rel="stylesheet" type="text/css" />
<link href="https://domaindrivenarchitecture.org/css/custom.css" rel="stylesheet" type="text/css" /> <link href="https://domaindrivenarchitecture.org/css/custom.css" rel="stylesheet" type="text/css" />
@ -65,10 +65,10 @@
<div class="invalid-feedback"><pre id="auth-validation"></pre></div> <div class="invalid-feedback"><pre id="auth-validation"></pre></div>
<br><br> <br><br>
<button type="button" id="generate-button" class="btn btn-primary"> <button type="button" id="generate-button" class="btn btn-primary">
Generate k8s yaml Generate c4k yaml
</button></form><br><br> </button></form><br><br>
<div id="k8s-mastodon-bot-output"> <div id="c4k-mastodon-bot-output">
<label for="output" class="form-label">Your k8s deployment.yaml:</label> <label for="output" class="form-label">Your c4k deployment.yaml:</label>
<textarea name="output" id="output" class="form-control" rows="15"> <textarea name="output" id="output" class="form-control" rows="15">
</textarea> </textarea>
</div> </div>

@ -10,7 +10,7 @@
(def usage (def usage
"usage: "usage:
k8s-keycloak {your configuraton file} {your authorization file}") c4k-keycloak {your configuraton file} {your authorization file}")
(s/def ::options (s/* #{"-h"})) (s/def ::options (s/* #{"-h"}))
(s/def ::filename (s/and string? (s/def ::filename (s/and string?

Loading…
Cancel
Save