diff --git a/k8s/helm/jira/Chart.yaml b/k8s/helm/jira/Chart.yaml index 03d754a8..0a81d2fd 100644 --- a/k8s/helm/jira/Chart.yaml +++ b/k8s/helm/jira/Chart.yaml @@ -6,9 +6,13 @@ sources: - https://github.com/instantlinux/docker-tools - https://hub.docker.com/r/atlassian/jira-core type: application -version: 0.1.5 +version: 0.1.6 appVersion: "9.12.1" dependencies: - name: chartlib version: 0.1.8 repository: https://instantlinux.github.io/docker-tools +- name: mariadb + version: 0.1.0 + repository: file://subcharts/mariadb + condition: mariadb.enabled diff --git a/k8s/helm/jira/subcharts/mariadb/.helmignore b/k8s/helm/jira/subcharts/mariadb/.helmignore new file mode 100644 index 00000000..839de881 --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/.helmignore @@ -0,0 +1,2 @@ +*~ +.git diff --git a/k8s/helm/jira/subcharts/mariadb/Chart.yaml b/k8s/helm/jira/subcharts/mariadb/Chart.yaml new file mode 100644 index 00000000..38090673 --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/Chart.yaml @@ -0,0 +1,15 @@ +apiVersion: v2 +name: mariadb +description: Mariadb database +home: https://github.com/instantlinux/docker-tools +sources: +- https://github.com/instantlinux/docker-tools +- https://hub.docker.com/_/mariadb +type: application +version: 0.1.0 +# specify version tag from hub.docker.com in top-level values.yaml +appVersion: "0.0.1" +dependencies: +- name: chartlib + version: 0.1.8 + repository: https://instantlinux.github.io/docker-tools diff --git a/k8s/helm/jira/subcharts/mariadb/templates/NOTES.txt b/k8s/helm/jira/subcharts/mariadb/templates/NOTES.txt new file mode 100644 index 00000000..62ea3f4b --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/templates/NOTES.txt @@ -0,0 +1,28 @@ +{{- if hasKey .Values "service" }} +{{- if or .Values.service.enabled (not (hasKey .Values.service "enabled")) }} +1. Get the application URL by running these commands: +{{- if hasKey .Values "ingress" }} +{{- 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 "local.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 "local.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "local.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 "local.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 }} +{{- end }} +{{- end }} +{{- end }} diff --git a/k8s/helm/jira/subcharts/mariadb/templates/app.yaml b/k8s/helm/jira/subcharts/mariadb/templates/app.yaml new file mode 100644 index 00000000..5a01911b --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/templates/app.yaml @@ -0,0 +1,15 @@ +{{- include "chartlib.configmap" . }} +--- +{{- include "chartlib.deployment" . }} +--- +{{- include "chartlib.hpa" . }} +--- +{{- include "chartlib.ingress" . }} +--- +{{- include "chartlib.ingresstotp" . }} +--- +{{- include "chartlib.service" . }} +--- +{{- include "chartlib.serviceaccount" . }} +--- +{{- include "chartlib.statefulset" . }} diff --git a/k8s/helm/jira/subcharts/mariadb/templates/configmap.yaml b/k8s/helm/jira/subcharts/mariadb/templates/configmap.yaml new file mode 100644 index 00000000..6675e353 --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/templates/configmap.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "local.fullname" . }} + labels: + {{- include "local.labels" . | nindent 4 }} +data: + my.cnf: | + # --- Deployed from kubernetes configmap --- + # + # For documentation see + # https://mariadb.com/kb/en/library/server-system-variables + + [mysqld] + # + # * Basic Settings + # + basedir = /usr + tmpdir = /tmp + skip-external-locking + character_set_server = {{ .Values.character_set_server }} + ignore_db_dirs = lost+found + + # + # * Fine Tuning + # + ft_min_word_len = {{ .Values.ft_min_word_len }} + join_buffer_size = {{ .Values.join_buffer_size }} + key_buffer_size = {{ .Values.key_buffer_size }} + max_allowed_packet = {{ .Values.max_allowed_packet }} + #max_connections = 100 + max_heap_table_size = {{ .Values.max_heap_table_size }} + query_cache_type = OFF + query_cache_size = 0 + read_buffer_size = {{ .Values.read_buffer_size }} + read_rnd_buffer_size = {{ .Values.read_rnd_buffer_size }} + table_open_cache = 4096 + thread_stack = {{ .Values.thread_stack }} + thread_cache_size = {{ .Values.thread_cache_size }} + #thread_concurrency = 12 + tmp_table_size = {{ .Values.tmp_table_size }} + + interactive_timeout = {{ .Values.interactive_timeout }} + net_read_timeout = {{ .Values.net_read_timeout }} + net_write_timeout = {{ .Values.net_read_timeout }} + wait_timeout = {{ .Values.wait_timeout }} + + # + # * Slow query log + # + slow_query_log_file = /var/log/mysql/mysql-slow.log + slow_query_log = {{ .Values.slow_query_log }} + long_query_time = {{ .Values.long_query_time }} + #log_queries_not_using_indexes + + # + # * InnoDB + # + innodb_data_file_path = ibdata1:10M:autoextend + innodb_buffer_pool_size = {{ .Values.innodb_buffer_pool_size }} + innodb_log_file_size = {{ .Values.innodb_log_file_size }} + + [mysqldump] + quick + quote-names + max_allowed_packet = 16M diff --git a/k8s/helm/jira/subcharts/mariadb/templates/tests/test-connection.yaml b/k8s/helm/jira/subcharts/mariadb/templates/tests/test-connection.yaml new file mode 100644 index 00000000..ae159a4f --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/templates/tests/test-connection.yaml @@ -0,0 +1,17 @@ +{{- if hasKey .Values "service" }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "local.fullname" . }}-test-connection" + labels: + {{- include "local.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "local.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never +{{- end }} diff --git a/k8s/helm/jira/subcharts/mariadb/values.yaml b/k8s/helm/jira/subcharts/mariadb/values.yaml new file mode 100644 index 00000000..e441da3a --- /dev/null +++ b/k8s/helm/jira/subcharts/mariadb/values.yaml @@ -0,0 +1,81 @@ +# Default values for mariadb +character_set_server: utf8 +ft_min_word_len: 3 +innodb_buffer_pool_size: 1024M +innodb_log_file_size: 32M +interactive_timeout: 28800 +join_buffer_size: 131072 +key_buffer_size: 16M +long_query_time: 4 +max_allowed_packet: 256M +max_heap_table_size: 16M +net_read_timeout: 30 +net_write_timeout: 60 +read_buffer_size: 131072 +read_rnd_buffer_size: 262144 +slow_query_log: 1 +thread_stack: 192K +thread_cache_size: 8 +tmp_table_size: 16M +wait_timeout: 3600 + +statefulset: + containerPorts: [ containerPort: 3306 ] + # environment variables defined in parent + env: + log_level: info + xenv: + - name: MARIADB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + key: mysql-root-password + name: mysql-root-password + resources: + limits: + memory: 4096Mi + requests: + cpu: 300m + memory: 128Mi +volumeMounts: +- mountPath: /etc/mysql/my.cnf.d + name: etc +- mountPath: /var/log/mysql + name: logs +- mountPath: /var/lib/mysql + name: data +volumes: +- name: etc + configMap: + name: jira-mariadb +volumeClaimTemplates: +- metadata: + name: data + spec: + accessModes: [ ReadWriteOnce ] + resources: + requests: + storage: 8Gi +- metadata: + name: logs + spec: + accessModes: [ ReadWriteOnce ] + resources: + requests: + storage: 500Mi + +image: + repository: mariadb + pullPolicy: IfNotPresent + # tag: default + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + enabled: false +service: + clusterIP: None + ports: [ port: 3306 ] + type: ClusterIP +autoscaling: + enabled: false diff --git a/k8s/helm/jira/values.yaml b/k8s/helm/jira/values.yaml index a33d3976..8b000d26 100644 --- a/k8s/helm/jira/values.yaml +++ b/k8s/helm/jira/values.yaml @@ -82,3 +82,8 @@ ingress: nginx.ingress.kubernetes.io/enable-access-log: "false" ingressTOTP: enabled: true + +mariadb: + enabled: false + image: + tag: 10.4.20