-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding helm charts #237
Adding helm charts #237
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm only going to make this comment here but it does repeat inside all the projects. The |
||
name: event-statistics-java11-latest-knative | ||
version: 1.0.0 | ||
apiVersion: v2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Quarkus Helm Notes | ||
|
||
To access the Helm annotations or properties you just need to have the following dependency in your | ||
class path: | ||
|
||
<dependency> | ||
<groupId>io.quarkiverse.helm</groupId> | ||
<artifactId>quarkus-helm</artifactId> | ||
<version>{quarkus-helm-version}</version> | ||
</dependency> | ||
|
||
Build the project using: | ||
|
||
mvn clean package | ||
|
||
You can find the generated Helm artifacts under: `target/helm/kubernetes/<chart name>/` that should look like: | ||
- Chart.yaml | ||
- values.yaml | ||
- templates/*.yml the generated resources by Quarkus Helm | ||
|
||
**Note**: The `<chart name>` is set from either the property `quarkus.helm.name` or the `@HelmChart` annotation or the Quarkus application. | ||
|
||
# Requirements | ||
|
||
- Have installed [the Helm command line](https://helm.sh/docs/intro/install/) | ||
- Have connected/logged to a kubernetes cluster | ||
- Configure your Quarkus application to use any of the Quarkus Kubernetes extensions like Quarkus Kubernetes, Quarkus OpenShift or Quarkus Knative. | ||
- Configure your Quarkus application to use any of [the Quarkus Container Image extensions](https://quarkus.io/guides/container-image) - This example uses `container-image-docker`. | ||
|
||
# How can it be used? | ||
|
||
You can run the following Maven command in order to generate the Helm artifacts and build/push the image into a container registry: | ||
|
||
```shell | ||
mvn clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=<your container registry> -Dquarkus.container-image.group=<your container registry namespace> | ||
``` | ||
|
||
This command will push the image to a container registry and will become available when a pod or container is created. | ||
|
||
Finally, let's use Helm to deploy it into the cluster: | ||
|
||
```shell | ||
helm install helm-example ./target/helm/kubernetes/<chart name> | ||
``` | ||
|
||
The above command will deploy a chart using the default values (as defined within the `values.yaml` file). We can override the default values to use your `values.dev.yaml` file by executing the following command: | ||
|
||
```shell | ||
helm install helm-example ./target/helm/kubernetes/<chart name> --values ./target/helm/<chart name>/kubernetes/values.dev.yaml | ||
``` | ||
|
||
How can I update my deployment? | ||
|
||
- Via the `upgrade` option of Helm command line: | ||
|
||
After making changes to your project and regenerating the Helm resources and the application container image, then you need to upgrade your deployment: | ||
|
||
```shell | ||
helm upgrade helm-example ./target/helm/kubernetes/<chart name> | ||
``` | ||
|
||
- Via the `set` option of Helm command line: | ||
|
||
```shell | ||
helm upgrade helm-example ./target/helm/kubernetes/<chart name> --set <app name>.replicas=1 | ||
``` | ||
|
||
How can we delete my deployment? | ||
|
||
```shell | ||
helm uninstall helm-example | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
app: event-statistics | ||
application: event-stats | ||
system: quarkus-super-heroes | ||
name: event-statistics-config | ||
data: | ||
kafka.bootstrap.servers: PLAINTEXT://fights-kafka:9092 | ||
mp.messaging.connector.smallrye-kafka.apicurio.registry.url: http://apicurio:8080/apis/registry/v2 | ||
quarkus.opentelemetry.tracer.exporter.otlp.endpoint: http://otel-collector:4317 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: fights-kafka | ||
application: fights-service | ||
app.kubernetes.io/part-of: fights-service | ||
app.openshift.io/runtime: amq | ||
system: quarkus-super-heroes | ||
name: fights-kafka | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: fights-kafka | ||
template: | ||
metadata: | ||
labels: | ||
application: fights-service | ||
name: fights-kafka | ||
system: quarkus-super-heroes | ||
spec: | ||
containers: | ||
- command: | ||
- sh | ||
- -c | ||
- "export CLUSTER_ID=$(bin/kafka-storage.sh random-uuid) && bin/kafka-storage.sh format -t ${CLUSTER_ID} -c config/kraft/server.properties && bin/kafka-server-start.sh config/kraft/server.properties --override advertised.listeners=${KAFKA_ADVERTISED_LISTENERS}" | ||
env: | ||
- name: LOG_DIR | ||
value: /tmp/logs | ||
- name: KAFKA_ADVERTISED_LISTENERS | ||
value: PLAINTEXT://fights-kafka:9092 | ||
image: quay.io/strimzi/kafka:0.28.0-kafka-3.1.0 | ||
name: fights-kafka | ||
ports: | ||
- containerPort: 9092 | ||
resources: | ||
limits: | ||
memory: 768Mi | ||
requests: | ||
memory: 128Mi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8080" | ||
prometheus.io/scheme: http | ||
labels: | ||
app: apicurio | ||
application: fights-service | ||
system: quarkus-super-heroes | ||
app.kubernetes.io/part-of: fights-service | ||
app.kubernetes.io/name: apicurio | ||
app.kubernetes.io/version: 2.2.3.Final | ||
app.openshift.io/runtime: apicurio | ||
name: apicurio | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: apicurio | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8080" | ||
prometheus.io/scheme: http | ||
labels: | ||
application: fights-service | ||
name: apicurio | ||
system: quarkus-super-heroes | ||
spec: | ||
containers: | ||
- env: | ||
- name: REGISTRY_AUTH_ANONYMOUS_READ_ACCESS_ENABLED | ||
value: "true" | ||
image: quay.io/apicurio/apicurio-registry-mem:2.2.3.Final | ||
livenessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /health/live | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 0 | ||
periodSeconds: 30 | ||
successThreshold: 1 | ||
timeoutSeconds: 10 | ||
name: apicurio | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /health/ready | ||
port: 8080 | ||
scheme: HTTP | ||
initialDelaySeconds: 0 | ||
periodSeconds: 30 | ||
successThreshold: 1 | ||
timeoutSeconds: 10 | ||
resources: | ||
limits: | ||
memory: 768Mi | ||
requests: | ||
memory: 128Mi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
labels: | ||
app: event-statistics | ||
application: event-stats | ||
system: quarkus-super-heroes | ||
name: event-statistics-config-creds | ||
type: Opaque |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
--- | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
app.openshift.io/connects-to: "fights-kafka,apicurio,otel-collector" | ||
app.openshift.io/vcs-ref: main | ||
app.openshift.io/vcs-url: https://github.com/quarkusio/quarkus-super-heroes | ||
app.quarkus.io/commit-id: e6b908a2aad15d5f15e203fc2a7e40dd28e85bab | ||
app.quarkus.io/build-timestamp: 2023-02-20 - 20:52:21 +0000 | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /q/metrics | ||
prometheus.io/port: "8085" | ||
prometheus.io/scheme: http | ||
labels: | ||
app: event-statistics | ||
app.openshift.io/runtime: quarkus | ||
application: event-stats | ||
system: quarkus-super-heroes | ||
app.kubernetes.io/name: event-statistics | ||
app.kubernetes.io/part-of: event-stats | ||
app.kubernetes.io/version: java11-latest | ||
name: event-statistics | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- envFrom: | ||
- configMapRef: | ||
name: event-statistics-config | ||
- secretRef: | ||
name: event-statistics-config-creds | ||
image: {{ .Values.app.image }} | ||
imagePullPolicy: Always | ||
livenessProbe: | ||
failureThreshold: {{ .Values.app.livenessProbe.failureThreshold }} | ||
httpGet: | ||
path: {{ .Values.app.livenessProbe.httpGet.path }} | ||
port: {{ .Values.app.livenessProbe.httpGet.port }} | ||
scheme: {{ .Values.app.livenessProbe.httpGet.scheme }} | ||
initialDelaySeconds: {{ .Values.app.livenessProbe.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.app.livenessProbe.periodSeconds }} | ||
successThreshold: {{ .Values.app.livenessProbe.successThreshold }} | ||
timeoutSeconds: {{ .Values.app.livenessProbe.timeoutSeconds }} | ||
name: event-statistics | ||
ports: | ||
- containerPort: 8085 | ||
name: http1 | ||
protocol: TCP | ||
readinessProbe: | ||
failureThreshold: {{ .Values.app.readinessProbe.failureThreshold }} | ||
httpGet: | ||
path: {{ .Values.app.readinessProbe.httpGet.path }} | ||
port: {{ .Values.app.readinessProbe.httpGet.port }} | ||
scheme: {{ .Values.app.readinessProbe.httpGet.scheme }} | ||
initialDelaySeconds: {{ .Values.app.readinessProbe.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.app.readinessProbe.periodSeconds }} | ||
successThreshold: {{ .Values.app.readinessProbe.successThreshold }} | ||
timeoutSeconds: {{ .Values.app.readinessProbe.timeoutSeconds }} | ||
resources: | ||
limits: | ||
memory: 768Mi | ||
requests: | ||
memory: 256Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
name: fights-kafka | ||
application: fights-service | ||
system: quarkus-super-heroes | ||
name: fights-kafka | ||
spec: | ||
ports: | ||
- port: 9092 | ||
protocol: TCP | ||
targetPort: 9092 | ||
selector: | ||
name: fights-kafka | ||
type: ClusterIP | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/path: /metrics | ||
prometheus.io/port: "8080" | ||
prometheus.io/scheme: http | ||
labels: | ||
name: apicurio | ||
application: fights-service | ||
system: quarkus-super-heroes | ||
name: apicurio | ||
spec: | ||
ports: | ||
- port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
name: apicurio | ||
type: ClusterIP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
app: | ||
serviceType: ClusterIP | ||
livenessProbe: | ||
failureThreshold: 3 | ||
periodSeconds: 10 | ||
timeoutSeconds: 10 | ||
successThreshold: 1 | ||
initialDelaySeconds: 5 | ||
httpGet: | ||
path: /q/health/live | ||
scheme: HTTP | ||
port: ":START:{{ .Values.app.livenessProbe.httpGet.port }}:END:" | ||
image: event-statistics:java11-latest | ||
readinessProbe: | ||
failureThreshold: 3 | ||
timeoutSeconds: 10 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
initialDelaySeconds: 5 | ||
httpGet: | ||
path: /q/health/ready | ||
scheme: HTTP | ||
port: ":START:{{ .Values.app.readinessProbe.httpGet.port }}:END:" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
name: event-statistics-java11-latest-kubernetes | ||
version: 1.0.0 | ||
apiVersion: v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further down in the
Commit generated resources
task you probably need to add"**/deploy/helm/*.yml", "deploy/helm/*.yml","**/deploy/helm/*.yaml", "deploy/helm/*.yaml"
to theadd
parameter so that all the generated resources get added & committed back to the repo.