From 89f47f89f04b6848f7ac5a79ed096094191513ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Sat, 13 Jul 2024 17:47:28 +0200 Subject: [PATCH] Release all NebulOuS charts (#11) Sourced from the HEADs of NebulOuS repos. [1] [1] https://github.com/eu-nebulous --- charts/nebulous-activemq/.helmignore | 23 ++ charts/nebulous-activemq/Chart.yaml | 24 ++ charts/nebulous-activemq/templates/NOTES.txt | 22 ++ .../nebulous-activemq/templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 75 +++++ charts/nebulous-activemq/templates/hpa.yaml | 28 ++ .../nebulous-activemq/templates/ingress.yaml | 61 ++++ .../nebulous-activemq/templates/service.yaml | 23 ++ .../templates/serviceaccount.yaml | 12 + charts/nebulous-activemq/values.yaml | 92 ++++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 90 ++++++ .../templates/config-map-postgresql.yaml | 23 ++ .../templates/deployment-postgres.yaml | 73 +++++ .../templates/deployment.yaml | 72 +++++ .../templates/frontend.yaml | 56 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress-frontend.yaml | 61 ++++ .../templates/ingress.yaml | 61 ++++ .../templates/pvc-postgresql.yaml | 10 + .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 133 +++++++++ charts/nebulous-exn-middleware/.helmignore | 23 ++ charts/nebulous-exn-middleware/Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 62 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + charts/nebulous-exn-middleware/values.yaml | 82 +++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 63 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 82 +++++ charts/nebulous-gui-controller/.helmignore | 23 ++ charts/nebulous-gui-controller/Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 76 +++++ .../templates/add-user-to-csm.yaml | 29 ++ .../templates/deployment.yaml | 59 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/mongodb.yaml | 79 +++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + charts/nebulous-gui-controller/values.yaml | 103 +++++++ charts/nebulous-gui/.helmignore | 23 ++ charts/nebulous-gui/Chart.yaml | 24 ++ charts/nebulous-gui/templates/NOTES.txt | 22 ++ charts/nebulous-gui/templates/_helpers.tpl | 62 ++++ charts/nebulous-gui/templates/deployment.yaml | 86 ++++++ charts/nebulous-gui/templates/hpa.yaml | 28 ++ charts/nebulous-gui/templates/ingress.yaml | 61 ++++ charts/nebulous-gui/templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + charts/nebulous-gui/values.yaml | 91 ++++++ charts/nebulous-influxdb/.helmignore | 23 ++ charts/nebulous-influxdb/Chart.yaml | 24 ++ charts/nebulous-influxdb/templates/NOTES.txt | 22 ++ .../nebulous-influxdb/templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 103 +++++++ charts/nebulous-influxdb/templates/hpa.yaml | 28 ++ .../templates/influxdb-secrets.yaml | 10 + .../nebulous-influxdb/templates/ingress.yaml | 61 ++++ charts/nebulous-influxdb/templates/pvc.yaml | 10 + .../nebulous-influxdb/templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + charts/nebulous-influxdb/values.yaml | 101 +++++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 63 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 82 +++++ charts/nebulous-monitoring/.helmignore | 23 ++ charts/nebulous-monitoring/Chart.yaml | 33 ++ .../nebulous-monitoring/templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 96 ++++++ charts/nebulous-monitoring/templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service-public.yaml | 29 ++ .../templates/service.yaml | 28 ++ .../templates/serviceaccount.yaml | 12 + charts/nebulous-monitoring/values.yaml | 281 ++++++++++++++++++ .../nebulous-optimiser-controller/.helmignore | 23 ++ .../nebulous-optimiser-controller/Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 83 ++++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../optimiser-controller-secrets.yaml | 9 + .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../nebulous-optimiser-controller/values.yaml | 99 ++++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 53 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 82 +++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 76 +++++ .../templates/deployment-postgres.yaml | 64 ++++ .../templates/deployment.yaml | 72 +++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 19 ++ .../templates/serviceaccount.yaml | 12 + .../values.yaml | 101 +++++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 66 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 91 ++++++ charts/nebulous-resource-manager/.helmignore | 23 ++ charts/nebulous-resource-manager/Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 82 +++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + charts/nebulous-resource-manager/values.yaml | 98 ++++++ .../.helmignore | 23 ++ .../Chart.yaml | 24 ++ .../templates/NOTES.txt | 22 ++ .../templates/_helpers.tpl | 62 ++++ .../templates/deployment.yaml | 63 ++++ .../templates/hpa.yaml | 28 ++ .../templates/ingress.yaml | 61 ++++ .../templates/service.yaml | 15 + .../templates/serviceaccount.yaml | 12 + .../values.yaml | 82 +++++ 162 files changed, 6946 insertions(+) create mode 100644 charts/nebulous-activemq/.helmignore create mode 100644 charts/nebulous-activemq/Chart.yaml create mode 100644 charts/nebulous-activemq/templates/NOTES.txt create mode 100644 charts/nebulous-activemq/templates/_helpers.tpl create mode 100644 charts/nebulous-activemq/templates/deployment.yaml create mode 100644 charts/nebulous-activemq/templates/hpa.yaml create mode 100644 charts/nebulous-activemq/templates/ingress.yaml create mode 100644 charts/nebulous-activemq/templates/service.yaml create mode 100644 charts/nebulous-activemq/templates/serviceaccount.yaml create mode 100644 charts/nebulous-activemq/values.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/.helmignore create mode 100644 charts/nebulous-cloud-fog-service-broker/Chart.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/NOTES.txt create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/_helpers.tpl create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/config-map-postgresql.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/deployment-postgres.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/deployment.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/frontend.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/hpa.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/ingress-frontend.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/ingress.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/pvc-postgresql.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/service.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/templates/serviceaccount.yaml create mode 100644 charts/nebulous-cloud-fog-service-broker/values.yaml create mode 100644 charts/nebulous-exn-middleware/.helmignore create mode 100644 charts/nebulous-exn-middleware/Chart.yaml create mode 100644 charts/nebulous-exn-middleware/templates/NOTES.txt create mode 100644 charts/nebulous-exn-middleware/templates/_helpers.tpl create mode 100644 charts/nebulous-exn-middleware/templates/deployment.yaml create mode 100644 charts/nebulous-exn-middleware/templates/hpa.yaml create mode 100644 charts/nebulous-exn-middleware/templates/ingress.yaml create mode 100644 charts/nebulous-exn-middleware/templates/service.yaml create mode 100644 charts/nebulous-exn-middleware/templates/serviceaccount.yaml create mode 100644 charts/nebulous-exn-middleware/values.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/.helmignore create mode 100755 charts/nebulous-exponential-smoothing-predictor/Chart.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/NOTES.txt create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/_helpers.tpl create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/deployment.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/hpa.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/ingress.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/service.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/templates/serviceaccount.yaml create mode 100755 charts/nebulous-exponential-smoothing-predictor/values.yaml create mode 100644 charts/nebulous-gui-controller/.helmignore create mode 100644 charts/nebulous-gui-controller/Chart.yaml create mode 100644 charts/nebulous-gui-controller/templates/NOTES.txt create mode 100644 charts/nebulous-gui-controller/templates/_helpers.tpl create mode 100644 charts/nebulous-gui-controller/templates/add-user-to-csm.yaml create mode 100644 charts/nebulous-gui-controller/templates/deployment.yaml create mode 100644 charts/nebulous-gui-controller/templates/hpa.yaml create mode 100644 charts/nebulous-gui-controller/templates/ingress.yaml create mode 100644 charts/nebulous-gui-controller/templates/mongodb.yaml create mode 100644 charts/nebulous-gui-controller/templates/service.yaml create mode 100644 charts/nebulous-gui-controller/templates/serviceaccount.yaml create mode 100644 charts/nebulous-gui-controller/values.yaml create mode 100644 charts/nebulous-gui/.helmignore create mode 100644 charts/nebulous-gui/Chart.yaml create mode 100644 charts/nebulous-gui/templates/NOTES.txt create mode 100644 charts/nebulous-gui/templates/_helpers.tpl create mode 100644 charts/nebulous-gui/templates/deployment.yaml create mode 100644 charts/nebulous-gui/templates/hpa.yaml create mode 100644 charts/nebulous-gui/templates/ingress.yaml create mode 100644 charts/nebulous-gui/templates/service.yaml create mode 100644 charts/nebulous-gui/templates/serviceaccount.yaml create mode 100644 charts/nebulous-gui/values.yaml create mode 100644 charts/nebulous-influxdb/.helmignore create mode 100644 charts/nebulous-influxdb/Chart.yaml create mode 100644 charts/nebulous-influxdb/templates/NOTES.txt create mode 100644 charts/nebulous-influxdb/templates/_helpers.tpl create mode 100644 charts/nebulous-influxdb/templates/deployment.yaml create mode 100644 charts/nebulous-influxdb/templates/hpa.yaml create mode 100644 charts/nebulous-influxdb/templates/influxdb-secrets.yaml create mode 100644 charts/nebulous-influxdb/templates/ingress.yaml create mode 100644 charts/nebulous-influxdb/templates/pvc.yaml create mode 100644 charts/nebulous-influxdb/templates/service.yaml create mode 100644 charts/nebulous-influxdb/templates/serviceaccount.yaml create mode 100644 charts/nebulous-influxdb/values.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/.helmignore create mode 100644 charts/nebulous-monitoring-data-persistor/Chart.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/templates/NOTES.txt create mode 100644 charts/nebulous-monitoring-data-persistor/templates/_helpers.tpl create mode 100644 charts/nebulous-monitoring-data-persistor/templates/deployment.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/templates/hpa.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/templates/ingress.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/templates/service.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/templates/serviceaccount.yaml create mode 100644 charts/nebulous-monitoring-data-persistor/values.yaml create mode 100644 charts/nebulous-monitoring/.helmignore create mode 100644 charts/nebulous-monitoring/Chart.yaml create mode 100644 charts/nebulous-monitoring/templates/NOTES.txt create mode 100644 charts/nebulous-monitoring/templates/_helpers.tpl create mode 100644 charts/nebulous-monitoring/templates/deployment.yaml create mode 100644 charts/nebulous-monitoring/templates/hpa.yaml create mode 100644 charts/nebulous-monitoring/templates/ingress.yaml create mode 100644 charts/nebulous-monitoring/templates/service-public.yaml create mode 100644 charts/nebulous-monitoring/templates/service.yaml create mode 100644 charts/nebulous-monitoring/templates/serviceaccount.yaml create mode 100644 charts/nebulous-monitoring/values.yaml create mode 100644 charts/nebulous-optimiser-controller/.helmignore create mode 100644 charts/nebulous-optimiser-controller/Chart.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/NOTES.txt create mode 100644 charts/nebulous-optimiser-controller/templates/_helpers.tpl create mode 100644 charts/nebulous-optimiser-controller/templates/deployment.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/hpa.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/ingress.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/optimiser-controller-secrets.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/service.yaml create mode 100644 charts/nebulous-optimiser-controller/templates/serviceaccount.yaml create mode 100644 charts/nebulous-optimiser-controller/values.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/.helmignore create mode 100644 charts/nebulous-optimiser-utility-evaluator/Chart.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/NOTES.txt create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/_helpers.tpl create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/deployment.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/hpa.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/ingress.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/service.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/templates/serviceaccount.yaml create mode 100644 charts/nebulous-optimiser-utility-evaluator/values.yaml create mode 100644 charts/nebulous-overlay-network-manager/.helmignore create mode 100644 charts/nebulous-overlay-network-manager/Chart.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/NOTES.txt create mode 100644 charts/nebulous-overlay-network-manager/templates/_helpers.tpl create mode 100644 charts/nebulous-overlay-network-manager/templates/deployment-postgres.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/deployment.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/hpa.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/ingress.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/service.yaml create mode 100644 charts/nebulous-overlay-network-manager/templates/serviceaccount.yaml create mode 100644 charts/nebulous-overlay-network-manager/values.yaml create mode 100644 charts/nebulous-prediction-orchestrator/.helmignore create mode 100644 charts/nebulous-prediction-orchestrator/Chart.yaml create mode 100644 charts/nebulous-prediction-orchestrator/templates/NOTES.txt create mode 100644 charts/nebulous-prediction-orchestrator/templates/_helpers.tpl create mode 100644 charts/nebulous-prediction-orchestrator/templates/deployment.yaml create mode 100644 charts/nebulous-prediction-orchestrator/templates/hpa.yaml create mode 100644 charts/nebulous-prediction-orchestrator/templates/ingress.yaml create mode 100644 charts/nebulous-prediction-orchestrator/templates/service.yaml create mode 100644 charts/nebulous-prediction-orchestrator/templates/serviceaccount.yaml create mode 100644 charts/nebulous-prediction-orchestrator/values.yaml create mode 100644 charts/nebulous-resource-manager/.helmignore create mode 100644 charts/nebulous-resource-manager/Chart.yaml create mode 100644 charts/nebulous-resource-manager/templates/NOTES.txt create mode 100644 charts/nebulous-resource-manager/templates/_helpers.tpl create mode 100644 charts/nebulous-resource-manager/templates/deployment.yaml create mode 100644 charts/nebulous-resource-manager/templates/hpa.yaml create mode 100644 charts/nebulous-resource-manager/templates/ingress.yaml create mode 100644 charts/nebulous-resource-manager/templates/service.yaml create mode 100644 charts/nebulous-resource-manager/templates/serviceaccount.yaml create mode 100644 charts/nebulous-resource-manager/values.yaml create mode 100644 charts/nebulous-slo-violation-detector/.helmignore create mode 100644 charts/nebulous-slo-violation-detector/Chart.yaml create mode 100644 charts/nebulous-slo-violation-detector/templates/NOTES.txt create mode 100644 charts/nebulous-slo-violation-detector/templates/_helpers.tpl create mode 100644 charts/nebulous-slo-violation-detector/templates/deployment.yaml create mode 100644 charts/nebulous-slo-violation-detector/templates/hpa.yaml create mode 100644 charts/nebulous-slo-violation-detector/templates/ingress.yaml create mode 100644 charts/nebulous-slo-violation-detector/templates/service.yaml create mode 100644 charts/nebulous-slo-violation-detector/templates/serviceaccount.yaml create mode 100644 charts/nebulous-slo-violation-detector/values.yaml diff --git a/charts/nebulous-activemq/.helmignore b/charts/nebulous-activemq/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-activemq/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-activemq/Chart.yaml b/charts/nebulous-activemq/Chart.yaml new file mode 100644 index 0000000..e39ef5c --- /dev/null +++ b/charts/nebulous-activemq/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-activemq +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-activemq/templates/NOTES.txt b/charts/nebulous-activemq/templates/NOTES.txt new file mode 100644 index 0000000..f11f5ec --- /dev/null +++ b/charts/nebulous-activemq/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-activemq.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-activemq.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-activemq.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- 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: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/_helpers.tpl b/charts/nebulous-activemq/templates/_helpers.tpl new file mode 100644 index 0000000..a6bf133 --- /dev/null +++ b/charts/nebulous-activemq/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-activemq.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-activemq.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-activemq.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-activemq.labels" -}} +helm.sh/chart: {{ include "nebulous-activemq.chart" . }} +{{ include "nebulous-activemq.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-activemq.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-activemq.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-activemq.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-activemq.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-activemq/templates/deployment.yaml b/charts/nebulous-activemq/templates/deployment.yaml new file mode 100644 index 0000000..1843168 --- /dev/null +++ b/charts/nebulous-activemq/templates/deployment.yaml @@ -0,0 +1,75 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-activemq.fullname" . }} + labels: + {{- include "nebulous-activemq.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-activemq.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-activemq.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-activemq.serviceAccountName" . }} + securityContext: + {{- 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: gui + containerPort: 8161 + protocol: TCP + - name: activemq + containerPort: 61616 + protocol: TCP + - name: amqp + containerPort: 5672 + protocol: TCP + livenessProbe: + tcpSocket: + port: activemq + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: activemq + periodSeconds: 10 + startupProbe: + tcpSocket: + port: activemq + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 6 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-activemq/templates/hpa.yaml b/charts/nebulous-activemq/templates/hpa.yaml new file mode 100644 index 0000000..0d6e823 --- /dev/null +++ b/charts/nebulous-activemq/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-activemq.fullname" . }} + labels: + {{- include "nebulous-activemq.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-activemq.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-activemq/templates/ingress.yaml b/charts/nebulous-activemq/templates/ingress.yaml new file mode 100644 index 0000000..6bd5d4f --- /dev/null +++ b/charts/nebulous-activemq/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-activemq.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-activemq.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-activemq/templates/service.yaml b/charts/nebulous-activemq/templates/service.yaml new file mode 100644 index 0000000..4a9651b --- /dev/null +++ b/charts/nebulous-activemq/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-activemq.fullname" . }} + labels: + {{- include "nebulous-activemq.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.guiPort }} + targetPort: gui + protocol: TCP + name: gui + - port: {{ .Values.service.activemqPort }} + targetPort: activemq + protocol: TCP + name: activemq + - port: {{ .Values.service.amqpPort }} + targetPort: amqp + protocol: TCP + name: amqp + selector: + {{- include "nebulous-activemq.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-activemq/templates/serviceaccount.yaml b/charts/nebulous-activemq/templates/serviceaccount.yaml new file mode 100644 index 0000000..835ad95 --- /dev/null +++ b/charts/nebulous-activemq/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-activemq.serviceAccountName" . }} + labels: + {{- include "nebulous-activemq.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-activemq/values.yaml b/charts/nebulous-activemq/values.yaml new file mode 100644 index 0000000..75cb0d8 --- /dev/null +++ b/charts/nebulous-activemq/values.yaml @@ -0,0 +1,92 @@ +# Default values for nebulous-activemq. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/activemq-broker" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + guiPort: 8161 + activemqPort: 61616 + amqpPort: 5672 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +brokerEnv: +- name: ACTIVEMQ_NAME + value: activemq +- name: ACTIVEMQ_PASSWORD + value: nebulous +- name: ACTIVEMQ_USERNAME + value: admin diff --git a/charts/nebulous-cloud-fog-service-broker/.helmignore b/charts/nebulous-cloud-fog-service-broker/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-cloud-fog-service-broker/Chart.yaml b/charts/nebulous-cloud-fog-service-broker/Chart.yaml new file mode 100644 index 0000000..f12b48e --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-cloud-fog-service-broker +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-cloud-fog-service-broker/templates/NOTES.txt b/charts/nebulous-cloud-fog-service-broker/templates/NOTES.txt new file mode 100644 index 0000000..9c7220c --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-cloud-fog-service-broker.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-cloud-fog-service-broker.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-cloud-fog-service-broker.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-cloud-fog-service-broker.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 +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/_helpers.tpl b/charts/nebulous-cloud-fog-service-broker/templates/_helpers.tpl new file mode 100644 index 0000000..73ae957 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/_helpers.tpl @@ -0,0 +1,90 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-cloud-fog-service-broker.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-cloud-fog-service-broker.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-cloud-fog-service-broker.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-cloud-fog-service-broker.labels" -}} +helm.sh/chart: {{ include "nebulous-cloud-fog-service-broker.chart" . }} +{{ include "nebulous-cloud-fog-service-broker.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "nebulous-cloud-fog-service-broker.frontend.labels" -}} +helm.sh/chart: {{ include "nebulous-cloud-fog-service-broker.chart" . }} +{{ include "nebulous-cloud-fog-service-broker.frontend.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "nebulous-cloud-fog-service-broker.postgresql.labels" -}} +helm.sh/chart: {{ include "nebulous-cloud-fog-service-broker.chart" . }} +{{ include "nebulous-cloud-fog-service-broker.postgresql.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-cloud-fog-service-broker.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-cloud-fog-service-broker.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "nebulous-cloud-fog-service-broker.frontend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-cloud-fog-service-broker.name" . }}-frontend +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "nebulous-cloud-fog-service-broker.postgresql.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-cloud-fog-service-broker.name" . }}-postgresql +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-cloud-fog-service-broker.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-cloud-fog-service-broker.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/config-map-postgresql.yaml b/charts/nebulous-cloud-fog-service-broker/templates/config-map-postgresql.yaml new file mode 100644 index 0000000..def7fe3 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/config-map-postgresql.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: db-init-script +data: + db_script.sql: | + CREATE TABLE IF NOT EXISTS users ( + id SERIAL PRIMARY KEY, + uuid VARCHAR(255) NOT NULL, + username VARCHAR(255) NOT NULL, + password VARCHAR(255) NOT NULL + ); + + CREATE TABLE IF NOT EXISTS apps ( + id SERIAL PRIMARY KEY, + user_uuid VARCHAR(255) NOT NULL, + title VARCHAR(255) NOT NULL, + description TEXT, + app_id VARCHAR(255) NOT NULL + ); + + INSERT INTO users (username, password, uuid) VALUES ('greg', '12345', 'e3ff4006-be5f-4e00-bbe1-e49a88b2541a'); + INSERT INTO apps (user_uuid, title, description, app_id) VALUES ('e3ff4006-be5f-4e00-bbe1-e49a88b2541a', 'Demo App', 'Demo App description', '2f7cc63df4b1da7532756f44345758da'); diff --git a/charts/nebulous-cloud-fog-service-broker/templates/deployment-postgres.yaml b/charts/nebulous-cloud-fog-service-broker/templates/deployment-postgres.yaml new file mode 100644 index 0000000..b8e1f06 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/deployment-postgres.yaml @@ -0,0 +1,73 @@ +{{ if .Values.postgresql.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }}-postgresql + labels: + {{- include "nebulous-cloud-fog-service-broker.postgresql.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "nebulous-cloud-fog-service-broker.postgresql.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "nebulous-cloud-fog-service-broker.postgresql.selectorLabels" . | nindent 8 }} + spec: + volumes: + - name: postgres-data + persistentVolumeClaim: + claimName: {{ .Values.postgresql.volumeMounts.data.claimName }} + - name: init-script + configMap: + name: {{ .Values.postgresql.volumeMounts.initScript.configMapName }} + containers: + - name: postgresql + image: "{{ .Values.postgresql.image }}" + ports: + - name: postgresql + containerPort: {{ .Values.postgresql.port }} + protocol: TCP + env: + - name: POSTGRES_USER + value: "{{ .Values.postgresql.user }}" + - name: POSTGRES_PASSWORD + value: "{{ .Values.postgresql.password }}" + - name: POSTGRES_DB + value: "{{ .Values.postgresql.dbName }}" + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data/ + - name: init-script + mountPath: /docker-entrypoint-initdb.d + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + + +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }}-postgresql + labels: + {{- include "nebulous-cloud-fog-service-broker.postgresql.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.postgresql.port }} + targetPort: postgresql + protocol: TCP + name: postgresql + selector: + {{- include "nebulous-cloud-fog-service-broker.postgresql.selectorLabels" . | nindent 4 }} +{{ end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/deployment.yaml b/charts/nebulous-cloud-fog-service-broker/templates/deployment.yaml new file mode 100644 index 0000000..bd1324d --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }} + labels: + {{- include "nebulous-cloud-fog-service-broker.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-cloud-fog-service-broker.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-cloud-fog-service-broker.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-cloud-fog-service-broker.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 8001 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: NEBULOUS_BROKER_URL + value: "{{ .Values.customEnv.NEBULOUS_BROKER_URL }}" + - name: NEBULOUS_BROKER_PORT + value: "{{ .Values.customEnv.NEBULOUS_BROKER_PORT }}" + - name: NEBULOUS_BROKER_USERNAME + value: "{{ .Values.customEnv.NEBULOUS_BROKER_USERNAME }}" + - name: NEBULOUS_BROKER_PASSWORD + value: "{{ .Values.customEnv.NEBULOUS_BROKER_PASSWORD }}" + - name: POSTGRES_DB_HOST + value: "{{ .Values.customEnv.POSTGRES_DB_HOST }}" + - name: POSTGRES_DB_NAME + value: "{{ .Values.customEnv.POSTGRES_DB_NAME }}" + - name: POSTGRES_DB_PORT + value: "{{ .Values.customEnv.POSTGRES_DB_PORT }}" + - name: POSTGRES_DB_USER + value: "{{ .Values.customEnv.POSTGRES_DB_USER }}" + - name: POSTGRES_DB_PASS + value: "{{ .Values.customEnv.POSTGRES_DB_PASS }}" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/charts/nebulous-cloud-fog-service-broker/templates/frontend.yaml b/charts/nebulous-cloud-fog-service-broker/templates/frontend.yaml new file mode 100644 index 0000000..9d6184a --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/frontend.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }}-frontend + labels: + {{- include "nebulous-cloud-fog-service-broker.frontend.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "nebulous-cloud-fog-service-broker.frontend.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "nebulous-cloud-fog-service-broker.frontend.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: nebulous-cloud-fog-service-broker-frontend + image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 80 + protocol: TCP + env: + - name: VUE_APP_BACKEND_HOST + value: {{ .Values.env.backendHost }} + - name: VITE_BACKEND_URL + value: {{ .Values.env.backendHost }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }}-frontend + labels: + {{- include "nebulous-cloud-fog-service-broker.frontend.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.service.guiPort }} + targetPort: http + protocol: TCP + name: gui + selector: + {{- include "nebulous-cloud-fog-service-broker.frontend.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/nebulous-cloud-fog-service-broker/templates/hpa.yaml b/charts/nebulous-cloud-fog-service-broker/templates/hpa.yaml new file mode 100644 index 0000000..b59c383 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }} + labels: + {{- include "nebulous-cloud-fog-service-broker.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/ingress-frontend.yaml b/charts/nebulous-cloud-fog-service-broker/templates/ingress-frontend.yaml new file mode 100644 index 0000000..2d0d012 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/ingress-frontend.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-cloud-fog-service-broker.fullname" . -}} +{{- $svcPort := .Values.service.guiPort -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }}-frontend + labels: + {{- include "nebulous-cloud-fog-service-broker.frontend.labels" . | nindent 4 }} + {{- with .Values.frontend.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.frontend.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.frontend.ingress.className }} + {{- end }} + {{- if .Values.frontend.ingress.tls }} + tls: + {{- range .Values.frontend.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.frontend.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }}-frontend + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }}-frontend + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/ingress.yaml b/charts/nebulous-cloud-fog-service-broker/templates/ingress.yaml new file mode 100644 index 0000000..e3b14a5 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-cloud-fog-service-broker.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-cloud-fog-service-broker.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/pvc-postgresql.yaml b/charts/nebulous-cloud-fog-service-broker/templates/pvc-postgresql.yaml new file mode 100644 index 0000000..3895aad --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/pvc-postgresql.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgresql-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/charts/nebulous-cloud-fog-service-broker/templates/service.yaml b/charts/nebulous-cloud-fog-service-broker/templates/service.yaml new file mode 100644 index 0000000..3cb5209 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.fullname" . }} + labels: + {{- include "nebulous-cloud-fog-service-broker.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-cloud-fog-service-broker.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-cloud-fog-service-broker/templates/serviceaccount.yaml b/charts/nebulous-cloud-fog-service-broker/templates/serviceaccount.yaml new file mode 100644 index 0000000..eb8fc0f --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-cloud-fog-service-broker.serviceAccountName" . }} + labels: + {{- include "nebulous-cloud-fog-service-broker.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-cloud-fog-service-broker/values.yaml b/charts/nebulous-cloud-fog-service-broker/values.yaml new file mode 100644 index 0000000..3b0e304 --- /dev/null +++ b/charts/nebulous-cloud-fog-service-broker/values.yaml @@ -0,0 +1,133 @@ +# Default values for nebulous-cloud-fog-service-broker. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/cloud-fog-service-broker-backend" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} +# fsGroup: 2000 + +securityContext: {} +# capabilities: +# drop: +# - ALL +# readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + +service: + type: ClusterIP + port: 8001 + guiPort: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +customEnv: + NEBULOUS_BROKER_URL: "nebulous-activemq" + NEBULOUS_BROKER_PORT: "5672" + NEBULOUS_BROKER_USERNAME: "admin" + NEBULOUS_BROKER_PASSWORD: "admin" + POSTGRES_DB_HOST: "localhost" + POSTGRES_DB_NAME: "fog_broker" + POSTGRES_DB_PORT: "5432" + POSTGRES_DB_USER: "dbuser" + POSTGRES_DB_PASS: "pass123" + +postgresql: + enabled: true + image: "docker.io/postgres:16" + user: "dbuser" + password: "pass123" + dbName: "fog_broker" + port: 5432 + volumeMounts: + data: + claimName: "postgresql-pvc" + initScript: + configMapName: "db-init-script" + +env: + backendHost: "http://cloud-fog-service-broker:8001" + +frontend: + resources: {} + image: + repository: "quay.io/nebulous/cloud-fog-service-broker-frontend" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local diff --git a/charts/nebulous-exn-middleware/.helmignore b/charts/nebulous-exn-middleware/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-exn-middleware/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-exn-middleware/Chart.yaml b/charts/nebulous-exn-middleware/Chart.yaml new file mode 100644 index 0000000..9be4f7a --- /dev/null +++ b/charts/nebulous-exn-middleware/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-exn-middleware +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-exn-middleware/templates/NOTES.txt b/charts/nebulous-exn-middleware/templates/NOTES.txt new file mode 100644 index 0000000..3c4b661 --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-exn-middleware.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-exn-middleware.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-exn-middleware.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-exn-middleware.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 +{{- end }} diff --git a/charts/nebulous-exn-middleware/templates/_helpers.tpl b/charts/nebulous-exn-middleware/templates/_helpers.tpl new file mode 100644 index 0000000..175ac31 --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-exn-middleware.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-exn-middleware.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-exn-middleware.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-exn-middleware.labels" -}} +helm.sh/chart: {{ include "nebulous-exn-middleware.chart" . }} +{{ include "nebulous-exn-middleware.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-exn-middleware.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-exn-middleware.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-exn-middleware.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-exn-middleware.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-exn-middleware/templates/deployment.yaml b/charts/nebulous-exn-middleware/templates/deployment.yaml new file mode 100644 index 0000000..17b4bbc --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-exn-middleware.fullname" . }} + labels: + {{- include "nebulous-exn-middleware.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-exn-middleware.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-exn-middleware.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-exn-middleware.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + 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 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: 'SAL_HOST' + value: {{ .Values.SAL_HOST | default "nebulous-sal" | quote }} + - name: 'SAL_PORT' + value: {{ .Values.SAL_PORT | default "8080" | quote }} + - name: 'ACTIVEMQ_HOST' + value: {{ .Values.ACTIVEMQ_HOST | default "nebulous-activemq" | quote }} + - name: 'ACTIVEMQ_PORT' + value: {{ .Values.ACTIVEMQ_PORT | default "5672" | quote }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-exn-middleware/templates/hpa.yaml b/charts/nebulous-exn-middleware/templates/hpa.yaml new file mode 100644 index 0000000..eb9b404 --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-exn-middleware.fullname" . }} + labels: + {{- include "nebulous-exn-middleware.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-exn-middleware.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exn-middleware/templates/ingress.yaml b/charts/nebulous-exn-middleware/templates/ingress.yaml new file mode 100644 index 0000000..5d6876d --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-exn-middleware.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-exn-middleware.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exn-middleware/templates/service.yaml b/charts/nebulous-exn-middleware/templates/service.yaml new file mode 100644 index 0000000..eae1b62 --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-exn-middleware.fullname" . }} + labels: + {{- include "nebulous-exn-middleware.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-exn-middleware.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-exn-middleware/templates/serviceaccount.yaml b/charts/nebulous-exn-middleware/templates/serviceaccount.yaml new file mode 100644 index 0000000..9b4f580 --- /dev/null +++ b/charts/nebulous-exn-middleware/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-exn-middleware.serviceAccountName" . }} + labels: + {{- include "nebulous-exn-middleware.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exn-middleware/values.yaml b/charts/nebulous-exn-middleware/values.yaml new file mode 100644 index 0000000..eb31f58 --- /dev/null +++ b/charts/nebulous-exn-middleware/values.yaml @@ -0,0 +1,82 @@ +# Default values for nebulous-exn-middleware. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/exn-middleware-core" + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/nebulous-exponential-smoothing-predictor/.helmignore b/charts/nebulous-exponential-smoothing-predictor/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-exponential-smoothing-predictor/Chart.yaml b/charts/nebulous-exponential-smoothing-predictor/Chart.yaml new file mode 100755 index 0000000..e04b799 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-exponential-smoothing-predictor +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/NOTES.txt b/charts/nebulous-exponential-smoothing-predictor/templates/NOTES.txt new file mode 100755 index 0000000..8720b98 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-exponential-smoothing-predictor.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-exponential-smoothing-predictor.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-exponential-smoothing-predictor.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-exponential-smoothing-predictor.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 +{{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/_helpers.tpl b/charts/nebulous-exponential-smoothing-predictor/templates/_helpers.tpl new file mode 100755 index 0000000..faa5f70 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-exponential-smoothing-predictor.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-exponential-smoothing-predictor.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-exponential-smoothing-predictor.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-exponential-smoothing-predictor.labels" -}} +helm.sh/chart: {{ include "nebulous-exponential-smoothing-predictor.chart" . }} +{{ include "nebulous-exponential-smoothing-predictor.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-exponential-smoothing-predictor.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-exponential-smoothing-predictor.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-exponential-smoothing-predictor.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-exponential-smoothing-predictor.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/deployment.yaml b/charts/nebulous-exponential-smoothing-predictor/templates/deployment.yaml new file mode 100755 index 0000000..7279333 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-exponential-smoothing-predictor.fullname" . }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-exponential-smoothing-predictor.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-exponential-smoothing-predictor.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + 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 +# protocol: TCP + livenessProbe: + exec: + command: + - ls + - /home + readinessProbe: + exec: + command: + - ls + - /home + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/hpa.yaml b/charts/nebulous-exponential-smoothing-predictor/templates/hpa.yaml new file mode 100755 index 0000000..584a76c --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-exponential-smoothing-predictor.fullname" . }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-exponential-smoothing-predictor.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/ingress.yaml b/charts/nebulous-exponential-smoothing-predictor/templates/ingress.yaml new file mode 100755 index 0000000..d6e7f72 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-exponential-smoothing-predictor.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/service.yaml b/charts/nebulous-exponential-smoothing-predictor/templates/service.yaml new file mode 100755 index 0000000..76df2a2 --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-exponential-smoothing-predictor.fullname" . }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-exponential-smoothing-predictor.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-exponential-smoothing-predictor/templates/serviceaccount.yaml b/charts/nebulous-exponential-smoothing-predictor/templates/serviceaccount.yaml new file mode 100755 index 0000000..e7ca7ac --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-exponential-smoothing-predictor.serviceAccountName" . }} + labels: + {{- include "nebulous-exponential-smoothing-predictor.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-exponential-smoothing-predictor/values.yaml b/charts/nebulous-exponential-smoothing-predictor/values.yaml new file mode 100755 index 0000000..015c22a --- /dev/null +++ b/charts/nebulous-exponential-smoothing-predictor/values.yaml @@ -0,0 +1,82 @@ +# Default values for nebulous-exponential-smoothing-predictor. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/exponential-smoothing-predictor" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/nebulous-gui-controller/.helmignore b/charts/nebulous-gui-controller/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-gui-controller/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-gui-controller/Chart.yaml b/charts/nebulous-gui-controller/Chart.yaml new file mode 100644 index 0000000..5510512 --- /dev/null +++ b/charts/nebulous-gui-controller/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-gui-controller +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-gui-controller/templates/NOTES.txt b/charts/nebulous-gui-controller/templates/NOTES.txt new file mode 100644 index 0000000..cd92629 --- /dev/null +++ b/charts/nebulous-gui-controller/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-gui-controller.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-gui-controller.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-gui-controller.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-gui-controller.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 +{{- end }} diff --git a/charts/nebulous-gui-controller/templates/_helpers.tpl b/charts/nebulous-gui-controller/templates/_helpers.tpl new file mode 100644 index 0000000..e033f9f --- /dev/null +++ b/charts/nebulous-gui-controller/templates/_helpers.tpl @@ -0,0 +1,76 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-gui-controller.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-gui-controller.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-gui-controller.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-gui-controller.labels" -}} +helm.sh/chart: {{ include "nebulous-gui-controller.chart" . }} +{{ include "nebulous-gui-controller.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "nebulous-gui-controller.mongodb.labels" -}} +helm.sh/chart: {{ include "nebulous-gui-controller.chart" . }} +{{ include "nebulous-gui-controller.mongodb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-gui-controller.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-gui-controller.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "nebulous-gui-controller.mongodb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-gui-controller.name" . }}-mongodb +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-gui-controller.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-gui-controller.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-gui-controller/templates/add-user-to-csm.yaml b/charts/nebulous-gui-controller/templates/add-user-to-csm.yaml new file mode 100644 index 0000000..bd66b74 --- /dev/null +++ b/charts/nebulous-gui-controller/templates/add-user-to-csm.yaml @@ -0,0 +1,29 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: add-admin-user + annotations: + "helm.sh/hook": post-install + "helm.sh/hook-weight": "5" + "helm.sh/hook-delete-policy": hook-succeeded + labels: + app: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} +spec: + template: + spec: + initContainers: + - name: wait-for-mongodb + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: ['sh', '-c', 'until nc -z nebulous-gui-controller-mongodb 27017; do echo waiting for mongodb; sleep 2; done;'] + containers: + - name: add-admin-user + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: + - sh + - -c + - "echo '{{ .Values.apostropheCMS.user.password }}' | node app.js @apostrophecms/user:add {{ .Values.apostropheCMS.user.name }} admin" + env: + {{- toYaml .Values.env | nindent 10 }} + restartPolicy: Never + backoffLimit: 4 diff --git a/charts/nebulous-gui-controller/templates/deployment.yaml b/charts/nebulous-gui-controller/templates/deployment.yaml new file mode 100644 index 0000000..588483a --- /dev/null +++ b/charts/nebulous-gui-controller/templates/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }} + labels: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-gui-controller.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-gui-controller.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-gui-controller.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: wait-for-mongodb + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: ['sh', '-c', 'until nc -z nebulous-gui-controller-mongodb 27017; do echo waiting for mongodb; sleep 2; done;'] + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + env: + {{- toYaml .Values.env | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-gui-controller/templates/hpa.yaml b/charts/nebulous-gui-controller/templates/hpa.yaml new file mode 100644 index 0000000..ab4ea5d --- /dev/null +++ b/charts/nebulous-gui-controller/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }} + labels: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-gui-controller.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui-controller/templates/ingress.yaml b/charts/nebulous-gui-controller/templates/ingress.yaml new file mode 100644 index 0000000..e2865ab --- /dev/null +++ b/charts/nebulous-gui-controller/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-gui-controller.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui-controller/templates/mongodb.yaml b/charts/nebulous-gui-controller/templates/mongodb.yaml new file mode 100644 index 0000000..cfa4493 --- /dev/null +++ b/charts/nebulous-gui-controller/templates/mongodb.yaml @@ -0,0 +1,79 @@ +{{ if .Values.mongodb.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + labels: + {{- include "nebulous-gui-controller.mongodb.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: mongodb + image: "docker.io/mongodb/mongodb-community-server:4.4.29-ubuntu2004" + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + env: + - name: MONGO_INITDB_ROOT_USERNAME + value: username + - name: MONGO_INITDB_ROOT_PASSWORD + value: password + - name: MONGO_INITDB_DATABASE + value: nebulous + volumeMounts: + - name: mongodb-data + mountPath: /data/db + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + labels: + {{- include "nebulous-gui-controller.mongodb.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 27017 + targetPort: mongodb + protocol: TCP + name: mongodb + selector: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 4 }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + labels: + {{- include "nebulous-gui-controller.mongodb.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi +{{ end }} \ No newline at end of file diff --git a/charts/nebulous-gui-controller/templates/service.yaml b/charts/nebulous-gui-controller/templates/service.yaml new file mode 100644 index 0000000..d765368 --- /dev/null +++ b/charts/nebulous-gui-controller/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }} + labels: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-gui-controller.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-gui-controller/templates/serviceaccount.yaml b/charts/nebulous-gui-controller/templates/serviceaccount.yaml new file mode 100644 index 0000000..1b96dde --- /dev/null +++ b/charts/nebulous-gui-controller/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-gui-controller.serviceAccountName" . }} + labels: + {{- include "nebulous-gui-controller.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui-controller/values.yaml b/charts/nebulous-gui-controller/values.yaml new file mode 100644 index 0000000..eb825d2 --- /dev/null +++ b/charts/nebulous-gui-controller/values.yaml @@ -0,0 +1,103 @@ +# Default values for nebulous-gui-controller. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/gui-controller" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 3000 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +mongodb: + # this enables the built-in mongodb deployment - not recommended for production + enabled: true + +env: + - name: ACTIVEMQ_HOST + value: "nebulous-activemq" + - name: ACTIVEMQ_PORT + value: "5672" + - name: ACTIVEMQ_USERNAME + value: "admin" + - name: ACTIVEMQ_PASSWORD + value: "nebulous" + - name: APOS_MONGODB_URI + value: "mongodb://username:password@nebulous-gui-controller-mongodb:27017/admin" + +apostropheCMS: + user: + name: admin + password: admin diff --git a/charts/nebulous-gui/.helmignore b/charts/nebulous-gui/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-gui/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-gui/Chart.yaml b/charts/nebulous-gui/Chart.yaml new file mode 100644 index 0000000..8754aac --- /dev/null +++ b/charts/nebulous-gui/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-gui +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-gui/templates/NOTES.txt b/charts/nebulous-gui/templates/NOTES.txt new file mode 100644 index 0000000..a478f6f --- /dev/null +++ b/charts/nebulous-gui/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-gui.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-gui.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-gui.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-gui.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 +{{- end }} diff --git a/charts/nebulous-gui/templates/_helpers.tpl b/charts/nebulous-gui/templates/_helpers.tpl new file mode 100644 index 0000000..0c6ab10 --- /dev/null +++ b/charts/nebulous-gui/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-gui.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-gui.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-gui.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-gui.labels" -}} +helm.sh/chart: {{ include "nebulous-gui.chart" . }} +{{ include "nebulous-gui.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-gui.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-gui.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-gui.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-gui.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-gui/templates/deployment.yaml b/charts/nebulous-gui/templates/deployment.yaml new file mode 100644 index 0000000..e06499e --- /dev/null +++ b/charts/nebulous-gui/templates/deployment.yaml @@ -0,0 +1,86 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-gui.fullname" . }} + labels: + {{- include "nebulous-gui.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-gui.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-gui.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-gui.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: {{ .Chart.Name }}-builder + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.builderImage.repository }}:{{ .Values.builderImage.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.builderImage.pullPolicy }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + command: + - npx + - vite + - build + volumeMounts: + - name: static-files + mountPath: /app/dist + env: + {{- toYaml .Values.builderEnv | nindent 12 }} + containers: + - name: {{ .Chart.Name }}-server + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.serverImage.repository }}:{{ .Values.serverImage.tag }}" + imagePullPolicy: {{ .Values.serverImage.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + env: + {{- toYaml .Values.env | nindent 12 }} + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: static-files + mountPath: /usr/share/nginx/html + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: static-files + emptyDir: {} diff --git a/charts/nebulous-gui/templates/hpa.yaml b/charts/nebulous-gui/templates/hpa.yaml new file mode 100644 index 0000000..f61af7f --- /dev/null +++ b/charts/nebulous-gui/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-gui.fullname" . }} + labels: + {{- include "nebulous-gui.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-gui.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui/templates/ingress.yaml b/charts/nebulous-gui/templates/ingress.yaml new file mode 100644 index 0000000..6ec2238 --- /dev/null +++ b/charts/nebulous-gui/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-gui.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-gui.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui/templates/service.yaml b/charts/nebulous-gui/templates/service.yaml new file mode 100644 index 0000000..430bc93 --- /dev/null +++ b/charts/nebulous-gui/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-gui.fullname" . }} + labels: + {{- include "nebulous-gui.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-gui.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-gui/templates/serviceaccount.yaml b/charts/nebulous-gui/templates/serviceaccount.yaml new file mode 100644 index 0000000..70f92d5 --- /dev/null +++ b/charts/nebulous-gui/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-gui.serviceAccountName" . }} + labels: + {{- include "nebulous-gui.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-gui/values.yaml b/charts/nebulous-gui/values.yaml new file mode 100644 index 0000000..f7f0f46 --- /dev/null +++ b/charts/nebulous-gui/values.yaml @@ -0,0 +1,91 @@ +# Default values for nebulous-gui. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +serverImage: + repository: "docker.io/library/nginx" + pullPolicy: IfNotPresent + tag: "latest" + +builderImage: + repository: "quay.io/nebulous/gui-builder" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +builderEnv: [] + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +env: [] diff --git a/charts/nebulous-influxdb/.helmignore b/charts/nebulous-influxdb/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-influxdb/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-influxdb/Chart.yaml b/charts/nebulous-influxdb/Chart.yaml new file mode 100644 index 0000000..f32a418 --- /dev/null +++ b/charts/nebulous-influxdb/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-influxdb +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-influxdb/templates/NOTES.txt b/charts/nebulous-influxdb/templates/NOTES.txt new file mode 100644 index 0000000..0297352 --- /dev/null +++ b/charts/nebulous-influxdb/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-influxdb.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-influxdb.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-influxdb.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-influxdb.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 +{{- end }} diff --git a/charts/nebulous-influxdb/templates/_helpers.tpl b/charts/nebulous-influxdb/templates/_helpers.tpl new file mode 100644 index 0000000..72354d5 --- /dev/null +++ b/charts/nebulous-influxdb/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-influxdb.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-influxdb.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-influxdb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-influxdb.labels" -}} +helm.sh/chart: {{ include "nebulous-influxdb.chart" . }} +{{ include "nebulous-influxdb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-influxdb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-influxdb.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-influxdb.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-influxdb.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-influxdb/templates/deployment.yaml b/charts/nebulous-influxdb/templates/deployment.yaml new file mode 100644 index 0000000..74df5b0 --- /dev/null +++ b/charts/nebulous-influxdb/templates/deployment.yaml @@ -0,0 +1,103 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-influxdb.fullname" . }} + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-influxdb.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-influxdb.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-influxdb.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 8086 + protocol: TCP + env: + - name: INFLUXDB_HTTP_AUTH_ENABLED + value: "{{ .Values.config.httpAuthEnabled }}" + - name: DOCKER_INFLUXDB_INIT_MODE + value: "{{ .Values.influxdbSetup.DOCKER_INFLUXDB_INIT_MODE }}" + - name: DOCKER_INFLUXDB_INIT_USERNAME + value: "{{ .Values.influxdbSetup.DOCKER_INFLUXDB_INIT_USERNAME }}" + - name: DOCKER_INFLUXDB_INIT_ORG + value: "{{ .Values.influxdbSetup.DOCKER_INFLUXDB_INIT_ORG }}" + - name: DOCKER_INFLUXDB_INIT_BUCKET + value: "{{ .Values.influxdbSetup.DOCKER_INFLUXDB_INIT_BUCKET }}" + - name: DOCKER_INFLUXDB_INIT_RETENTION + value: "{{ .Values.influxdbSetup.DOCKER_INFLUXDB_INIT_RETENTION }}" + - name: DOCKER_INFLUXDB_INIT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "nebulous-influxdb.fullname" . }}-secrets + key: DOCKER_INFLUXDB_INIT_PASSWORD + - name: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "nebulous-influxdb.fullname" . }}-secrets + key: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN + livenessProbe: + httpGet: + path: /health + port: 8086 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + readinessProbe: + httpGet: + 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 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-influxdb/templates/hpa.yaml b/charts/nebulous-influxdb/templates/hpa.yaml new file mode 100644 index 0000000..5c178d6 --- /dev/null +++ b/charts/nebulous-influxdb/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-influxdb.fullname" . }} + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-influxdb.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-influxdb/templates/influxdb-secrets.yaml b/charts/nebulous-influxdb/templates/influxdb-secrets.yaml new file mode 100644 index 0000000..091cb95 --- /dev/null +++ b/charts/nebulous-influxdb/templates/influxdb-secrets.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "nebulous-influxdb.fullname" . }}-secrets + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} +type: Opaque +data: + DOCKER_INFLUXDB_INIT_PASSWORD: {{ .Values.secrets.DOCKER_INFLUXDB_INIT_PASSWORD | b64enc | quote }} + DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: {{ .Values.secrets.DOCKER_INFLUXDB_INIT_ADMIN_TOKEN | b64enc | quote }} \ No newline at end of file diff --git a/charts/nebulous-influxdb/templates/ingress.yaml b/charts/nebulous-influxdb/templates/ingress.yaml new file mode 100644 index 0000000..4292896 --- /dev/null +++ b/charts/nebulous-influxdb/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-influxdb.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} 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/templates/service.yaml b/charts/nebulous-influxdb/templates/service.yaml new file mode 100644 index 0000000..76783b3 --- /dev/null +++ b/charts/nebulous-influxdb/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-influxdb.fullname" . }} + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-influxdb.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-influxdb/templates/serviceaccount.yaml b/charts/nebulous-influxdb/templates/serviceaccount.yaml new file mode 100644 index 0000000..1acd678 --- /dev/null +++ b/charts/nebulous-influxdb/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-influxdb.serviceAccountName" . }} + labels: + {{- include "nebulous-influxdb.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-influxdb/values.yaml b/charts/nebulous-influxdb/values.yaml new file mode 100644 index 0000000..c9dc5e6 --- /dev/null +++ b/charts/nebulous-influxdb/values.yaml @@ -0,0 +1,101 @@ +# Default values for nebulous-influxdb. + +# Number of replicas +replicaCount: 1 + +# Image configurations +image: + repository: "quay.io/nebulous/influxdb" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +# InfluxDB specific configurations +config: + httpAuthEnabled: "true" + adminUser: "admin" + +# Service Account configurations +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# Pod configurations +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# Service settings +service: + type: ClusterIP + port: 8086 + +# Ingress configurations +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +# 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 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Node selector, tolerations, and affinity settings +nodeSelector: {} + +tolerations: [] + +affinity: {} +influxdbSetup: + DOCKER_INFLUXDB_INIT_MODE: "setup" + DOCKER_INFLUXDB_INIT_USERNAME: "my-user" + DOCKER_INFLUXDB_INIT_ORG: "my-org" + DOCKER_INFLUXDB_INIT_BUCKET: "my-bucket" + DOCKER_INFLUXDB_INIT_RETENTION: "1w" + +secrets: + DOCKER_INFLUXDB_INIT_PASSWORD: "my-password" + DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: "my-super-secret-auth-token" diff --git a/charts/nebulous-monitoring-data-persistor/.helmignore b/charts/nebulous-monitoring-data-persistor/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-monitoring-data-persistor/Chart.yaml b/charts/nebulous-monitoring-data-persistor/Chart.yaml new file mode 100644 index 0000000..feeb1f4 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-monitoring-data-persistor +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-monitoring-data-persistor/templates/NOTES.txt b/charts/nebulous-monitoring-data-persistor/templates/NOTES.txt new file mode 100644 index 0000000..a1c64ab --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-monitoring-data-persistor.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-monitoring-data-persistor.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-monitoring-data-persistor.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-monitoring-data-persistor.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 +{{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/_helpers.tpl b/charts/nebulous-monitoring-data-persistor/templates/_helpers.tpl new file mode 100644 index 0000000..835a239 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-monitoring-data-persistor.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-monitoring-data-persistor.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-monitoring-data-persistor.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-monitoring-data-persistor.labels" -}} +helm.sh/chart: {{ include "nebulous-monitoring-data-persistor.chart" . }} +{{ include "nebulous-monitoring-data-persistor.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-monitoring-data-persistor.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-monitoring-data-persistor.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-monitoring-data-persistor.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-monitoring-data-persistor.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/deployment.yaml b/charts/nebulous-monitoring-data-persistor/templates/deployment.yaml new file mode 100644 index 0000000..490f7a3 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-monitoring-data-persistor.fullname" . }} + labels: + {{- include "nebulous-monitoring-data-persistor.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-monitoring-data-persistor.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-monitoring-data-persistor.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-monitoring-data-persistor.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 8070 + protocol: TCP + livenessProbe: + exec: + command: + - ls + - /home + readinessProbe: + exec: + command: + - ls + - /home + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/hpa.yaml b/charts/nebulous-monitoring-data-persistor/templates/hpa.yaml new file mode 100644 index 0000000..5688128 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-monitoring-data-persistor.fullname" . }} + labels: + {{- include "nebulous-monitoring-data-persistor.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-monitoring-data-persistor.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/ingress.yaml b/charts/nebulous-monitoring-data-persistor/templates/ingress.yaml new file mode 100644 index 0000000..3791f6a --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-monitoring-data-persistor.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-monitoring-data-persistor.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/service.yaml b/charts/nebulous-monitoring-data-persistor/templates/service.yaml new file mode 100644 index 0000000..e89d000 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-monitoring-data-persistor.fullname" . }} + labels: + {{- include "nebulous-monitoring-data-persistor.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-monitoring-data-persistor.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-monitoring-data-persistor/templates/serviceaccount.yaml b/charts/nebulous-monitoring-data-persistor/templates/serviceaccount.yaml new file mode 100644 index 0000000..c442215 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-monitoring-data-persistor.serviceAccountName" . }} + labels: + {{- include "nebulous-monitoring-data-persistor.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring-data-persistor/values.yaml b/charts/nebulous-monitoring-data-persistor/values.yaml new file mode 100644 index 0000000..e77e274 --- /dev/null +++ b/charts/nebulous-monitoring-data-persistor/values.yaml @@ -0,0 +1,82 @@ +# Default values for nebulous-monitoring-data-persistor. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/monitoring-data-persistor" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/nebulous-monitoring/.helmignore b/charts/nebulous-monitoring/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-monitoring/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-monitoring/Chart.yaml b/charts/nebulous-monitoring/Chart.yaml new file mode 100644 index 0000000..3eebef5 --- /dev/null +++ b/charts/nebulous-monitoring/Chart.yaml @@ -0,0 +1,33 @@ +# +# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr) +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless +# Esper library is used, in which case it is subject to the terms of General Public License v2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://www.mozilla.org/en-US/MPL/2.0/ +# + +apiVersion: v2 +name: nebulous-monitoring +description: EMS server Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.5 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-monitoring/templates/NOTES.txt b/charts/nebulous-monitoring/templates/NOTES.txt new file mode 100644 index 0000000..c1840d9 --- /dev/null +++ b/charts/nebulous-monitoring/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-monitoring.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-monitoring.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-monitoring.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-monitoring.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 +{{- end }} diff --git a/charts/nebulous-monitoring/templates/_helpers.tpl b/charts/nebulous-monitoring/templates/_helpers.tpl new file mode 100644 index 0000000..6a4e6f7 --- /dev/null +++ b/charts/nebulous-monitoring/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-monitoring.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-monitoring.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-monitoring.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-monitoring.labels" -}} +helm.sh/chart: {{ include "nebulous-monitoring.chart" . }} +{{ include "nebulous-monitoring.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-monitoring.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-monitoring.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-monitoring.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-monitoring.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring/templates/deployment.yaml b/charts/nebulous-monitoring/templates/deployment.yaml new file mode 100644 index 0000000..63d9d6f --- /dev/null +++ b/charts/nebulous-monitoring/templates/deployment.yaml @@ -0,0 +1,96 @@ +# +# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr) +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless +# Esper library is used, in which case it is subject to the terms of General Public License v2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://www.mozilla.org/en-US/MPL/2.0/ +# +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-monitoring.fullname" . }} + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-monitoring.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-monitoring.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-monitoring.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + + terminationGracePeriodSeconds: 10 + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + ports: + {{- range .Values.ports }} + - name: {{ .name }} + containerPort: {{ .containerPort }} + protocol: {{ .protocol }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nebulous-monitoring-role-binding +subjects: + - kind: ServiceAccount + name: {{ include "nebulous-monitoring.serviceAccountName" . }} +# namespace: default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: nebulous-monitoring-role +--- +kind: Role +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: nebulous-monitoring-role +# Benefit of using RBAC over giving your personal access token as a secret to your application: You can pinpoint which access you want to allow +rules: + - apiGroups: [""] + resources: ["pods", "services"] + verbs: ["get", "list", "watch"] diff --git a/charts/nebulous-monitoring/templates/hpa.yaml b/charts/nebulous-monitoring/templates/hpa.yaml new file mode 100644 index 0000000..e191ea5 --- /dev/null +++ b/charts/nebulous-monitoring/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-monitoring.fullname" . }} + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-monitoring.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring/templates/ingress.yaml b/charts/nebulous-monitoring/templates/ingress.yaml new file mode 100644 index 0000000..60bd948 --- /dev/null +++ b/charts/nebulous-monitoring/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-monitoring.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring/templates/service-public.yaml b/charts/nebulous-monitoring/templates/service-public.yaml new file mode 100644 index 0000000..8cb96d8 --- /dev/null +++ b/charts/nebulous-monitoring/templates/service-public.yaml @@ -0,0 +1,29 @@ +# +# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr) +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless +# Esper library is used, in which case it is subject to the terms of General Public License v2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://www.mozilla.org/en-US/MPL/2.0/ +# + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-monitoring.fullname" . }}-public + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }}-public +spec: + type: NodePort + ports: + {{- range .Values.ports }} + {{- if .public }} + - name: {{ .name }} + port: {{ .containerPort }} + targetPort: {{ .containerPort }} + nodePort: {{ .nodePort }} + protocol: {{ .protocol }} + {{- end }} + {{- end }} + selector: + {{- include "nebulous-monitoring.selectorLabels" . | nindent 4 }}-public diff --git a/charts/nebulous-monitoring/templates/service.yaml b/charts/nebulous-monitoring/templates/service.yaml new file mode 100644 index 0000000..d9f731d --- /dev/null +++ b/charts/nebulous-monitoring/templates/service.yaml @@ -0,0 +1,28 @@ +# +# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr) +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless +# Esper library is used, in which case it is subject to the terms of General Public License v2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://www.mozilla.org/en-US/MPL/2.0/ +# + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-monitoring.fullname" . }} + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + {{- range .Values.ports }} + {{- if not .public }} + - name: {{ .name }} + port: {{ .containerPort }} + targetPort: {{ .containerPort }} + protocol: {{ .protocol }} + {{- end }} + {{- end }} + selector: + {{- include "nebulous-monitoring.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-monitoring/templates/serviceaccount.yaml b/charts/nebulous-monitoring/templates/serviceaccount.yaml new file mode 100644 index 0000000..ddec79c --- /dev/null +++ b/charts/nebulous-monitoring/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-monitoring.serviceAccountName" . }} + labels: + {{- include "nebulous-monitoring.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-monitoring/values.yaml b/charts/nebulous-monitoring/values.yaml new file mode 100644 index 0000000..a37ce11 --- /dev/null +++ b/charts/nebulous-monitoring/values.yaml @@ -0,0 +1,281 @@ +# +# Copyright (C) 2017-2025 Institute of Communication and Computer Systems (imu.iccs.gr) +# +# This Source Code Form is subject to the terms of the Mozilla Public License, v2.0, unless +# Esper library is used, in which case it is subject to the terms of General Public License v2.0. +# If a copy of the MPL was not distributed with this file, you can obtain one at +# https://www.mozilla.org/en-US/MPL/2.0/ +# + +# Default values for nebulous-monitoring. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/monitoring" +# pullPolicy: IfNotPresent + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8111 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 1 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +ports: + - name: http + containerPort: 8111 + protocol: TCP + public: true + nodePort: 30111 + - name: openwire + containerPort: 61616 + protocol: TCP + public: false + - name: openwire-tls + containerPort: 61617 + protocol: TCP + public: true + nodePort: 31617 + - name: stomp + containerPort: 61610 + protocol: TCP + public: false + - name: baguette + containerPort: 2222 + protocol: TCP + public: true + nodePort: 32222 + +env: + # + # ===== EMS server configuration ===== + # + # ===== INITIALIZATION settings ===== + - name: BUILD_MESSAGE + value: '2024-05-09 11:57:00+03:00 opendev' + - name: JASYPT_PASSWORD + value: 'password' # +++++++++++++++++++++++++ ????????????????? + - name: NET_UTIL_ADDRESS_DISCOVERY_SERVICES + value: '-' + - name: EMS_IP_SETTING + value: 'DEFAULT_IP' + + - name: EMS_LOG_REQUESTS + value: 'false' + - name: EMS_PRELOAD_APP_MODEL + value: 'empty.yml' + - name: EMS_PRELOAD_CP_MODEL + value: '' + + - name: CONTROL_SKIP_MVV_RETRIEVE + value: 'true' + - name: CONTROL_SKIP_METASOLVER + value: 'true' + - name: CONTROL_SKIP_NOTIFICATION + value: 'true' + - name: CONTROL_EXIT_ALLOWED + value: 'true' + - name: RESTART_EXIT_CODE + value: '99' + + # ===== Security and Authentication settings ===== + - name: CONTROL_SSL_KEY_ENTRY_GENERATE + value: 'ALWAYS' + - name: CONTROL_SSL_KEYSTORE_PASSWORD + value: 'melodic' # +++++++++++++++++++++++++ ${P_KEYSTORE_PASSWORD} + - name: CONTROL_SSL_TRUSTSTORE_PASSWORD + value: 'melodic' # +++++++++++++++++++++++++ ${P_KEYSTORE_PASSWORD} + + - name: JWT_SECRET + value: 'ENC(I0mRWgH2FVDDNs4OBcdh7Z+o3lOQDa3ztaEtmnXT2HN0aClkChp/lqm9zM5HyTk0stJ7v2Di75U=)' # +++++++++++++++++++++++++ ${P_JWT_SECRET} + - name: WEB_SECURITY_API_KEY_AUTHENTICATION_VALUE + value: '1234567890' # +++++++++++++++++++++++++ ${P_WEB_API_KEY_VALUE} + - name: WEB_SECURITY_FORM_AUTHENTICATION_PASSWORD + value: 'ems' # +++++++++++++++++++++++++ ${P_WEB_ADMIN_PASSWORD} + + # ===== Topic Beacon settings ===== + - name: BEACON_INITIAL_DELAY + value: '10000' + - name: BEACON_DELAY + value: '10000' + + # ===== EMS server monitoring settings ===== + - name: EMS_SYSMON_ENABLED + value: 'true' + - name: EMS_SYSMON_PERIOD + value: '1000' + - name: EMS_SYSMON_COMMAND + value: './bin/sysmon.sh' + + - name: INFO_FILES_ROOTS + value: '/logs, /config, /opt/ems-server/public_resources/resources' + - name: INFO_FILES_EXTENSIONS_BLOCKED + value: '.pem, .p12, .sh' + + # ===== EMS Boot (server) settings ===== + - name: BOOT_ENABLED + value: 'true' + + # ===== EMS Boot Initializer (client) settings ===== + - name: BOOT_INITIALIZER_ENABLED + value: 'false' + + # ===== EMS-Nebulous K8S service settings ===== + - name: K8S_DEPLOY_EMS_CLIENTS_ON_KUBERNETES_ENABLED + value: 'false' + - name: K8S_ENABLED + value: 'false' + - name: K8S_WATCHER_ENABLED + value: 'false' + + # ===== External Broker settings ===== + - name: EXTERNAL_ENABLED + value: 'true' + - name: EXTERNAL_BROKER_ADDRESS + value: 'nebulous-activemq' + - name: EXTERNAL_BROKER_PORT + value: '5672' + - name: EXTERNAL_BROKER_USERNAME + value: 'nebulous' + - name: EXTERNAL_BROKER_PASSWORD + value: 'admin' + + - name: EXTERNAL_CONNECTION_INFO_COLLECTION_MODE + value: 'CONFIG' + - name: EXTERNAL_BROKER_SERVICE_NAME + value: 'nebulous-activemq' + - name: EXTERNAL_BROKER_SERVICE_NAMESPACE + value: 'nebulous-cd' + + # ===== Broker settings ===== + - name: EMS_SERVER_BROKER_PORT + value: '31617' + - name: BROKERCEP_ADDITIONAL_BROKER_CREDENTIALS + value: 'aaa/111, bbb/222' # ++++++++++++++++ ${P_BROKERCEP_CREDENTIALS:-} +# value: 'ENC(axeJUxNHajYfBffUwvuT3kwTgLTpRliDMz/ZQ9hROZ3BNOv0Idw72NJsawzIZRuZ)' + - name: BROKERCEP_EVENT_RECORDER_ENABLED + value: 'false' + - name: BROKERCEP_EVENT_RECORDER_FILTER_MODE + value: 'ALL' + + # ===== Baguette Server settings ===== + - name: BAGUETTE_SERVER_CREDENTIALS + value: '{ "aa":"xx" }' # ++++++++++++++++ ${P_BAGUETTE_SERVER_CREDENTIALS:-{} +# value: 'ENC(y46CiW6przlpXvz8ToE+T1Sn6uGfO2haP7OhATB0SXo=)' + + # ===== Baguette Client Install settings ===== + - name: EMS_SERVER_ADDRESS + value: '158.39.200.177' + - name: BAGUETTE_SERVER_ADDRESS + value: '158.39.200.177' + - name: BAGUETTE_SERVER_PORT + value: '32222' +# - name: BAGUETTE_CLIENT_INSTALL_INSTRUCTIONS_LINUX +# value: 'file:${EMS_CONFIG_DIR}/baguette-client-install/helm/app-detection.yml, file:${EMS_CONFIG_DIR}/baguette-client-install/helm/epm-deploy.yml, file:${EMS_CONFIG_DIR}/baguette-client-install/helm/netdata-deploy.yml' + - name: BAGUETTE_CLIENT_INSTALL_INSTALLATION_CONTEXT_PROCESSOR_PLUGINS + value: 'eu.nebulous.ems.plugins.NebulousInstallationContextProcessorPlugin' + + # + # ===== EMS server K8sClientInstaller configuration ===== + # + - name: EMS_CLIENT_DEPLOYMENT_DRY_RUN + value: "false" + - name: K8S_SERVICE_ACCOUNT_SECRETS_PATH + value: "/var/run/secrets/kubernetes.io/serviceaccount" + - name: APP_CONFIG_MAP_NAME + value: "monitoring-configmap" + - name: EMS_CLIENT_CONFIG_MAP_NAME + value: "ems-client-configmap" + # - name: EMS_CLIENT_DAEMONSET_SPECIFICATION_FILE + # value: "/ems-client-daemonset.yaml" + - name: EMS_CLIENT_DAEMONSET_NAME + value: "ems-client-daemonset" + - name: EMS_CLIENT_DAEMONSET_IMAGE_REPOSITORY + value: "registry.gitlab.com/nebulous-project/ems-main/ems-client" + - name: EMS_CLIENT_DAEMONSET_IMAGE_TAG + value: "latest" + - name: EMS_CLIENT_DAEMONSET_IMAGE_PULL_POLICY + value: "Always" + + # ===== EMS clients - Security and Authentication settings ===== + - name: EMS_CLIENT_ADDITIONAL_BROKER_CREDENTIALS + value: 'aaa/111, bbb/222' +# value: "ENC(axeJUxNHajYfBffUwvuT3kwTgLTpRliDMz/ZQ9hROZ3BNOv0Idw72NJsawzIZRuZ)" + # - name: EMS_CLIENT_BROKER_USERNAME # It is appended to EMS_CLIENT_ADDITIONAL_BROKER_CREDENTIALS + # value: "ccc" + # - name: EMS_CLIENT_BROKER_PASSWORD + # value: "333" + - name: EMS_CLIENT_KEYSTORE_SECRET + value: "" + - name: EMS_CLIENT_TRUSTSTORE_SECRET + value: "" diff --git a/charts/nebulous-optimiser-controller/.helmignore b/charts/nebulous-optimiser-controller/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-optimiser-controller/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-optimiser-controller/Chart.yaml b/charts/nebulous-optimiser-controller/Chart.yaml new file mode 100644 index 0000000..ecc49f6 --- /dev/null +++ b/charts/nebulous-optimiser-controller/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-optimiser-controller +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-optimiser-controller/templates/NOTES.txt b/charts/nebulous-optimiser-controller/templates/NOTES.txt new file mode 100644 index 0000000..f486331 --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-optimiser-controller.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-optimiser-controller.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-optimiser-controller.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-optimiser-controller.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 +{{- end }} diff --git a/charts/nebulous-optimiser-controller/templates/_helpers.tpl b/charts/nebulous-optimiser-controller/templates/_helpers.tpl new file mode 100644 index 0000000..2d22bc0 --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-optimiser-controller.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-optimiser-controller.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-optimiser-controller.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-optimiser-controller.labels" -}} +helm.sh/chart: {{ include "nebulous-optimiser-controller.chart" . }} +{{ include "nebulous-optimiser-controller.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-optimiser-controller.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-optimiser-controller.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-optimiser-controller.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-optimiser-controller.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-controller/templates/deployment.yaml b/charts/nebulous-optimiser-controller/templates/deployment.yaml new file mode 100644 index 0000000..e808ecb --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/deployment.yaml @@ -0,0 +1,83 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-optimiser-controller.fullname" . }} + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-optimiser-controller.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-optimiser-controller.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-optimiser-controller.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + 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 + protocol: TCP + env: + - name: LOGDIR + value: "{{ .Values.debug.LOGDIR }}" + - name: ACTIVEMQ_HOST + value: "{{ .Values.activemq.ACTIVEMQ_HOST }}" + - name: ACTIVEMQ_PORT + value: "{{ .Values.activemq.ACTIVEMQ_PORT }}" + - name: ACTIVEMQ_USER + value: "{{ .Values.activemq.ACTIVEMQ_USER }}" + - name: ACTIVEMQ_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "nebulous-optimiser-controller.fullname" . }}-secrets + key: ACTIVEMQ_PASSWORD + - name: APP_ACTIVEMQ_HOST + value: "{{ .Values.app.ACTIVEMQ_HOST }}" + - name: APP_ACTIVEMQ_PORT + value: "{{ .Values.app.ACTIVEMQ_PORT }}" + - name: ONM_IP + value: "{{ .Values.app.ONM_IP }}" + - name: ONM_URL + value: "{{ .Values.app.ONM_URL }}" + # livenessProbe: + # httpGet: + # path: / + # port: http + # readinessProbe: + # httpGet: + # path: / + # port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-optimiser-controller/templates/hpa.yaml b/charts/nebulous-optimiser-controller/templates/hpa.yaml new file mode 100644 index 0000000..2f6555e --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-optimiser-controller.fullname" . }} + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-optimiser-controller.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-controller/templates/ingress.yaml b/charts/nebulous-optimiser-controller/templates/ingress.yaml new file mode 100644 index 0000000..bef72f9 --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-optimiser-controller.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-controller/templates/optimiser-controller-secrets.yaml b/charts/nebulous-optimiser-controller/templates/optimiser-controller-secrets.yaml new file mode 100644 index 0000000..5ee535b --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/optimiser-controller-secrets.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "nebulous-optimiser-controller.fullname" . }}-secrets + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} +type: Opaque +data: + ACTIVEMQ_PASSWORD: {{ .Values.secrets.ACTIVEMQ_PASSWORD | b64enc | quote }} diff --git a/charts/nebulous-optimiser-controller/templates/service.yaml b/charts/nebulous-optimiser-controller/templates/service.yaml new file mode 100644 index 0000000..f9e3ad1 --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-optimiser-controller.fullname" . }} + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-optimiser-controller.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-optimiser-controller/templates/serviceaccount.yaml b/charts/nebulous-optimiser-controller/templates/serviceaccount.yaml new file mode 100644 index 0000000..18e3b3e --- /dev/null +++ b/charts/nebulous-optimiser-controller/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-optimiser-controller.serviceAccountName" . }} + labels: + {{- include "nebulous-optimiser-controller.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-controller/values.yaml b/charts/nebulous-optimiser-controller/values.yaml new file mode 100644 index 0000000..f1d2572 --- /dev/null +++ b/charts/nebulous-optimiser-controller/values.yaml @@ -0,0 +1,99 @@ +# Default values for nebulous-optimiser-controller. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/optimiser-controller" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +debug: + LOGDIR: /tmp/nebulous + +activemq: + ACTIVEMQ_HOST: nebulous-activemq + ACTIVEMQ_PORT: 5672 + ACTIVEMQ_USER: admin + +app: + ONM_IP: '123' + ONM_URL: 'onm-url' + ACTIVEMQ_HOST: 'nebulous-activemq' + ACTIVEMQ_PORT: '131' + +secrets: + ACTIVEMQ_PASSWORD: nebulous diff --git a/charts/nebulous-optimiser-utility-evaluator/.helmignore b/charts/nebulous-optimiser-utility-evaluator/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-optimiser-utility-evaluator/Chart.yaml b/charts/nebulous-optimiser-utility-evaluator/Chart.yaml new file mode 100644 index 0000000..46567d4 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-optimiser-utility-evaluator +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/NOTES.txt b/charts/nebulous-optimiser-utility-evaluator/templates/NOTES.txt new file mode 100644 index 0000000..9cb2841 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-optimiser-utility-evaluator.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-optimiser-utility-evaluator.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-optimiser-utility-evaluator.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-optimiser-utility-evaluator.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 +{{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/_helpers.tpl b/charts/nebulous-optimiser-utility-evaluator/templates/_helpers.tpl new file mode 100644 index 0000000..83522a8 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-optimiser-utility-evaluator.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-optimiser-utility-evaluator.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-optimiser-utility-evaluator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-optimiser-utility-evaluator.labels" -}} +helm.sh/chart: {{ include "nebulous-optimiser-utility-evaluator.chart" . }} +{{ include "nebulous-optimiser-utility-evaluator.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-optimiser-utility-evaluator.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-optimiser-utility-evaluator.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-optimiser-utility-evaluator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-optimiser-utility-evaluator.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/deployment.yaml b/charts/nebulous-optimiser-utility-evaluator/templates/deployment.yaml new file mode 100644 index 0000000..e8d58b7 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/deployment.yaml @@ -0,0 +1,53 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-optimiser-utility-evaluator.fullname" . }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-optimiser-utility-evaluator.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-optimiser-utility-evaluator.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + 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 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/hpa.yaml b/charts/nebulous-optimiser-utility-evaluator/templates/hpa.yaml new file mode 100644 index 0000000..ba10437 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-optimiser-utility-evaluator.fullname" . }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-optimiser-utility-evaluator.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/ingress.yaml b/charts/nebulous-optimiser-utility-evaluator/templates/ingress.yaml new file mode 100644 index 0000000..e60d794 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-optimiser-utility-evaluator.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/service.yaml b/charts/nebulous-optimiser-utility-evaluator/templates/service.yaml new file mode 100644 index 0000000..5142b49 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-optimiser-utility-evaluator.fullname" . }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-optimiser-utility-evaluator.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-optimiser-utility-evaluator/templates/serviceaccount.yaml b/charts/nebulous-optimiser-utility-evaluator/templates/serviceaccount.yaml new file mode 100644 index 0000000..527bc6c --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-optimiser-utility-evaluator.serviceAccountName" . }} + labels: + {{- include "nebulous-optimiser-utility-evaluator.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-optimiser-utility-evaluator/values.yaml b/charts/nebulous-optimiser-utility-evaluator/values.yaml new file mode 100644 index 0000000..3c39300 --- /dev/null +++ b/charts/nebulous-optimiser-utility-evaluator/values.yaml @@ -0,0 +1,82 @@ +# Default values for nebulous-optimiser-utility-evaluator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/optimiser-utility-evaluator" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/nebulous-overlay-network-manager/.helmignore b/charts/nebulous-overlay-network-manager/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-overlay-network-manager/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-overlay-network-manager/Chart.yaml b/charts/nebulous-overlay-network-manager/Chart.yaml new file mode 100644 index 0000000..60a4c5f --- /dev/null +++ b/charts/nebulous-overlay-network-manager/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-overlay-network-manager +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-overlay-network-manager/templates/NOTES.txt b/charts/nebulous-overlay-network-manager/templates/NOTES.txt new file mode 100644 index 0000000..5d4cf13 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-overlay-network-manager.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-overlay-network-manager.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-overlay-network-manager.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-overlay-network-manager.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 +{{- end }} diff --git a/charts/nebulous-overlay-network-manager/templates/_helpers.tpl b/charts/nebulous-overlay-network-manager/templates/_helpers.tpl new file mode 100644 index 0000000..7ad84b4 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/_helpers.tpl @@ -0,0 +1,76 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-overlay-network-manager.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-overlay-network-manager.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-overlay-network-manager.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-overlay-network-manager.labels" -}} +helm.sh/chart: {{ include "nebulous-overlay-network-manager.chart" . }} +{{ include "nebulous-overlay-network-manager.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "nebulous-overlay-network-manager.postgresql.labels" -}} +helm.sh/chart: {{ include "nebulous-overlay-network-manager.chart" . }} +{{ include "nebulous-overlay-network-manager.postgresql.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-overlay-network-manager.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-overlay-network-manager.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "nebulous-overlay-network-manager.postgresql.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-overlay-network-manager.name" . }}-postgresql +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-overlay-network-manager.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-overlay-network-manager.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-overlay-network-manager/templates/deployment-postgres.yaml b/charts/nebulous-overlay-network-manager/templates/deployment-postgres.yaml new file mode 100644 index 0000000..99fb3ac --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/deployment-postgres.yaml @@ -0,0 +1,64 @@ +{{ if .Values.postgresql.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-overlay-network-manager.fullname" . }}-postgresql + labels: + {{- include "nebulous-overlay-network-manager.postgresql.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "nebulous-overlay-network-manager.postgresql.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "nebulous-overlay-network-manager.postgresql.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: postgresql + image: "{{ .Values.postgresql.image }}" + ports: + - name: postgresql + containerPort: {{ .Values.postgresql.port }} + protocol: TCP + env: + - name: POSTGRES_USER + value: "{{ .Values.postgresql.user }}" + - name: POSTGRES_PASSWORD + value: "{{ .Values.postgresql.password }}" + - name: POSTGRES_DB + value: "{{ .Values.postgresql.dbName }}" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-overlay-network-manager.fullname" . }}-postgresql + labels: + {{- include "nebulous-overlay-network-manager.postgresql.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.postgresql.port }} + targetPort: postgresql + protocol: TCP + name: postgresql + - port: 5050 + targetPort: pgadmin + protocol: TCP + name: pgadmin + selector: + {{- include "nebulous-overlay-network-manager.postgresql.selectorLabels" . | nindent 4 }} +{{ end }} diff --git a/charts/nebulous-overlay-network-manager/templates/deployment.yaml b/charts/nebulous-overlay-network-manager/templates/deployment.yaml new file mode 100644 index 0000000..d11bdc5 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-overlay-network-manager.fullname" . }} + labels: + {{- include "nebulous-overlay-network-manager.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-overlay-network-manager.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-overlay-network-manager.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-overlay-network-manager.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: onm-api + containerPort: 8082 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: POSTGRES_USER + value: {{ .Values.postgresql.user }} + - name: POSTGRES_PASSWORD + value: {{ .Values.postgresql.password }} + - name: POSTGRES_DB + value: {{ .Values.postgresql.database }} + - name: POSTGRES_IP_FQDN + value: "nebulous-overlay-network-manager-postgresql" + - name: POSTGRES_CONNECTION_STRING + value: "jdbc:postgresql://nebulous-overlay-network-manager-postgresql:5432/postgres" + - name: WIREGUARD_NETWORK_PORTION + value: "{{ .Values.customEnv.WIREGUARD_NETWORK_PORTION }}" + - name: WIREGUARD_DEFAULT_SERVER_IP + value: "{{ .Values.customEnv.WIREGUARD_DEFAULT_SERVER_IP }}" + - name: WIREGUARD_ALLOWED_IPS + value: "{{ .Values.customEnv.WIREGUARD_ALLOWED_IPS }}" + - name: _PROD_WG_BOOTSTRAP_AGENT_SCRIPTS_DIR + value: "{{ .Values.customEnv._PROD_WG_BOOTSTRAP_AGENT_SCRIPTS_DIR }}" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-overlay-network-manager/templates/hpa.yaml b/charts/nebulous-overlay-network-manager/templates/hpa.yaml new file mode 100644 index 0000000..099f0c3 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-overlay-network-manager.fullname" . }} + labels: + {{- include "nebulous-overlay-network-manager.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-overlay-network-manager.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-overlay-network-manager/templates/ingress.yaml b/charts/nebulous-overlay-network-manager/templates/ingress.yaml new file mode 100644 index 0000000..1012f0b --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-overlay-network-manager.fullname" . -}} +{{- $svcPort := .Values.service.onmApiApplicationPort -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-overlay-network-manager.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-overlay-network-manager/templates/service.yaml b/charts/nebulous-overlay-network-manager/templates/service.yaml new file mode 100644 index 0000000..777a2e7 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-overlay-network-manager.fullname" . }} + labels: + {{- include "nebulous-overlay-network-manager.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.pgadminPort }} + targetPort: {{ .Values.service.pgadminPort }} + protocol: TCP + name: pgadmin + - port: {{ .Values.service.onmApiExposePort }} + targetPort: {{ .Values.service.onmApiApplicationPort }} + protocol: TCP + name: onm-api + selector: + {{- include "nebulous-overlay-network-manager.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-overlay-network-manager/templates/serviceaccount.yaml b/charts/nebulous-overlay-network-manager/templates/serviceaccount.yaml new file mode 100644 index 0000000..01e823b --- /dev/null +++ b/charts/nebulous-overlay-network-manager/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-overlay-network-manager.serviceAccountName" . }} + labels: + {{- include "nebulous-overlay-network-manager.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-overlay-network-manager/values.yaml b/charts/nebulous-overlay-network-manager/values.yaml new file mode 100644 index 0000000..b912c41 --- /dev/null +++ b/charts/nebulous-overlay-network-manager/values.yaml @@ -0,0 +1,101 @@ +# Default values for nebulous-overlay-network-manager. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/overlay-network-manager" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: + {} + # fsGroup: 2000 + +securityContext: + {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + pgadminPort: 5050 + onmApiExposePort: 8082 + onmApiApplicationPort: 8080 + +ingress: + enabled: false + className: "" + annotations: + {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +postgresql: + enabled: true + image: "docker.io/postgres:16" + user: "postgresql" + password: "postgresql" + dbName: "postgres" + port: 5432 + +customEnv: + WIREGUARD_NETWORK_PORTION: "192.168.55." + _PROD_WG_BOOTSTRAP_AGENT_SCRIPTS_DIR: "/deployments/wg-bootstrap-agent-scripts" diff --git a/charts/nebulous-prediction-orchestrator/.helmignore b/charts/nebulous-prediction-orchestrator/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-prediction-orchestrator/Chart.yaml b/charts/nebulous-prediction-orchestrator/Chart.yaml new file mode 100644 index 0000000..a1fe565 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-prediction-orchestrator +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-prediction-orchestrator/templates/NOTES.txt b/charts/nebulous-prediction-orchestrator/templates/NOTES.txt new file mode 100644 index 0000000..611d716 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-prediction-orchestrator.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-prediction-orchestrator.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-prediction-orchestrator.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-prediction-orchestrator.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 +{{- end }} diff --git a/charts/nebulous-prediction-orchestrator/templates/_helpers.tpl b/charts/nebulous-prediction-orchestrator/templates/_helpers.tpl new file mode 100644 index 0000000..f1e846c --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-prediction-orchestrator.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-prediction-orchestrator.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-prediction-orchestrator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-prediction-orchestrator.labels" -}} +helm.sh/chart: {{ include "nebulous-prediction-orchestrator.chart" . }} +{{ include "nebulous-prediction-orchestrator.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-prediction-orchestrator.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-prediction-orchestrator.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-prediction-orchestrator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-prediction-orchestrator.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-prediction-orchestrator/templates/deployment.yaml b/charts/nebulous-prediction-orchestrator/templates/deployment.yaml new file mode 100644 index 0000000..1597893 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-prediction-orchestrator.fullname" . }} + labels: + {{- include "nebulous-prediction-orchestrator.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-prediction-orchestrator.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-prediction-orchestrator.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-prediction-orchestrator.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: EXN_HOST + value: "{{ .Values.application.env.exnHost }}" + - name: EXN_PORT + value: "{{ .Values.application.env.exnPort | toString }}" + - name: EXN_USERNAME + value: "{{ .Values.application.env.exnUsername }}" + - name: EXN_PASSWORD + value: "{{ .Values.application.env.exnPassword }}" + - name: EXN_RETRY_ATTEMPTS + value: "{{ .Values.application.env.exnRetryAttempts | toString }}" + - name: SERVER_PORT + value: "{{ .Values.application.env.serverPort | toString }}" + ports: + - name: http + containerPort: 3333 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-prediction-orchestrator/templates/hpa.yaml b/charts/nebulous-prediction-orchestrator/templates/hpa.yaml new file mode 100644 index 0000000..db0d331 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-prediction-orchestrator.fullname" . }} + labels: + {{- include "nebulous-prediction-orchestrator.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-prediction-orchestrator.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-prediction-orchestrator/templates/ingress.yaml b/charts/nebulous-prediction-orchestrator/templates/ingress.yaml new file mode 100644 index 0000000..c37535a --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-prediction-orchestrator.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-prediction-orchestrator.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-prediction-orchestrator/templates/service.yaml b/charts/nebulous-prediction-orchestrator/templates/service.yaml new file mode 100644 index 0000000..ac55899 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-prediction-orchestrator.fullname" . }} + labels: + {{- include "nebulous-prediction-orchestrator.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-prediction-orchestrator.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-prediction-orchestrator/templates/serviceaccount.yaml b/charts/nebulous-prediction-orchestrator/templates/serviceaccount.yaml new file mode 100644 index 0000000..baf6387 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-prediction-orchestrator.serviceAccountName" . }} + labels: + {{- include "nebulous-prediction-orchestrator.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-prediction-orchestrator/values.yaml b/charts/nebulous-prediction-orchestrator/values.yaml new file mode 100644 index 0000000..1d6ddc1 --- /dev/null +++ b/charts/nebulous-prediction-orchestrator/values.yaml @@ -0,0 +1,91 @@ +# Default values for nebulous-prediction-orchestrator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/prediction-orchestrator" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 3333 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +application: + env: + exnHost: "nebulous-activemq" + exnPort: 5672 + exnUsername: "admin" + exnPassword: "admin" + exnRetryAttempts: 5 + serverPort: 3333 diff --git a/charts/nebulous-resource-manager/.helmignore b/charts/nebulous-resource-manager/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-resource-manager/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-resource-manager/Chart.yaml b/charts/nebulous-resource-manager/Chart.yaml new file mode 100644 index 0000000..b9cb49d --- /dev/null +++ b/charts/nebulous-resource-manager/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-resource-manager +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-resource-manager/templates/NOTES.txt b/charts/nebulous-resource-manager/templates/NOTES.txt new file mode 100644 index 0000000..e05eb90 --- /dev/null +++ b/charts/nebulous-resource-manager/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-resource-manager.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-resource-manager.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-resource-manager.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-resource-manager.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 +{{- end }} diff --git a/charts/nebulous-resource-manager/templates/_helpers.tpl b/charts/nebulous-resource-manager/templates/_helpers.tpl new file mode 100644 index 0000000..44bd13a --- /dev/null +++ b/charts/nebulous-resource-manager/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-resource-manager.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-resource-manager.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-resource-manager.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-resource-manager.labels" -}} +helm.sh/chart: {{ include "nebulous-resource-manager.chart" . }} +{{ include "nebulous-resource-manager.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-resource-manager.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-resource-manager.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-resource-manager.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-resource-manager.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-resource-manager/templates/deployment.yaml b/charts/nebulous-resource-manager/templates/deployment.yaml new file mode 100644 index 0000000..2e15628 --- /dev/null +++ b/charts/nebulous-resource-manager/templates/deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-resource-manager.fullname" . }} + labels: + {{- include "nebulous-resource-manager.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-resource-manager.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-resource-manager.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-resource-manager.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + ports: + - name: http + containerPort: 8080 + protocol: TCP +# livenessProbe: +# httpGet: +# path: / +# port: http +# readinessProbe: +# httpGet: +# path: / +# port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + - name: {{ .Chart.Name }}-mongodb + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "docker.io/library/mongo:4.4.29" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range .Values.env }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + ports: + - name: mongo-port + containerPort: 27017 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-resource-manager/templates/hpa.yaml b/charts/nebulous-resource-manager/templates/hpa.yaml new file mode 100644 index 0000000..0e00f40 --- /dev/null +++ b/charts/nebulous-resource-manager/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-resource-manager.fullname" . }} + labels: + {{- include "nebulous-resource-manager.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-resource-manager.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-resource-manager/templates/ingress.yaml b/charts/nebulous-resource-manager/templates/ingress.yaml new file mode 100644 index 0000000..2fbe650 --- /dev/null +++ b/charts/nebulous-resource-manager/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-resource-manager.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-resource-manager.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-resource-manager/templates/service.yaml b/charts/nebulous-resource-manager/templates/service.yaml new file mode 100644 index 0000000..6cff93d --- /dev/null +++ b/charts/nebulous-resource-manager/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-resource-manager.fullname" . }} + labels: + {{- include "nebulous-resource-manager.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-resource-manager.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-resource-manager/templates/serviceaccount.yaml b/charts/nebulous-resource-manager/templates/serviceaccount.yaml new file mode 100644 index 0000000..422e1ef --- /dev/null +++ b/charts/nebulous-resource-manager/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-resource-manager.serviceAccountName" . }} + labels: + {{- include "nebulous-resource-manager.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-resource-manager/values.yaml b/charts/nebulous-resource-manager/values.yaml new file mode 100644 index 0000000..78273c2 --- /dev/null +++ b/charts/nebulous-resource-manager/values.yaml @@ -0,0 +1,98 @@ +# Default values for nebulous-resource-manager. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/resource-manager" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +env: + # ===== MongoDB configuration ===== + - name: MONGO_INITDB_ROOT_USERNAME + value: 'root' + - name: MONGO_INITDB_ROOT_PASSWORD + value: 'example' + # ===== Resource Manager configuration ===== + - name: SPRING_DATA_MONGODB_URI + value: 'mongodb://root:example@localhost:27017/admin' + - name: DISCOVERY_BROKER_USERNAME + value: 'aaa' + - name: DISCOVERY_BROKER_PASSWORD + value: '111' + - name: DISCOVERY_BROKERURL + value: 'tcp://nebulous-monitoring:61616?daemon=true&trace=false&useInactivityMonitor=false&connectionTimeout=0&keepAlive=true' diff --git a/charts/nebulous-slo-violation-detector/.helmignore b/charts/nebulous-slo-violation-detector/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/nebulous-slo-violation-detector/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/nebulous-slo-violation-detector/Chart.yaml b/charts/nebulous-slo-violation-detector/Chart.yaml new file mode 100644 index 0000000..ad63e61 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: nebulous-slo-violation-detector +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/nebulous-slo-violation-detector/templates/NOTES.txt b/charts/nebulous-slo-violation-detector/templates/NOTES.txt new file mode 100644 index 0000000..5587e66 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nebulous-slo-violation-detector.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nebulous-slo-violation-detector.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nebulous-slo-violation-detector.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nebulous-slo-violation-detector.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 +{{- end }} diff --git a/charts/nebulous-slo-violation-detector/templates/_helpers.tpl b/charts/nebulous-slo-violation-detector/templates/_helpers.tpl new file mode 100644 index 0000000..66bd8ee --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nebulous-slo-violation-detector.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "nebulous-slo-violation-detector.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "nebulous-slo-violation-detector.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nebulous-slo-violation-detector.labels" -}} +helm.sh/chart: {{ include "nebulous-slo-violation-detector.chart" . }} +{{ include "nebulous-slo-violation-detector.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nebulous-slo-violation-detector.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-slo-violation-detector.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nebulous-slo-violation-detector.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nebulous-slo-violation-detector.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/nebulous-slo-violation-detector/templates/deployment.yaml b/charts/nebulous-slo-violation-detector/templates/deployment.yaml new file mode 100644 index 0000000..091c011 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-slo-violation-detector.fullname" . }} + labels: + {{- include "nebulous-slo-violation-detector.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "nebulous-slo-violation-detector.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "nebulous-slo-violation-detector.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "nebulous-slo-violation-detector.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + 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 +# protocol: TCP + livenessProbe: + exec: + command: + - ls + - /home + readinessProbe: + exec: + command: + - ls + - /home + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/nebulous-slo-violation-detector/templates/hpa.yaml b/charts/nebulous-slo-violation-detector/templates/hpa.yaml new file mode 100644 index 0000000..2aca2f1 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "nebulous-slo-violation-detector.fullname" . }} + labels: + {{- include "nebulous-slo-violation-detector.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "nebulous-slo-violation-detector.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-slo-violation-detector/templates/ingress.yaml b/charts/nebulous-slo-violation-detector/templates/ingress.yaml new file mode 100644 index 0000000..6344999 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "nebulous-slo-violation-detector.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "nebulous-slo-violation-detector.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-slo-violation-detector/templates/service.yaml b/charts/nebulous-slo-violation-detector/templates/service.yaml new file mode 100644 index 0000000..1274c60 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-slo-violation-detector.fullname" . }} + labels: + {{- include "nebulous-slo-violation-detector.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "nebulous-slo-violation-detector.selectorLabels" . | nindent 4 }} diff --git a/charts/nebulous-slo-violation-detector/templates/serviceaccount.yaml b/charts/nebulous-slo-violation-detector/templates/serviceaccount.yaml new file mode 100644 index 0000000..b847691 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "nebulous-slo-violation-detector.serviceAccountName" . }} + labels: + {{- include "nebulous-slo-violation-detector.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/nebulous-slo-violation-detector/values.yaml b/charts/nebulous-slo-violation-detector/values.yaml new file mode 100644 index 0000000..079e3b2 --- /dev/null +++ b/charts/nebulous-slo-violation-detector/values.yaml @@ -0,0 +1,82 @@ +# Default values for nebulous-slo-violation-detector. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: "quay.io/nebulous/slo-violation-detector" + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # 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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {}