Skip to content
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

Aerchery Kubernetes Helm Chart 维护 #1334

Merged
merged 4 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
aiVersion: v1
aiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
home: https://archerydms.com/
description: Archery Helm chart for Kubernetes
name: archery
version: 0.1.0
version: 0.1.1
sources:
- https://github.com/hhyo/Archery

maintainers:
- name: AceRyuunosuke
email: [email protected]

dependencies:
- name: redis
version: ~15.7.1
repository: https://charts.bitnami.com/bitnami
- name: mysql
version: ~8.8.20
repository: https://charts.bitnami.com/bitnami
36 changes: 27 additions & 9 deletions src/charts/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
1、setting: 根目录values.yaml下配置,相关configMap的文件,settings.py,soar.yaml,analysis_slow_query.sh等,找出与mysql,redis的数据库连接 charts/goinception,charts/inception目录下的values.yaml配置修改,主要与mysql连接的配置 mysql的存储持久化,请查看values.yaml的方法进行配置
# Archery Kubernetes Helm 部署文档

2、dependency: cd charts/archeryk8s && helm dependency update
## 1. 获取依赖

3、install: helm install ./ --name archery --namespace=default
helm dependency update

4、visit:
## 2. 替换mysql、redis、archery登录密码

i 本机访问 kubectl port-forward pods/archery-xxxxxx 9123:9123
ii 集群外访问 将svc配置为nodePort或loadBalance,或开启ingress
### 2.1 mysql
执行以下命令,执行前将${your mysql password}替换为想要设置的mysql密码。
`grep -rn "MYSQL_ROOT_PASSWORD" *|awk -F: '{print $1}'|uniq|xargs sed -i s/MYSQL_ROOT_PASSWORD/${your mysql password}/g`

默认关闭ingress,如需开启ingress,请在values.yaml设置为true,并修改ingress默认域名配置。
### 2.2 redis
执行以下命令,执行前将${your redis password}替换为想要设置的redis密码。
`grep -rn "REDIS_PASSWORD" *|awk -F: '{print $1}'|uniq|xargs sed -i s/REDIS_PASSWORD/${your redis password}/g`

### 2.3 archery默认admin登录密码
执行以下命令,执行前将${your archery password}替换为想要设置的archery密码。
`grep -rn "ARCHERY_ADMIN_PASSWORD" *|awk -F: '{print $1}'|uniq|xargs sed -i s/ARCHERY_ADMIN_PASSWORD/${your archery password}/g`

默认用户名:admin
默认密码:Archery2019
## 3. 更改mysql持久化配置

mysql的存储持久化,请查看values.yaml的方法进行配置。

## 4. LDAP设置

如需启用LDAP,修改value.yaml里comfigmap下settings.py 内相关内容。

## 5. 访问方式

5.1 本机访问 kubectl port-forward pods/archery-xxxxxx 9123:9123
5.2 集群外访问 将svc配置为nodePort或loadBalance,或开启ingress

默认用户名: admin
密码为2.3中设置的密码
2 changes: 1 addition & 1 deletion src/charts/charts/goinception/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "goinception.fullname" . }}
Expand Down
3 changes: 2 additions & 1 deletion src/charts/charts/goinception/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ configMap:
backup_host="archery-mysql"
backup_port=3306
backup_user="root"
backup_password="archery"
backup_password="MYSQL_ROOT_PASSWORD"
#安全更新是否开启.
#-1表示不做操作,基于远端数据库[默认值]
#0表示关闭安全更新
Expand Down Expand Up @@ -154,3 +154,4 @@ nodeSelector: {}
tolerations: []

affinity: {}

2 changes: 1 addition & 1 deletion src/charts/charts/inception/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "inception.fullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion src/charts/charts/inception/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ configMap:
character-set-client-handshake=0
character-set-server=utf8mb4
inception_language_code=zh-CN
inception_remote_system_password=archery
inception_remote_system_password=MYSQL_ROOT_PASSWORD
inception_remote_system_user=root
inception_remote_backup_port=3306
inception_remote_backup_host=archery-mysql
Expand Down
9 changes: 0 additions & 9 deletions src/charts/requirements.yaml

This file was deleted.

35 changes: 21 additions & 14 deletions src/charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "archery.fullname" . }}
Expand All @@ -21,21 +21,27 @@ spec:
spec:
initContainers:
- image: busybox
name: init-container
name: init-mysql
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'until nslookup archery-mysql; do echo waiting for mysql; sleep 10; done;']
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
name: init-archery
imagePullPolicy: IfNotPresent
args:
- "mkdir"
- "-p"
- "/opt/archery/downloads/{binlog2sql,log,schemasync}"
volumeMounts:
- name: archery-settings
subPath: settings.py
mountPath: /opt/archery/archery/settings.py
- name: archery-settings
subPath: init-archery.sh
mountPath: /opt/archery/src/docker/init-archery.sh
- name: archery-settings
subPath: createsuperuser.py
mountPath: /opt/archery/src/docker/createsuperuser.py
- mountPath: /opt/archery/downloads
name: archery-download
- mountPath: /opt/archery/src/script
name: archery-script
- image: busybox
name: init-mysql
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'until nslookup archery-mysql; do echo waiting for mysql; sleep 2; done;']
command: ['/bin/bash','/opt/archery/src/docker/init-archery.sh']
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand All @@ -51,10 +57,11 @@ spec:
httpGet:
path: /
port: archery
lifecycle:
postStart:
exec:
command: ['/bin/bash','/opt/archery/src/docker/init-archery.sh']
initialDelaySeconds: 180
periodSeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
Expand Down
43 changes: 26 additions & 17 deletions src/charts/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
{{- $fullName := include "archery.fullname" . -}}
{{- $ingressPaths := .Values.ingress.paths -}}
{{- $servicePort := .Values.ingress.servicePort -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -16,26 +22,29 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
{{- range .Values.ingress.hosts }}
{{- $url := splitList "/" . }}
- host: {{ first $url }}
http:
paths:
{{- range $ingressPaths }}
- path: {{ . }}
- path: /{{ rest $url | join "/" }}
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: Prefix
{{- end }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
Loading