Skip to content

Commit 37be571

Browse files
Minimal k8s version (#85)
Add k8s and ClickHouse version compatibility tests. Lower minimal required k8s version.
1 parent dc2a105 commit 37be571

11 files changed

Lines changed: 182 additions & 11 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,58 @@ jobs:
197197
- name: Check Helm release status
198198
run: helm status my-release --namespace clickhouse-operator-system
199199

200+
compat-e2e-test:
201+
runs-on: ubuntu-latest
202+
strategy:
203+
fail-fast: false
204+
matrix:
205+
include:
206+
- name: "Minimal supported kubernetes with LTS ClickHouse release"
207+
kind_version: v1.28.15
208+
clickhouse_version: "25.8"
209+
- name: "Latest kubernetes version with LTS ClickHouse release"
210+
kind_version: v1.35.1
211+
clickhouse_version: "25.8"
212+
- name: "Supported ClickHouse versions"
213+
kind_version: v1.30.13
214+
clickhouse_version: "26.1,25.12,25.11,25.8,25.3"
215+
steps:
216+
- name: Checkout code
217+
uses: actions/checkout@v6
218+
219+
- name: Set up Go
220+
uses: actions/setup-go@v5
221+
with:
222+
go-version-file: 'go.mod'
223+
224+
- name: Go Mod
225+
run: go mod download
226+
227+
- name: Build image
228+
run: make docker-build IMG="clickhouse.com/clickhouse-operator:v0.0.1" BUILD_TIME=e2e
229+
230+
- name: Create k8s Kind Cluster
231+
uses: helm/kind-action@v1
232+
with:
233+
cluster_name: kind
234+
version: ${{ env.kind-version }}
235+
config: ci/kind-cluster.config
236+
node_image: "kindest/node:${{ matrix.kind_version }}"
237+
238+
- name: Run compatibility e2e tests
239+
run: make test-compat-e2e
240+
env:
241+
CLICKHOUSE_VERSION: ${{ matrix.clickhouse_version }}
242+
243+
- name: Test Report
244+
uses: dorny/test-reporter@v2
245+
if: ${{ !cancelled() }}
246+
with:
247+
name: compat-e2e (k8s ${{ matrix.k8s_version }}${{ matrix.clickhouse_version && format(', ch {0}', matrix.clickhouse_version) || '' }})
248+
badge-title: compat-e2e (k8s ${{ matrix.k8s_version }})
249+
path: "**/report/*.xml"
250+
reporter: java-junit
251+
200252
e2e-test:
201253
needs: [ lint, bundle, build_and_test, helm-validate, helm-test ]
202254
strategy:
@@ -242,7 +294,7 @@ jobs:
242294
ci-success-check:
243295
name: All CI checks passed
244296
runs-on: ubuntu-latest
245-
needs: [ lint, bundle, build_and_test, helm-validate, helm-test, e2e-test ]
297+
needs: [ lint, bundle, build_and_test, helm-validate, helm-test, compat-e2e-test, e2e-test ]
246298
if: always()
247299
steps:
248300
- name: Determine CI status

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ test-keeper-e2e: ## Run keeper e2e tests.
143143
test-clickhouse-e2e: ## Run clickhouse e2e tests.
144144
go test ./test/e2e/ --ginkgo.label-filter clickhouse -test.timeout 30m --ginkgo.v --ginkgo.junit-report=report/junit-report.xml
145145

146+
.PHONY: test-compat-e2e # Run compatibility smoke tests across ClickHouse versions.
147+
test-compat-e2e: ## Run compatibility e2e tests.
148+
go test ./test/e2e/ --ginkgo.label-filter compatibility -test.timeout 30m --ginkgo.v --ginkgo.junit-report=report/junit-report.xml
149+
146150
.PHONY: lint
147151
lint: golangci-lint codespell ## Run golangci-lint linter and codespell
148152
$(GOLANGCI_LINT) run

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ The Operator handles the full lifecycle of ClickHouse clusters, including scalin
3131
### Prerequisites
3232
- go version v1.25.0+
3333
- docker version 17.03+
34-
- `kubectl` version v1.30.0+
35-
- Access to a Kubernetes v1.30.0+ cluster
34+
- `kubectl` version v1.28.0+
35+
- Access to a Kubernetes v1.28.0+ cluster
3636
- cert-manager installed in the cluster (for webhook certificates)
3737

3838
### Quick Start

api/v1alpha1/clickhousecluster_types.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ type ClickHouseCluster struct {
203203

204204
Spec ClickHouseClusterSpec `json:"spec,omitempty"`
205205
Status ClickHouseClusterStatus `json:"status,omitempty"`
206+
207+
specificName string `json:"-"`
206208
}
207209

208210
// ClickHouseReplicaID identifies a ClickHouse replica within the cluster.
@@ -306,9 +308,13 @@ func (v *ClickHouseCluster) Conditions() *[]metav1.Condition {
306308
return &v.Status.Conditions
307309
}
308310

309-
// SpecificName returns cluster name with resource suffix. Used to generate resource names.
311+
// SpecificName returns cluster name with resource suffix. Used to generate resource names that may be used in DNS.
310312
func (v *ClickHouseCluster) SpecificName() string {
311-
return v.GetName() + "-clickhouse"
313+
if v.specificName == "" {
314+
v.specificName = normalizeName(v.Name) + "-clickhouse"
315+
}
316+
317+
return v.specificName
312318
}
313319

314320
// Shards returns requested number of shards in the ClickHouseCluster.

api/v1alpha1/common.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package v1alpha1
33
import (
44
"errors"
55
"fmt"
6+
"strings"
67

78
corev1 "k8s.io/api/core/v1"
89
)
@@ -290,6 +291,11 @@ func (s *DefaultPasswordSelector) Validate() error {
290291
return nil
291292
}
292293

294+
// normalizeName removes dots from name to make it valid for use as a hostname or label value, where dots are not allowed.
295+
func normalizeName(name string) string {
296+
return strings.ReplaceAll(name, ".", "-")
297+
}
298+
293299
// formatPodHostname returns hostname for the first pod in the StatefulSet.
294300
func formatPodHostname(stsName, serviceName, namespace, domain string) string {
295301
if domain == "" {

api/v1alpha1/keepercluster_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ type KeeperCluster struct {
166166

167167
Spec KeeperClusterSpec `json:"spec,omitempty"`
168168
Status KeeperClusterStatus `json:"status,omitempty"`
169+
170+
specificName string `json:"-"`
169171
}
170172

171173
// KeeperReplicaID represents ClickHouse Keeper replica ID. Used for naming resources and RAFT configuration.
@@ -213,7 +215,11 @@ func (v *KeeperCluster) Conditions() *[]metav1.Condition {
213215

214216
// SpecificName returns cluster name with resource suffix. Used to generate resource names.
215217
func (v *KeeperCluster) SpecificName() string {
216-
return v.GetName() + "-keeper"
218+
if v.specificName == "" {
219+
v.specificName = normalizeName(v.Name) + "-keeper"
220+
}
221+
222+
return v.specificName
217223
}
218224

219225
// Replicas returns requested number of replicas in the cluster.

config/manifests/bases/clickhouse-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ spec:
170170
- email: operator@clickhouse.com
171171
name: ClickHouse Team
172172
maturity: alpha
173-
minKubeVersion: 1.30.0
173+
minKubeVersion: 1.28.0
174174
provider:
175175
name: ClickHouse Inc.
176176
url: https://clickhouse.com

docs/installation/helm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide covers installing the ClickHouse Operator using Helm charts.
44

55
## Prerequisites
66

7-
- Kubernetes cluster v1.30.0 or later
7+
- Kubernetes cluster v1.28.0 or later
88
- Helm v3.0 or later
99
- kubectl configured to communicate with your cluster
1010

docs/installation/kubectl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This guide covers installing the ClickHouse Operator using kubectl and manifest
44

55
## Prerequisites
66

7-
- Kubernetes cluster v1.30.0 or later
8-
- kubectl v1.30.0 or later
7+
- Kubernetes cluster v1.28.0 or later
8+
- kubectl v1.28.0 or later
99
- Cluster admin permissions
1010

1111
## Install from Release Manifests

docs/installation/olm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This guide covers installing the ClickHouse Operator using Operator Lifecycle Ma
1111

1212
## Prerequisites
1313

14-
- Kubernetes cluster version 1.30.0 or later
14+
- Kubernetes cluster version 1.28.0 or later
1515
- kubectl configured to access your cluster
1616
- Cluster admin permissions
1717
- Installed OLM (Operator Lifecycle Manager)

0 commit comments

Comments
 (0)