-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from akash4sh/main
feat: Add helm chart
- Loading branch information
Showing
20 changed files
with
1,204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
appVersion: v1.0.0 | ||
dependencies: | ||
- name: postgresql | ||
repository: https://kube-tarian.github.io/helmrepo-supporting-tools/ | ||
version: 1.x.x | ||
condition: postgresql.enabled | ||
description: A Helm chart for QualityTrace | ||
name: qualitytrace | ||
type: application | ||
version: 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# qualitytrace | ||
|
||
This is the Helm chart for [qualitytrace] installation. | ||
|
||
## Installation | ||
|
||
### Chart installation | ||
|
||
Add repo: | ||
|
||
```sh | ||
helm repo add qualitytrace https://intelops.github.io/qualitytrace | ||
helm repo update | ||
|
||
``` | ||
|
||
```sh | ||
helm install qualitytrace qualitytrace/qualitytrace | ||
``` | ||
|
||
## Uninstall | ||
|
||
```sh | ||
helm delete qualitytrace | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "qualitytrace.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 "qualitytrace.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "qualitytrace.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 "qualitytrace.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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "qualitytrace.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 "qualitytrace.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 "qualitytrace.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "qualitytrace.labels" -}} | ||
helm.sh/chart: {{ include "qualitytrace.chart" . }} | ||
{{ include "qualitytrace.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified postgresql name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
*/}} | ||
{{- define "qualitytrace.postgresql.fullname" -}} | ||
{{- include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) -}} | ||
{{- end -}} | ||
|
||
|
||
{{- define "qualitytrace.database.encryptedPassword" -}} | ||
{{- include "qualitytrace.database.rawPassword" . | b64enc | quote -}} | ||
{{- end -}} | ||
|
||
{{- define "qualitytrace.database.rawPassword" -}} | ||
{{- if .Values.postgresql.enabled }} | ||
{{- if .Values.global.postgresql }} | ||
{{- if .Values.global.postgresql.auth }} | ||
{{- coalesce .Values.global.postgresql.auth.postgresPassword .Values.postgresql.auth.postgresPassword -}} | ||
{{- else -}} | ||
{{- .Values.postgresql.auth.postgresPassword -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- .Values.postgresql.auth.postgresPassword -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- .Values.externalDatabase.password -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "qualitytrace.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "qualitytrace.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "qualitytrace.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "qualitytrace.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Define a valid pathPrefix | ||
*/}} | ||
{{- define "qualitytrace.pathPrefix" -}} | ||
{{- if .Values.server.pathPrefix }} | ||
{{- .Values.server.pathPrefix }} | ||
{{- else }} | ||
{{- "/" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "otelCollector.labels" -}} | ||
helm.sh/chart: {{ include "qualitytrace.chart" . }} | ||
{{ include "otelCollector.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "otelCollector.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ default "otel-collector" .Values.otelCollector.name }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "qualitytrace.fullname" . }}-analyzer | ||
annotations: | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-delete-policy": hook-succeeded | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: analyzer | ||
image: ghcr.io/kube-tarian/helmrepo-supporting-tools/curl:latest | ||
command: ["/bin/sh", "-c"] | ||
args: | ||
- > | ||
sleep 100 && | ||
curl --location --request PUT 'http://{{ include "qualitytrace.fullname" . }}:11633/api/analyzers/current' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"type": "Analyzer", | ||
"typePlural": "Analyzers", | ||
"spec": { | ||
"id": "current", | ||
"name": "analyzer", | ||
"minimumScore": 0, | ||
"enabled": {{ .Values.analyzer.enabled }}, | ||
"plugins": [ | ||
{ | ||
"name": "OTel Semantic Conventions", | ||
"id": "standards", | ||
"enabled": true, | ||
"description": "Enforce trace standards following OTel Semantic Conventions", | ||
"rules": [ | ||
{ | ||
"id": "span-naming", | ||
"weight": 25, | ||
"errorLevel": "error", | ||
"name": "Span Naming", | ||
"description": "Enforce span names that identify a class of Spans", | ||
"errorDescription": "", | ||
"tips": [] | ||
}, | ||
{ | ||
"id": "required-attributes", | ||
"weight": 25, | ||
"errorLevel": "error", | ||
"name": "Required Attributes", | ||
"description": "Enforce required attributes by span type", | ||
"errorDescription": "This span is missing the following required attributes:", | ||
"tips": [ | ||
"This rule checks if all required attributes are present in spans of given type" | ||
] | ||
}, | ||
{ | ||
"id": "attribute-naming", | ||
"weight": 25, | ||
"errorLevel": "error", | ||
"name": "Attribute Naming", | ||
"description": "Enforce attribute keys to follow common specifications", | ||
"errorDescription": "The following attributes do not follow the naming convention:", | ||
"tips": [ | ||
"You should always add namespaces to your span names to ensure they will not be overwritten", | ||
"Use snake_case to separate multi-words. Ex: http.status_code instead of http.statusCode" | ||
] | ||
}, | ||
{ | ||
"id": "no-empty-attributes", | ||
"weight": 25, | ||
"errorLevel": "error", | ||
"name": "No Empty Attributes", | ||
"description": "Disallow empty attribute values", | ||
"errorDescription": "The following attributes are empty:", | ||
"tips": [ | ||
"Empty attributes don'\''t provide any information about the operation and should be removed" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Common Problems", | ||
"id": "common", | ||
"enabled": true, | ||
"description": "Help you find common mistakes with your application", | ||
"rules": [ | ||
{ | ||
"id": "prefer-dns", | ||
"weight": 100, | ||
"errorLevel": "error", | ||
"name": "Prefer DNS", | ||
"description": "Enforce usage of DNS instead of IP addresses", | ||
"errorDescription": "The following attributes are using IP addresses instead of DNS:", | ||
"tips": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Security", | ||
"id": "security", | ||
"enabled": true, | ||
"description": "Help you find security problems with your application", | ||
"rules": [ | ||
{ | ||
"id": "secure-https-protocol", | ||
"weight": 30, | ||
"errorLevel": "error", | ||
"name": "Secure HTTPS Protocol", | ||
"description": "Enforce usage of secure protocol for HTTP server spans", | ||
"errorDescription": "The following attributes are using insecure http protocol:", | ||
"tips": [] | ||
}, | ||
{ | ||
"id": "no-api-key-leak", | ||
"weight": 70, | ||
"errorLevel": "error", | ||
"name": "No API Key Leak", | ||
"description": "Disallow leaked API keys for HTTP spans", | ||
"errorDescription": "The following attributes are exposing API keys:", | ||
"tips": [] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}' | ||
restartPolicy: Never | ||
backoffLimit: 1 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if not .Values.postgresql.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: postgresql-query | ||
annotations: | ||
"helm.sh/hook": pre-install | ||
"helm.sh/hook-weight": "1" | ||
"helm.sh/hook-delete-policy": before-hook-creation | ||
data: | ||
create-database.sql: | | ||
SELECT 'CREATE DATABASE {{ .Values.externalPostgresql.qualitytrace.database }}' | ||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname='{{ .Values.externalPostgresql.qualitytrace.database }}')\gexec | ||
SELECT 'CREATE USER {{ .Values.externalPostgresql.qualitytrace.username }} WITH PASSWORD ''' || :'db_password' || '''' | ||
WHERE NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname='{{ .Values.externalPostgresql.qualitytrace.username }}')\gexec | ||
ALTER DATABASE {{ .Values.externalPostgresql.qualitytrace.database }} OWNER TO {{ .Values.externalPostgresql.qualitytrace.username }}; | ||
ALTER ROLE {{ .Values.externalPostgresql.qualitytrace.username }} CREATEDB; | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "qualitytrace.fullname" . }} | ||
labels: | ||
{{- include "qualitytrace.labels" . | nindent 4 }} | ||
data: | ||
config.yaml: |- | ||
poolingConfig: | ||
{{- toYaml .Values.poolingConfig | nindent 6 }} | ||
googleAnalytics: | ||
enabled: {{.Values.analytics.enabled}} | ||
postgres: | ||
{{- if .Values.postgresql.enabled }} | ||
host: {{ include "qualitytrace.postgresql.fullname" . }} | ||
user: {{.Values.postgresql.auth.username}} | ||
password: {{.Values.postgresql.auth.password}} | ||
{{- else }} | ||
host: {{ .Values.externalPostgresql.host }} | ||
user: {{ .Values.externalPostgresql.qualitytrace.username }} | ||
{{- if not .Values.externalPostgresql.qualitytrace.existingSecret }} | ||
password: {{ .Values.externalPostgresql.qualitytrace.password }} | ||
{{- else }} | ||
password: 'db_password' | ||
{{- end }} | ||
{{- end }} | ||
port: 5432 | ||
params: sslmode=disable | ||
telemetry: | ||
{{- toYaml .Values.telemetry | nindent 6 }} | ||
server: | ||
{{- toYaml .Values.server | nindent 6 }} | ||
provisioning.yaml: |- | ||
{{- toYaml .Values.provisioning | nindent 4 }} | ||
--- |
Oops, something went wrong.