<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de"><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://mhus.de/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://mhus.de/" rel="alternate" type="text/html" hreflang="de" /><updated>2026-11-25T15:36:32+00:00</updated><id>https://mhus.de/blog/feed.xml</id><title type="html">Mike Hummel</title><subtitle>Mike Hummel, Software-Architekt und AI Engineer aus Oberfranken. Projekte wie Vancetope, Nimbus, jknife und KT2L, dazu ein Blog über Fehler und Lösungen.</subtitle><author><name>Mike Hummel</name></author><entry xml:lang="de"><title type="html">Suspekte Assertation Exception mit Vaadin im Selenium Chrome Driver</title><link href="https://mhus.de/blog/2024/06/kt2l-suspecte-assertation-exception-mit.html" rel="alternate" type="text/html" title="Suspekte Assertation Exception mit Vaadin im Selenium Chrome Driver" /><published>2024-06-17T20:15:00+00:00</published><updated>2024-06-17T20:15:00+00:00</updated><id>https://mhus.de/blog/2024/06/kt2l-suspecte-assertation-exception-mit</id><content type="html" xml:base="https://mhus.de/blog/2024/06/kt2l-suspecte-assertation-exception-mit.html"><![CDATA[<p>Für einen Abend Kopfschmerzen hat mich eine merkwürdige Exception gekostet, die nur in den Tests mit Selenium auftritt. In der Entwicklung ist die Exception nicht aufgetaucht.</p><p>Eingrenzen konnte ich die Quelle zumindest im Source-Code auf eine Änderung in der DeskTabBar. Hier habe ich anstelle von einem setContent( newPanel ) nun alle Panels in ein Layout gepackt und nur das Panel sichtbar, das aktuell aktiv ist. Damit gehen die Inhalte des Panels nicht verloren, bzw. muss nicht neu gerendert werden (vor allem mit Addons gibt es hier oft Probleme, z.B. vis und xTerm).</p><p>Bei der Änderung wird an jedes Panel die CSS-Class 'hidden' angehängt. Genau dieser Befehl löst die <code>Assertation: null</code> Exception von Vaadin aus. Die Exception wird in einem anderen Thread geworfen.</p><p>Als Lösung kann DeskTabBar nun beide Strategien umsetzen. In den Selenium-Tests wird das alte Vorgehen genutzt, im Betrieb das verbesserte.<br /></p>]]></content><author><name>Mike Hummel</name></author><category term="kt2l" /><summary type="html"><![CDATA[Für einen Abend Kopfschmerzen hat mich eine merkwürdige Exception gekostet, die nur in den Tests mit Selenium auftritt. In der Entwicklung ist die Exception nicht aufgetaucht.…]]></summary></entry><entry xml:lang="de"><title type="html">Jetzt auch Linux DEB installierbar</title><link href="https://mhus.de/blog/2024/06/kt2l-jetzt-auch-linux-deb-installierbar.html" rel="alternate" type="text/html" title="Jetzt auch Linux DEB installierbar" /><published>2024-06-17T06:23:00+00:00</published><updated>2024-06-17T06:23:00+00:00</updated><id>https://mhus.de/blog/2024/06/kt2l-jetzt-auch-linux-deb-installierbar</id><content type="html" xml:base="https://mhus.de/blog/2024/06/kt2l-jetzt-auch-linux-deb-installierbar.html"><![CDATA[<p>Nach einigen Kämpfen kann der Desktop jetzt auch unter Linux mittels DEB-Datei und APT-Kommando installiert werden. Die korrekte <a href="https://kt2l.org/#downloads" target="_blank">Datei</a> ist nun hinterlegt und die <a href="https://kt2l.org/docs/installation/desktop#linux-deb" target="_blank">Dokumentation</a> wurde aktualisiert.</p><p>Problem war der JVM-Parameter '-XstartOnMainThread', der zwar unter MacOSX angegeben werden muss, damit SWT funktioniert, aber unter Linux nicht existiert und hier verhindert, dass die Binary ausgeführt werden kann.</p><p>Leider hat die Erstellung eines Desktop-Eintrags noch nicht richtig funktioniert, die Dokumentation habe ich schon drin gelassen und als 'WIP' markiert.</p>]]></content><author><name>Mike Hummel</name></author><category term="kt2l" /><summary type="html"><![CDATA[Nach einigen Kämpfen kann der Desktop jetzt auch unter Linux mittels DEB-Datei und APT-Kommando installiert werden. Die korrekte Datei ist nun hinterlegt und die Dokumentation…]]></summary></entry><entry xml:lang="de"><title type="html">Dateien für Benutzer ermöglichen</title><link href="https://mhus.de/blog/2024/05/kt2l-dateien-fur-benutzer-ermoglichen.html" rel="alternate" type="text/html" title="Dateien für Benutzer ermöglichen" /><published>2024-05-18T17:05:00+00:00</published><updated>2024-05-18T17:05:00+00:00</updated><id>https://mhus.de/blog/2024/05/kt2l-dateien-fur-benutzer-ermoglichen</id><content type="html" xml:base="https://mhus.de/blog/2024/05/kt2l-dateien-fur-benutzer-ermoglichen.html"><![CDATA[<p>Aktuell können Benutzer keine Dateien verwalten, Dateien im Hintergrund. Funktionen wie Logs speichern, Dateien von Pods herunterladen oder beim Ausführen von Exec einen Mitschnitt machen.</p><p>Um diese Funktionen bereitzustellen, wird ein System benötigt, bei dem der Benutzer im Hintergrund Dateien ablegen und herunterladen kann. Ist die Anwendung lokal gestartet, soll der Datei-Explorer/Finder aufgehen anstelle von einem Download. Hier sollen die Dateien im User Home abgelegt werden. Wird KT2L in Kubernetes gestartet, ist es besser, die Dateien werden in einem Volume oder einem S3 Bucket abgelegt.</p><p>Da es keine echten Benutzerrechte auf Dateiebene gibt, müssen die Dateien sicher voneinander getrennt werden und der Zugriff auf 'andere' verhindert werden. Aber so kann auch das Sharing von Dateien umgesetzt werden. Wenn mehrere Benutzer in einer Gruppe sind, kann die Gruppe als Basis der Dateien genutzt werden (z.B. alle Admins).</p><p>Die Funktion ist nicht abhängig von Clustern, aber vom angemeldeten Benutzer und sollte auch komplett deaktiviert werden können, wenn die Installation eine reine 'View-Only' Anwendung ist. In diesem Fall ist der Service ein 'Dummy'.</p><p>Demnächst in Ihrem KT2L.</p>]]></content><author><name>Mike Hummel</name></author><category term="kt2l" /><summary type="html"><![CDATA[Aktuell können Benutzer keine Dateien verwalten, Dateien im Hintergrund. Funktionen wie Logs speichern, Dateien von Pods herunterladen oder beim Ausführen von Exec einen…]]></summary></entry><entry xml:lang="de"><title type="html">Das mit Vaadin UI und der HTTP Session</title><link href="https://mhus.de/blog/2024/05/kt2l-das-mit-vaadin-ui-und-der-http.html" rel="alternate" type="text/html" title="Das mit Vaadin UI und der HTTP Session" /><published>2024-05-18T16:54:00+00:00</published><updated>2024-05-18T16:54:00+00:00</updated><id>https://mhus.de/blog/2024/05/kt2l-das-mit-vaadin-ui-und-der-http</id><content type="html" xml:base="https://mhus.de/blog/2024/05/kt2l-das-mit-vaadin-ui-und-der-http.html"><![CDATA[<p>Eigentlich sollte bei einem Refresh im Browser alles weggeworfen werden und es fängt von vorne an. Das ist so auch der Standard wenn man Vaadin nutzt. Genauer wird sogar beim Wechsel der Seite (Routing) immer alles neu geladen. Navigierst du zurück, ist alles weg. Nachteil des Verhaltens ist, dass man keine echte Anwendung bauen kann, in der der Status einer Seite, die gerade nicht zu sehen ist, bestehen bleibt. Blöd, wenn man z.B. ein Log oder zwei Logs laufen hat und dann mal was anderes schauen will. Huch, Log weg.</p><p>Deshalb wurde bei KT2L auf die Fähigkeit verzichtet, die Session <code>serializable</code> zu halten und somit stateless auf mehreren Instanzen bereitzustellen: Einmal an einer Instanz angemeldet, musst du dort auch bleiben, sonst ist deine Anwendung weg. Vorteil: im Hintergrund kann die Anwendung schön weiter arbeiten, Logs und Events sammeln,  damit die Ansicht aktuell bleibt.</p><p>Solange im Browser nicht 'Refresh' gedrückt wird, ist alles gut. Leider hat sich der Teil mit dem Refresh auf der aktuellen Seite auch als problematisch herausgestellt. Im Grunde wird bei jedem Refresh die Session und die Vaadin UI neu erstellt. Bei schwachen Verbindungen kann da schon mal ein Refresh passieren, ohne dass man das will. Schwups, Anwendung beendet und von vorne.</p><p>Zum Glück kann man das umstellen und die Session bei einem Refresh wird nicht mehr gelöscht. Aber auch das hat seine Haken. Denn die Vaadin UI wird schon gelöscht und eine neue erstellt. Das bedeutet bei jedem Refresh wird jede Referenz auf das UI-Objekt ungültig. Es werden Events geworfen für <code>Detach</code> und <code>Attach</code> der UI. Und bei <code>Detach</code> können nun auch die Ressourcen (z.B. Log-Watch)  nicht mehr freigegeben werden.</p><p>Aber alles halb so schlimm. Wichtig: Bei jeder Aktion, immer, die UI neu holen. Leider kann es passieren, dass die UI gerade ungültig ist. Ggf. sollte das noch abgefangen werden. </p><p>Leider läuft die HTTP Session normalerweise so 180 Minuten.  Wenn im Hintergrund jede Menge Ressourcen für die Anwendung gebraucht werden, kann das ein Problem werden. Deshalb muss die HTTP Session auf eine viel kürzere Zeit, z.B. 10 Minuten reduziert werden.</p><p>Doch jetzt das nächste Problem in der Kette: Ist der User 10 Minuten inaktiv, stirbt die aktuelle HTTP Session. Und nun? Die Lösung ist eine Session-Timeout-Benachrichtigung. Sie wird 60 Sekunden vor dem Ende der HTTP Session aktiv und zeigt einen Dialog an 'Achtung die Session läuft gleich ab ...'. Und der Dialog hat einen 'Session verlängern' Knopf. Erscheint die Nachricht, kann mit JavaScript im Browser der Knopf automatisiert aktiviert werden und so wird die Session automatisch verlängert.</p><p>Diese Lösung ermöglicht es, die Session zu behalten, solange die Anwendung im Browser offen ist und der Browser auch reagiert (z.B. der Rechner nicht eingeschlafen ist). Außerdem werden Ressourcen innerhalb von 10 Minuten weggeräumt, ist der User nicht mehr da. Und es wird immer wieder kurz ein Dialog angezeigt, wenn der User die Anwendung nicht mehr bedient. </p><p>Problem gelöst!</p>]]></content><author><name>Mike Hummel</name></author><category term="kt2l" /><summary type="html"><![CDATA[Eigentlich sollte bei einem Refresh im Browser alles weggeworfen werden und es fängt von vorne an. Das ist so auch der Standard wenn man Vaadin nutzt. Genauer wird sogar beim…]]></summary></entry><entry xml:lang="de"><title type="html">Anzahl der Ressourcen wird jetzt angezeigt</title><link href="https://mhus.de/blog/2024/05/anzahl-der-resources-wird-jetzt.html" rel="alternate" type="text/html" title="Anzahl der Ressourcen wird jetzt angezeigt" /><published>2024-05-08T15:39:00+00:00</published><updated>2024-05-08T15:39:00+00:00</updated><id>https://mhus.de/blog/2024/05/anzahl-der-resources-wird-jetzt</id><content type="html" xml:base="https://mhus.de/blog/2024/05/anzahl-der-resources-wird-jetzt.html"><![CDATA[<p>Unter dem Grid wird nun ein Footer dargestellt, in dem die Anzahl der Ressourcen im Grid angezeigt wird. Wird gefiltert, werden die angezeigte und tatsächliche Menge an Einträgen angezeigt. Wurden Einträge selektiert, wird auch die Anzahl der selektierten Einträge angezeigt.</p><p>Die Formatierung muss noch angepasst werden, ggf. noch ein Kürzel, damit die Anzeige besser eingeordnet werden kann.</p><p>Um Platz für den Footer zu schaffen, habe ich Padding und Margin in den Layouts entfernt. Damit rückt alles mehr zusammen und sieht kompakter aus.</p>]]></content><author><name>Mike Hummel</name></author><category term="kt2l" /><summary type="html"><![CDATA[Unter dem Grid wird nun ein Footer dargestellt, in dem die Anzahl der Ressourcen im Grid angezeigt wird. Wird gefiltert, werden die angezeigte und tatsächliche Menge an Einträgen…]]></summary></entry><entry xml:lang="en"><title type="html">Creating a flux sync configuration referring a config map for substitution</title><link href="https://mhus.de/blog/2022/11/creating-flux-sync-configuration.html" rel="alternate" type="text/html" title="Creating a flux sync configuration referring a config map for substitution" /><published>2022-11-10T07:30:00+00:00</published><updated>2022-11-10T07:30:00+00:00</updated><id>https://mhus.de/blog/2022/11/creating-flux-sync-configuration</id><content type="html" xml:base="https://mhus.de/blog/2022/11/creating-flux-sync-configuration.html"><![CDATA[<p> If you configure your k8s cluster with terraform one of the final steps is to install a fluxcd operator. The operator is responsible to manage the resources inside of the cluster. In this way a fully automatic creation process is possible.</p><p>To install <a href="https://registry.terraform.io/providers/fluxcd/flux/latest/docs">flux a terraform provider</a> is available preparing an install and sync configuration which can be installed in k8s using the kubernetes/kubectl providers.</p><p>In fluxcd itself it is possible to use <a href="https://fluxcd.io/flux/components/kustomize/kustomization/#variable-substitution">substitution</a>. This means you can use variables to prepare the k8s yaml files. This is useful for variable content like different cluster names and domain names for all stages. Or more specialised arn ids of created resources while creating the cluster in aws. To use substitution fluxcd offers to link the configuration to a config map. In the map a set of key values can be defined to replace variable values.</p><p>The map can also be created with terraform and the kubectl provider. Do not store secrets in the config map. Try to use secrets instead.</p><p>Applying the config map to the sync configuration of the fluxcd terraform source turned out as the biggest challenge. Since the provider <a href="https://github.com/fluxcd/terraform-provider-flux/issues/265#issuecomment-1308635563">does not support setting the <i>substituteFrom</i> parameter</a>. Therefore the configuration must be manipulated before applying to k8s.</p><pre><code>postBuildParameters = {
    substituteFrom = [
      {
        kind = "ConfigMap"
        name = "cluster-vars"
      }
    ]

  }

  decoded_documents = [ for v in data.kubectl_file_documents.sync.documents : yamldecode(v) ]
  documents = [ for v in local.decoded_documents :
    merge( v, v.kind == "Kustomization" ? { spec = merge(v.spec, {postBuild = local.postBuildParameters}) } : {})
  ]</code></pre><p>In this way a config map named <i>kube-system/cluster-vars</i> will be used to substitute the variables.</p>]]></content><author><name>Mike Hummel</name></author><summary type="html"><![CDATA[If you configure your k8s cluster with terraform one of the final steps is to install a fluxcd operator. The operator is responsible to manage the resources inside of the cluster.…]]></summary></entry><entry xml:lang="en"><title type="html">Create Spring Boot Images in Jenkins/CI in K8s, Part 1</title><link href="https://mhus.de/blog/2022/06/create-spring-boot-images-in-jenkinsci.html" rel="alternate" type="text/html" title="Create Spring Boot Images in Jenkins/CI in K8s, Part 1" /><published>2022-06-30T15:18:00+00:00</published><updated>2022-06-30T15:18:00+00:00</updated><id>https://mhus.de/blog/2022/06/create-spring-boot-images-in-jenkinsci</id><content type="html" xml:base="https://mhus.de/blog/2022/06/create-spring-boot-images-in-jenkinsci.html"><![CDATA[<p>  Working out Jenkins/CI pipelines it is a common task to create Spring Boot Images. Doing this with kubernetes agents is a challenge since docker is no longer available from inside of containers.</p><p>The task is quite simple, create a spring boot image with <code>mvn spring-boot:build-image</code> inside a kubernetes pod.</p><p>By default this fails because spring tries to execute 'buildpacks' but the needed docker service is not available. The docker service is needed to create the container image. With spring 2.6 and below it is not possible to use another service than docker. But it is possible to use buildpacks separately after creating the project jar file.</p><p>As replacement of docker it is possible to use podman as service. podman is compatible with docker and also supports the docker.sock. Looking forward to spring boot 2.7 which supports also podman as alternative to docker I did not try to use 'kaniko'.</p><p>Objectives of this post:</p><ul><li>Create a working pod and script to create spring boot images inside of Kubernetes</li><li>Prove how creation could be done in K8s </li><li>Push the image to docker hub</li></ul><div>Out of scope</div><div><ul><li>Creating the Jenkins pipeline</li></ul><p>To do the task I create a 'pod.yaml' with container needed to create a spring boot image and a 'build.sh' containing all the commands executing at the pods containers.</p><p>To test the script a simple spring application will be used (<a href="https://github.com/mhus/sample-spring-service">https://github.com/mhus/sample-spring-service</a>). - These files are included in the repository in '/test'.</p><p>So let's do it:</p><p><b>(0)</b> First a management pod is needed to download the project. Usually this is done by Jenkins at the start of the pipeline. In this case I need to do it manually. I need an image which contains the command 'git' to clone the git repo. The image 'dockercore/docker' will do the job. As usual we need to start a dummy command to keep the container alive. My name for the container is 'box'.</p><p>To simulate Jenkins I will share the folder '/home/jenkins/agent/' over all pods.</p></div>      - name: box<br />        image: dockercore/docker<br />        command:<br />        - cat<br />        tty: true<br />        volumeMounts:<br />          - name: workspace-volume<br /><div><div>            mountPath: /home/jenkins/agent</div></div><div><p> Now it is possible to clone the repository</p></div>kubectl exec -it -c box agent -- /bin/bash -c \<br /> "cd /home/jenkins/agent/;<br /><div><div> git clone https://github.com/mhus/sample-spring-service.git"</div></div><div><p>Preparation is done.</p><p><b>(1)</b> First pipeline step is to create the jar file using maven. This is a common task in Jenkins pipelines. Use the 'maven' image and execute <code>mvn package</code> for the project.</p></div>- name: maven<br />     image:  maven:3.8-openjdk-11<br />     command:<br />     - cat<br />     tty: true<br />     volumeMounts:<br />       - name: workspace-volume<br /><div><div>         mountPath: /home/jenkins/agent</div></div><div><p>and execute</p></div>kubectl exec -it -c maven agent -- \<br /> /bin/bash -c "cd /home/jenkins/agent/sample-spring-service;<br /><div><div> mvn package"</div></div><div><p><b>(2)</b> More complicated is to execute the buildpack command. To create the image the command is </p></div><div>pack build &lt;image name&gt; -p &lt;jar file&gt; -B paketobuildpacks/builder:base"` and there is an official buildpack image in docker hub 'buildpacksio/pack</div><div><p>But the image does not include a bash or sh command and it is not possible to start the container doing nothing and wait for exec commands - wtf. Therefore I was forced to create a separate image containing buildpacks AND a shell.</p><p>Dockerfile</p></div>FROM debian<br />RUN set +x \<br /> &amp;&amp; apt update \<br /> &amp;&amp; apt install -y curl git \<br /> &amp;&amp; (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.26.0/pack-v0.26.0-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack) \<br /> &amp;&amp; apt-get clean \<br /> &amp;&amp; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*<br /> <br /><div><p>ENTRYPOINT ["/usr/local/bin/pack"]</p></div><p>And I pushed the image to docker hub as 'mhus/buildpacks:0.26.0-0'. Adding the container specification to the pod I created a shared folder to share the docker socket from podman into buildpacks.</p>- name: buildpacks<br />     image: mhus/buildpacks:0.26.0-0<br />     command: ["/bin/bash","-c"]<br />     args: ["cat"]<br />     tty: true<br />     volumeMounts:<br />       - name: workspace-volume<br />         mountPath: /home/jenkins/agent<br />       - name: docker-socket<br /><div>         mountPath: /var/run</div><p>And the podman container as helper for the buildpacks command. To provide the socket it's important to start the podman as a service and set the path for the socket.</p>- name: podman<br />     image: quay.io/podman/stable<br />     args: ["/usr/bin/podman","system","service","-t","0","--log-level=info", "unix:///var/run/docker.sock"]<br />     tty: true<br />     securityContext:<br />      privileged: true<br />     volumeMounts:<br />       - name: workspace-volume<br />         mountPath: /home/jenkins/agent<br />       - name: docker-socket<br /><div>         mountPath: /var/run</div><div>Now it's possible to start buildpack to create the container image for the spring boot project:</div>kubectl exec -it -c buildpacks agent -- /bin/bash -c \<br /> "cd /home/jenkins/agent/sample-spring-service;<br /><div> pack build sample-spring-service -p target/sample-spring-service-1.0.0-SNAPSHOT.jar -B paketobuildpacks/builder:base"</div><p><b>(3)</b> Last step is to push the image to docker hub. To do this I need to tag the image, login to the hub and push the image. Since the podman container already exists I only need to call the command in the existing container.</p>kubectl exec -it -c podman agent -- /bin/bash -c \<br /> "podman tag sample-spring-service docker.io/$docker_user/sample-spring-service:$version;"<br />kubectl exec -it -c podman agent -- /bin/bash -c \<br /> "podman login -u $docker_user -p '$docker_pass' docker.io/$docker_user"<br />kubectl exec -it -c podman agent -- /bin/bash -c \<br /><div> "podman push docker.io/$docker_user/sample-spring-service:$version"</div><div><p>Before execution set the variables </p></div>version="latest"<br />docker_user="mhus"<br /><div>docker_pass="xxx"</div><p>Let's test the new image with docker:</p><div>docker run --rm --name sample-spring-service -p 8080:8080 mhus/sample-spring-service:latest</div><div>And test the rest service in the browser 'http://localhost:8080/hello'.</div><p>This proof could be more generic but I reached the goal to create a spring boot image. Next this should be done all together to create a pipeline that works for this project and with parameters for all other projects too.</p>]]></content><author><name>Mike Hummel</name></author><summary type="html"><![CDATA[Working out Jenkins/CI pipelines it is a common task to create Spring Boot Images. Doing this with kubernetes agents is a challenge since docker is no longer available from inside…]]></summary></entry><entry xml:lang="en"><title type="html">Sonatype Nexus fails with random “peer not authenticated” errors behind ingress</title><link href="https://mhus.de/blog/2022/06/sonatype-nexus-fails-with-random-peer.html" rel="alternate" type="text/html" title="Sonatype Nexus fails with random “peer not authenticated” errors behind ingress" /><published>2022-06-11T11:55:00+00:00</published><updated>2022-06-11T11:55:00+00:00</updated><id>https://mhus.de/blog/2022/06/sonatype-nexus-fails-with-random-peer</id><content type="html" xml:base="https://mhus.de/blog/2022/06/sonatype-nexus-fails-with-random-peer.html"><![CDATA[<p> After installing nexus3 server in a kubernetes environment at first glance everything looks good. Server is running and accessible from the world. Users and roles are defined and working.</p><p>But already in the first hours of working with the repository there are problems. The trick was to retry the failed activity and everything went ok. It turned out that heavy activities failed a lot of times and a lot of retries have to be done to finish the tasks. Annoying if a release deploy failed. You need to increase the version number every time.</p><p>There was little help on the internet, most of it about SSL problems between maven and nexus. But it did not fix the problem.</p><p>It looks like maven and the used http library wagon have got problems with pooled connections if using ingress (a test with a standalone installation did not show the problem)  - The 'deep' reason is not really clear for me, need to invest more time for it.</p><p>The solution is to prevent wagon from using pooled http connections. Add the option </p><blockquote><p>-Dmaven.wagon.http.pool=false</p></blockquote><p>to the maven command and no more 'peer not authenticated' will appear. The cost is that maven is slower, but it works now. </p><p>The discussed solution about SSL problems did not solve the issue. Parameters like </p><blockquote><p>-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true </p></blockquote><p>did not fix it.</p><p><b>News:</b></p><p>After more investigation I found the problem. The client side java version 11.0.2 has a known SSL bug which sporadically drops the SSL connection. This is not fixed with the ssl options above. An update to 11.0.15 fixed the problem.</p><p>Finally!</p>]]></content><author><name>Mike Hummel</name></author><summary type="html"><![CDATA[After installing nexus3 server in a kubernetes environment at first glance everything looks good. Server is running and accessible from the world. Users and roles are defined and…]]></summary></entry><entry xml:lang="en"><title type="html">Error Reporting and Forwarding</title><link href="https://mhus.de/blog/2022/06/error-reporting-and-forwarding.html" rel="alternate" type="text/html" title="Error Reporting and Forwarding" /><published>2022-06-11T11:37:00+00:00</published><updated>2022-06-11T11:37:00+00:00</updated><id>https://mhus.de/blog/2022/06/error-reporting-and-forwarding</id><content type="html" xml:base="https://mhus.de/blog/2022/06/error-reporting-and-forwarding.html"><![CDATA[<h4>Overview</h4><div>Error reporting is most of the time underestimated because it is believed that it is clear how this works. But the real requirements are most of the time not clear and most of the time it is not working how it should. This article shows the needs and goals of good error reporting. It also shows how it is currently done and how it is related to logging. Especially in distributed systems error reporting must be redefined.</div><h4>Reporting</h4><div>Why do we report errors? We want to let someone or something know that something went wrong. </div><div>This gives the first requirements for error reporting. We need to report what's wrong. Precise enough to understand the problem or to analyse it deeper. </div><div>To do this a static error message for the case is necessary and more dynamic data to describe the specific case. Also a stack trace should be delivered to show exactly the code line where the error occurs. The stack trace is not part of this contemplation because it depends on the underlying programming language how it works. Because of security reasons most times it is not delivered to a user interface but it should be logged with the error message.</div><blockquote><div>message : String</div><div>parameters : Array of String</div><div>stacktrace: Array of elements</div></blockquote><div>The message is a more technical information what happened.</div><div>Moreover if we present the error to humans in a user interface it is important to present the error. This means it should be possible to translate it and to show it as a text. Therefore the message could include placeholders where the parameters should be included. Since the parameters are not part of the message itself and the message is a static string it will be possible to create translation tables for the supported languages. Even English, to translate the technical message into well readable information. The technical message is only the last option - fall back. </div><blockquote><div><div>message : String - original technical message with placeholders</div></div><div><div>messageString : String - Translated and substituted message</div></div><div><div>parameters : Array of String</div></div><div><div>stacktrace: Array of elements</div></div></blockquote><div>Another important task of error messages is that we want to search for it in a log system. Most of the time this is one of the hardest things to do, especially if the error message includes dynamic parts. It would also be great if dynamic parts could be searched separately. This is absolutely important to operate a software system.</div><div>An example to understand the case:</div><blockquote><div>Access for a user will not be granted for a ticket queue. A traditional way to throw and log an error would be "Access for user 'u123456' are not allowed for ticket queue 'devops'."</div><div>To search this in a log something like 'Access for user% and %are not allowed for ticket%' must be searched. This is inefficient and could also find other log entries.</div><div>Now change the log entry like it is defined below:</div><div>message: "Access for user {1} are not allowed for ticket queue {2}"</div><div>parameters[1]: u123456</div><div>parameters[2]: devops</div><div>Now it will be possible to search the exact message "message:Access for user {1} are not allowed for ticket queue {2}" and if needed it will also be possible to search for the exact user "parameters:u123456" or queue "parameters:devops". By the way this kind of search is more efficient by searching exact values.</div></blockquote><div>The example shows that error reporting is strongly related to logging. This is a topic for another post. It shows also that the separation of static message and dynamic parameters is clever. It is not necessary to log the translation.</div><h4>Error Codes</h4><div>For technical reasons it is useful to ship an error code with the error message. The error code should not describe the error in detail but the error class. A similar system are HTTP status codes. The code describes the kind of error, e.g. server side error or client error. Since errors are often reported as HTTP results like for RESTful calls it is smart to use the same codes as error codes. But it is necessary to map error events to static codes.</div><div>An important property of error codes is the information whether the call should be retried. A 'syntax error' will never return success but a 'service unavailable' could be successful after a while.</div><blockquote><div><div>errorCode: integer</div></div><div><div>message : String - original technical message with placeholders</div></div><div><div>messageString : String - Translated and substituted message</div></div><div><div>parameters : Array of String</div></div><div><div>stacktrace: Array of elements</div></div></blockquote><h4>Forwarding</h4><div>In distributed systems error reporting to the UI is more complex than in monolith apps.</div><div>A sample to describe the case:</div><blockquote><div>There is a service to create a user in the database which is called from outside UI. The create customer service accepts a list of addresses like owner, contact, shipping address. To validate the address a second service is called. The service also checks the ZIP against the area code of the phone number.</div><div>If one address is not valid because of the ZIP-AC check the error is "ZIP and phone area code do not match". Another reason could be "family name is too long, maximum is a length of 70 characters". Then the create customer service fails with "shipping address is not valid".</div><div>The error message tells us which address causes the problem but the user has no idea what the problem is. Therefore a forwarding of the original error is desirable. But a pure forwarding is also not useful. A combination would help: "shipping address is not valid, ZIP and phone area code do not match".</div></blockquote><div>Encapsulated error messages should be forwarded to the caller. There are a few options to handle root causes.</div><div><ul><li>Adopt the root cause: If a root cause is given then override the current message</li><li>Append the root cause: Add the root cause at the end as part of the error</li><li>Ignore root cause</li></ul></div><div>A root cause could also be the result of another REST call. It will be stored as error object in the parameters.</div><blockquote><div></div></blockquote><pre><code>The translation will be done while delivery to the UI.
message: &quot;shipping address is not valid, {1}&quot;
errorCode: 400
properties[1]: {
  message: &quot;ZIP {1} and phone area code {2} do not match&quot;
  errorCode: 405
  properties[1]: &quot;12345&quot;
  properties[2]: &quot;55555&quot;
}
As result error code &#x27;400 Bad request&#x27; and  translated message:
Shipping address is not valid, ZIP &quot;12345&quot; and phone area code &quot;55555&quot; do not match.</code></pre>
<h4>Conclusion</h4><div>Error reporting can become an upgrade if there is the will to think about it. Then it can be a helpful tool supporting users and operators during their daily tasks.</div>]]></content><author><name>Mike Hummel</name></author><summary type="html"><![CDATA[Overview Error reporting is most of the time underestimated because it is believed that it is clear how this works. But the real requirements are most of the time not clear and…]]></summary></entry><entry xml:lang="en"><title type="html">Create docker/container images in a Kubernetes Jenkins pipeline</title><link href="https://mhus.de/blog/2022/05/create-docker-images-in-kubernetes.html" rel="alternate" type="text/html" title="Create docker/container images in a Kubernetes Jenkins pipeline" /><published>2022-05-16T06:46:00+00:00</published><updated>2022-05-16T06:46:00+00:00</updated><id>https://mhus.de/blog/2022/05/create-docker-images-in-kubernetes</id><content type="html" xml:base="https://mhus.de/blog/2022/05/create-docker-images-in-kubernetes.html"><![CDATA[<p> The challenge is quite simple: To deploy a piece of software to Kubernetes it's necessary to create the (docker) container image in a pipeline.</p><p>But the solution was not found directly. Most articles I found show how to use the docker socket or tcp port to create images but since docker is no longer part of Kubernetes this will not work any more.</p><p>The solution is to use '<a href="https://github.com/GoogleContainerTools/kaniko" target="_blank">kaniko</a>'. Looks like the project is able to master image creation.</p><p>1) First install and configure Jenkins</p><p>values.yaml</p><p>controller:</p><p>  JCasC:</p><p>    securityRealm: |-</p><p>      local:</p><p>        allowsSignup: false</p><p>        enableCaptcha: false</p><p>        users:</p><p>        - id: "admin"</p><p>          name: "Jenkins Admin"</p><p>          password: "xxx"</p><p>    authorizationStrategy: |-</p><p>      loggedInUsersCanDoAnything:</p><p>        allowAnonymousRead: false</p><p>  ingress:</p><p>       enabled: true</p><p>       paths: []</p><p>       apiVersion: "extensions/v1beta1"</p><p>       hostName: jenkins.mycluster.de</p><div><div>kubectl create namespace jx</div><div>helm install jenkins jenkins/jenkins -f values.yaml</div></div><p>2) To push images in a repository (e.g. sonatype nexus) it's necessary to configure the repository credentials:</p><p>Create a file 'config.json' (the name must fit) and import it into the Jenkins namespace:</p><div><pre><code>CI_REGISTRY=docker.mycluster.de
CI_REGISTRY_USER=managernexus
CI_REGISTRY_PASSWORD=$(pass cloud/prod/mycluster/managernexus)
echo &quot;{\&quot;auths\&quot;:{\&quot;${CI_REGISTRY}\&quot;:{\&quot;auth\&quot;:\&quot;$(printf &quot;%s:%s&quot; &quot;${CI_REGISTRY_USER}&quot; &quot;${CI_REGISTRY_PASSWORD}&quot; | base64 | tr -d &#x27;\n&#x27;)\&quot;}}}&quot; &gt; config.json</code></pre>
<br /></div><div>kubectl create secret generic -n jx docker-config --from-file=config.json
</div><div>rm config.json</div><p>3) Create a pipeline:</p><div><pre><code>pipeline {
  agent {
    kubernetes {
      yamlFile &#x27;jenkins-pod.yaml&#x27;
    }
  }
  stages {
    stage(&#x27;Build image&#x27;) {
      steps {
        container(&#x27;kaniko&#x27;) {
          sh &quot;/kaniko/executor \
          --dockerfile pwd/Dockerfile \
          --context pwd \
          --destination=docker.mycluster.de/myimage:${env.BUILD_ID} \
          --destination=docker.mycluster.de/myimage:latest&quot;
        }
      }
    }
  }
}</code></pre>
</div><p>4) Create a pod configuration</p><div><pre><code>spec:
  containers:
  - name: kaniko
    image: gcr.io/kaniko-project/executor:debug
    command:
    - cat
    tty: true
    volumeMounts:
    - name: docker-config
      mountPath: /kaniko/.docker
  volumes:
  - name: docker-config
    secret:
      secretName: docker-config</code></pre>
</div><p>5) Create a Jenkins pipeline</p><p>In Jenkins create a new pipeline using the 'Jenkins' file as pipeline. Create a Dockerfile in the project root to create the container image.</p>]]></content><author><name>Mike Hummel</name></author><summary type="html"><![CDATA[The challenge is quite simple: To deploy a piece of software to Kubernetes it's necessary to create the (docker) container image in a pipeline. But the solution was not found…]]></summary></entry></feed>