From 5c1169c88aa36a2395a0d4e5f6d69e26c1a2ad58 Mon Sep 17 00:00:00 2001 From: jmarchel Date: Mon, 4 Dec 2023 23:23:16 +0100 Subject: [PATCH] Add charts, dockerfile and zuul jobs of influxdb Change-Id: I281b5e4f7a59e8fade59a9f63cb4f7449768cfb5 --- .../templates/deployment.yaml | 32 +++++++++++--- charts/nebulous-influxdb/templates/pvc.yaml | 10 +++++ charts/nebulous-influxdb/values.yaml | 37 +++++++++------- influxdb/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 ++--- 12 files changed, 67 insertions(+), 154 deletions(-) create mode 100644 charts/nebulous-influxdb/templates/pvc.yaml create mode 100644 influxdb/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-influxdb/templates/deployment.yaml b/charts/nebulous-influxdb/templates/deployment.yaml index 4f4b03c..a89af03 100644 --- a/charts/nebulous-influxdb/templates/deployment.yaml +++ b/charts/nebulous-influxdb/templates/deployment.yaml @@ -35,18 +35,40 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http - containerPort: 8080 + containerPort: 8086 protocol: TCP + env: + - name: INFLUXDB_HTTP_AUTH_ENABLED + value: "{{ .Values.config.httpAuthEnabled }}" livenessProbe: httpGet: - path: / - port: http + path: /health + port: 8086 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 readinessProbe: httpGet: - path: / - port: http + path: /health + port: 8086 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 3 resources: {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: influxdb-storage + mountPath: /var/lib/influxdb + volumes: + - name: influxdb-config + configMap: + name: influxdb-config + - name: influxdb-storage + persistentVolumeClaim: + claimName: influxdb-storage {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/nebulous-influxdb/templates/pvc.yaml b/charts/nebulous-influxdb/templates/pvc.yaml new file mode 100644 index 0000000..03d21fc --- /dev/null +++ b/charts/nebulous-influxdb/templates/pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: influxdb-storage +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/charts/nebulous-influxdb/values.yaml b/charts/nebulous-influxdb/values.yaml index 0002e11..3512256 100644 --- a/charts/nebulous-influxdb/values.yaml +++ b/charts/nebulous-influxdb/values.yaml @@ -1,11 +1,11 @@ # Default values for nebulous-influxdb. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. +# Number of replicas replicaCount: 1 +# Image configurations image: - repository: "quay.io/nebulous/influxdb-java-spring-boot-demo" + repository: "quay.io/nebulous/influxdb" pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" @@ -14,6 +14,12 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +# InfluxDB specific configurations +config: + httpAuthEnabled: "true" # Set true or false + adminUser: "admin" + +# Service Account configurations serviceAccount: # Specifies whether a service account should be created create: true @@ -23,6 +29,7 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" +# Pod configurations podAnnotations: {} podSecurityContext: {} @@ -36,10 +43,12 @@ securityContext: {} # runAsNonRoot: true # runAsUser: 1000 +# Service settings service: type: ClusterIP port: 80 +# Ingress configurations ingress: enabled: false className: "" @@ -56,18 +65,17 @@ ingress: # hosts: # - chart-example.local -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +# Resource allocation for pods +resources: + # limits and requests for CPU and memory + limits: + cpu: "500m" + memory: "1Gi" + requests: + cpu: "250m" + memory: "512Mi" +# Autoscaling configurations autoscaling: enabled: false minReplicas: 1 @@ -75,6 +83,7 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +# Node selector, tolerations, and affinity settings nodeSelector: {} tolerations: [] diff --git a/influxdb/Dockerfile b/influxdb/Dockerfile new file mode 100644 index 0000000..a8e6359 --- /dev/null +++ b/influxdb/Dockerfile @@ -0,0 +1,2 @@ +# Use the official InfluxDB image with version 2.1.1 +FROM docker.io/influxdb:2.1.1 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 95d3d99..3298b2c 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -8,15 +8,15 @@ - nebulous-influxdb-container-images description: Build the container images. files: &image_files - - ^java-spring-boot-demo/ + - ^influxdb/ vars: &image_vars promote_container_image_job: nebulous-influxdb-upload-container-images container_images: - - context: java-spring-boot-demo + - context: influxdb registry: quay.io - repository: quay.io/nebulous/influxdb-java-spring-boot-demo + repository: quay.io/nebulous/influxdb namespace: nebulous - repo_shortname: influxdb-java-spring-boot-demo + repo_shortname: influxdb repo_description: "" - job: @@ -44,7 +44,7 @@ description: Run Hadolint on Dockerfile(s). vars: dockerfiles: - - java-spring-boot-demo/Dockerfile + - influxdb/Dockerfile - job: name: nebulous-influxdb-helm-lint