Skip to content

Commit fe32894

Browse files
committed
current state
1 parent cd1c0f2 commit fe32894

File tree

10 files changed

+1610
-448
lines changed

10 files changed

+1610
-448
lines changed

.vscode/launch.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}",
13+
"args" : ["--run-in-prow", "false", "--gke-cluster-prefix", "csitest-",
14+
"--gke-is-alpha", "true", "--machine-type", "n4-standard-8", "--deploy-overlay-name", "noauth-debug",
15+
"--staging-image", "europe-west3-docker.pkg.dev/kimambo-sandbox/csi-dev/gce-pd-csi-driver",
16+
"--service-account-file", "/usr/local/google/home/kimambo/dev/go/src/github.com/maxkimambo/creds/cloud-sa.json",
17+
"--deploy-overlay-name", "noauth-debug", "--storageclass-files", "sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml",
18+
"--test-focus", "External.Storage", "--gce-zone", "us-central1-b", "--deployment-strategy", "gke", "--gke-cluster-version", "${gke_cluster_version}", "--test-version", "${test_version}", "--num-nodes", "3"]
19+
},
20+
{
21+
"name": "Cluster",
22+
"type": "go",
23+
"request": "attach",
24+
"mode": "remote",
25+
"debugAdapter": "dlv-dap",
26+
"substitutePath": [
27+
{"from": "${workspaceFolder}", "to": "/go/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver"}
28+
],
29+
"port": 2345,
30+
"host": "127.0.0.1"
31+
},
32+
]
33+
}

deploy/kubernetes/install-kustomize.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
3131
exit 1
3232
fi
3333

34-
function cleanup {
35-
rm -rf "$tmpDir"
36-
}
34+
# function cleanup {
35+
# rm -rf "$tmpDir"
36+
# }
3737

38-
trap cleanup EXIT
38+
# trap cleanup EXIT
3939

4040
pushd $tmpDir >& /dev/null
4141

deploy/kubernetes/overlays/noauth-debug/kustomization.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ patchesStrategicMerge:
1010
- controller-overlay.yaml
1111
- node-overlay.yaml
1212
namespace: gce-pd-csi-driver
13-
# To change the dev image, add something like the following.
14-
# images:
15-
# - name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
16-
# newName: gcr.io/mauriciopoppe-gke-dev/gcp-compute-persistent-disk-csi-driver
17-
# newTag: latest
13+
images:
14+
- name: gke.gcr.io/gcp-compute-persistent-disk-csi-driver
15+
newName: europe-west3-docker.pkg.dev/kimambo-sandbox/csi-dev/gce-pd-csi-driver
16+
newTag: dev_linux

pkg/gce-pd-csi-driver/controller.go

+15-10
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,21 @@ func (gceCS *GCEControllerServer) createVolumeInternal(ctx context.Context, req
331331
// https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume
332332
// mutable_parameters MUST take precedence over the values from parameters.
333333
mutableParams := req.GetMutableParameters()
334+
335+
klog.V(4).Infof("CreateVolume parameters: %v", params)
336+
klog.V(4).Infof("CreateVolume mutable parameters: %v", mutableParams)
337+
klog.V(4).Infof("CreateVolume disk type: %v", diskTypeForMetric)
334338
// If the disk type is pd-*, the IOPS and Throughput parameters are ignored.
335-
if mutableParams != nil && !strings.HasPrefix(params.DiskType, "pd") {
336-
p, err := common.ExtractModifyVolumeParameters(mutableParams)
337-
if err != nil {
338-
return nil, status.Errorf(codes.InvalidArgument, "Invalid mutable parameters: %v", err)
339-
}
340-
params.ProvisionedIOPSOnCreate = p.IOPS
341-
params.ProvisionedThroughputOnCreate = p.Throughput
342-
} else {
343-
klog.V(4).Infof("Ignoring IOPS and throughput parameters for unsupported disk type %s", params.DiskType)
344-
}
339+
// if !strings.HasPrefix(params.DiskType, "pd-") {
340+
// p, err := common.ExtractModifyVolumeParameters(mutableParams)
341+
// if err != nil {
342+
// return nil, status.Errorf(codes.InvalidArgument, "Invalid mutable parameters: %v", err)
343+
// }
344+
// params.ProvisionedIOPSOnCreate = p.IOPS
345+
// params.ProvisionedThroughputOnCreate = p.Throughput
346+
// } else {
347+
// klog.V(4).Infof("Ignoring IOPS and throughput parameters for unsupported disk type %s", params.DiskType)
348+
// }
345349

346350
if _, err := getMultiWriterFromCapabilities(volumeCapabilities); err != nil {
347351
return nil, status.Errorf(codes.InvalidArgument, "VolumeCapabilities is invalid: %v", err.Error())
@@ -754,6 +758,7 @@ func (gceCS *GCEControllerServer) ControllerModifyVolume(ctx context.Context, re
754758
}
755759

756760
volumeModifyParams, err := common.ExtractModifyVolumeParameters(req.GetMutableParameters())
761+
klog.V(4).Info("Volume Modify Parameters: ", volumeModifyParams)
757762
if err != nil {
758763
klog.Errorf("Failed to extract parameters for volume %s: %v", volumeID, err)
759764
return nil, status.Errorf(codes.InvalidArgument, "Invalid parameters: %v", err)

test/k8s-integration/cluster.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"slices"
1011
"strconv"
1112
"strings"
1213

@@ -159,7 +160,7 @@ func setImageTypeEnvs(imageType string) error {
159160
return nil
160161
}
161162

162-
func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int, imageType string, useManagedDriver bool) error {
163+
func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int, machineType string, isAlpha bool, imageType string, useManagedDriver bool) error {
163164
locationArg, locationVal, err := gkeLocationArgs(gceZone, gceRegion)
164165
if err != nil {
165166
return err
@@ -181,9 +182,16 @@ func clusterUpGKE(gceZone, gceRegion string, numNodes int, numWindowsNodes int,
181182
}
182183

183184
var cmd *exec.Cmd
185+
184186
cmdParams := []string{"container", "clusters", "create", *gkeTestClusterName,
185187
locationArg, locationVal, "--num-nodes", strconv.Itoa(numNodes),
186-
"--quiet", "--machine-type", "n1-standard-2", "--image-type", imageType, "--no-enable-autoupgrade"}
188+
"--quiet", "--machine-type", machineType, "--image-type", imageType, "--no-enable-autoupgrade", "--service-account", "[email protected]"}
189+
190+
if isAlpha {
191+
// prepend beta to be used with gcloud beta container clusters create
192+
cmdParams = slices.Insert(cmdParams, 0, "beta")
193+
cmdParams = append(cmdParams, "--enable-kubernetes-alpha")
194+
}
187195
if isVariableSet(gkeClusterVer) {
188196
cmdParams = append(cmdParams, "--cluster-version", *gkeClusterVer)
189197
} else {

test/k8s-integration/driver.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ func getOverlayDir(pkgDir, deployOverlayName string) string {
1717
}
1818

1919
func installDriver(testParams *testParameters, stagingImage, deployOverlayName string, doDriverBuild bool) error {
20+
fmt.Println("Doing driver build and install")
2021
if doDriverBuild {
2122
// Install kustomize
2223
klog.Infof("Installing kustomize")
2324
out, err := exec.Command(filepath.Join(testParams.pkgDir, "deploy", "kubernetes", "install-kustomize.sh")).CombinedOutput()
25+
klog.Infof("Done Installing kustomize")
2426
if err != nil {
2527
return fmt.Errorf("failed to install kustomize: %s, err: %v", out, err.Error())
2628
}
27-
29+
30+
klog.Infof("Applying overlays")
2831
// Edit ci kustomization to use given image tag
2932
overlayDir := getOverlayDir(testParams.pkgDir, deployOverlayName)
3033
err = os.Chdir(overlayDir)

test/k8s-integration/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ var (
5454
gkeTestClusterPrefix = flag.String("gke-cluster-prefix", "pdcsi", "Prefix of GKE cluster names. A random suffix will be appended to form the full name.")
5555
gkeTestClusterName = flag.String("gke-cluster-name", "", "Name of existing cluster")
5656
gkeNodeVersion = flag.String("gke-node-version", "", "GKE cluster worker node version")
57+
gkeIsAlpha = flag.Bool("gke-is-alpha", false, "Deploy alpha GKE cluster")
5758
isRegionalCluster = flag.Bool("is-regional-cluster", false, "tell the test that a regional cluster is being used. Should be used for running on an existing regional cluster (ie, --bringup-cluster=false). The test will fail if a zonal GKE cluster is created when this flag is true")
59+
machineType = flag.String("machine-type", "n1-standard-2", "machine type to use for the cluster")
5860

5961
// Test infrastructure flags
6062
boskosResourceType = flag.String("boskos-resource-type", "gce-project", "name of the boskos resource type to reserve")
@@ -366,7 +368,7 @@ func handle() error {
366368
case "gce":
367369
err = clusterUpGCE(testParams.k8sSourceDir, *gceZone, *numNodes, *numWindowsNodes, testParams.imageType)
368370
case "gke":
369-
err = clusterUpGKE(*gceZone, *gceRegion, *numNodes, *numWindowsNodes, testParams.imageType, testParams.useGKEManagedDriver)
371+
err = clusterUpGKE(*gceZone, *gceRegion, *numNodes, *numWindowsNodes, *machineType, *gkeIsAlpha, testParams.imageType, testParams.useGKEManagedDriver)
370372
default:
371373
err = fmt.Errorf("deployment-strategy must be set to 'gce' or 'gke', but is: %s", testParams.deploymentStrategy)
372374
}

test/run-k8s-integration-local.sh

+12-10
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ make -C "${PKGDIR}" test-k8s-integration
1515
# This version of the command creates a GKE cluster. It also downloads and builds a k8s release
1616
# so that it can run the test specified
1717

18-
# ${PKGDIR}/bin/k8s-integration-test --run-in-prow=false \
19-
# --staging-image=${GCE_PD_CSI_STAGING_IMAGE} --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
20-
# --deploy-overlay-name=dev --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
21-
# --test-focus="External.Storage" --gce-zone="us-central1-b" \
22-
# --deployment-strategy=gke --gke-cluster-version=${gke_cluster_version} \
23-
# --test-version=${test_version} --num-nodes=3
18+
${PKGDIR}/bin/k8s-integration-test --run-in-prow=false --do-driver-build=true \
19+
--gke-cluster-prefix="csitest-" --gke-is-alpha=true --machine-type "n4-standard-8" \
20+
--gke-cluster-version=1.30.1-gke.1329000 \
21+
--staging-image=${GCE_PD_CSI_STAGING_IMAGE} --service-account-file=${GCE_PD_SA_DIR}/cloud-sa.json \
22+
--deploy-overlay-name=noauth-debug --storageclass-files=sc-standard.yaml,sc-balanced.yaml,sc-ssd.yaml \
23+
--test-focus="External.Storage" --gce-zone="europe-west1-c" \
24+
--deployment-strategy=gke --gke-cluster-version=${gke_cluster_version} \
25+
--test-version=${TEST_VERSION} --num-nodes=3 --teardown-driver=false
2426

2527
# This version of the command creates a GCE cluster. It downloads and builds two k8s releases,
2628
# one for the cluster and one for the tests, unless the cluster and test versioning is the same.
@@ -94,10 +96,10 @@ make -C "${PKGDIR}" test-k8s-integration
9496
#
9597
# As with all other methods local credentials must be set by running
9698
# gcloud auth application-default login
97-
"${PKGDIR}/bin/k8s-integration-test" --run-in-prow=false \
98-
--deploy-overlay-name=noauth --bringup-cluster=false --teardown-cluster=false --local-k8s-dir="$KTOP" \
99-
--storageclass-files=sc-standard.yaml --do-driver-build=false --test-focus='External.Storage' \
100-
--gce-zone="us-central1-b" --num-nodes="${NUM_NODES:-3}"
99+
# "${PKGDIR}/bin/k8s-integration-test" --run-in-prow=false \
100+
# --deploy-overlay-name=noauth --bringup-cluster=false --teardown-cluster=false --local-k8s-dir="$KTOP" \
101+
# --storageclass-files=sc-standard.yaml --do-driver-build=false --test-focus='External.Storage' \
102+
# --gce-zone="us-central1-b" --num-nodes="${NUM_NODES:-3}"
101103

102104

103105
# This version of the command does not build the driver or K8s, points to a

0 commit comments

Comments
 (0)