-
Notifications
You must be signed in to change notification settings - Fork 287
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 #724 from Lingghh/dev/suport_helm_deploy
✨支持Helm charts部署TCA服务
- Loading branch information
Showing
47 changed files
with
3,703 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,10 @@ | ||
# TCA | ||
|
||
**欢迎体验 TCA Charts,期待您的反馈或PR~** | ||
|
||
> 注意: | ||
> | ||
> - 请根据`Prerequisites`小节确认好版本好,使用默认的`values.yaml`即可部署 | ||
> - 可以根据业务情况调整`values.yaml`配置,比如默认的`passwordKey`、账号密码等敏感配置信息 | ||
> - TCA服务metrics方案正在完善,即将支持 | ||
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,10 @@ | ||
dependencies: | ||
- name: mariadb | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 11.1.8 | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 17.0.6 | ||
- name: nginx-ingress-controller | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 9.3.2 |
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,29 @@ | ||
apiVersion: v2 | ||
appVersion: 1.0.0 | ||
name: tca | ||
description: Tencent Cloud Code Analysis (TCA for short, code-named CodeDog inside the company early) is a comprehensive platform for code analysis and issue tracking. TCA consist of three components, server, web and client. It integrates of a number of self-developed tools, and also supports dynamic integration of code analysis tools in various programming languages. | ||
home: https://github.com/Tencent/CodeAnalysis | ||
icon: https://github.com/Tencent/CodeAnalysis/blob/main/media/Logo.png | ||
dependencies: | ||
- name: mariadb | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 11.1.8 | ||
condition: mariadb.enabled | ||
- name: redis | ||
repository: https://charts.bitnami.com/bitnami | ||
version: 17.0.6 | ||
condition: redis.enabled | ||
- name: nginx-ingress-controller | ||
version: 9.3.2 | ||
repository: https://charts.bitnami.com/bitnami | ||
condition: nginx-ingress-controller.enabled | ||
keywords: | ||
- code-analysis | ||
- code-quality | ||
- code-review | ||
- static-analysis | ||
- code-quality-analyzer | ||
sources: | ||
- https://github.com/Tencent/CodeAnalysis | ||
type: application | ||
version: 0.1.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
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,147 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "tca.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 "tca.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 "tca.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "tca.labels" -}} | ||
helm.sh/chart: {{ include "tca.chart" . }} | ||
{{ include "tca.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "tca.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "tca.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "tca.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "tca.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified mongodb subchart. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
*/}} | ||
{{- define "tca.mariadb.fullname" -}} | ||
{{- if .Values.mariadb.fullnameOverride -}} | ||
{{- .Values.mariadb.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default "mariadb" .Values.mariadb.nameOverride -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.redis.fullname" -}} | ||
{{- if .Values.redis.fullnameOverride -}} | ||
{{ $name := .Values.redis.fullnameOverride | trunc 63 | trimSuffix "-"}} | ||
{{- list $name "master" | join "-" -}} | ||
{{- else -}} | ||
{{- $name := default "redis" .Values.redis.nameOverride -}} | ||
{{- printf "%s-%s-master" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Redis config | ||
*/}} | ||
{{- define "tca.redis.host" -}} | ||
{{- if eq .Values.redis.enabled true -}} | ||
{{- ( include "tca.redis.fullname" . ) -}} | ||
{{- else -}} | ||
{{- .Values.externalRedis.host -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.redis.port" -}} | ||
{{- if eq .Values.redis.enabled true -}} | ||
{{- printf "6379" -}} | ||
{{- else -}} | ||
{{- printf "%d" ( .Values.externalRedis.port | int ) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.redis.password" -}} | ||
{{- if eq .Values.redis.enabled true -}} | ||
{{- .Values.redis.auth.password -}} | ||
{{- else -}} | ||
{{- .Values.externalRedis.password -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
DB config | ||
*/}} | ||
{{- define "tca.database.host" -}} | ||
{{- if eq .Values.mariadb.enabled true -}} | ||
{{- ( include "tca.mariadb.fullname" . ) -}} | ||
{{- else -}} | ||
{{- .Values.externalMySQL.host -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.database.port" -}} | ||
{{- if eq .Values.mariadb.enabled true -}} | ||
{{- printf "3306" -}} | ||
{{- else -}} | ||
{{- printf "%d" (.Values.externalMySQL.port | int ) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.database.username" -}} | ||
{{- if eq .Values.mariadb.enabled true -}} | ||
{{- printf "root" -}} | ||
{{- else -}} | ||
{{- .Values.externalMySQL.username -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "tca.database.password" -}} | ||
{{- if eq .Values.mariadb.enabled true -}} | ||
{{- .Values.mariadb.auth.rootPassword -}} | ||
{{- else -}} | ||
{{- .Values.externalMySQL.password -}} | ||
{{- end -}} | ||
{{- 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,32 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: analysis-env | ||
data: | ||
DAEMON: {{ .Values.tca.commonConfig.daemonFlag | quote}} | ||
SERVER_ACCESS_LOG: {{ .Values.tca.commonConfig.accessLogPath | quote }} | ||
SERVER_ERROR_LOG: {{ .Values.tca.commonConfig.errorLogPath | quote }} | ||
API_TICKET_SALT: {{ .Values.tca.commonConfig.apiTicketSalt }} | ||
API_TICKET_TOKEN: {{ .Values.tca.commonConfig.apiTicketToken }} | ||
LOCAL_DOMAIN: {{ .Values.tca.commonConfig.publicUrl }} | ||
ANALYSIS_SENTRY_DSN: {{ .Values.tca.commonConfig.sentryDsn | quote }} | ||
ANALYSIS_SECRET_KEY: {{ .Values.tca.commonConfig.secretKey }} | ||
CELERY_WORKER_NUM: {{ .Values.tca.analysis.worker.num | quote }} | ||
ANALYSIS_SERVER_PORT: {{ .Values.tca.analysis.server.port | quote }} | ||
ANALYSIS_SERVER_PROCESS_NUM: {{ .Values.tca.analysis.server.processNum | quote }} | ||
DJANGO_SETTINGS_MODULE: {{ .Values.tca.analysis.settings.base.module }} | ||
ANALYSIS_DEBUG_MODE: {{ .Values.tca.analysis.settings.base.debugMode | quote }} | ||
ANALYSIS_DB_NAME: {{ .Values.tca.analysis.settings.dbName }} | ||
ANALYSIS_REDIS_DBID: {{ .Values.tca.analysis.settings.redisDBId | quote }} | ||
# DB相关配置,优先使用 Values.tca.analysis.settings.customDB 配置,默认使用 tca.database | ||
ANALYSIS_DB_USER: {{ .Values.tca.analysis.settings.customDB.user | default ( include "tca.database.username" . ) }} | ||
ANALYSIS_DB_PASSWORD: {{ .Values.tca.analysis.settings.customDB.password | default ( include "tca.database.password" . ) }} | ||
ANALYSIS_DB_HOST: {{ .Values.tca.analysis.settings.customDB.host | default ( include "tca.database.host" . ) }} | ||
ANALYSIS_DB_PORT: {{ .Values.tca.analysis.settings.customDB.port | default ( include "tca.database.port" . ) | quote }} | ||
# Redis相关配置,优先使用 Values.tca.analysis.settings.customRedis 配置,默认使用 tca.redis | ||
ANALYSIS_REDIS_HOST: {{ .Values.tca.analysis.settings.customRedis.host | default ( include "tca.redis.host" . ) | quote }} | ||
ANALYSIS_REDIS_PORT: {{ .Values.tca.analysis.settings.customRedis.port | default ( include "tca.redis.port" . ) | quote }} | ||
ANALYSIS_REDIS_PASSWD: {{ .Values.tca.analysis.settings.customRedis.password | default ( include "tca.redis.password" . ) }} | ||
# 内部服务通信配置 | ||
MAIN_SERVER_URL: http://{{ template "tca.fullname" . }}-main | ||
FILE_SERVER_URL: http://{{ template "tca.fullname" . }}-gateway/files/ |
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,53 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
labels: | ||
k8s-app: {{ template "tca.fullname" . }}-analysis-init-job | ||
app: {{ template "tca.name" . }} | ||
chart: {{ template "tca.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
name: {{ template "tca.fullname" . }}-analysis-init-job | ||
annotations: | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-weight": "5" | ||
spec: | ||
ttlSecondsAfterFinished: 100 | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: {{ template "tca.fullname" . }}-analysis-init-job | ||
release: {{ .Release.Name }} | ||
spec: | ||
{{- with .Values.global.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.tca.podAntiAffinity.enable }} | ||
affinity: | ||
podAntiAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 1 | ||
podAffinityTerm: | ||
topologyKey: "{{ .Values.tca.podAntiAffinity.topologyKey }}" | ||
labelSelector: | ||
matchLabels: | ||
k8s-app: {{ template "tca.fullname" . }}-analysis-init-job | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
containers: | ||
- name: {{ template "tca.fullname" . }}-analysis-init-job | ||
image: "{{ .Values.tca.analysis.image.repository }}:{{ .Values.tca.analysis.image.tag }}" | ||
imagePullPolicy: {{ .Values.global.imagePullPolicy }} | ||
command: ["bash"] | ||
args: ["./bin/init.sh"] | ||
envFrom: | ||
- configMapRef: | ||
name: analysis-env | ||
env: | ||
- name: _HASH_CONFIG_ | ||
value: {{ include (print $.Template.BasePath "/analysis/configmap.yaml") . | sha256sum }} | ||
resources: | ||
{{ toYaml .Values.tca.analysis.server.resources | indent 12 }} | ||
restartPolicy: Never | ||
backoffLimit: 2 |
Oops, something went wrong.