more refactoring

This commit is contained in:
jem 2021-06-05 17:27:42 +02:00
parent af2f16714e
commit a900551a58
6 changed files with 24 additions and 23 deletions

View file

@ -1,5 +1,5 @@
# 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)
@ -9,7 +9,7 @@ c4k-keycloak ....
## 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 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.

View file

@ -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
# build
cd ~/repo/dda/k8s-keycloak
cd ~/repo/dda/c4k-keycloak
lein uberjar
mkdir -p target/graalvm
lein native
# execute
./target/graalvm/k8s-keycloak -h
./target/graalvm/k8s-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 -h
./target/graalvm/c4k-keycloak src/test/resources/valid-config.edn src/test/resources/valid-auth.edn
./target/graalvm/c4k-keycloak src/test/resources/invalid-config.edn src/test/resources/invalid-auth.edn
```
## k8s-setup
## c4k-setup
### install kubectl
```
@ -89,10 +89,10 @@ tar -xf /tmp/kubeconform.tar.gz
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
# add in /etc/hosts "127.0.0.1 kubernetes"
@ -105,6 +105,6 @@ kubectl get pods
### 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/k8s-keycloak-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
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/c4k-keycloak-standalone.jar valid-config.edn my-auth.edn | kubectl apply -f -
```

View file

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

View file

@ -1,5 +1,5 @@
(defproject org.domaindrivenarchitecture/c4k-keycloak "0.1.0-SNAPSHOT"
:description "keycloak k8s-installation package"
:description "keycloak c4k-installation package"
:url "https://domaindrivenarchitecture.org"
:license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
@ -23,7 +23,7 @@
:dev {:plugins [[lein-shell "0.5.0"]]}
:uberjar {:aot :all
: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"]
[ch.qos.logback/logback-classic "1.3.0-alpha4"
:exclusions [com.sun.mail/javax.mail]]
@ -38,7 +38,7 @@
"native-image"
"--report-unsupported-elements-at-runtime"
"--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:Log=registerResource"
"-H:Name=target/graalvm/${:name}"]})

View file

@ -3,7 +3,7 @@
<head>
<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/fonts/fontawesome/fontawesome.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>
<br><br>
<button type="button" id="generate-button" class="btn btn-primary">
Generate k8s yaml
Generate c4k yaml
</button></form><br><br>
<div id="k8s-mastodon-bot-output">
<label for="output" class="form-label">Your k8s deployment.yaml:</label>
<div id="c4k-mastodon-bot-output">
<label for="output" class="form-label">Your c4k deployment.yaml:</label>
<textarea name="output" id="output" class="form-control" rows="15">
</textarea>
</div>

View file

@ -10,7 +10,7 @@
(def 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 ::filename (s/and string?