Skip to content

Commit 9280c02

Browse files
authored
fix: improve kubeClientQPS type consistency in operator chart (#1485)
* fix: improve kubeClientQPS type consistency in operator chart - Use explicit float comparison (0.0) in deployment template - Update values.yaml kubeClientQPS default from 0 to 0.0 for type consistency - Ensures proper float64 type handling in Helm template condition Signed-off-by: yangw <[email protected]> * update docs Signed-off-by: yangw <[email protected]> * remove condition Signed-off-by: yangw <[email protected]> * update test config Signed-off-by: yangw <[email protected]> * fix lint Signed-off-by: yangw <[email protected]> --------- Signed-off-by: yangw <[email protected]>
1 parent 0fa816c commit 9280c02

File tree

8 files changed

+62
-41
lines changed

8 files changed

+62
-41
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test Helm Charts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
chart_dirs:
7+
description: 'JSON array of chart directories to test'
8+
required: false
9+
type: string
10+
default: '["redis-operator", "redis", "redis-cluster", "redis-replication", "redis-sentinel"]'
11+
12+
jobs:
13+
test-charts:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Create k8s Kind Cluster
20+
uses: helm/[email protected]
21+
with:
22+
cluster_name: kind
23+
24+
- name: Install Helm
25+
uses: azure/setup-helm@v4
26+
with:
27+
version: v3.5.4
28+
29+
- name: Install yq
30+
run: |
31+
sudo snap install yq
32+
33+
- name: Install and test Redis Related Helm charts
34+
run: |
35+
kubectl cluster-info --context kind-kind
36+
chart_dirs_json='${{ inputs.chart_dirs }}'
37+
chart_dirs=($(echo $chart_dirs_json | jq -r '.[]'))
38+
for dir in "${chart_dirs[@]}"
39+
do
40+
if [[ -f ./charts/$dir/Chart.yaml ]]; then
41+
helm dependency update ./charts/$dir/
42+
fi
43+
helm install $dir ./charts/$dir/
44+
helm test $dir
45+
done
46+
echo "Listing installed Helm charts..."

.github/workflows/ci.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,17 @@ jobs:
206206

207207
GOSEC_OUTPUT: "junit-xml:/github/workspace/gosec-results.xml"
208208

209+
helm_chart_test:
210+
needs: [gotest]
211+
name: Helm Chart Test
212+
uses: ./.github/workflows/call-test-charts.yaml
213+
209214
e2e_test:
210215
# DEBUG
211-
needs: [validate_yaml]
216+
needs: [validate_yaml, helm_chart_test]
212217
name: E2E Test
213218
runs-on: ubuntu-latest
219+
if: always() && (needs.validate_yaml.result == 'success') && (needs.helm_chart_test.result == 'success' || needs.helm_chart_test.result == 'skipped')
214220
steps:
215221
- name: Checkout code
216222
uses: actions/checkout@v4

.github/workflows/publish-charts.yaml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,7 @@ jobs:
3737
test-charts:
3838
needs:
3939
- lint-charts
40-
runs-on: ubuntu-latest
41-
steps:
42-
- name: Check out code
43-
uses: actions/checkout@v4
44-
45-
- name: Create k8s Kind Cluster
46-
uses: helm/[email protected]
47-
with:
48-
cluster_name: kind
49-
50-
- name: Install Helm
51-
uses: azure/setup-helm@v4
52-
with:
53-
version: v3.5.4
54-
55-
- name: Install yq
56-
run: |
57-
sudo snap install yq
58-
59-
- name: Install and test Redis Related Helm charts
60-
run: |
61-
kubectl cluster-info --context kind-kind
62-
chart_dirs=("redis-operator" "redis" "redis-cluster" "redis-replication" "redis-sentinel")
63-
for dir in "${chart_dirs[@]}"
64-
do
65-
if [[ -f ./charts/$dir/Chart.yaml ]]; then
66-
helm dependency update ./charts/$dir/
67-
fi
68-
helm install $dir ./charts/$dir/
69-
helm test $dir
70-
done
71-
echo "Listing installed Helm charts..."
40+
uses: ./.github/workflows/call-test-charts.yaml
7241

7342
release-charts:
7443
runs-on: ubuntu-latest

charts/redis-operator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ kubectl create secret tls <webhook-server-cert> --key tls.key --cert tls.crt -n
102102
| issuer.solver.enabled | bool | `true` | |
103103
| issuer.solver.ingressClass | string | `"nginx"` | |
104104
| issuer.type | string | `"selfSigned"` | |
105-
| manager.config.kubeClientQPS | int | `0` | If value > 0, it will override the default value in the operator |
105+
| manager.config.kubeClientQPS | float | `0` | If value > 0, it will override the default value in the operator |
106106
| manager.config.kubeClientTimeout | string | `"60s"` | |
107107
| nodeSelector | object | `{}` | |
108108
| podSecurityContext | object | `{}` | |

charts/redis-operator/templates/operator-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
{{- if .Values.manager.config.kubeClientTimeout }}
5757
- --kube-client-timeout={{ .Values.manager.config.kubeClientTimeout }}
5858
{{- end }}
59-
{{- if and .Values.manager.config.kubeClientQPS (gt (.Values.manager.config.kubeClientQPS | float64) 0) }}
59+
{{- if and .Values.manager.config.kubeClientQPS (gt (.Values.manager.config.kubeClientQPS | float64) 0.0) }}
6060
- --kube-client-qps={{ .Values.manager.config.kubeClientQPS }}
6161
{{- end }}
6262
{{- range $arg := .Values.redisOperator.extraArgs }}

charts/redis-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ manager:
114114
config:
115115
kubeClientTimeout: 60s
116116
# -- If value > 0, it will override the default value in the operator
117-
kubeClientQPS: 0
117+
kubeClientQPS: 0.0

tests/_config/chainsaw-configuration.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ metadata:
77
spec:
88
execution:
99
failFast: true
10-
parallel: 10
10+
parallel: 2
11+
forceTerminationGracePeriod: 5s
1112
cleanup:
12-
# DEBUG
1313
skipDelete: true
14-
delayBeforeCleanup: 30m
14+
delayBeforeCleanup: 10s
1515
timeouts:
1616
apply: 5m
1717
delete: 5m

tests/e2e-chainsaw/v1beta2/setup/redis-ha/chainsaw-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
- name: Test Master IP consistency
5151
try:
5252
- sleep:
53-
duration: 180s
53+
duration: 60s
5454
- script:
5555
timeout: 10s
5656
content: |
@@ -86,7 +86,7 @@ spec:
8686
- name: Test Master IP consistency
8787
try:
8888
- sleep:
89-
duration: 180s
89+
duration: 60s
9090
- script:
9191
timeout: 10s
9292
content: |

0 commit comments

Comments
 (0)