Skip to content

Commit c940e0b

Browse files
committed
feat: add jifa helm chart
1 parent 0d17fa4 commit c940e0b

18 files changed

+700
-0
lines changed

manifests/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
## Deploy jifa by helm
2+
3+
We can use [helm](https://helm.sh/) to quickly deploy jifa.
4+
5+
## Install jifa
6+
7+
```shell
8+
helm install jifa jifa -n jifa --create-namespace
9+
```
10+
11+
Check workloads:
12+
13+
```shell
14+
# kubectl get po -n jifa
15+
NAME READY STATUS RESTARTS AGE
16+
jifa-54d6b4d888-ngr6j 1/1 Running 2 (8m32s ago) 8m45s
17+
jifa-mysql-cfd5dbdb4-2m8bn 1/1 Running 0 8m45s
18+
```
19+
20+
Check service available:Upload an analysis file, check whether the worker starts normally,
21+
whether the log is normal, and whether the analysis results are obtained on the jifa interface.
22+
23+
```shell
24+
kubectl get po -n jifa -w
25+
NAME READY STATUS RESTARTS AGE
26+
jifa-54d6b4d888-ngr6j 1/1 Running 2 (12m ago) 13m
27+
jifa-elastic-worker-1 1/1 Running 0 16s
28+
jifa-mysql-cfd5dbdb4-2m8bn 1/1 Running 0 13m
29+
```
30+
31+
``jifa-elastic-worker-1`` logs:
32+
```shell
33+
kubectl logs -f -n jifa jifa-elastic-worker-1
34+
,--. ,--. ,------. ,---.
35+
| | | | | .---' / O \
36+
,--. | | | | | `--, | .-. |
37+
| '-' / | | | |` | | | |
38+
`-----' `--' `--' `--' `--'
39+
Eclipse Jifa
40+
Powered by Spring Boot 3.1.4
41+
42+
2024-03-19T04:19:15.573Z INFO 1 --- [ main] org.eclipse.jifa.server.Launcher : Starting Launcher using Java 17.0.8.1 with PID 1 (/jifa started by root in /)
43+
2024-03-19T04:19:15.579Z INFO 1 --- [ main] org.eclipse.jifa.server.Launcher : No active profile set, falling back to 1 default profile: "default"
44+
2024-03-19T04:19:16.693Z INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
45+
2024-03-19T04:19:16.917Z INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 215 ms. Found 8 JPA repository interfaces.
46+
2024-03-19T04:19:17.876Z INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8102 (http)
47+
2024-03-19T04:19:17.886Z INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
48+
2024-03-19T04:19:17.886Z INFO 1 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.13]
49+
2024-03-19T04:19:18.019Z INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
50+
2024-03-19T04:19:18.020Z INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2330 ms
51+
2024-03-19T04:19:18.178Z INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
52+
2024-03-19T04:19:18.236Z INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.2.9.Final
53+
2024-03-19T04:19:18.238Z INFO 1 --- [ main] org.hibernate.cfg.Environment : HHH000406: Using bytecode reflection optimizer
54+
2024-03-19T04:19:18.368Z INFO 1 --- [ main] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy
55+
2024-03-19T04:19:18.511Z INFO 1 --- [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
56+
2024-03-19T04:19:18.531Z INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
57+
2024-03-19T04:19:18.695Z INFO 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@2558f65c
58+
2024-03-19T04:19:18.698Z INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
59+
2024-03-19T04:19:18.752Z WARN 1 --- [ main] org.hibernate.dialect.Dialect : HHH000511: The 5.6.51 version for [org.hibernate.dialect.MySQLDialect] is no longer supported, hence certain features may not work properly. The minimum supported version is 5.7.0. Check the community dialects project for available legacy versions.
60+
2024-03-19T04:19:19.044Z INFO 1 --- [ main] o.h.b.i.BytecodeProviderInitiator : HHH000021: Bytecode provider name : bytebuddy
61+
2024-03-19T04:19:19.799Z INFO 1 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
62+
2024-03-19T04:19:19.926Z INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
63+
2024-03-19T04:19:23.844Z WARN 1 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
64+
2024-03-19T04:19:24.408Z INFO 1 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@18e0c618, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@32002a21, org.springframework.security.web.context.SecurityContextHolderFilter@c1aa8f9, org.springframework.security.web.header.HeaderWriterFilter@3106efb9, org.springframework.web.filter.CorsFilter@b13c600, org.springframework.security.web.authentication.logout.LogoutFilter@30090808, org.springframework.security.oauth2.server.resource.web.authentication.BearerTokenAuthenticationFilter@476fc8a1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@498e9130, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7b779c7b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7ae5231c, org.springframework.security.web.session.SessionManagementFilter@54ba7366, org.springframework.security.web.access.ExceptionTranslationFilter@4acbe932, org.springframework.security.web.access.intercept.AuthorizationFilter@34a7decd]
65+
2024-03-19T04:19:24.737Z INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8102 (http) with context path ''
66+
2024-03-19T04:19:24.752Z INFO 1 --- [ main] org.eclipse.jifa.server.Launcher : Started Launcher in 9.805 seconds (process running for 10.276)
67+
2024-03-19T04:19:26.470Z INFO 1 --- [nio-8102-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
68+
2024-03-19T04:19:26.470Z INFO 1 --- [nio-8102-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
69+
2024-03-19T04:19:26.471Z INFO 1 --- [nio-8102-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
70+
```
71+
72+
Successful installation!

manifests/charts/jifa/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

manifests/charts/jifa/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: jifa
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "jifa.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "jifa.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "jifa.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "jifa.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "jifa.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "jifa.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "jifa.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "jifa.labels" -}}
37+
helm.sh/chart: {{ include "jifa.chart" . }}
38+
{{ include "jifa.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "jifa.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "jifa.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "jifa.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "jifa.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
63+
64+
{{/*
65+
Return the appropriate apiVersion for RBAC resources.
66+
*/}}
67+
{{- define "common.capabilities.rbac.apiVersion" -}}
68+
{{- if semverCompare "<1.17-0" (include "common.capabilities.kubeVersion" .) -}}
69+
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
70+
{{- else -}}
71+
{{- print "rbac.authorization.k8s.io/v1" -}}
72+
{{- end -}}
73+
{{- end -}}
74+
75+
{{/*
76+
Return the target Kubernetes version
77+
*/}}
78+
{{- define "common.capabilities.kubeVersion" -}}
79+
{{- if .Values.global }}
80+
{{- if .Values.global.kubeVersion }}
81+
{{- .Values.global.kubeVersion -}}
82+
{{- else }}
83+
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
84+
{{- end -}}
85+
{{- else }}
86+
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
87+
{{- end -}}
88+
{{- end -}}
89+
90+
91+
{{/*
92+
Get Mysql Host
93+
*/}}
94+
{{- define "jifa.mysqlHost" -}}
95+
{{- if .Values.mysql.create }}
96+
{{- default (include "jifa.mysqlName" .) .Values.mysql.host }}
97+
{{- else }}
98+
{{- default "default" .Values.mysql.host }}
99+
{{- end }}
100+
{{- end }}
101+
102+
{{/*
103+
Get Mysql Default Name
104+
*/}}
105+
{{- define "jifa.mysqlName" -}}
106+
jifa-mysql
107+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "jifa.fullname" . }}
6+
labels:
7+
{{- include "jifa.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "jifa.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "jifa.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
14+
apiVersion: extensions/v1beta1
15+
{{- end }}
16+
kind: Ingress
17+
metadata:
18+
name: {{ $fullName }}
19+
labels:
20+
{{- include "jifa.labels" . | nindent 4 }}
21+
{{- with .Values.ingress.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
29+
{{- if .Values.ingress.tls }}
30+
tls:
31+
{{- range .Values.ingress.tls }}
32+
- hosts:
33+
{{- range .hosts }}
34+
- {{ . | quote }}
35+
{{- end }}
36+
secretName: {{ .secretName }}
37+
{{- end }}
38+
{{- end }}
39+
rules:
40+
{{- range .Values.ingress.hosts }}
41+
- host: {{ .host | quote }}
42+
http:
43+
paths:
44+
{{- range .paths }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
49+
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
number: {{ $svcPort }}
55+
{{- else }}
56+
serviceName: {{ $fullName }}
57+
servicePort: {{ $svcPort }}
58+
{{- end }}
59+
{{- end }}
60+
{{- end }}
61+
{{- end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: mysql-initdb-config
5+
namespace: {{ .Release.Namespace | quote }}
6+
labels:
7+
{{- include "jifa.labels" . | nindent 4 }}
8+
data:
9+
initdb.sql: |
10+
CREATE DATABASE IF NOT EXISTS jifa;

0 commit comments

Comments
 (0)