-
Notifications
You must be signed in to change notification settings - Fork 209
Introduce the Helm Chart #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v2 | ||
| name: allure-docker-service | ||
| description: A Helm chart for Kubernetes | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "2.38.1" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| Allure Docker Service has been deployed. | ||
|
|
||
| 1. API endpoint: | ||
| {{- if .Values.api.ingress.enabled }} | ||
| http{{ if .Values.api.ingress.tls }}s{{ end }}://{{ (first .Values.api.ingress.hosts).host }} | ||
| {{- else if eq .Values.api.service.type "NodePort" }} | ||
| export NODE_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "allure-docker-service.api.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") | ||
| export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
| echo "API: http://$NODE_IP:$NODE_PORT" | ||
| {{- else if eq .Values.api.service.type "LoadBalancer" }} | ||
| NOTE: It may take a few minutes for the LoadBalancer IP to be assigned. | ||
| kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "allure-docker-service.api.fullname" . }} | ||
| {{- else }} | ||
| kubectl port-forward --namespace {{ .Release.Namespace }} \ | ||
| svc/{{ include "allure-docker-service.api.fullname" . }} 5050:{{ .Values.api.service.port }} | ||
| echo "API: http://127.0.0.1:5050" | ||
| {{- end }} | ||
|
|
||
| 2. API credentials: | ||
| {{- if .Values.api.security.existingSecret }} | ||
| Using existing Secret: {{ .Values.api.security.existingSecret }} | ||
| {{- else }} | ||
| A Secret named {{ include "allure-docker-service.api.fullname" . }} was created | ||
| with auto-generated credentials. Retrieve them with: | ||
|
|
||
| kubectl get secret --namespace {{ .Release.Namespace }} \ | ||
| {{ include "allure-docker-service.api.fullname" . }} \ | ||
| -o jsonpath="{.data.user}" | base64 -d; echo | ||
| kubectl get secret --namespace {{ .Release.Namespace }} \ | ||
| {{ include "allure-docker-service.api.fullname" . }} \ | ||
| -o jsonpath="{.data.password}" | base64 -d; echo | ||
|
|
||
| To supply your own credentials instead of auto-generated ones: | ||
|
|
||
| api: | ||
| security: | ||
| user: "my_username" | ||
| password: "my_password" | ||
| viewerUser: "view_user" | ||
| viewerPassword: "view_pass" | ||
|
|
||
| To reference a pre-existing Secret and skip Secret creation entirely: | ||
|
|
||
| api: | ||
| security: | ||
| existingSecret: "<your-secret-name>" | ||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "allure-docker-service.name" -}} | ||
| {{- default .Chart.Name .Values.global.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create a default fully qualified app name. | ||
| Truncated 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 "allure-docker-service.fullname" -}} | ||
| {{- if .Values.global.fullnameOverride }} | ||
| {{- .Values.global.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- else }} | ||
| {{- $name := default .Chart.Name .Values.global.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 label. | ||
| */}} | ||
| {{- define "allure-docker-service.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels (chart-wide, used for resources that span components such as ServiceAccount). | ||
| */}} | ||
| {{- define "allure-docker-service.commonLabels" -}} | ||
| helm.sh/chart: {{ include "allure-docker-service.chart" . }} | ||
| app.kubernetes.io/name: {{ include "allure-docker-service.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| ServiceAccount name. | ||
| */}} | ||
| {{- define "allure-docker-service.serviceAccountName" -}} | ||
| {{- if .Values.global.serviceAccount.create }} | ||
| {{- default (include "allure-docker-service.fullname" .) .Values.global.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.global.serviceAccount.name }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{/* ------------------------------------------------------------------ */}} | ||
| {{/* API component */}} | ||
| {{/* ------------------------------------------------------------------ */}} | ||
|
|
||
| {{/* | ||
| API fully-qualified name. | ||
| */}} | ||
| {{- define "allure-docker-service.api.fullname" -}} | ||
| {{- printf "%s-api" (include "allure-docker-service.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| API selector labels. | ||
| */}} | ||
| {{- define "allure-docker-service.api.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "allure-docker-service.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app.kubernetes.io/component: api | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| API labels (selector labels + chart metadata). | ||
| */}} | ||
| {{- define "allure-docker-service.api.labels" -}} | ||
| helm.sh/chart: {{ include "allure-docker-service.chart" . }} | ||
| {{ include "allure-docker-service.api.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| API image reference — prepends the global registry when set. | ||
| Falls back to Chart.AppVersion when image.tag is not specified. | ||
| */}} | ||
| {{- define "allure-docker-service.api.image" -}} | ||
| {{- $registry := .Values.global.image.registry -}} | ||
| {{- $repo := .Values.api.image.repository -}} | ||
| {{- $tag := .Values.api.image.tag | default .Chart.AppVersion -}} | ||
| {{- if $registry -}} | ||
| {{- printf "%s/%s:%s" $registry $repo $tag -}} | ||
| {{- else -}} | ||
| {{- printf "%s:%s" $repo $tag -}} | ||
| {{- end -}} | ||
| {{- end }} | ||
|
|
||
| {{/* ------------------------------------------------------------------ */}} | ||
| {{/* UI component */}} | ||
| {{/* ------------------------------------------------------------------ */}} | ||
|
|
||
| {{/* | ||
| UI fully-qualified name. | ||
| */}} | ||
| {{- define "allure-docker-service.ui.fullname" -}} | ||
| {{- printf "%s-ui" (include "allure-docker-service.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| UI selector labels. | ||
| */}} | ||
| {{- define "allure-docker-service.ui.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "allure-docker-service.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| app.kubernetes.io/component: ui | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| UI labels (selector labels + chart metadata). | ||
| */}} | ||
| {{- define "allure-docker-service.ui.labels" -}} | ||
| helm.sh/chart: {{ include "allure-docker-service.chart" . }} | ||
| {{ include "allure-docker-service.ui.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| UI image reference — prepends the global registry when set. | ||
| Falls back to Chart.AppVersion when image.tag is not specified. | ||
| */}} | ||
| {{- define "allure-docker-service.ui.image" -}} | ||
| {{- $registry := .Values.global.image.registry -}} | ||
| {{- $repo := .Values.ui.image.repository -}} | ||
| {{- $tag := .Values.ui.image.tag | default .Chart.AppVersion -}} | ||
| {{- if $registry -}} | ||
| {{- printf "%s/%s:%s" $registry $repo $tag -}} | ||
| {{- else -}} | ||
| {{- printf "%s:%s" $repo $tag -}} | ||
| {{- end -}} | ||
| {{- end }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| {{- if .Values.api.enabled -}} | ||
| {{/* | ||
| Build the default environment variables for the API container. | ||
| These are the operational defaults derived from docker-compose-dev.yml. | ||
|
|
||
| Merge strategy: user values win. | ||
| 1. Collect the names of every env var the user declared in podEnvs. | ||
| 2. Keep only the defaults whose name is NOT in that set. | ||
| 3. Concat filtered defaults with podEnvs — user entries always appear last | ||
| and therefore shadow any remaining duplicate that could sneak in. | ||
|
|
||
| Credentials (SECURITY_USER/PASS, viewer pair) are injected from the managed | ||
| Secret via secretKeyRef — see api-secrets.yaml and api.security in values. | ||
| URL_PREFIX defaults to an empty string (root). Override via podEnvs to serve | ||
| the API under a sub-path, e.g.: - name: URL_PREFIX\n value: "/my-prefix" | ||
| */}} | ||
| {{- $defaults := list | ||
| (dict "name" "DEV_MODE" "value" "0") | ||
| (dict "name" "CHECK_RESULTS_EVERY_SECONDS" "value" "NONE") | ||
| (dict "name" "KEEP_HISTORY" "value" "1") | ||
| (dict "name" "KEEP_HISTORY_LATEST" "value" "5") | ||
| (dict "name" "SECURITY_ENABLED" "value" "1") | ||
| (dict "name" "MAKE_VIEWER_ENDPOINTS_PUBLIC" "value" "0") | ||
| (dict "name" "OPTIMIZE_STORAGE" "value" "0") | ||
| (dict "name" "API_RESPONSE_LESS_VERBOSE" "value" "0") | ||
| (dict "name" "TLS" "value" "0") | ||
| (dict "name" "URL_PREFIX" "value" "") | ||
| -}} | ||
| {{- $userEnvNames := list -}} | ||
| {{- range .Values.api.podEnvs -}} | ||
| {{- $userEnvNames = append $userEnvNames .name -}} | ||
| {{- end -}} | ||
| {{- $filteredDefaults := list -}} | ||
| {{- range $defaults -}} | ||
| {{- if not (has .name $userEnvNames) -}} | ||
| {{- $filteredDefaults = append $filteredDefaults . -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| {{- $allEnvs := concat $filteredDefaults .Values.api.podEnvs -}} | ||
| {{- $secretName := .Values.api.security.existingSecret | default (include "allure-docker-service.api.fullname" .) -}} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "allure-docker-service.api.fullname" . }} | ||
| labels: | ||
| {{- include "allure-docker-service.api.labels" . | nindent 4 }} | ||
| spec: | ||
| replicas: {{ .Values.api.replicaCount }} | ||
| selector: | ||
| matchLabels: | ||
| {{- include "allure-docker-service.api.selectorLabels" . | nindent 6 }} | ||
| template: | ||
| metadata: | ||
| {{- with .Values.api.podAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "allure-docker-service.api.selectorLabels" . | nindent 8 }} | ||
| {{- with .Values.api.podLabels }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- with .Values.global.image.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| serviceAccountName: {{ include "allure-docker-service.serviceAccountName" . }} | ||
|
Comment on lines
+63
to
+68
|
||
| {{- with .Values.api.podSecurityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - name: api | ||
| {{- with .Values.api.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| image: {{ include "allure-docker-service.api.image" . }} | ||
| imagePullPolicy: {{ .Values.api.image.pullPolicy }} | ||
| ports: | ||
| - name: http | ||
| containerPort: 5050 | ||
| protocol: TCP | ||
| env: | ||
| - name: SECURITY_USER | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ $secretName }} | ||
| key: user | ||
| - name: SECURITY_PASS | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ $secretName }} | ||
| key: password | ||
| - name: SECURITY_VIEWER_USER | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ $secretName }} | ||
| key: viewerUser | ||
| - name: SECURITY_VIEWER_PASS | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: {{ $secretName }} | ||
| key: viewerPassword | ||
| {{- toYaml $allEnvs | nindent 12 }} | ||
| {{- with .Values.api.livenessProbe }} | ||
| livenessProbe: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- with .Values.api.readinessProbe }} | ||
| readinessProbe: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- with .Values.api.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- if .Values.api.persistence.enabled }} | ||
| volumeMounts: | ||
| - name: allure-results | ||
| mountPath: /app/allure-results | ||
| {{- end }} | ||
| {{- if .Values.api.persistence.enabled }} | ||
| volumes: | ||
| - name: allure-results | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "allure-docker-service.api.fullname" . }} | ||
| {{- end }} | ||
| {{- with .Values.api.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.api.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.api.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {{- if and .Values.api.enabled .Values.api.httpRoute.enabled -}} | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: {{ include "allure-docker-service.api.fullname" . }} | ||
| labels: | ||
| {{- include "allure-docker-service.api.labels" . | nindent 4 }} | ||
| {{- with .Values.api.httpRoute.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| parentRefs: | ||
| {{- toYaml .Values.api.httpRoute.parentRefs | nindent 4 }} | ||
| {{- with .Values.api.httpRoute.hostnames }} | ||
| hostnames: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| rules: | ||
| {{- toYaml .Values.api.httpRoute.rules | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Ingress case prints only
http(s)://<host>but the default API ingress path invalues.yamlis/allure-docker-service. The NOTES output will mislead users into hitting the wrong URL. Consider including the first configured ingress path (or documenting the path separately) when printing the API endpoint.