From b3f95fbe38f6444fdf3c4bd75eb125aab70e9247 Mon Sep 17 00:00:00 2001 From: mriedl Date: Wed, 27 Sep 2023 10:45:34 +0200 Subject: [PATCH] Update chart configuration of deployment and service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Radosław Piliszek Co-Authored-By: Jan Marchel Change-Id: I66d9973313d07edace843c765cc91efbdfb72da0 --- charts/nebulous-activemq/templates/NOTES.txt | 4 +- .../templates/deployment.yaml | 19 +++++---- .../nebulous-activemq/templates/service.yaml | 10 +++-- charts/nebulous-activemq/values.yaml | 13 +++++- docker/Dockerfile | 2 + java-spring-boot-demo/.gitignore | 33 --------------- java-spring-boot-demo/Dockerfile | 15 ------- java-spring-boot-demo/pom.xml | 42 ------------------- .../com/example/demo/DemoApplication.java | 13 ------ .../java/com/example/demo/DemoController.java | 14 ------- .../src/main/resources/application.properties | 0 .../example/demo/DemoApplicationTests.java | 13 ------ zuul.d/jobs.yaml | 10 ++--- zuul.d/project.yaml | 2 + 14 files changed, 40 insertions(+), 150 deletions(-) create mode 100644 docker/Dockerfile delete mode 100644 java-spring-boot-demo/.gitignore delete mode 100644 java-spring-boot-demo/Dockerfile delete mode 100644 java-spring-boot-demo/pom.xml delete mode 100644 java-spring-boot-demo/src/main/java/com/example/demo/DemoApplication.java delete mode 100644 java-spring-boot-demo/src/main/java/com/example/demo/DemoController.java delete mode 100644 java-spring-boot-demo/src/main/resources/application.properties delete mode 100644 java-spring-boot-demo/src/test/java/com/example/demo/DemoApplicationTests.java diff --git a/charts/nebulous-activemq/templates/NOTES.txt b/charts/nebulous-activemq/templates/NOTES.txt index 2cfe0dc..f11f5ec 100644 --- a/charts/nebulous-activemq/templates/NOTES.txt +++ b/charts/nebulous-activemq/templates/NOTES.txt @@ -17,6 +17,6 @@ {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-activemq.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT + echo "Visit http://127.0.0.1:8161/admin to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8161:$CONTAINER_PORT {{- end }} diff --git a/charts/nebulous-activemq/templates/deployment.yaml b/charts/nebulous-activemq/templates/deployment.yaml index 6fdc201..227e176 100644 --- a/charts/nebulous-activemq/templates/deployment.yaml +++ b/charts/nebulous-activemq/templates/deployment.yaml @@ -29,22 +29,25 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} + env: + {{- toYaml .Values.brokerEnv | nindent 12 }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - - name: http - containerPort: 8080 + - name: gui + containerPort: 8161 + protocol: TCP + - name: activemq + containerPort: 61616 protocol: TCP livenessProbe: - httpGet: - path: / - port: http + tcpSocket: + port: activemq readinessProbe: - httpGet: - path: / - port: http + tcpSocket: + port: activemq resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/charts/nebulous-activemq/templates/service.yaml b/charts/nebulous-activemq/templates/service.yaml index cc014cf..2ef13fa 100644 --- a/charts/nebulous-activemq/templates/service.yaml +++ b/charts/nebulous-activemq/templates/service.yaml @@ -7,9 +7,13 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: {{ .Values.service.port }} - targetPort: http + - port: {{ .Values.service.guiPort }} + targetPort: gui protocol: TCP - name: http + name: gui + - port: {{ .Values.service.activemqPort }} + targetPort: activemq + protocol: TCP + name: activemq selector: {{- include "nebulous-activemq.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-activemq/values.yaml b/charts/nebulous-activemq/values.yaml index 6931255..be1955c 100644 --- a/charts/nebulous-activemq/values.yaml +++ b/charts/nebulous-activemq/values.yaml @@ -5,7 +5,7 @@ replicaCount: 1 image: - repository: "quay.io/nebulous/activemq-java-spring-boot-demo" + repository: "quay.io/nebulous/activemq-broker" pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" @@ -38,7 +38,8 @@ securityContext: {} service: type: ClusterIP - port: 80 + guiPort: 8161 + activemqPort: 61616 ingress: enabled: false @@ -80,3 +81,11 @@ nodeSelector: {} tolerations: [] affinity: {} + +brokerEnv: +- name: ACTIVEMQ_NAME + value: activemq +- name: ACTIVEMQ_PASSWORD + value: nebulous +- name: ACTIVEMQ_USERNAME + value: admin diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6c823e0 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,2 @@ +# Use the official Apache ActiveMQ image +FROM docker.io/apache/activemq-classic:5.18.2 diff --git a/java-spring-boot-demo/.gitignore b/java-spring-boot-demo/.gitignore deleted file mode 100644 index 549e00a..0000000 --- a/java-spring-boot-demo/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/java-spring-boot-demo/Dockerfile b/java-spring-boot-demo/Dockerfile deleted file mode 100644 index 427e30e..0000000 --- a/java-spring-boot-demo/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Build stage -# -FROM docker.io/library/maven:3.9.2-eclipse-temurin-17 AS build -COPY src /home/app/src -COPY pom.xml /home/app -RUN mvn -f /home/app/pom.xml clean package - -# -# Package stage -# -FROM docker.io/library/eclipse-temurin:17-jre -COPY --from=build /home/app/target/demo-0.0.1-SNAPSHOT.jar /usr/local/lib/demo.jar -EXPOSE 8080 -ENTRYPOINT ["java","-jar","/usr/local/lib/demo.jar"] diff --git a/java-spring-boot-demo/pom.xml b/java-spring-boot-demo/pom.xml deleted file mode 100644 index 76e0f0e..0000000 --- a/java-spring-boot-demo/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.1.0 - - - com.example - demo - 0.0.1-SNAPSHOT - demo - Demo project for Spring Boot - - 17 - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/java-spring-boot-demo/src/main/java/com/example/demo/DemoApplication.java b/java-spring-boot-demo/src/main/java/com/example/demo/DemoApplication.java deleted file mode 100644 index 094d95b..0000000 --- a/java-spring-boot-demo/src/main/java/com/example/demo/DemoApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.demo; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DemoApplication { - - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } - -} diff --git a/java-spring-boot-demo/src/main/java/com/example/demo/DemoController.java b/java-spring-boot-demo/src/main/java/com/example/demo/DemoController.java deleted file mode 100644 index 61a5075..0000000 --- a/java-spring-boot-demo/src/main/java/com/example/demo/DemoController.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.demo; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class DemoController { - - @RequestMapping("/") - public Object root() { - return null; - } - -} diff --git a/java-spring-boot-demo/src/main/resources/application.properties b/java-spring-boot-demo/src/main/resources/application.properties deleted file mode 100644 index e69de29..0000000 diff --git a/java-spring-boot-demo/src/test/java/com/example/demo/DemoApplicationTests.java b/java-spring-boot-demo/src/test/java/com/example/demo/DemoApplicationTests.java deleted file mode 100644 index eaa9969..0000000 --- a/java-spring-boot-demo/src/test/java/com/example/demo/DemoApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.example.demo; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DemoApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 8437e25..a10dd5c 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -8,15 +8,15 @@ - nebulous-activemq-container-images description: Build the container images. files: &image_files - - ^java-spring-boot-demo/ + - ^docker/ vars: &image_vars promote_container_image_job: nebulous-activemq-upload-container-images container_images: - - context: java-spring-boot-demo + - context: docker registry: quay.io - repository: quay.io/nebulous/activemq-java-spring-boot-demo + repository: quay.io/nebulous/activemq-broker namespace: nebulous - repo_shortname: activemq-java-spring-boot-demo + repo_shortname: activemq-broker repo_description: "" - job: @@ -44,7 +44,7 @@ description: Run Hadolint on Dockerfile(s). vars: dockerfiles: - - java-spring-boot-demo/Dockerfile + - docker/Dockerfile - job: name: nebulous-activemq-helm-lint diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index d1ad1ef..9349d2f 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -5,6 +5,8 @@ - nebulous-activemq-helm-lint - nebulous-activemq-build-container-images - nebulous-activemq-hadolint + # TODO: temporary, remove + - nebulous-activemq-apply-helm-charts - nebulous-platform-apply-helm-charts - nox-linters gate: