Skip to content

sync CCM<>CSI test cluster setup, add integration tests on schedule - #175

Open
mweibel wants to merge 2 commits into
align-go-repositoryfrom
integration-tests
Open

sync CCM<>CSI test cluster setup, add integration tests on schedule#175
mweibel wants to merge 2 commits into
align-go-repositoryfrom
integration-tests

Conversation

@mweibel

@mweibel mweibel commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

test-matrix has a few differences:

  • uses 1.28 and the latest two Kubernetes versions for testing to cover README.md documented cluster versions
  • uses different subnets and cluster prefix to avoid potential mismatching between ccm and CSI (they're in separate projects anyway though)

Comment thread .github/workflows/csi-integration-tests.yml Fixed
@mweibel
mweibel force-pushed the integration-tests branch 4 times, most recently from 15371c4 to 52e7726 Compare September 2, 2026 15:18
@mweibel
mweibel force-pushed the integration-tests branch 14 times, most recently from 6e224fc to ffffb57 Compare September 9, 2026 11:03
@mweibel
mweibel force-pushed the integration-tests branch 3 times, most recently from 272b607 to 5b0d6ee Compare September 9, 2026 14:34
Comment on lines -1 to -13
# Copyright 2018 DigitalOcean
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other inherited file keeps the notice: driver/*.go and main.go all use the
same two-line form:

# Copyright cloudscale.ch
# Copyright 2018 DigitalOcean

Can you restore it please restore it?

RUN go mod download

# Copy all source code
COPY . .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While overall the new Dockerfile is definitely an improvement, I think we should explicitly COPY the files we require for the build rather than COPY . . + .dockerignore:

COPY Makefile ./
COPY driver/ driver/
COPY cmd/ cmd/

Reasoning:

  • Directories like .idea/ and similar is gitignored (on my machine) but not dockerignored, so it ships into every build. And breaks layer caching.
  • I had a stray ./test-venv with test-venv/.gitignore containing *. This was included in the COPY. But its links point to /opt/homebrew which means the build fails in sbx.

A file I'd genuinely. gitignore is cmd/cloudscale-csi-plugin/cloudscale-csi-plugin from the old version of the Dockerfile. It's huge and included in every build.

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.27-alpine AS builder

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few things coming into play here:

  • First of all: in the Makefile there is now an unused GO_VERSION := $(shell awk '/^go/ {print $$2}' go.mod). IMHO okay to remove it, but it's currently dead. That approach stopped working with GOTOOLCHAIN=local anyways.

  • We should probably pin a patch version here and set GOTOOLCHAIN=local.

  • We should reconsider an earlier decision of ignoring patch versions for docker ecosystem in the dependabot config. Or not pin a patch version?

Happy to discuss :)

Comment thread helpers/bootstrap-cluster
@@ -1,130 +0,0 @@
#!/usr/bin/env bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deploy/README.md should reflect the deletion of this file.

Comment thread README.md
Comment on lines +421 to +445
To run the integration tests locally with your local CSI build:

```
$ export KUBECONFIG=$(pwd)/kubeconfig
```bash
# 1. Build and export the CSI image
$ VERSION=dev make publish

# 2. Create a test cluster with CCM and CSI
$ export CLOUDSCALE_API_TOKEN=your-token
$ export IMAGE=quay.io/cloudscalech/cloudscale-csi-plugin:dev
$ helpers/run-in-test-cluster

# This will:
# - Create a Kubernetes cluster on cloudscale.ch
# - Deploy CCM from the latest official release
# - Deploy CSI from your local build

# 3. Run integration tests
$ export KUBECONFIG=$(pwd)/k8test/cluster/admin.conf
$ make test-integration

# Run a single test
$ TESTARGS='-run TestPod_Single_SSD_Volume' make test-integration

# 4. Clean up
$ helpers/cleanup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace/merge/move to deploy/README.md (as noted elsewhere)

echo ""

# Apply the manifest
kubectl apply -n kube-system -f "$manifest_file"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found while diffing against CCM:

# CCM original                                    # CSI port
kubectl delete -f /tmp/ccm.yml \                  kubectl apply -n kube-system -f "$manifest_file"
  --ignore-not-found=true
kubectl apply -f /tmp/ccm.yml

I think that without the delete kubectl apply -n kube-system -f "$manifest_file"is a no-op.

Comment on lines +115 to +122
function build-image() {
k8test/playbooks/build-image.yml \
-i k8test/cluster/inventory.yml \
-e dockerfile=./Dockerfile \
-e tag="$IMAGE" \
-e extra='--build-arg=VERSION=test' \
-l controls
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems unused:

```bash
# CCM original                           # CSI port
if [[ ... == "build" ]]; then            if [[ ... == "import" ]]; then
  build-image                                import-image
else                                     fi
  import-image
fi

why did you choose not implement build-image?

Comment on lines +254 to +261
first_run=$(test ! -f k8test/cluster/inventory.yml && echo "yes" || echo "no")

ensure-k8test
ensure-cluster

# Deploy components on both new and existing clusters. For new clusters,
# this happens after the full cluster bootstrap (including Cilium) is done.
deploy-components

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed while comparing with CCM version:

# CCM original                           # CSI port
first_run=$(...)                         first_run=$(...)
ensure-k8test                            ensure-k8test
ensure-cluster                           ensure-cluster
if [[ "$first_run" == "no" ]]; then      deploy-components
  update-ccm
fi

I don't fully remember what first_run guards against in the CCM repo. Can you please research?

Comment on lines +1514 to 1530
// Kubernetes client
k8test, ok := os.LookupEnv("K8TEST_PATH")
if !ok {
log.Fatalf("could not find K8TEST_PATH environment variable\n")
}

// if you want to change override values or bind them to flags, there are
// methods to help you
configOverrides := &clientcmd.ConfigOverrides{}
path := filepath.Join(k8test, "cluster", "admin.conf")
data, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("failed to read kubeconfig at path %q: %w", path, err)
}

kubeConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, configOverrides)
var err error
config, err = kubeConfig.ClientConfig()
config, err = clientcmd.RESTConfigFromKubeConfig(data)
if err != nil {
return err
return fmt.Errorf("failed to apply kubeconfig at path %q: %w", path, err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously: make test-integration would run the test suite in whatever cluster KUBECONFIG was pointing at. Now, make test-integration hard-codes the k8test provisioned cluster.

I think this choice is good for CCM, but in the CSI repo I see use-cases for the opposite: running the test suite on a cluster provisioned some other way (e.g. Rancher, OpenShift) etc..

Comment thread README.md
# - Deploy CSI from your local build

# 3. Run integration tests
$ export KUBECONFIG=$(pwd)/k8test/cluster/admin.conf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contradicts test/kubernetes/integration_test.go (also noted there)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants