Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Adds SubscriptionId for Cloud Images
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ryoo committed Jun 21, 2023
1 parent d502266 commit d2fe1ba
Show file tree
Hide file tree
Showing 21 changed files with 1,203 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/allure-testops-standalone/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
34 changes: 34 additions & 0 deletions charts/allure-testops-standalone/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v2
name: allure-testops-standalone
description: A Helm chart for Testops Deployment

type: application
version: 0.1.0

appVersion: "4.16.7"

kubeVersion: '>= 1.14.0-0'

home: https://qameta.io

maintainers:
- name: Andrey Ryoo
email: andrey.ryoo@qameta.io

dependencies:
- name: rabbitmq
version: 11.14.3
repository: https://charts.bitnami.com/bitnami
condition: rabbitmq.enabled
- name: postgresql
version: 12.4.2
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: redis
version: 17.10.1
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: minio
version: 12.4.2
repository: https://charts.bitnami.com/bitnami
condition: minio.enabled
152 changes: 152 additions & 0 deletions charts/allure-testops-standalone/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "allure-testops-standalone.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 "allure-testops-standalone.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" $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "allure-testops-standalone.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "allure-testops-standalone.labels" -}}
helm.sh/chart: {{ include "allure-testops-standalone.chart" . }}
{{ include "allure-testops-standalone.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "allure-testops-standalone.selectorLabels" -}}
app.kubernetes.io/name: {{ include "allure-testops-standalone.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "allure-testops-standalone.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "allure-testops-standalone.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "getImageRegistry" }}
{{- if .Values.registry.name }}
{{- printf "%s/%s/" .Values.registry.repo .Values.registry.name }}
{{- else }}
{{- printf "%s/" .Values.registry.repo }}
{{- end }}
{{- end }}

{{- define "imagePullSecret" }}
{{- with .Values.registry }}
{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"auth\":\"%s\"}}}" .repo .auth.username .auth.password (printf "%s:%s" .auth.username .auth.password | b64enc) | b64enc }}
{{- end }}
{{- end }}

{{- define "allure-testops.redis.fullname" -}}
{{- if .Values.redis.enabled }}
{{- printf "%s-%s" .Release.Name "redis-master" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- print .Values.redis.host }}
{{- end }}
{{- end -}}

{{- define "rabbitHost" }}
{{- if .Values.rabbitmq.enabled }}
{{- printf "amqp://%s:%.f" .Values.rabbitmq.fullnameOverride .Values.rabbitmq.service.ports.amqp | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- print .Values.rabbitmq.external.hosts }}
{{- end }}
{{- end }}

{{- define "uaaDBHost" }}
{{- if .Values.postgresql.enabled }}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- print .Values.postgresql.external.uaaHost }}
{{- end }}
{{- end }}

{{- define "uaaDBPort" }}
{{- if .Values.postgresql.enabled }}
{{- printf "%.f" .Values.postgresql.primary.service.ports.postgresql }}
{{- else }}
{{- printf "%.f" .Values.postgresql.external.uaaPort }}
{{- end }}
{{- end }}

{{- define "uaaDBName" }}
{{- if .Values.postgresql.enabled }}
{{- print "uaa" }}
{{- else }}
{{- print .Values.postgresql.external.uaaDbName }}
{{- end }}
{{- end }}

{{- define "reportDBHost" }}
{{- if .Values.postgresql.enabled }}
{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- print .Values.postgresql.external.reportHost }}
{{- end }}
{{- end }}

{{- define "reportDBPort" }}
{{- if .Values.postgresql.enabled }}
{{- printf "%.f" .Values.postgresql.primary.service.ports.postgresql }}
{{- else }}
{{- printf "%.f" .Values.postgresql.external.reportPort }}
{{- end }}
{{- end }}

{{- define "reportDBName" }}
{{- if .Values.postgresql.enabled }}
{{- print "report"}}
{{- else }}
{{- print .Values.postgresql.external.reportDbName }}
{{- end }}
{{- end }}

{{- define "postgresSSL" }}
{{- if .Values.postgresql.enabled }}
{{- print "disable" }}
{{- else }}
{{- print .Values.postgresql.external.sslMode }}
{{- end }}
{{- end }}

{{- define "allure-testops.minio.fullname" -}}
{{- printf "%s-%s" .Release.Name "minio" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
118 changes: 118 additions & 0 deletions charts/allure-testops-standalone/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "allure-testops-standalone.fullname" .}}
labels:
app: {{ template "allure-testops-standalone.name" . }}
version: v1
chart: {{ template "allure-testops-standalone.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.testops.replicas }}
strategy:
{{ toYaml .Values.strategy | indent 4 }}
selector:
matchLabels:
app: {{ template "allure-testops-standalone.fullname" . }}
version: v1
template:
metadata:
labels:
app: {{ template "allure-testops-standalone.fullname" . }}
version: v1
{{- if .Values.testops.annotations }}
annotations:
{{- range $key, $value := .Values.testops.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
{{- if .Values.rbac.enabled }}
serviceAccountName: {{ template "allure-testops-standalone.fullname" . }}-sa
{{- end }}
imagePullSecrets:
- name: {{ .Values.registry.imagePullSecret }}
tolerations:
{{ toYaml .Values.testops.tolerations | indent 8 }}
nodeSelector:
{{ toYaml .Values.testops.nodeSelector | indent 8 }}
affinity:
{{ toYaml .Values.testops.affinity | indent 8 }}
initContainers:
- name: uaa-db-readiness-check
image: {{ .Values.postgresql.init.image | quote }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
command: [ 'sh', '-c',
'until pg_isready -h {{ template "uaaDBHost" . }} -p {{ template "uaaDBPort" . }};
do echo waiting for database; sleep 2; done;' ]
- name: report-db-readiness-check
image: {{ .Values.postgresql.init.image | quote }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
command: [ 'sh', '-c',
'until pg_isready -h {{ template "reportDBHost" . }} -p {{ template "reportDBPort" . }};
do echo waiting for database; sleep 2; done;' ]
containers:
- name: {{ template "allure-testops-standalone.fullname" . }}
image: "{{ template "getImageRegistry" . }}{{ .Values.testops.image }}:{{ .Values.version | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.registry.pullPolicy }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
ports:
- name: http-gtw
containerPort: {{ .Values.testops.service.gatewayPort }}
- name: http-uaa
containerPort: {{ .Values.testops.service.uaaPort }}
- name: http-rep
containerPort: {{ .Values.testops.service.reportPort }}
env:
- name: TZ
value: "{{ .Values.testops.timeZone }}"
livenessProbe:
httpGet:
path: /management/health
port: http-gtw
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
readinessProbe:
httpGet:
path: /management/health
port: http-gtw
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
{{- with .Values.testops.resources }}
resources:
{{ toYaml . | indent 12 }}
{{- end }}
volumeMounts:
- name: gateway-secret
readOnly: true
mountPath: /opt/allure-testops/conf/gateway.properties
subPath: gateway.properties
- name: uaa-secret
readOnly: true
mountPath: /opt/allure-testops/conf/uaa.properties
subPath: uaa.properties
- name: report-secret
readOnly: true
mountPath: /opt/allure-testops/conf/report.properties
subPath: report.properties

volumes:
- name: gateway-secret
secret:
secretName: gateway-secret
- name: uaa-secret
secret:
secretName: uaa-secret
- name: report-secret
secret:
secretName: report-secret
38 changes: 38 additions & 0 deletions charts/allure-testops-standalone/templates/gateway-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: gateway-secret
stringData:
gateway.properties: |
server.port={{ .Values.testops.service.gatewayPort }}
spring.profiles.active=kubernetes
spring.cloud.consul.enabled=false
allure.secure={{ .Values.network.tls.enabled }}
allure.jwt.secret={{ .Values.jwtSecret }}
spring.session.store-type=REDIS
spring.redis.host={{ template "allure-testops.redis.fullname" . }}
spring.redis.port={{ .Values.redis.port }}
spring.redis.database={{ .Values.redis.database }}
spring.redis.password={{ .Values.redis.auth.password }}
spring.cloud.discovery.client.simple.instances.allure-ee-gateway[0].instanceId=allure-ee-gateway-1
spring.cloud.discovery.client.simple.instances.allure-ee-gateway[0].host={{ template "allure-testops-standalone.fullname" . }}
spring.cloud.discovery.client.simple.instances.allure-ee-gateway[0].port={{ .Values.testops.service.gatewayPort }}
spring.cloud.discovery.client.simple.instances.allure-ee-uaa[0].instanceId=allure-ee-uaa-1
spring.cloud.discovery.client.simple.instances.allure-ee-uaa[0].host={{ template "allure-testops-standalone.fullname" . }}
spring.cloud.discovery.client.simple.instances.allure-ee-uaa[0].port={{ .Values.testops.service.uaaPort }}
spring.cloud.discovery.client.simple.instances.allure-ee-report[0].instanceId=allure-ee-report-1
spring.cloud.discovery.client.simple.instances.allure-ee-report[0].host={{ template "allure-testops-standalone.fullname" . }}
spring.cloud.discovery.client.simple.instances.allure-ee-report[0].port={{ .Values.testops.service.reportPort }}
management.endpoints.web.exposure.include=health,info,prometheus,configprops
management.endpoint.health.cache.time-to-live=15s
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://{{ template "allure-testops-standalone.fullname" . }}:{{ .Values.testops.service.reportPort }}/.well-known/jwks.json
Loading

0 comments on commit d2fe1ba

Please sign in to comment.