From 6683860063315dd0b5d863d2ab50c3031837e9d2 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 27 Aug 2021 18:10:51 +0200 Subject: [PATCH 1/7] Add parent trento-server chart --- helm/trento-server/Chart.yaml | 25 +++++++++++++++++++++++++ helm/trento-server/templates/NOTES.txt | 26 ++++++++++++++++++++++++++ helm/trento-server/values.yaml | 19 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 helm/trento-server/Chart.yaml create mode 100644 helm/trento-server/templates/NOTES.txt create mode 100644 helm/trento-server/values.yaml diff --git a/helm/trento-server/Chart.yaml b/helm/trento-server/Chart.yaml new file mode 100644 index 000000000..2b3fee2b9 --- /dev/null +++ b/helm/trento-server/Chart.yaml @@ -0,0 +1,25 @@ +apiVersion: v2 +name: Trento server chart +description: The trento server chart contains all the components necessary to run a Trento server. +type: application +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates +version: 0.1.0 + +dependencies: + - name: trento-web + repository: file://charts/trento-web + version: ">0.0.0" + condition: trento-web.enabled + - name: trento-runner + repository: file://charts/trento-runner + version: ">0.0.0" + condition: trento-runner.enabled + - name: ara + repository: file://charts/ara + version: ">0.0.0" + condition: ara.enabled + - name: consul + version: "~0.32.1" + repository: https://helm.releases.hashicorp.com + condition: consul.enabled \ No newline at end of file diff --git a/helm/trento-server/templates/NOTES.txt b/helm/trento-server/templates/NOTES.txt new file mode 100644 index 000000000..e8fda869d --- /dev/null +++ b/helm/trento-server/templates/NOTES.txt @@ -0,0 +1,26 @@ +Trento Server installed! + _ _ _ _ _ _ _ _ + | |_| |_| | | |_| |_| | + \ . / \ . . / + \ , / \ . / + | . |_ _ _ _ _ _| , | + | .| |_| |_| |_| |_| |_| | . | + | , | . . . . | .| + | . | . . . . , |. | + ___----_____| . |. , _______ . | , |---~_____ +_---~ | | . /+++++++\ . | . | ~---_ + |. | . |+++++++| . | . | ~-_ + __ | . | , |+++++++|. . _|__ | ~-_ + ____--`~ '--~~__ . |++++ __|----~ ~`---, ___^~-__ +-~--~ ~---__|,--~' ~~----_____-~' `~----~ + + +{{- if (index .Values "trento-web").enabled }} +{{- if (index .Values "trento-web").ingress.enabled }} +{{- range $host := (index .Values "trento-web").ingress.hosts }} + {{- range .paths }} +URL: http{{ if (index $.Values "trento-web").ingress.tls }}s{{ end }}://{{ $host.host }} + {{- end }} +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/trento-server/values.yaml b/helm/trento-server/values.yaml new file mode 100644 index 000000000..161c5cd9d --- /dev/null +++ b/helm/trento-server/values.yaml @@ -0,0 +1,19 @@ +### Global Values if any ### +global: {} + +### Sub Charts Specific Values ### +trento-web: + enabled: true + +trento-runner: + enabled: true + +ara: + enabled: true + +consul: + enabled: true + server: + bootstrapExpect: 1 + replicas: 1 + exposeGossipAndRPCPorts: true From e808463581afe5bf16ee53deec9235994bc011aa Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 27 Aug 2021 18:11:06 +0200 Subject: [PATCH 2/7] Add ara chart --- helm/trento-server/charts/ara/.helmignore | 23 +++++++ helm/trento-server/charts/ara/Chart.yaml | 24 +++++++ .../charts/ara/templates/NOTES.txt | 1 + .../charts/ara/templates/_helpers.tpl | 62 +++++++++++++++++ .../charts/ara/templates/deployment.yaml | 64 +++++++++++++++++ .../charts/ara/templates/hpa.yaml | 28 ++++++++ .../charts/ara/templates/service.yaml | 15 ++++ .../charts/ara/templates/serviceaccount.yaml | 12 ++++ .../ara/templates/tests/test-connection.yaml | 15 ++++ helm/trento-server/charts/ara/values.yaml | 69 +++++++++++++++++++ 10 files changed, 313 insertions(+) create mode 100644 helm/trento-server/charts/ara/.helmignore create mode 100644 helm/trento-server/charts/ara/Chart.yaml create mode 100644 helm/trento-server/charts/ara/templates/NOTES.txt create mode 100644 helm/trento-server/charts/ara/templates/_helpers.tpl create mode 100644 helm/trento-server/charts/ara/templates/deployment.yaml create mode 100644 helm/trento-server/charts/ara/templates/hpa.yaml create mode 100644 helm/trento-server/charts/ara/templates/service.yaml create mode 100644 helm/trento-server/charts/ara/templates/serviceaccount.yaml create mode 100644 helm/trento-server/charts/ara/templates/tests/test-connection.yaml create mode 100644 helm/trento-server/charts/ara/values.yaml diff --git a/helm/trento-server/charts/ara/.helmignore b/helm/trento-server/charts/ara/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/trento-server/charts/ara/.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/helm/trento-server/charts/ara/Chart.yaml b/helm/trento-server/charts/ara/Chart.yaml new file mode 100644 index 000000000..7026b9221 --- /dev/null +++ b/helm/trento-server/charts/ara/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ara +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: "0.0.1" diff --git a/helm/trento-server/charts/ara/templates/NOTES.txt b/helm/trento-server/charts/ara/templates/NOTES.txt new file mode 100644 index 000000000..99d226dcb --- /dev/null +++ b/helm/trento-server/charts/ara/templates/NOTES.txt @@ -0,0 +1 @@ +ARA Chart installed! diff --git a/helm/trento-server/charts/ara/templates/_helpers.tpl b/helm/trento-server/charts/ara/templates/_helpers.tpl new file mode 100644 index 000000000..4c7a944ea --- /dev/null +++ b/helm/trento-server/charts/ara/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ara.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 "ara.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 "ara.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ara.labels" -}} +helm.sh/chart: {{ include "ara.chart" . }} +{{ include "ara.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ara.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ara.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ara.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ara.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/trento-server/charts/ara/templates/deployment.yaml b/helm/trento-server/charts/ara/templates/deployment.yaml new file mode 100644 index 000000000..853e79fb4 --- /dev/null +++ b/helm/trento-server/charts/ara/templates/deployment.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ara.fullname" . }} + labels: + {{- include "ara.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ara.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ara.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ara.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: ARA_ALLOWED_HOSTS + value: "['*']" + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + 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/helm/trento-server/charts/ara/templates/hpa.yaml b/helm/trento-server/charts/ara/templates/hpa.yaml new file mode 100644 index 000000000..9e8b66ae7 --- /dev/null +++ b/helm/trento-server/charts/ara/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "ara.fullname" . }} + labels: + {{- include "ara.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "ara.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/helm/trento-server/charts/ara/templates/service.yaml b/helm/trento-server/charts/ara/templates/service.yaml new file mode 100644 index 000000000..5b357f153 --- /dev/null +++ b/helm/trento-server/charts/ara/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ara.fullname" . }} + labels: + {{- include "ara.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "ara.selectorLabels" . | nindent 4 }} diff --git a/helm/trento-server/charts/ara/templates/serviceaccount.yaml b/helm/trento-server/charts/ara/templates/serviceaccount.yaml new file mode 100644 index 000000000..dac15dc20 --- /dev/null +++ b/helm/trento-server/charts/ara/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ara.serviceAccountName" . }} + labels: + {{- include "ara.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/trento-server/charts/ara/templates/tests/test-connection.yaml b/helm/trento-server/charts/ara/templates/tests/test-connection.yaml new file mode 100644 index 000000000..21c24b7dd --- /dev/null +++ b/helm/trento-server/charts/ara/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "ara.fullname" . }}-test-connection" + labels: + {{- include "ara.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "ara.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/helm/trento-server/charts/ara/values.yaml b/helm/trento-server/charts/ara/values.yaml new file mode 100644 index 000000000..de2f674bd --- /dev/null +++ b/helm/trento-server/charts/ara/values.yaml @@ -0,0 +1,69 @@ +# Default values for ara. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: recordsansible/ara-api + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "fedora33-pypi-latest" + +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: 8000 + +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: {} From 0aed992baab06af087d225719c618e86615e1e62 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 27 Aug 2021 18:11:50 +0200 Subject: [PATCH 3/7] Add trento web chart --- .../charts/trento-web/.helmignore | 23 +++++ .../charts/trento-web/Chart.yaml | 24 ++++++ .../charts/trento-web/templates/NOTES.txt | 22 +++++ .../charts/trento-web/templates/_helpers.tpl | 62 ++++++++++++++ .../trento-web/templates/deployment.yaml | 71 ++++++++++++++++ .../charts/trento-web/templates/hpa.yaml | 28 ++++++ .../charts/trento-web/templates/ingress.yaml | 61 +++++++++++++ .../charts/trento-web/templates/service.yaml | 15 ++++ .../trento-web/templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ .../charts/trento-web/values.yaml | 85 +++++++++++++++++++ 11 files changed, 418 insertions(+) create mode 100644 helm/trento-server/charts/trento-web/.helmignore create mode 100644 helm/trento-server/charts/trento-web/Chart.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/NOTES.txt create mode 100644 helm/trento-server/charts/trento-web/templates/_helpers.tpl create mode 100644 helm/trento-server/charts/trento-web/templates/deployment.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/hpa.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/ingress.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/service.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/serviceaccount.yaml create mode 100644 helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml create mode 100644 helm/trento-server/charts/trento-web/values.yaml diff --git a/helm/trento-server/charts/trento-web/.helmignore b/helm/trento-server/charts/trento-web/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/trento-server/charts/trento-web/.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/helm/trento-server/charts/trento-web/Chart.yaml b/helm/trento-server/charts/trento-web/Chart.yaml new file mode 100644 index 000000000..57c76ac9d --- /dev/null +++ b/helm/trento-server/charts/trento-web/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: trento-web +description: Trento Web Chart + +# 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: "0.3.0" diff --git a/helm/trento-server/charts/trento-web/templates/NOTES.txt b/helm/trento-server/charts/trento-web/templates/NOTES.txt new file mode 100644 index 000000000..12fd30112 --- /dev/null +++ b/helm/trento-server/charts/trento-web/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 "trento-web.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 "trento-web.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "trento-web.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 "trento-web.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/helm/trento-server/charts/trento-web/templates/_helpers.tpl b/helm/trento-server/charts/trento-web/templates/_helpers.tpl new file mode 100644 index 000000000..f1729a8c5 --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "trento-web.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 "trento-web.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 "trento-web.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "trento-web.labels" -}} +helm.sh/chart: {{ include "trento-web.chart" . }} +{{ include "trento-web.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "trento-web.selectorLabels" -}} +app.kubernetes.io/name: {{ include "trento-web.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "trento-web.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "trento-web.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/trento-server/charts/trento-web/templates/deployment.yaml b/helm/trento-server/charts/trento-web/templates/deployment.yaml new file mode 100644 index 000000000..6816db921 --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/deployment.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "trento-web.fullname" . }} + labels: + {{- include "trento-web.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "trento-web.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "trento-web.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "trento-web.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + args: + - web + - serve + - --ara-addr + - {{ .Release.Name }}-ara:8000 + - -p + - "{{ .Values.service.port }}" + env: + - name: CONSUL_HTTP_ADDR + value: {{ .Release.Name }}-consul-server:8500 + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: /api/ping + port: http + readinessProbe: + httpGet: + path: /api/ping + 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/helm/trento-server/charts/trento-web/templates/hpa.yaml b/helm/trento-server/charts/trento-web/templates/hpa.yaml new file mode 100644 index 000000000..f583ddffc --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "trento-web.fullname" . }} + labels: + {{- include "trento-web.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "trento-web.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/helm/trento-server/charts/trento-web/templates/ingress.yaml b/helm/trento-server/charts/trento-web/templates/ingress.yaml new file mode 100644 index 000000000..283f36bc8 --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "trento-web.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 "trento-web.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/helm/trento-server/charts/trento-web/templates/service.yaml b/helm/trento-server/charts/trento-web/templates/service.yaml new file mode 100644 index 000000000..f519cb84c --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "trento-web.fullname" . }} + labels: + {{- include "trento-web.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "trento-web.selectorLabels" . | nindent 4 }} diff --git a/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml b/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml new file mode 100644 index 000000000..c5e8d0c38 --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "trento-web.serviceAccountName" . }} + labels: + {{- include "trento-web.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml b/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml new file mode 100644 index 000000000..6f98ca154 --- /dev/null +++ b/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "trento-web.fullname" . }}-test-connection" + labels: + {{- include "trento-web.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "trento-web.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/helm/trento-server/charts/trento-web/values.yaml b/helm/trento-server/charts/trento-web/values.yaml new file mode 100644 index 000000000..91e94dfc0 --- /dev/null +++ b/helm/trento-server/charts/trento-web/values.yaml @@ -0,0 +1,85 @@ +# Default values for trento-web. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: ghcr.io/fabriziosestito/trento + 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: true + className: "" + annotations: + kubernetes.io/ingress.class: "traefik" + kubernetes.io/tls-acme: "true" + hosts: + - host: "localhost" + 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: {} From 5b9122e7e5f8f7612aa6fcb7d8906a7166c75b27 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 27 Aug 2021 18:11:38 +0200 Subject: [PATCH 4/7] Add trento runner chart --- .../charts/trento-runner/.helmignore | 23 +++++ .../charts/trento-runner/Chart.yaml | 24 ++++++ .../charts/trento-runner/templates/NOTES.txt | 1 + .../trento-runner/templates/_helpers.tpl | 62 ++++++++++++++ .../trento-runner/templates/deployment.yaml | 85 +++++++++++++++++++ .../charts/trento-runner/templates/hpa.yaml | 28 ++++++ .../trento-runner/templates/privatekey.yaml | 7 ++ .../trento-runner/templates/service.yaml | 15 ++++ .../templates/serviceaccount.yaml | 12 +++ .../templates/tests/test-connection.yaml | 15 ++++ .../charts/trento-runner/values.yaml | 84 ++++++++++++++++++ 11 files changed, 356 insertions(+) create mode 100644 helm/trento-server/charts/trento-runner/.helmignore create mode 100644 helm/trento-server/charts/trento-runner/Chart.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/NOTES.txt create mode 100644 helm/trento-server/charts/trento-runner/templates/_helpers.tpl create mode 100644 helm/trento-server/charts/trento-runner/templates/deployment.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/hpa.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/privatekey.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/service.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml create mode 100644 helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml create mode 100644 helm/trento-server/charts/trento-runner/values.yaml diff --git a/helm/trento-server/charts/trento-runner/.helmignore b/helm/trento-server/charts/trento-runner/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/.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/helm/trento-server/charts/trento-runner/Chart.yaml b/helm/trento-server/charts/trento-runner/Chart.yaml new file mode 100644 index 000000000..f15a4b059 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: trento-runner +description: Trento runner chart + +# 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: "1.16.0" diff --git a/helm/trento-server/charts/trento-runner/templates/NOTES.txt b/helm/trento-server/charts/trento-runner/templates/NOTES.txt new file mode 100644 index 000000000..7de35cc27 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/NOTES.txt @@ -0,0 +1 @@ +Trento (runner) installed! \ No newline at end of file diff --git a/helm/trento-server/charts/trento-runner/templates/_helpers.tpl b/helm/trento-server/charts/trento-runner/templates/_helpers.tpl new file mode 100644 index 000000000..84cfb2f7e --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "trento-runner.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 "trento-runner.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 "trento-runner.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "trento-runner.labels" -}} +helm.sh/chart: {{ include "trento-runner.chart" . }} +{{ include "trento-runner.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "trento-runner.selectorLabels" -}} +app.kubernetes.io/name: {{ include "trento-runner.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "trento-runner.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "trento-runner.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/trento-server/charts/trento-runner/templates/deployment.yaml b/helm/trento-server/charts/trento-runner/templates/deployment.yaml new file mode 100644 index 000000000..6ccae2ab7 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/deployment.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "trento-runner.fullname" . }} + labels: + {{- include "trento-runner.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "trento-runner.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "trento-runner.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "trento-runner.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + args: + - runner + - start + - --ara-server + - http://{{ .Release.Name }}-ara:8000 + - --consul-addr + - "{{ .Release.Name }}-consul-server:8500" + - -i + - "5" + env: + - name: CONSUL_HTTP_ADDR + value: + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + exec: + command: + - /usr/bin/true + readinessProbe: + exec: + command: + - /usr/bin/true + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: sshconfig + mountPath: "/root/.ssh" + readOnly: true + {{- 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: sshconfig + secret: + secretName: trento-runner-privatekey + defaultMode: 0400 + items: + - key: privatekey + path: id_rsa \ No newline at end of file diff --git a/helm/trento-server/charts/trento-runner/templates/hpa.yaml b/helm/trento-server/charts/trento-runner/templates/hpa.yaml new file mode 100644 index 000000000..0ee4465a6 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "trento-runner.fullname" . }} + labels: + {{- include "trento-runner.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "trento-runner.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/helm/trento-server/charts/trento-runner/templates/privatekey.yaml b/helm/trento-server/charts/trento-runner/templates/privatekey.yaml new file mode 100644 index 000000000..30264b8eb --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/privatekey.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: trento-runner-privatekey +data: + privatekey: |- + {{ .Values.privateKey | b64enc }} \ No newline at end of file diff --git a/helm/trento-server/charts/trento-runner/templates/service.yaml b/helm/trento-server/charts/trento-runner/templates/service.yaml new file mode 100644 index 000000000..f106c6799 --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "trento-runner.fullname" . }} + labels: + {{- include "trento-runner.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "trento-runner.selectorLabels" . | nindent 4 }} diff --git a/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml b/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml new file mode 100644 index 000000000..0232a7bde --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "trento-runner.serviceAccountName" . }} + labels: + {{- include "trento-runner.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml b/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml new file mode 100644 index 000000000..f32db174d --- /dev/null +++ b/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "trento-runner.fullname" . }}-test-connection" + labels: + {{- include "trento-runner.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "trento-runner.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/helm/trento-server/charts/trento-runner/values.yaml b/helm/trento-server/charts/trento-runner/values.yaml new file mode 100644 index 000000000..f2e772f7e --- /dev/null +++ b/helm/trento-server/charts/trento-runner/values.yaml @@ -0,0 +1,84 @@ +# Default values for trento-runner. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +privateKey: "" + +image: + repository: ghcr.io/fabriziosestito/trento + 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: {} \ No newline at end of file From bcb22857ae0715d88bd8931b8a6ab123406e9974 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Fri, 27 Aug 2021 18:12:17 +0200 Subject: [PATCH 5/7] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d21851301..e93d088c7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /build /web/frontend/assets /web/frontend/node_modules +/helm/trento-server/charts/*.tgz \ No newline at end of file From a44c0fb57fd971194e64f4a7f5ab0bff536e240a Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Tue, 14 Sep 2021 11:20:40 +0200 Subject: [PATCH 6/7] Move helm chart in packaging folder --- {helm => packaging/helm}/trento-server/Chart.yaml | 0 {helm => packaging/helm}/trento-server/charts/ara/.helmignore | 0 {helm => packaging/helm}/trento-server/charts/ara/Chart.yaml | 0 .../helm}/trento-server/charts/ara/templates/NOTES.txt | 0 .../helm}/trento-server/charts/ara/templates/_helpers.tpl | 0 .../helm}/trento-server/charts/ara/templates/deployment.yaml | 0 .../helm}/trento-server/charts/ara/templates/hpa.yaml | 0 .../helm}/trento-server/charts/ara/templates/service.yaml | 0 .../helm}/trento-server/charts/ara/templates/serviceaccount.yaml | 0 .../trento-server/charts/ara/templates/tests/test-connection.yaml | 0 {helm => packaging/helm}/trento-server/charts/ara/values.yaml | 0 .../helm}/trento-server/charts/trento-runner/.helmignore | 0 .../helm}/trento-server/charts/trento-runner/Chart.yaml | 0 .../helm}/trento-server/charts/trento-runner/templates/NOTES.txt | 0 .../trento-server/charts/trento-runner/templates/_helpers.tpl | 0 .../trento-server/charts/trento-runner/templates/deployment.yaml | 0 .../helm}/trento-server/charts/trento-runner/templates/hpa.yaml | 0 .../trento-server/charts/trento-runner/templates/privatekey.yaml | 0 .../trento-server/charts/trento-runner/templates/service.yaml | 0 .../charts/trento-runner/templates/serviceaccount.yaml | 0 .../charts/trento-runner/templates/tests/test-connection.yaml | 0 .../helm}/trento-server/charts/trento-runner/values.yaml | 0 .../helm}/trento-server/charts/trento-web/.helmignore | 0 .../helm}/trento-server/charts/trento-web/Chart.yaml | 0 .../helm}/trento-server/charts/trento-web/templates/NOTES.txt | 0 .../helm}/trento-server/charts/trento-web/templates/_helpers.tpl | 0 .../trento-server/charts/trento-web/templates/deployment.yaml | 0 .../helm}/trento-server/charts/trento-web/templates/hpa.yaml | 0 .../helm}/trento-server/charts/trento-web/templates/ingress.yaml | 0 .../helm}/trento-server/charts/trento-web/templates/service.yaml | 0 .../trento-server/charts/trento-web/templates/serviceaccount.yaml | 0 .../charts/trento-web/templates/tests/test-connection.yaml | 0 .../helm}/trento-server/charts/trento-web/values.yaml | 0 {helm => packaging/helm}/trento-server/templates/NOTES.txt | 0 {helm => packaging/helm}/trento-server/values.yaml | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename {helm => packaging/helm}/trento-server/Chart.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/.helmignore (100%) rename {helm => packaging/helm}/trento-server/charts/ara/Chart.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/NOTES.txt (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/_helpers.tpl (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/deployment.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/hpa.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/service.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/serviceaccount.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/templates/tests/test-connection.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/ara/values.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/.helmignore (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/Chart.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/NOTES.txt (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/_helpers.tpl (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/deployment.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/hpa.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/privatekey.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/service.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/serviceaccount.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/templates/tests/test-connection.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-runner/values.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/.helmignore (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/Chart.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/NOTES.txt (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/_helpers.tpl (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/deployment.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/hpa.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/ingress.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/service.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/serviceaccount.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/templates/tests/test-connection.yaml (100%) rename {helm => packaging/helm}/trento-server/charts/trento-web/values.yaml (100%) rename {helm => packaging/helm}/trento-server/templates/NOTES.txt (100%) rename {helm => packaging/helm}/trento-server/values.yaml (100%) diff --git a/helm/trento-server/Chart.yaml b/packaging/helm/trento-server/Chart.yaml similarity index 100% rename from helm/trento-server/Chart.yaml rename to packaging/helm/trento-server/Chart.yaml diff --git a/helm/trento-server/charts/ara/.helmignore b/packaging/helm/trento-server/charts/ara/.helmignore similarity index 100% rename from helm/trento-server/charts/ara/.helmignore rename to packaging/helm/trento-server/charts/ara/.helmignore diff --git a/helm/trento-server/charts/ara/Chart.yaml b/packaging/helm/trento-server/charts/ara/Chart.yaml similarity index 100% rename from helm/trento-server/charts/ara/Chart.yaml rename to packaging/helm/trento-server/charts/ara/Chart.yaml diff --git a/helm/trento-server/charts/ara/templates/NOTES.txt b/packaging/helm/trento-server/charts/ara/templates/NOTES.txt similarity index 100% rename from helm/trento-server/charts/ara/templates/NOTES.txt rename to packaging/helm/trento-server/charts/ara/templates/NOTES.txt diff --git a/helm/trento-server/charts/ara/templates/_helpers.tpl b/packaging/helm/trento-server/charts/ara/templates/_helpers.tpl similarity index 100% rename from helm/trento-server/charts/ara/templates/_helpers.tpl rename to packaging/helm/trento-server/charts/ara/templates/_helpers.tpl diff --git a/helm/trento-server/charts/ara/templates/deployment.yaml b/packaging/helm/trento-server/charts/ara/templates/deployment.yaml similarity index 100% rename from helm/trento-server/charts/ara/templates/deployment.yaml rename to packaging/helm/trento-server/charts/ara/templates/deployment.yaml diff --git a/helm/trento-server/charts/ara/templates/hpa.yaml b/packaging/helm/trento-server/charts/ara/templates/hpa.yaml similarity index 100% rename from helm/trento-server/charts/ara/templates/hpa.yaml rename to packaging/helm/trento-server/charts/ara/templates/hpa.yaml diff --git a/helm/trento-server/charts/ara/templates/service.yaml b/packaging/helm/trento-server/charts/ara/templates/service.yaml similarity index 100% rename from helm/trento-server/charts/ara/templates/service.yaml rename to packaging/helm/trento-server/charts/ara/templates/service.yaml diff --git a/helm/trento-server/charts/ara/templates/serviceaccount.yaml b/packaging/helm/trento-server/charts/ara/templates/serviceaccount.yaml similarity index 100% rename from helm/trento-server/charts/ara/templates/serviceaccount.yaml rename to packaging/helm/trento-server/charts/ara/templates/serviceaccount.yaml diff --git a/helm/trento-server/charts/ara/templates/tests/test-connection.yaml b/packaging/helm/trento-server/charts/ara/templates/tests/test-connection.yaml similarity index 100% rename from helm/trento-server/charts/ara/templates/tests/test-connection.yaml rename to packaging/helm/trento-server/charts/ara/templates/tests/test-connection.yaml diff --git a/helm/trento-server/charts/ara/values.yaml b/packaging/helm/trento-server/charts/ara/values.yaml similarity index 100% rename from helm/trento-server/charts/ara/values.yaml rename to packaging/helm/trento-server/charts/ara/values.yaml diff --git a/helm/trento-server/charts/trento-runner/.helmignore b/packaging/helm/trento-server/charts/trento-runner/.helmignore similarity index 100% rename from helm/trento-server/charts/trento-runner/.helmignore rename to packaging/helm/trento-server/charts/trento-runner/.helmignore diff --git a/helm/trento-server/charts/trento-runner/Chart.yaml b/packaging/helm/trento-server/charts/trento-runner/Chart.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/Chart.yaml rename to packaging/helm/trento-server/charts/trento-runner/Chart.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/NOTES.txt b/packaging/helm/trento-server/charts/trento-runner/templates/NOTES.txt similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/NOTES.txt rename to packaging/helm/trento-server/charts/trento-runner/templates/NOTES.txt diff --git a/helm/trento-server/charts/trento-runner/templates/_helpers.tpl b/packaging/helm/trento-server/charts/trento-runner/templates/_helpers.tpl similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/_helpers.tpl rename to packaging/helm/trento-server/charts/trento-runner/templates/_helpers.tpl diff --git a/helm/trento-server/charts/trento-runner/templates/deployment.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/deployment.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/deployment.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/deployment.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/hpa.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/hpa.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/hpa.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/hpa.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/privatekey.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/privatekey.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/privatekey.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/privatekey.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/service.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/service.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/service.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/service.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/serviceaccount.yaml diff --git a/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml b/packaging/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml rename to packaging/helm/trento-server/charts/trento-runner/templates/tests/test-connection.yaml diff --git a/helm/trento-server/charts/trento-runner/values.yaml b/packaging/helm/trento-server/charts/trento-runner/values.yaml similarity index 100% rename from helm/trento-server/charts/trento-runner/values.yaml rename to packaging/helm/trento-server/charts/trento-runner/values.yaml diff --git a/helm/trento-server/charts/trento-web/.helmignore b/packaging/helm/trento-server/charts/trento-web/.helmignore similarity index 100% rename from helm/trento-server/charts/trento-web/.helmignore rename to packaging/helm/trento-server/charts/trento-web/.helmignore diff --git a/helm/trento-server/charts/trento-web/Chart.yaml b/packaging/helm/trento-server/charts/trento-web/Chart.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/Chart.yaml rename to packaging/helm/trento-server/charts/trento-web/Chart.yaml diff --git a/helm/trento-server/charts/trento-web/templates/NOTES.txt b/packaging/helm/trento-server/charts/trento-web/templates/NOTES.txt similarity index 100% rename from helm/trento-server/charts/trento-web/templates/NOTES.txt rename to packaging/helm/trento-server/charts/trento-web/templates/NOTES.txt diff --git a/helm/trento-server/charts/trento-web/templates/_helpers.tpl b/packaging/helm/trento-server/charts/trento-web/templates/_helpers.tpl similarity index 100% rename from helm/trento-server/charts/trento-web/templates/_helpers.tpl rename to packaging/helm/trento-server/charts/trento-web/templates/_helpers.tpl diff --git a/helm/trento-server/charts/trento-web/templates/deployment.yaml b/packaging/helm/trento-server/charts/trento-web/templates/deployment.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/deployment.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/deployment.yaml diff --git a/helm/trento-server/charts/trento-web/templates/hpa.yaml b/packaging/helm/trento-server/charts/trento-web/templates/hpa.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/hpa.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/hpa.yaml diff --git a/helm/trento-server/charts/trento-web/templates/ingress.yaml b/packaging/helm/trento-server/charts/trento-web/templates/ingress.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/ingress.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/ingress.yaml diff --git a/helm/trento-server/charts/trento-web/templates/service.yaml b/packaging/helm/trento-server/charts/trento-web/templates/service.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/service.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/service.yaml diff --git a/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml b/packaging/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/serviceaccount.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/serviceaccount.yaml diff --git a/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml b/packaging/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml rename to packaging/helm/trento-server/charts/trento-web/templates/tests/test-connection.yaml diff --git a/helm/trento-server/charts/trento-web/values.yaml b/packaging/helm/trento-server/charts/trento-web/values.yaml similarity index 100% rename from helm/trento-server/charts/trento-web/values.yaml rename to packaging/helm/trento-server/charts/trento-web/values.yaml diff --git a/helm/trento-server/templates/NOTES.txt b/packaging/helm/trento-server/templates/NOTES.txt similarity index 100% rename from helm/trento-server/templates/NOTES.txt rename to packaging/helm/trento-server/templates/NOTES.txt diff --git a/helm/trento-server/values.yaml b/packaging/helm/trento-server/values.yaml similarity index 100% rename from helm/trento-server/values.yaml rename to packaging/helm/trento-server/values.yaml From 6fa95c531474a93d17b7c4dd98e12d75b7f563e4 Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Tue, 14 Sep 2021 11:26:32 +0200 Subject: [PATCH 7/7] Update .gitignore Co-authored-by: Stefano Torresi --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e93d088c7..d30c8dc91 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ /build /web/frontend/assets /web/frontend/node_modules -/helm/trento-server/charts/*.tgz \ No newline at end of file +/packaging/helm/trento-server/charts/*.tgz \ No newline at end of file