Skip to content

Commit 4546ae1

Browse files
authored
feat: add pvc setting into the helm chart (#244)
1 parent 0661686 commit 4546ae1

File tree

12 files changed

+103
-19
lines changed

12 files changed

+103
-19
lines changed

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
FROM node:20-alpine3.17 AS ui
1+
FROM docker.io/library/node:20-alpine3.17 AS ui
22

33
WORKDIR /workspace
44
COPY console/atest-ui .
55
RUN npm install --ignore-scripts --registry=https://registry.npmmirror.com
66
RUN npm run build-only
77

8-
FROM apache/skywalking-go:0.2.0-go1.18 AS sk
8+
FROM docker.io/apache/skywalking-go:0.2.0-go1.18 AS sk
99

10-
FROM golang:1.19 AS builder
10+
FROM docker.io/golang:1.19 AS builder
1111

1212
ARG VERSION
1313
ARG GOPROXY
@@ -42,7 +42,7 @@ RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-or
4242
RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-s3 extensions/store-s3/main.go
4343
RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-git extensions/store-git/main.go
4444

45-
FROM ubuntu:23.04
45+
FROM docker.io/library/ubuntu:23.04
4646

4747
LABEL "com.github.actions.name"="API testing"
4848
LABEL "com.github.actions.description"="API testing"
@@ -63,11 +63,10 @@ COPY --from=builder /workspace/atest-store-git /usr/local/bin/atest-store-git
6363
COPY --from=builder /workspace/LICENSE /LICENSE
6464
COPY --from=builder /workspace/README.md /README.md
6565

66-
RUN mkdir -p /var/www/data
6766
COPY --from=builder /workspace/sample /var/www/sample
6867

6968
RUN apt update -y && \
7069
# required for atest-store-git
7170
apt install -y --no-install-recommends ssh-client ca-certificates
7271

73-
CMD ["atest", "server", "--local-storage=/var/www/sample/*.yaml", "--local-storage=/var/www/data/*.yaml"]
72+
CMD ["atest", "server", "--local-storage=/var/www/sample/*.yaml"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ IMG_TOOL?=podman
22
BINARY?=atest
33
TOOLEXEC?=-toolexec="skywalking-go-agent"
44
GOPROXY?=https://goproxy.cn,direct
5-
HELM_VERSION?=v0.0.1
5+
HELM_VERSION?=v0.0.2
66
APP_VERSION?=v0.0.13
77

88
build:

console/atest-ui/src/views/TestSuite.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ function save() {
6868
fetch('/server.Runner/UpdateTestSuite', requestOptions)
6969
.then((response) => response.json())
7070
.then((e) => {
71-
ElMessage({
72-
message: 'Updated.',
73-
type: 'success'
74-
})
71+
if (e.error === "") {
72+
ElMessage({
73+
message: 'Updated.',
74+
type: 'success'
75+
})
76+
} else {
77+
ElMessage.error('Oops, ' + e.message)
78+
}
7579
})
7680
.catch((e) => {
7781
ElMessage.error('Oops, ' + e)

helm/api-testing/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: v0.0.1
18+
version: v0.0.2
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

helm/api-testing/templates/deployment.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $core := .Values.persistence.persistentVolumeClaim.core -}}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -45,6 +46,13 @@ spec:
4546
httpGet:
4647
path: /
4748
port: http
49+
volumeMounts:
50+
- name: data
51+
mountPath: /var/www/sample
52+
subPath: {{ $core.subPath }}
53+
- name: data
54+
mountPath: /root
55+
subPath: config
4856
resources:
4957
{{- toYaml .Values.resources | nindent 12 }}
5058
{{- with .Values.nodeSelector }}
@@ -59,3 +67,16 @@ spec:
5967
tolerations:
6068
{{- toYaml . | nindent 8 }}
6169
{{- end }}
70+
volumes:
71+
{{- if not .Values.persistence.enabled }}
72+
- name: "data"
73+
emptyDir: {}
74+
{{- else if $core.existingClaim }}
75+
- name: "data"
76+
persistentVolumeClaim:
77+
claimName: {{ $core.existingClaim }}
78+
{{- else }}
79+
- name: "data"
80+
persistentVolumeClaim:
81+
claimName: {{ include "api-testing.fullname" . }}
82+
{{- end -}}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- $core := .Values.persistence.persistentVolumeClaim.core -}}
2+
{{- if and .Values.persistence.enabled (not $core.existingClaim) }}
3+
kind: PersistentVolumeClaim
4+
apiVersion: v1
5+
metadata:
6+
name: {{ include "api-testing.fullname" . }}
7+
labels:
8+
{{- include "api-testing.labels" . | nindent 4 }}
9+
spec:
10+
accessModes:
11+
- {{ $core.accessMode }}
12+
resources:
13+
requests:
14+
storage: {{ $core.size }}
15+
{{- if $core.storageClass }}
16+
{{- if eq "-" $core.storageClass }}
17+
storageClassName: ""
18+
{{- else }}
19+
storageClassName: {{ $core.storageClass }}
20+
{{- end }}
21+
{{- end }}
22+
{{- end }}

helm/api-testing/templates/service.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ spec:
1111
targetPort: http
1212
protocol: TCP
1313
name: http
14+
{{- if and .Values.service.nodePort }}
15+
nodePort: {{ .Values.service.nodePort }}
16+
{{- end}}
1417
selector:
1518
{{- include "api-testing.selectorLabels" . | nindent 4 }}

helm/api-testing/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ securityContext: {}
3939
service:
4040
type: ClusterIP
4141
port: 8080
42+
nodePort: ""
4243

4344
ingress:
4445
enabled: false
@@ -75,6 +76,16 @@ autoscaling:
7576
targetCPUUtilizationPercentage: 80
7677
# targetMemoryUtilizationPercentage: 80
7778

79+
persistence:
80+
enabled: true
81+
persistentVolumeClaim:
82+
core:
83+
existingClaim: ""
84+
storageClass: ""
85+
subPath: ""
86+
accessMode: ReadWriteMany
87+
size: 500Mi
88+
7889
nodeSelector: {}
7990

8091
tolerations: []

pkg/server/convert.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ func ToGRPCStore(store testing.Store) (result *Store) {
3131
result = &Store{
3232
Name: store.Name,
3333
Kind: &StoreKind{
34-
Name: store.Kind.Name,
35-
Url: store.Kind.URL,
34+
Name: store.Kind.Name,
35+
Url: store.Kind.URL,
36+
Enabled: store.Kind.Enabled,
3637
},
3738
Description: store.Description,
3839
Url: store.URL,

pkg/testing/store.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,26 @@ func (s *storeFactory) CreateStore(store Store) (err error) {
199199
}
200200

201201
func (s *storeFactory) save(storeConfig *StoreConfig) (err error) {
202-
if err = os.MkdirAll(s.configDir, 0755);err==nil{
202+
for i, item := range storeConfig.Stores {
203+
if item.Kind.Name != "" {
204+
storeConfig.Stores[i].Kind.Enabled = true
205+
206+
foundPlugin := false
207+
for j, kind := range storeConfig.Plugins {
208+
if kind.Name == item.Kind.Name {
209+
foundPlugin = true
210+
storeConfig.Plugins[j].Enabled = true
211+
break
212+
}
213+
}
214+
215+
if !foundPlugin {
216+
storeConfig.Plugins = append(storeConfig.Plugins, storeConfig.Stores[i].Kind)
217+
}
218+
}
219+
}
220+
221+
if err = os.MkdirAll(s.configDir, 0755); err == nil {
203222
var data []byte
204223
if data, err = yaml.Marshal(storeConfig); err == nil {
205224
err = os.WriteFile(path.Join(s.configDir, "stores.yaml"), data, 0644)

0 commit comments

Comments
 (0)