diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b3e1d9a..cc92c87f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,10 @@ name: Build on: push: - branches: [ master, devel ] + branches: [master, v4.0] pull_request: - branches: [ master, devel ] + branches: [master, v4.0] # This ensures that previous jobs for the PR are canceled when the PR is # updated. @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x check-latest: true - name: Set environment run: | @@ -35,7 +35,6 @@ jobs: go test -v ./... - uses: docker/setup-qemu-action@v3 - name: Check Goreleaser - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 with: - version: latest - args: release --skip-publish --skip-sign --clean --snapshot + args: release --skip=publish,sign --clean --snapshot diff --git a/.github/workflows/functests.yml b/.github/workflows/functests.yml index 8ec09707..8204049a 100644 --- a/.github/workflows/functests.yml +++ b/.github/workflows/functests.yml @@ -20,14 +20,14 @@ jobs: timeout-minutes: 60 strategy: matrix: - kube-version: ['v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.15', 'v1.28.11', 'v1.29.6', 'v1.30.2'] + kube-version: ['v1.20.15', 'v1.21.14', 'v1.22.17', 'v1.23.17', 'v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.16', 'v1.28.14', 'v1.29.9', 'v1.30.5', 'v1.31.1'] os: [ubuntu-20.04, ubuntu-22.04] steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x check-latest: true - name: Install dependencies @@ -69,6 +69,11 @@ jobs: while kubectl get pods -n kube-system --no-headers | grep -vqw Running; do echo "Waiting for Minikube pods to be ready"; sleep 3; done while kubectl get nodes --no-headers | grep -vqw Ready; do echo "Waiting for Minikube node to be ready"; sleep 3; done + - name: Enable kustomize + if: contains(fromJson('["v1.24.17", "v1.25.16", "v1.26.15", "v1.27.15", "v1.28.11", "v1.29.6", "v1.30.2"]'), matrix.kube-version) + run: | + echo "KUSTOMIZE=true" >> $GITHUB_ENV + - name: Run tests run: | functests/run-tests.sh diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 0cf087d1..d1457f4f 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -20,10 +20,10 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x check-latest: true - uses: ludeeus/action-shellcheck@master - uses: golangci/golangci-lint-action@v6 with: - version: v1.59.1 + version: v1.61.0 args: --config ./.golangci.yml --timeout=60m diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml index f86c931b..8c4297a4 100644 --- a/.github/workflows/vulncheck.yml +++ b/.github/workflows/vulncheck.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 1.22.x + go-version: 1.23.x check-latest: true - name: Install govulncheck run: go install golang.org/x/vuln/cmd/govulncheck@latest diff --git a/.golangci.yml b/.golangci.yml index 7d738763..632ae64e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,6 @@ linters-settings: run: - go: "1.22" + go: "1.23" misspell: locale: US @@ -26,8 +26,8 @@ linters: issues: exclude-use-default: false exclude: - - should have a package comment - - exitAfterDefer + - should have a package comment + - exitAfterDefer service: - golangci-lint-version: 1.59.1 # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.61.0 # use the fixed version to not introduce new linters unexpectedly diff --git a/.goreleaser.yml b/.goreleaser.yml index bc7ab8f2..d576172c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,24 +1,27 @@ +--- +version: 2 project_name: directpv release: - name_template: "Release version {{.Version}}" + name_template: "Release version {{.Version}}" - github: + target_commitish: "{{ .Commit }}" + + github: owner: minio name: directpv - extra_files: - - glob: "*.minisig" - - glob: "*.zip" + extra_files: + - glob: "*.minisig" + - glob: "*.zip" before: hooks: - - go mod tidy -compat=1.22 + - go mod tidy -compat=1.23 - go mod download builds: - - - main: ./cmd/directpv + - main: ./cmd/directpv id: directpv binary: directpv goos: @@ -35,8 +38,7 @@ builds: ldflags: - -s -w -X main.Version={{ .Tag }} - - - main: ./cmd/kubectl-directpv + - main: ./cmd/kubectl-directpv id: kubectl-directpv binary: kubectl-directpv goos: @@ -61,61 +63,60 @@ builds: post: ./package.sh {{ .Path }} archives: - - - allow_different_binary_count: true + - allow_different_binary_count: true format: binary changelog: sort: asc dockers: -- image_templates: - - "quay.io/minio/directpv:{{ .Tag }}-amd64" - use: buildx - goarch: amd64 - ids: - - directpv - dockerfile: Dockerfile - extra_files: - - LICENSE - - CREDITS - - AlmaLinux.repo - build_flag_templates: - - "--platform=linux/amd64" -- image_templates: - - "quay.io/minio/directpv:{{ .Tag }}-ppc64le" - use: buildx - goarch: ppc64le - ids: - - directpv - dockerfile: Dockerfile - extra_files: - - LICENSE - - CREDITS - - AlmaLinux.repo - build_flag_templates: - - "--platform=linux/ppc64le" -- image_templates: - - "quay.io/minio/directpv:{{ .Tag }}-arm64" - use: buildx - goarch: arm64 - ids: - - directpv - dockerfile: Dockerfile - extra_files: - - LICENSE - - CREDITS - - AlmaLinux.repo - build_flag_templates: - - "--platform=linux/arm64" + - image_templates: + - "quay.io/minio/directpv:{{ .Tag }}-amd64" + use: buildx + goarch: amd64 + ids: + - directpv + dockerfile: Dockerfile + extra_files: + - LICENSE + - CREDITS + - AlmaLinux.repo + build_flag_templates: + - "--platform=linux/amd64" + - image_templates: + - "quay.io/minio/directpv:{{ .Tag }}-ppc64le" + use: buildx + goarch: ppc64le + ids: + - directpv + dockerfile: Dockerfile + extra_files: + - LICENSE + - CREDITS + - AlmaLinux.repo + build_flag_templates: + - "--platform=linux/ppc64le" + - image_templates: + - "quay.io/minio/directpv:{{ .Tag }}-arm64" + use: buildx + goarch: arm64 + ids: + - directpv + dockerfile: Dockerfile + extra_files: + - LICENSE + - CREDITS + - AlmaLinux.repo + build_flag_templates: + - "--platform=linux/arm64" docker_manifests: -- name_template: quay.io/minio/directpv:{{ .Tag }} - image_templates: - - quay.io/minio/directpv:{{ .Tag }}-amd64 - - quay.io/minio/directpv:{{ .Tag }}-arm64 - - quay.io/minio/directpv:{{ .Tag }}-ppc64le -- name_template: quay.io/minio/directpv:latest - image_templates: - - quay.io/minio/directpv:{{ .Tag }}-amd64 - - quay.io/minio/directpv:{{ .Tag }}-arm64 - - quay.io/minio/directpv:{{ .Tag }}-ppc64le + - name_template: quay.io/minio/directpv:{{ .Tag }} + image_templates: + - quay.io/minio/directpv:{{ .Tag }}-amd64 + - quay.io/minio/directpv:{{ .Tag }}-arm64 + - quay.io/minio/directpv:{{ .Tag }}-ppc64le + - name_template: quay.io/minio/directpv:latest + image_templates: + - quay.io/minio/directpv:{{ .Tag }}-amd64 + - quay.io/minio/directpv:{{ .Tag }}-arm64 + - quay.io/minio/directpv:{{ .Tag }}-ppc64le diff --git a/cmd/kubectl-directpv/discover.go b/cmd/kubectl-directpv/discover.go index 61cb6bf9..cf1081f8 100644 --- a/cmd/kubectl-directpv/discover.go +++ b/cmd/kubectl-directpv/discover.go @@ -152,7 +152,7 @@ func showDevices(resultMap map[directpvtypes.NodeID][]types.Device) error { } if writer.Length() == 0 || !foundAvailableDrive { - eprintf(false, color.HiYellowString("No drives are available to initialize")+"\n") + eprintf(false, "%v\n", color.HiYellowString("No drives are available to initialize")) return errDiscoveryFailed } @@ -218,7 +218,7 @@ func discoverMain(ctx context.Context) { eprintf(true, "discovery failed; %v\n", err) os.Exit(1) case <-ctx.Done(): - eprintf(true, ctx.Err().Error()) + eprintf(true, "%v", ctx.Err().Error()) os.Exit(1) } } diff --git a/cmd/kubectl-directpv/utils.go b/cmd/kubectl-directpv/utils.go index 355c678e..da3551a3 100644 --- a/cmd/kubectl-directpv/utils.go +++ b/cmd/kubectl-directpv/utils.go @@ -126,5 +126,5 @@ func eprintf(isErr bool, format string, args ...any) { } func logFunc(log admin.LogMessage) { - eprintf(log.Type == admin.ErrorLogType, log.FormattedMessage) + eprintf(log.Type == admin.ErrorLogType, "%v", log.FormattedMessage) } diff --git a/codegen.sh b/codegen.sh index 8ef70c54..46ab4204 100755 --- a/codegen.sh +++ b/codegen.sh @@ -25,32 +25,13 @@ export PATH="$PATH:$GOPATH/bin" # Must keep versions sorted. VERSIONS=(v1beta1) -function install_code_generator() { - if [ ! -x "$GOPATH/bin/deepcopy-gen" ]; then - go install -v k8s.io/code-generator/cmd/deepcopy-gen@v0.29.6 - fi - - if [ ! -x "$GOPATH/bin/openapi-gen" ]; then - go install -v k8s.io/code-generator/cmd/openapi-gen@v0.29.6 - fi - - if [ ! -x "$GOPATH/bin/client-gen" ]; then - go install -v k8s.io/code-generator/cmd/client-gen@v0.29.6 - fi - - if [ ! -x "$GOPATH/bin/conversion-gen" ]; then - go install -v k8s.io/code-generator/cmd/conversion-gen@v0.29.6 - fi -} - -function install_controller_tools() { - if [ ! -x "$GOPATH/bin/controller-gen" ]; then - go install -v sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0 - fi -} - -install_code_generator -install_controller_tools +echo "Installing code generators ..." +go install -v \ + k8s.io/code-generator/cmd/deepcopy-gen@v0.31.1 \ + k8s.io/code-generator/cmd/client-gen@v0.31.1 \ + k8s.io/code-generator/cmd/conversion-gen@v0.31.1 +go install -v k8s.io/kube-openapi/cmd/openapi-gen@v0.0.0-20240903163716-9e1beecbcb38 +go install -v sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.3 cd "$(dirname "$0")" @@ -80,16 +61,18 @@ input_dirs=$(IFS=,; echo "${arr[*]}") echo "Running deepcopy-gen ..." deepcopy-gen \ --go-header-file boilerplate.go.txt \ - --input-dirs "${input_dirs}" \ - --output-package "${REPOSITORY}/pkg/" + --output-file deepcopy_generated.go \ + "${input_dirs}" echo "Running openapi-gen ..." for version in "${VERSIONS[@]}"; do repo="${REPOSITORY}/pkg/apis/directpv.min.io/${version}" openapi-gen \ --go-header-file boilerplate.go.txt \ - --input-dirs "${repo}" \ - --output-package "${repo}" + --output-file openapi_generated.go \ + --output-dir "pkg/apis/directpv.min.io/${version}" \ + --output-pkg "${repo}" \ + "${repo}" done echo "Running client-gen ..." @@ -99,12 +82,13 @@ arr=("${VERSIONS[@]/#/directpv.min.io/}") input_versions=$(IFS=,; echo "${arr[*]}") client-gen \ --go-header-file boilerplate.go.txt \ - --input-dirs "${input_dirs}" \ - --output-package "${REPOSITORY}/pkg/" \ --fake-clientset \ + --output-dir pkg \ + --output-pkg "${REPOSITORY}/pkg" \ --clientset-name clientset \ --input "${input_versions}" \ - --input-base "${REPOSITORY}/pkg/apis" + --input-base "${REPOSITORY}/pkg/apis" \ + "${input_dirs}" echo "Running controller-gen ..." controller-gen crd:crdVersions=v1 paths=./... output:dir=pkg/admin/installer @@ -113,5 +97,5 @@ rm -f pkg/admin/installer/direct.csi.min.io_directcsidrives.yaml pkg/admin/insta echo "Running conversion-gen ..." conversion-gen \ --go-header-file boilerplate.go.txt \ - --input-dirs "${VERSIONS[-1]/#/$REPOSITORY/pkg/apis/directpv.min.io/}" \ - --output-package "${REPOSITORY}/pkg/" + --output-file zz_generated.conversion.go \ + "${VERSIONS[-1]/#/$REPOSITORY/pkg/apis/directpv.min.io/}" diff --git a/docs/monitoring.md b/docs/monitoring.md index 113927b9..c7fef856 100644 --- a/docs/monitoring.md +++ b/docs/monitoring.md @@ -3,7 +3,13 @@ DirectPV nodes export Prometheus compatible metrics data via port `10443`. The metrics data includes * directpv_stats_bytes_used * directpv_stats_bytes_total -and categorized by labels `tenant`, `volumeID` and `node`. +* directpv_stats_drive_ready +* directpv_stats_drive_total_read_bytes +* directpv_stats_drive_total_write_bytes +* directpv_stats_drive_read_latency_seconds +* directpv_stats_drive_write_latency_seconds +* directpv_stats_drive_wait_time_seconds +and categorized by labels `drive`, `tenant`, `volumeID` and `node`. To scrape data in Prometheus, each node must be accessible by port `10443`. A simple example is below diff --git a/functests/common.sh b/functests/common.sh index 8d8f8ada..166c4431 100644 --- a/functests/common.sh +++ b/functests/common.sh @@ -137,6 +137,41 @@ function install_directpv() { sleep 10 } +# install_directpv_kustomize +function install_directpv_kustomize() { + directpv_client="$1" + echo "* Installing DirectPV via kustomize" + + cat > kustomization.yaml < function uninstall_directpv() { directpv_client="$1" @@ -160,6 +195,39 @@ function uninstall_directpv() { return 0 } +# uninstall_directpv_kustomize +function uninstall_directpv_kustomize() { + echo "* Uninstalling DirectPV via kustomize" + + cat > kustomization.yaml </dev/null | wc -l) + done + + while kubectl get namespace directpv-min-io --no-headers 2>/dev/null | grep -q .; do + echo " ...waiting for directpv-min-io namespace to be removed" + sleep 5 + done + + return 0 +} + # usage: check_drives_status function check_drives_status() { if ! is_github_workflow; then diff --git a/functests/multi-node-tests.sh b/functests/multi-node-tests.sh index edd8bb8e..6035f6c0 100644 --- a/functests/multi-node-tests.sh +++ b/functests/multi-node-tests.sh @@ -302,7 +302,7 @@ EOF return fi - scp_cmd "root@${MASTER_VM_IP}:{${directpv_image_tar_xz},${sleep_image_tar_xz}}" "." + scp_cmd "root@${MASTER_VM_IP}:${directpv_image_tar_xz}" "root@${MASTER_VM_IP}:${sleep_image_tar_xz}" "." setup_sh="${TEST_ID}_setup.sh" cat > "${setup_sh}" < 0 && len(image) > matchIndex[0]+1 { - imageTag = image[matchIndex[0]+1:] - } return &Args{ image: image, Registry: "quay.io", @@ -101,7 +92,6 @@ func NewArgs(image string) *Args { nodeDriverRegistrarImage: nodeDriverRegistrarImage, livenessProbeImage: livenessProbeImage, csiResizerImage: csiResizerImage, - imageTag: imageTag, } } diff --git a/pkg/admin/installer/csidriver.go b/pkg/admin/installer/csidriver.go index 7cce21ac..0437dae4 100644 --- a/pkg/admin/installer/csidriver.go +++ b/pkg/admin/installer/csidriver.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" - directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" "github.com/minio/directpv/pkg/consts" legacyclient "github.com/minio/directpv/pkg/legacy/client" @@ -95,10 +94,7 @@ func (t csiDriverTask) doCreateCSIDriver(ctx context.Context, args *Args, versio ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: metav1.NamespaceNone, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, - Labels: defaultLabels, + Labels: defaultLabels, }, Spec: storagev1.CSIDriverSpec{ PodInfoOnMount: &podInfoOnMount, @@ -128,10 +124,7 @@ func (t csiDriverTask) doCreateCSIDriver(ctx context.Context, args *Args, versio ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: metav1.NamespaceNone, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, - Labels: defaultLabels, + Labels: defaultLabels, }, Spec: storagev1beta1.CSIDriverSpec{ PodInfoOnMount: &podInfoOnMount, diff --git a/pkg/admin/installer/daemonset.go b/pkg/admin/installer/daemonset.go index 627b1122..791cf699 100644 --- a/pkg/admin/installer/daemonset.go +++ b/pkg/admin/installer/daemonset.go @@ -20,7 +20,6 @@ import ( "context" "fmt" - directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" "github.com/minio/directpv/pkg/consts" "github.com/minio/directpv/pkg/k8s" @@ -215,11 +214,7 @@ func newDaemonset(podSpec corev1.PodSpec, name, selectorValue string, args *Args ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, - Annotations: map[string]string{ - string(directpvtypes.ImageTagLabelKey): args.imageTag, - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, - Labels: defaultLabels, + Labels: defaultLabels, }, Spec: appsv1.DaemonSetSpec{ Selector: metav1.AddLabelToSelector(&metav1.LabelSelector{}, selectorKey, selectorValue), @@ -297,7 +292,7 @@ func (t daemonsetTask) doCreateDaemonset(ctx context.Context, args *Args) (err e } } if selectorValue == "" { - selectorValue = fmt.Sprintf("%v-%v", consts.Identity, getRandSuffix()) + selectorValue = fmt.Sprintf("%v-%v", consts.Identity, consts.NodeServerName) } daemonset := newDaemonset(podSpec, consts.NodeServerName, selectorValue, args) @@ -360,7 +355,7 @@ func (t daemonsetTask) doCreateLegacyDaemonset(ctx context.Context, args *Args) } } if selectorValue == "" { - selectorValue = fmt.Sprintf("%v-%v", consts.Identity, getRandSuffix()) + selectorValue = fmt.Sprintf("%v-%v", consts.Identity, consts.LegacyNodeServerName) } daemonset := newDaemonset(podSpec, consts.LegacyNodeServerName, selectorValue, args) diff --git a/pkg/admin/installer/deployment.go b/pkg/admin/installer/deployment.go index 429993a5..e64cc3db 100644 --- a/pkg/admin/installer/deployment.go +++ b/pkg/admin/installer/deployment.go @@ -20,7 +20,6 @@ import ( "context" "fmt" - directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" "github.com/minio/directpv/pkg/consts" "github.com/minio/directpv/pkg/k8s" @@ -195,7 +194,7 @@ func (t deploymentTask) doCreateDeployment(ctx context.Context, args *Args, lega } } if selectorValue == "" { - selectorValue = fmt.Sprintf("%v-%v", consts.ControllerServerName, getRandSuffix()) + selectorValue = fmt.Sprintf("%v-%v", consts.ControllerServerName, name) } replicas := int32(3) @@ -207,11 +206,7 @@ func (t deploymentTask) doCreateDeployment(ctx context.Context, args *Args, lega ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, - Annotations: map[string]string{ - string(directpvtypes.ImageTagLabelKey): args.imageTag, - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, - Labels: defaultLabels, + Labels: defaultLabels, }, Spec: appsv1.DeploymentSpec{ Replicas: &replicas, diff --git a/pkg/admin/installer/directpv.min.io_directpvdrives.yaml b/pkg/admin/installer/directpv.min.io_directpvdrives.yaml index 3dedfd64..e5a04c0b 100644 --- a/pkg/admin/installer/directpv.min.io_directpvdrives.yaml +++ b/pkg/admin/installer/directpv.min.io_directpvdrives.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.15.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: directpvdrives.directpv.min.io spec: group: directpv.min.io @@ -52,16 +52,8 @@ spec: type: integer conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -102,12 +94,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/pkg/admin/installer/directpv.min.io_directpvinitrequests.yaml b/pkg/admin/installer/directpv.min.io_directpvinitrequests.yaml index ef0a7f31..fb05a819 100644 --- a/pkg/admin/installer/directpv.min.io_directpvinitrequests.yaml +++ b/pkg/admin/installer/directpv.min.io_directpvinitrequests.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.15.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: directpvinitrequests.directpv.min.io spec: group: directpv.min.io diff --git a/pkg/admin/installer/directpv.min.io_directpvnodes.yaml b/pkg/admin/installer/directpv.min.io_directpvnodes.yaml index 9a56238a..d750fa6e 100644 --- a/pkg/admin/installer/directpv.min.io_directpvnodes.yaml +++ b/pkg/admin/installer/directpv.min.io_directpvnodes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.15.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: directpvnodes.directpv.min.io spec: group: directpv.min.io @@ -47,16 +47,8 @@ spec: properties: conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -97,12 +89,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/pkg/admin/installer/directpv.min.io_directpvvolumes.yaml b/pkg/admin/installer/directpv.min.io_directpvvolumes.yaml index 482cc757..9eae6edf 100644 --- a/pkg/admin/installer/directpv.min.io_directpvvolumes.yaml +++ b/pkg/admin/installer/directpv.min.io_directpvvolumes.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.15.0 + controller-gen.kubebuilder.io/version: v0.16.3 name: directpvvolumes.directpv.min.io spec: group: directpv.min.io @@ -44,16 +44,8 @@ spec: type: integer conditions: items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -94,12 +86,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/pkg/admin/installer/namespace.go b/pkg/admin/installer/namespace.go index 5e7a1fb8..233a3170 100644 --- a/pkg/admin/installer/namespace.go +++ b/pkg/admin/installer/namespace.go @@ -19,7 +19,6 @@ package installer import ( "context" - directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -90,11 +89,8 @@ func (t namespaceTask) createNamespace(ctx context.Context, args *Args) (err err Kind: "Namespace", }, ObjectMeta: metav1.ObjectMeta{ - Name: namespace, - Namespace: metav1.NamespaceNone, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, + Name: namespace, + Namespace: metav1.NamespaceNone, Labels: labels, Finalizers: []string{metav1.FinalizerDeleteDependents}, }, diff --git a/pkg/admin/installer/rbac.go b/pkg/admin/installer/rbac.go index 4bd1773b..9a55d39b 100644 --- a/pkg/admin/installer/rbac.go +++ b/pkg/admin/installer/rbac.go @@ -19,7 +19,6 @@ package installer import ( "context" - directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" "github.com/minio/directpv/pkg/consts" corev1 "k8s.io/api/core/v1" @@ -99,10 +98,7 @@ func (t rbacTask) createServiceAccount(ctx context.Context, args *Args) (err err ObjectMeta: metav1.ObjectMeta{ Name: consts.Identity, Namespace: namespace, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, - Labels: defaultLabels, + Labels: defaultLabels, }, Secrets: []corev1.ObjectReference{}, ImagePullSecrets: []corev1.LocalObjectReference{}, @@ -142,7 +138,6 @@ func (t rbacTask) createClusterRole(ctx context.Context, args *Args) (err error) Namespace: metav1.NamespaceNone, Annotations: map[string]string{ "rbac.authorization.kubernetes.io/autoupdate": "true", - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, }, Labels: defaultLabels, }, @@ -153,16 +148,14 @@ func (t rbacTask) createClusterRole(ctx context.Context, args *Args) (err error) newPolicyRule([]string{"persistentvolumeclaims"}, nil, getVerb, listVerb, updateVerb, watchVerb), newPolicyRule([]string{"storageclasses"}, []string{"storage.k8s.io"}, getVerb, listVerb, watchVerb), newPolicyRule([]string{"events"}, nil, createVerb, listVerb, patchVerb, updateVerb, watchVerb), - newPolicyRule([]string{"volumesnapshots"}, []string{"snapshot.storage.k8s.io"}, getVerb, listVerb), - newPolicyRule([]string{"volumesnapshotcontents"}, []string{"snapshot.storage.k8s.io"}, getVerb, listVerb), newPolicyRule([]string{"csinodes"}, []string{"storage.k8s.io"}, getVerb, listVerb, watchVerb), newPolicyRule([]string{"nodes"}, nil, getVerb, listVerb, watchVerb), newPolicyRule([]string{"volumeattachments"}, []string{"storage.k8s.io"}, getVerb, listVerb, watchVerb), newPolicyRule([]string{"endpoints"}, nil, createVerb, deleteVerb, getVerb, listVerb, updateVerb, watchVerb), newPolicyRule([]string{"leases"}, []string{"coordination.k8s.io"}, createVerb, deleteVerb, getVerb, listVerb, updateVerb, watchVerb), newPolicyRule( - []string{"customresourcedefinitions", "customresourcedefinition"}, - []string{"apiextensions.k8s.io", consts.GroupName}, + []string{"customresourcedefinitions"}, + []string{"apiextensions.k8s.io"}, createVerb, deleteVerb, getVerb, listVerb, patchVerb, updateVerb, watchVerb, ), newPolicyRule( @@ -170,8 +163,8 @@ func (t rbacTask) createClusterRole(ctx context.Context, args *Args) (err error) []string{consts.GroupName}, createVerb, deleteVerb, getVerb, listVerb, updateVerb, watchVerb, ), - newPolicyRule([]string{"pods", "pod"}, nil, getVerb, listVerb, watchVerb), - newPolicyRule([]string{"secrets", "secret"}, nil, getVerb, listVerb, watchVerb), + newPolicyRule([]string{"pods"}, nil, getVerb, listVerb, watchVerb), + newPolicyRule([]string{"secrets"}, nil, getVerb, listVerb, watchVerb), }, AggregationRule: nil, } @@ -209,7 +202,6 @@ func (t rbacTask) createClusterRoleBinding(ctx context.Context, args *Args) (err Namespace: metav1.NamespaceNone, Annotations: map[string]string{ "rbac.authorization.kubernetes.io/autoupdate": "true", - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, }, Labels: defaultLabels, }, @@ -260,7 +252,6 @@ func (t rbacTask) createRole(ctx context.Context, args *Args) (err error) { Namespace: namespace, Annotations: map[string]string{ "rbac.authorization.kubernetes.io/autoupdate": "true", - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, }, Labels: defaultLabels, }, @@ -302,7 +293,6 @@ func (t rbacTask) createRoleBinding(ctx context.Context, args *Args) (err error) Namespace: namespace, Annotations: map[string]string{ "rbac.authorization.kubernetes.io/autoupdate": "true", - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, }, Labels: defaultLabels, }, diff --git a/pkg/admin/installer/storageclass.go b/pkg/admin/installer/storageclass.go index 8c4fce60..65142f04 100644 --- a/pkg/admin/installer/storageclass.go +++ b/pkg/admin/installer/storageclass.go @@ -101,11 +101,8 @@ func (t storageClassTask) doCreateStorageClass(ctx context.Context, args *Args, storageClass := &storagev1.StorageClass{ TypeMeta: metav1.TypeMeta{APIVersion: "storage.k8s.io/v1", Kind: "StorageClass"}, ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceNone, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, + Name: name, + Namespace: metav1.NamespaceNone, Labels: defaultLabels, Finalizers: []string{metav1.FinalizerDeleteDependents}, }, @@ -135,11 +132,8 @@ func (t storageClassTask) doCreateStorageClass(ctx context.Context, args *Args, storageClass := &storagev1beta1.StorageClass{ TypeMeta: metav1.TypeMeta{APIVersion: "storage.k8s.io/v1beta1", Kind: "StorageClass"}, ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: metav1.NamespaceNone, - Annotations: map[string]string{ - string(directpvtypes.PluginVersionLabelKey): args.PluginVersion, - }, + Name: name, + Namespace: metav1.NamespaceNone, Labels: defaultLabels, Finalizers: []string{metav1.FinalizerDeleteDependents}, }, diff --git a/pkg/admin/installer/utils.go b/pkg/admin/installer/utils.go index 3dd42bc7..4fb638c4 100644 --- a/pkg/admin/installer/utils.go +++ b/pkg/admin/installer/utils.go @@ -18,10 +18,7 @@ package installer import ( "context" - "crypto/rand" - "encoding/base32" "path" - "strings" "github.com/minio/directpv/pkg/k8s" "k8s.io/klog/v2" @@ -31,14 +28,6 @@ func newPluginsSocketDir(kubeletDir, name string) string { return path.Join(kubeletDir, "plugins", k8s.SanitizeResourceName(name)) } -func getRandSuffix() string { - b := make([]byte, 5) - if _, err := rand.Read(b); err != nil { - klog.Fatalf("unable to generate random bytes; %v", err) - } - return strings.ToLower(base32.StdEncoding.EncodeToString(b)[:5]) -} - func sendDoneMessage(ctx context.Context, progressCh chan<- Message, err error) (sent bool) { sent = sendMessage(ctx, progressCh, newDoneMessage(err)) if !sent && err != nil { diff --git a/pkg/apis/directpv.min.io/types/label.go b/pkg/apis/directpv.min.io/types/label.go index 72425b63..df569fe5 100644 --- a/pkg/apis/directpv.min.io/types/label.go +++ b/pkg/apis/directpv.min.io/types/label.go @@ -88,12 +88,6 @@ const ( // ClaimIDLabelKey label key to denote the claim id of the volumes ClaimIDLabelKey LabelKey = consts.GroupName + "/claim-id" - - // ImageTagLabelKey denotes the tag of the directpv container image - ImageTagLabelKey LabelKey = consts.GroupName + "/image-tag" - - // PluginVersionLabelKey denotes the plugin version - PluginVersionLabelKey LabelKey = consts.GroupName + "/plugin-version" ) var reservedLabelKeys = map[LabelKey]struct{}{ @@ -115,8 +109,6 @@ var reservedLabelKeys = map[LabelKey]struct{}{ SuspendLabelKey: {}, VolumeClaimIDLabelKey: {}, ClaimIDLabelKey: {}, - ImageTagLabelKey: {}, - PluginVersionLabelKey: {}, } // IsReserved returns if the key is a reserved key diff --git a/pkg/apis/directpv.min.io/v1beta1/openapi_generated.go b/pkg/apis/directpv.min.io/v1beta1/openapi_generated.go index 31f4917b..c8cf3166 100644 --- a/pkg/apis/directpv.min.io/v1beta1/openapi_generated.go +++ b/pkg/apis/directpv.min.io/v1beta1/openapi_generated.go @@ -19,8 +19,6 @@ // Code generated by openapi-gen. DO NOT EDIT. -// This file was autogenerated by openapi-gen. Do not edit it manually! - package v1beta1 import ( diff --git a/pkg/client/dynamic_test.go b/pkg/client/dynamic_test.go index df7b1eac..4a952911 100644 --- a/pkg/client/dynamic_test.go +++ b/pkg/client/dynamic_test.go @@ -395,7 +395,7 @@ func TestWatcher(t *testing.T) { t.Fatalf("no event received for create") } if err := checkEvent(event, watch.Added, testCreateObject); err != nil { - t.Fatalf(err.Error()) + t.Fatalf("%v", err.Error()) } // Test Update Event @@ -414,7 +414,7 @@ func TestWatcher(t *testing.T) { t.Fatalf("no event received for update") } if err := checkEvent(event, watch.Modified, testUpdateObject); err != nil { - t.Fatalf(err.Error()) + t.Fatalf("%v", err.Error()) } // Test Delete Event @@ -427,7 +427,7 @@ func TestWatcher(t *testing.T) { t.Fatalf("no event received for delete") } if err := checkEvent(event, watch.Deleted, testUpdateObject); err != nil { - t.Fatalf(err.Error()) + t.Fatalf("%v", err.Error()) } } diff --git a/pkg/clientset/fake/clientset_generated.go b/pkg/clientset/fake/clientset_generated.go index 4a358125..b91ec04c 100644 --- a/pkg/clientset/fake/clientset_generated.go +++ b/pkg/clientset/fake/clientset_generated.go @@ -31,8 +31,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvdrive.go b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvdrive.go index 2148e3bd..f3fee329 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvdrive.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvdrive.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/minio/directpv/pkg/apis/directpv.min.io/v1beta1" scheme "github.com/minio/directpv/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DirectPVDrivesGetter has a method to return a DirectPVDriveInterface. @@ -40,6 +39,7 @@ type DirectPVDrivesGetter interface { type DirectPVDriveInterface interface { Create(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.CreateOptions) (*v1beta1.DirectPVDrive, error) Update(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (*v1beta1.DirectPVDrive, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (*v1beta1.DirectPVDrive, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,133 +52,18 @@ type DirectPVDriveInterface interface { // directPVDrives implements DirectPVDriveInterface type directPVDrives struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.DirectPVDrive, *v1beta1.DirectPVDriveList] } // newDirectPVDrives returns a DirectPVDrives func newDirectPVDrives(c *DirectpvV1beta1Client) *directPVDrives { return &directPVDrives{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.DirectPVDrive, *v1beta1.DirectPVDriveList]( + "directpvdrives", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.DirectPVDrive { return &v1beta1.DirectPVDrive{} }, + func() *v1beta1.DirectPVDriveList { return &v1beta1.DirectPVDriveList{} }), } } - -// Get takes name of the directPVDrive, and returns the corresponding directPVDrive object, and an error if there is any. -func (c *directPVDrives) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVDrive, err error) { - result = &v1beta1.DirectPVDrive{} - err = c.client.Get(). - Resource("directpvdrives"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DirectPVDrives that match those selectors. -func (c *directPVDrives) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVDriveList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DirectPVDriveList{} - err = c.client.Get(). - Resource("directpvdrives"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested directPVDrives. -func (c *directPVDrives) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("directpvdrives"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a directPVDrive and creates it. Returns the server's representation of the directPVDrive, and an error, if there is any. -func (c *directPVDrives) Create(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.CreateOptions) (result *v1beta1.DirectPVDrive, err error) { - result = &v1beta1.DirectPVDrive{} - err = c.client.Post(). - Resource("directpvdrives"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVDrive). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a directPVDrive and updates it. Returns the server's representation of the directPVDrive, and an error, if there is any. -func (c *directPVDrives) Update(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (result *v1beta1.DirectPVDrive, err error) { - result = &v1beta1.DirectPVDrive{} - err = c.client.Put(). - Resource("directpvdrives"). - Name(directPVDrive.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVDrive). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *directPVDrives) UpdateStatus(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (result *v1beta1.DirectPVDrive, err error) { - result = &v1beta1.DirectPVDrive{} - err = c.client.Put(). - Resource("directpvdrives"). - Name(directPVDrive.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVDrive). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the directPVDrive and deletes it. Returns an error if one occurs. -func (c *directPVDrives) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("directpvdrives"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *directPVDrives) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("directpvdrives"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched directPVDrive. -func (c *directPVDrives) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVDrive, err error) { - result = &v1beta1.DirectPVDrive{} - err = c.client.Patch(pt). - Resource("directpvdrives"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvinitrequest.go b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvinitrequest.go index 45a20dd8..ddc43c82 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvinitrequest.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvinitrequest.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/minio/directpv/pkg/apis/directpv.min.io/v1beta1" scheme "github.com/minio/directpv/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DirectPVInitRequestsGetter has a method to return a DirectPVInitRequestInterface. @@ -40,6 +39,7 @@ type DirectPVInitRequestsGetter interface { type DirectPVInitRequestInterface interface { Create(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.CreateOptions) (*v1beta1.DirectPVInitRequest, error) Update(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (*v1beta1.DirectPVInitRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (*v1beta1.DirectPVInitRequest, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,133 +52,18 @@ type DirectPVInitRequestInterface interface { // directPVInitRequests implements DirectPVInitRequestInterface type directPVInitRequests struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.DirectPVInitRequest, *v1beta1.DirectPVInitRequestList] } // newDirectPVInitRequests returns a DirectPVInitRequests func newDirectPVInitRequests(c *DirectpvV1beta1Client) *directPVInitRequests { return &directPVInitRequests{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.DirectPVInitRequest, *v1beta1.DirectPVInitRequestList]( + "directpvinitrequests", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.DirectPVInitRequest { return &v1beta1.DirectPVInitRequest{} }, + func() *v1beta1.DirectPVInitRequestList { return &v1beta1.DirectPVInitRequestList{} }), } } - -// Get takes name of the directPVInitRequest, and returns the corresponding directPVInitRequest object, and an error if there is any. -func (c *directPVInitRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVInitRequest, err error) { - result = &v1beta1.DirectPVInitRequest{} - err = c.client.Get(). - Resource("directpvinitrequests"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DirectPVInitRequests that match those selectors. -func (c *directPVInitRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVInitRequestList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DirectPVInitRequestList{} - err = c.client.Get(). - Resource("directpvinitrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested directPVInitRequests. -func (c *directPVInitRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("directpvinitrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a directPVInitRequest and creates it. Returns the server's representation of the directPVInitRequest, and an error, if there is any. -func (c *directPVInitRequests) Create(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.CreateOptions) (result *v1beta1.DirectPVInitRequest, err error) { - result = &v1beta1.DirectPVInitRequest{} - err = c.client.Post(). - Resource("directpvinitrequests"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVInitRequest). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a directPVInitRequest and updates it. Returns the server's representation of the directPVInitRequest, and an error, if there is any. -func (c *directPVInitRequests) Update(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (result *v1beta1.DirectPVInitRequest, err error) { - result = &v1beta1.DirectPVInitRequest{} - err = c.client.Put(). - Resource("directpvinitrequests"). - Name(directPVInitRequest.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVInitRequest). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *directPVInitRequests) UpdateStatus(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (result *v1beta1.DirectPVInitRequest, err error) { - result = &v1beta1.DirectPVInitRequest{} - err = c.client.Put(). - Resource("directpvinitrequests"). - Name(directPVInitRequest.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVInitRequest). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the directPVInitRequest and deletes it. Returns an error if one occurs. -func (c *directPVInitRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("directpvinitrequests"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *directPVInitRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("directpvinitrequests"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched directPVInitRequest. -func (c *directPVInitRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVInitRequest, err error) { - result = &v1beta1.DirectPVInitRequest{} - err = c.client.Patch(pt). - Resource("directpvinitrequests"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvnode.go b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvnode.go index a9c7957a..54a6b145 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvnode.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvnode.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/minio/directpv/pkg/apis/directpv.min.io/v1beta1" scheme "github.com/minio/directpv/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DirectPVNodesGetter has a method to return a DirectPVNodeInterface. @@ -40,6 +39,7 @@ type DirectPVNodesGetter interface { type DirectPVNodeInterface interface { Create(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.CreateOptions) (*v1beta1.DirectPVNode, error) Update(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (*v1beta1.DirectPVNode, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (*v1beta1.DirectPVNode, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,133 +52,18 @@ type DirectPVNodeInterface interface { // directPVNodes implements DirectPVNodeInterface type directPVNodes struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.DirectPVNode, *v1beta1.DirectPVNodeList] } // newDirectPVNodes returns a DirectPVNodes func newDirectPVNodes(c *DirectpvV1beta1Client) *directPVNodes { return &directPVNodes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.DirectPVNode, *v1beta1.DirectPVNodeList]( + "directpvnodes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.DirectPVNode { return &v1beta1.DirectPVNode{} }, + func() *v1beta1.DirectPVNodeList { return &v1beta1.DirectPVNodeList{} }), } } - -// Get takes name of the directPVNode, and returns the corresponding directPVNode object, and an error if there is any. -func (c *directPVNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVNode, err error) { - result = &v1beta1.DirectPVNode{} - err = c.client.Get(). - Resource("directpvnodes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DirectPVNodes that match those selectors. -func (c *directPVNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVNodeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DirectPVNodeList{} - err = c.client.Get(). - Resource("directpvnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested directPVNodes. -func (c *directPVNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("directpvnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a directPVNode and creates it. Returns the server's representation of the directPVNode, and an error, if there is any. -func (c *directPVNodes) Create(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.CreateOptions) (result *v1beta1.DirectPVNode, err error) { - result = &v1beta1.DirectPVNode{} - err = c.client.Post(). - Resource("directpvnodes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVNode). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a directPVNode and updates it. Returns the server's representation of the directPVNode, and an error, if there is any. -func (c *directPVNodes) Update(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (result *v1beta1.DirectPVNode, err error) { - result = &v1beta1.DirectPVNode{} - err = c.client.Put(). - Resource("directpvnodes"). - Name(directPVNode.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVNode). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *directPVNodes) UpdateStatus(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (result *v1beta1.DirectPVNode, err error) { - result = &v1beta1.DirectPVNode{} - err = c.client.Put(). - Resource("directpvnodes"). - Name(directPVNode.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVNode). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the directPVNode and deletes it. Returns an error if one occurs. -func (c *directPVNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("directpvnodes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *directPVNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("directpvnodes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched directPVNode. -func (c *directPVNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVNode, err error) { - result = &v1beta1.DirectPVNode{} - err = c.client.Patch(pt). - Resource("directpvnodes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvvolume.go b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvvolume.go index baefa22d..b33c1a87 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/directpvvolume.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/directpvvolume.go @@ -20,14 +20,13 @@ package v1beta1 import ( "context" - "time" v1beta1 "github.com/minio/directpv/pkg/apis/directpv.min.io/v1beta1" scheme "github.com/minio/directpv/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" + gentype "k8s.io/client-go/gentype" ) // DirectPVVolumesGetter has a method to return a DirectPVVolumeInterface. @@ -40,6 +39,7 @@ type DirectPVVolumesGetter interface { type DirectPVVolumeInterface interface { Create(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.CreateOptions) (*v1beta1.DirectPVVolume, error) Update(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (*v1beta1.DirectPVVolume, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (*v1beta1.DirectPVVolume, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -52,133 +52,18 @@ type DirectPVVolumeInterface interface { // directPVVolumes implements DirectPVVolumeInterface type directPVVolumes struct { - client rest.Interface + *gentype.ClientWithList[*v1beta1.DirectPVVolume, *v1beta1.DirectPVVolumeList] } // newDirectPVVolumes returns a DirectPVVolumes func newDirectPVVolumes(c *DirectpvV1beta1Client) *directPVVolumes { return &directPVVolumes{ - client: c.RESTClient(), + gentype.NewClientWithList[*v1beta1.DirectPVVolume, *v1beta1.DirectPVVolumeList]( + "directpvvolumes", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.DirectPVVolume { return &v1beta1.DirectPVVolume{} }, + func() *v1beta1.DirectPVVolumeList { return &v1beta1.DirectPVVolumeList{} }), } } - -// Get takes name of the directPVVolume, and returns the corresponding directPVVolume object, and an error if there is any. -func (c *directPVVolumes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVVolume, err error) { - result = &v1beta1.DirectPVVolume{} - err = c.client.Get(). - Resource("directpvvolumes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of DirectPVVolumes that match those selectors. -func (c *directPVVolumes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVVolumeList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.DirectPVVolumeList{} - err = c.client.Get(). - Resource("directpvvolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested directPVVolumes. -func (c *directPVVolumes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Resource("directpvvolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a directPVVolume and creates it. Returns the server's representation of the directPVVolume, and an error, if there is any. -func (c *directPVVolumes) Create(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.CreateOptions) (result *v1beta1.DirectPVVolume, err error) { - result = &v1beta1.DirectPVVolume{} - err = c.client.Post(). - Resource("directpvvolumes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVVolume). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a directPVVolume and updates it. Returns the server's representation of the directPVVolume, and an error, if there is any. -func (c *directPVVolumes) Update(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (result *v1beta1.DirectPVVolume, err error) { - result = &v1beta1.DirectPVVolume{} - err = c.client.Put(). - Resource("directpvvolumes"). - Name(directPVVolume.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVVolume). - Do(ctx). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *directPVVolumes) UpdateStatus(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (result *v1beta1.DirectPVVolume, err error) { - result = &v1beta1.DirectPVVolume{} - err = c.client.Put(). - Resource("directpvvolumes"). - Name(directPVVolume.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(directPVVolume). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the directPVVolume and deletes it. Returns an error if one occurs. -func (c *directPVVolumes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Resource("directpvvolumes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *directPVVolumes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Resource("directpvvolumes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched directPVVolume. -func (c *directPVVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVVolume, err error) { - result = &v1beta1.DirectPVVolume{} - err = c.client.Patch(pt). - Resource("directpvvolumes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvdrive.go b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvdrive.go index 2219391e..888d456e 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvdrive.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvdrive.go @@ -40,20 +40,22 @@ var directpvdrivesKind = v1beta1.SchemeGroupVersion.WithKind("DirectPVDrive") // Get takes name of the directPVDrive, and returns the corresponding directPVDrive object, and an error if there is any. func (c *FakeDirectPVDrives) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVDrive, err error) { + emptyResult := &v1beta1.DirectPVDrive{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(directpvdrivesResource, name), &v1beta1.DirectPVDrive{}) + Invokes(testing.NewRootGetActionWithOptions(directpvdrivesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVDrive), err } // List takes label and field selectors, and returns the list of DirectPVDrives that match those selectors. func (c *FakeDirectPVDrives) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVDriveList, err error) { + emptyResult := &v1beta1.DirectPVDriveList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(directpvdrivesResource, directpvdrivesKind, opts), &v1beta1.DirectPVDriveList{}) + Invokes(testing.NewRootListActionWithOptions(directpvdrivesResource, directpvdrivesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,36 +74,39 @@ func (c *FakeDirectPVDrives) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested directPVDrives. func (c *FakeDirectPVDrives) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(directpvdrivesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(directpvdrivesResource, opts)) } // Create takes the representation of a directPVDrive and creates it. Returns the server's representation of the directPVDrive, and an error, if there is any. func (c *FakeDirectPVDrives) Create(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.CreateOptions) (result *v1beta1.DirectPVDrive, err error) { + emptyResult := &v1beta1.DirectPVDrive{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(directpvdrivesResource, directPVDrive), &v1beta1.DirectPVDrive{}) + Invokes(testing.NewRootCreateActionWithOptions(directpvdrivesResource, directPVDrive, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVDrive), err } // Update takes the representation of a directPVDrive and updates it. Returns the server's representation of the directPVDrive, and an error, if there is any. func (c *FakeDirectPVDrives) Update(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (result *v1beta1.DirectPVDrive, err error) { + emptyResult := &v1beta1.DirectPVDrive{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(directpvdrivesResource, directPVDrive), &v1beta1.DirectPVDrive{}) + Invokes(testing.NewRootUpdateActionWithOptions(directpvdrivesResource, directPVDrive, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVDrive), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDirectPVDrives) UpdateStatus(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (*v1beta1.DirectPVDrive, error) { +func (c *FakeDirectPVDrives) UpdateStatus(ctx context.Context, directPVDrive *v1beta1.DirectPVDrive, opts v1.UpdateOptions) (result *v1beta1.DirectPVDrive, err error) { + emptyResult := &v1beta1.DirectPVDrive{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(directpvdrivesResource, "status", directPVDrive), &v1beta1.DirectPVDrive{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(directpvdrivesResource, "status", directPVDrive, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVDrive), err } @@ -115,7 +120,7 @@ func (c *FakeDirectPVDrives) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeDirectPVDrives) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(directpvdrivesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(directpvdrivesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.DirectPVDriveList{}) return err @@ -123,10 +128,11 @@ func (c *FakeDirectPVDrives) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched directPVDrive. func (c *FakeDirectPVDrives) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVDrive, err error) { + emptyResult := &v1beta1.DirectPVDrive{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(directpvdrivesResource, name, pt, data, subresources...), &v1beta1.DirectPVDrive{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(directpvdrivesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVDrive), err } diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvinitrequest.go b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvinitrequest.go index 72bc3d64..cfc0c484 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvinitrequest.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvinitrequest.go @@ -40,20 +40,22 @@ var directpvinitrequestsKind = v1beta1.SchemeGroupVersion.WithKind("DirectPVInit // Get takes name of the directPVInitRequest, and returns the corresponding directPVInitRequest object, and an error if there is any. func (c *FakeDirectPVInitRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVInitRequest, err error) { + emptyResult := &v1beta1.DirectPVInitRequest{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(directpvinitrequestsResource, name), &v1beta1.DirectPVInitRequest{}) + Invokes(testing.NewRootGetActionWithOptions(directpvinitrequestsResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVInitRequest), err } // List takes label and field selectors, and returns the list of DirectPVInitRequests that match those selectors. func (c *FakeDirectPVInitRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVInitRequestList, err error) { + emptyResult := &v1beta1.DirectPVInitRequestList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(directpvinitrequestsResource, directpvinitrequestsKind, opts), &v1beta1.DirectPVInitRequestList{}) + Invokes(testing.NewRootListActionWithOptions(directpvinitrequestsResource, directpvinitrequestsKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,36 +74,39 @@ func (c *FakeDirectPVInitRequests) List(ctx context.Context, opts v1.ListOptions // Watch returns a watch.Interface that watches the requested directPVInitRequests. func (c *FakeDirectPVInitRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(directpvinitrequestsResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(directpvinitrequestsResource, opts)) } // Create takes the representation of a directPVInitRequest and creates it. Returns the server's representation of the directPVInitRequest, and an error, if there is any. func (c *FakeDirectPVInitRequests) Create(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.CreateOptions) (result *v1beta1.DirectPVInitRequest, err error) { + emptyResult := &v1beta1.DirectPVInitRequest{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(directpvinitrequestsResource, directPVInitRequest), &v1beta1.DirectPVInitRequest{}) + Invokes(testing.NewRootCreateActionWithOptions(directpvinitrequestsResource, directPVInitRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVInitRequest), err } // Update takes the representation of a directPVInitRequest and updates it. Returns the server's representation of the directPVInitRequest, and an error, if there is any. func (c *FakeDirectPVInitRequests) Update(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (result *v1beta1.DirectPVInitRequest, err error) { + emptyResult := &v1beta1.DirectPVInitRequest{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(directpvinitrequestsResource, directPVInitRequest), &v1beta1.DirectPVInitRequest{}) + Invokes(testing.NewRootUpdateActionWithOptions(directpvinitrequestsResource, directPVInitRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVInitRequest), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDirectPVInitRequests) UpdateStatus(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (*v1beta1.DirectPVInitRequest, error) { +func (c *FakeDirectPVInitRequests) UpdateStatus(ctx context.Context, directPVInitRequest *v1beta1.DirectPVInitRequest, opts v1.UpdateOptions) (result *v1beta1.DirectPVInitRequest, err error) { + emptyResult := &v1beta1.DirectPVInitRequest{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(directpvinitrequestsResource, "status", directPVInitRequest), &v1beta1.DirectPVInitRequest{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(directpvinitrequestsResource, "status", directPVInitRequest, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVInitRequest), err } @@ -115,7 +120,7 @@ func (c *FakeDirectPVInitRequests) Delete(ctx context.Context, name string, opts // DeleteCollection deletes a collection of objects. func (c *FakeDirectPVInitRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(directpvinitrequestsResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(directpvinitrequestsResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.DirectPVInitRequestList{}) return err @@ -123,10 +128,11 @@ func (c *FakeDirectPVInitRequests) DeleteCollection(ctx context.Context, opts v1 // Patch applies the patch and returns the patched directPVInitRequest. func (c *FakeDirectPVInitRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVInitRequest, err error) { + emptyResult := &v1beta1.DirectPVInitRequest{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(directpvinitrequestsResource, name, pt, data, subresources...), &v1beta1.DirectPVInitRequest{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(directpvinitrequestsResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVInitRequest), err } diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvnode.go b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvnode.go index 08e90256..fdacc4f7 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvnode.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvnode.go @@ -40,20 +40,22 @@ var directpvnodesKind = v1beta1.SchemeGroupVersion.WithKind("DirectPVNode") // Get takes name of the directPVNode, and returns the corresponding directPVNode object, and an error if there is any. func (c *FakeDirectPVNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVNode, err error) { + emptyResult := &v1beta1.DirectPVNode{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(directpvnodesResource, name), &v1beta1.DirectPVNode{}) + Invokes(testing.NewRootGetActionWithOptions(directpvnodesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVNode), err } // List takes label and field selectors, and returns the list of DirectPVNodes that match those selectors. func (c *FakeDirectPVNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVNodeList, err error) { + emptyResult := &v1beta1.DirectPVNodeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(directpvnodesResource, directpvnodesKind, opts), &v1beta1.DirectPVNodeList{}) + Invokes(testing.NewRootListActionWithOptions(directpvnodesResource, directpvnodesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,36 +74,39 @@ func (c *FakeDirectPVNodes) List(ctx context.Context, opts v1.ListOptions) (resu // Watch returns a watch.Interface that watches the requested directPVNodes. func (c *FakeDirectPVNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(directpvnodesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(directpvnodesResource, opts)) } // Create takes the representation of a directPVNode and creates it. Returns the server's representation of the directPVNode, and an error, if there is any. func (c *FakeDirectPVNodes) Create(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.CreateOptions) (result *v1beta1.DirectPVNode, err error) { + emptyResult := &v1beta1.DirectPVNode{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(directpvnodesResource, directPVNode), &v1beta1.DirectPVNode{}) + Invokes(testing.NewRootCreateActionWithOptions(directpvnodesResource, directPVNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVNode), err } // Update takes the representation of a directPVNode and updates it. Returns the server's representation of the directPVNode, and an error, if there is any. func (c *FakeDirectPVNodes) Update(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (result *v1beta1.DirectPVNode, err error) { + emptyResult := &v1beta1.DirectPVNode{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(directpvnodesResource, directPVNode), &v1beta1.DirectPVNode{}) + Invokes(testing.NewRootUpdateActionWithOptions(directpvnodesResource, directPVNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVNode), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDirectPVNodes) UpdateStatus(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (*v1beta1.DirectPVNode, error) { +func (c *FakeDirectPVNodes) UpdateStatus(ctx context.Context, directPVNode *v1beta1.DirectPVNode, opts v1.UpdateOptions) (result *v1beta1.DirectPVNode, err error) { + emptyResult := &v1beta1.DirectPVNode{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(directpvnodesResource, "status", directPVNode), &v1beta1.DirectPVNode{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(directpvnodesResource, "status", directPVNode, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVNode), err } @@ -115,7 +120,7 @@ func (c *FakeDirectPVNodes) Delete(ctx context.Context, name string, opts v1.Del // DeleteCollection deletes a collection of objects. func (c *FakeDirectPVNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(directpvnodesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(directpvnodesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.DirectPVNodeList{}) return err @@ -123,10 +128,11 @@ func (c *FakeDirectPVNodes) DeleteCollection(ctx context.Context, opts v1.Delete // Patch applies the patch and returns the patched directPVNode. func (c *FakeDirectPVNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVNode, err error) { + emptyResult := &v1beta1.DirectPVNode{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(directpvnodesResource, name, pt, data, subresources...), &v1beta1.DirectPVNode{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(directpvnodesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVNode), err } diff --git a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvvolume.go b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvvolume.go index bf13e8b3..0854db2f 100644 --- a/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvvolume.go +++ b/pkg/clientset/typed/directpv.min.io/v1beta1/fake/fake_directpvvolume.go @@ -40,20 +40,22 @@ var directpvvolumesKind = v1beta1.SchemeGroupVersion.WithKind("DirectPVVolume") // Get takes name of the directPVVolume, and returns the corresponding directPVVolume object, and an error if there is any. func (c *FakeDirectPVVolumes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.DirectPVVolume, err error) { + emptyResult := &v1beta1.DirectPVVolume{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(directpvvolumesResource, name), &v1beta1.DirectPVVolume{}) + Invokes(testing.NewRootGetActionWithOptions(directpvvolumesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVVolume), err } // List takes label and field selectors, and returns the list of DirectPVVolumes that match those selectors. func (c *FakeDirectPVVolumes) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.DirectPVVolumeList, err error) { + emptyResult := &v1beta1.DirectPVVolumeList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(directpvvolumesResource, directpvvolumesKind, opts), &v1beta1.DirectPVVolumeList{}) + Invokes(testing.NewRootListActionWithOptions(directpvvolumesResource, directpvvolumesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -72,36 +74,39 @@ func (c *FakeDirectPVVolumes) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested directPVVolumes. func (c *FakeDirectPVVolumes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(directpvvolumesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(directpvvolumesResource, opts)) } // Create takes the representation of a directPVVolume and creates it. Returns the server's representation of the directPVVolume, and an error, if there is any. func (c *FakeDirectPVVolumes) Create(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.CreateOptions) (result *v1beta1.DirectPVVolume, err error) { + emptyResult := &v1beta1.DirectPVVolume{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(directpvvolumesResource, directPVVolume), &v1beta1.DirectPVVolume{}) + Invokes(testing.NewRootCreateActionWithOptions(directpvvolumesResource, directPVVolume, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVVolume), err } // Update takes the representation of a directPVVolume and updates it. Returns the server's representation of the directPVVolume, and an error, if there is any. func (c *FakeDirectPVVolumes) Update(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (result *v1beta1.DirectPVVolume, err error) { + emptyResult := &v1beta1.DirectPVVolume{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(directpvvolumesResource, directPVVolume), &v1beta1.DirectPVVolume{}) + Invokes(testing.NewRootUpdateActionWithOptions(directpvvolumesResource, directPVVolume, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVVolume), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDirectPVVolumes) UpdateStatus(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (*v1beta1.DirectPVVolume, error) { +func (c *FakeDirectPVVolumes) UpdateStatus(ctx context.Context, directPVVolume *v1beta1.DirectPVVolume, opts v1.UpdateOptions) (result *v1beta1.DirectPVVolume, err error) { + emptyResult := &v1beta1.DirectPVVolume{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(directpvvolumesResource, "status", directPVVolume), &v1beta1.DirectPVVolume{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(directpvvolumesResource, "status", directPVVolume, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVVolume), err } @@ -115,7 +120,7 @@ func (c *FakeDirectPVVolumes) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeDirectPVVolumes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(directpvvolumesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(directpvvolumesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.DirectPVVolumeList{}) return err @@ -123,10 +128,11 @@ func (c *FakeDirectPVVolumes) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched directPVVolume. func (c *FakeDirectPVVolumes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.DirectPVVolume, err error) { + emptyResult := &v1beta1.DirectPVVolume{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(directpvvolumesResource, name, pt, data, subresources...), &v1beta1.DirectPVVolume{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(directpvvolumesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.DirectPVVolume), err } diff --git a/pkg/csi/controller/legacy_server.go b/pkg/csi/controller/legacy_server.go index 4cc256de..35290001 100644 --- a/pkg/csi/controller/legacy_server.go +++ b/pkg/csi/controller/legacy_server.go @@ -18,7 +18,6 @@ package controller import ( "context" - "fmt" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/minio/directpv/pkg/consts" @@ -41,6 +40,7 @@ func NewLegacyServer() *LegacyServer { func (c *LegacyServer) CreateVolume(_ context.Context, _ *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { return nil, status.Errorf( codes.InvalidArgument, - fmt.Sprintf("legacy volume creation not supported; use %v storage class", consts.Identity), + "legacy volume creation not supported; use %v storage class", + consts.Identity, ) } diff --git a/pkg/device/sysfs_linux.go b/pkg/device/sysfs_linux.go index 1c3f90e1..b122d58f 100644 --- a/pkg/device/sysfs_linux.go +++ b/pkg/device/sysfs_linux.go @@ -106,3 +106,21 @@ func getHolders(name string) ([]string, error) { func getDMName(name string) (string, error) { return readFirstLine("/sys/class/block/" + name + "/dm/name") } + +// GetStat returns statistics for a given device name. +func GetStat(name string) (stats []uint64, err error) { + line, err := readFirstLine("/sys/class/block/" + name + "/stat") + if err != nil { + return nil, err + } + + for _, token := range strings.Fields(line) { + ui64, err := strconv.ParseUint(token, 10, 64) + if err != nil { + return nil, err + } + stats = append(stats, ui64) + } + + return stats, nil +} diff --git a/pkg/metrics/collector.go b/pkg/metrics/collector.go index 2567eabd..aa040b22 100644 --- a/pkg/metrics/collector.go +++ b/pkg/metrics/collector.go @@ -18,17 +18,51 @@ package metrics import ( "context" + "fmt" directpvtypes "github.com/minio/directpv/pkg/apis/directpv.min.io/types" "github.com/minio/directpv/pkg/client" "github.com/minio/directpv/pkg/consts" + "github.com/minio/directpv/pkg/device" "github.com/minio/directpv/pkg/sys" "github.com/minio/directpv/pkg/types" + "github.com/minio/directpv/pkg/utils" "github.com/minio/directpv/pkg/xfs" "github.com/prometheus/client_golang/prometheus" "k8s.io/klog/v2" ) +const defaultSectorSize = 512 + +type driveStats struct { + readBytes float64 + readTicks float64 + writeBytes float64 + writeTicks float64 + timeInQueue float64 +} + +func getDriveStats(driveName string) (*driveStats, error) { + stat, err := device.GetStat(driveName) + switch { + case err != nil: + return nil, err + case len(stat) == 0: + return nil, fmt.Errorf("unable to read stat from drive %v", driveName) + case len(stat) < 10: + return nil, fmt.Errorf("invalid stat format from drive %v", driveName) + } + + // Refer https://www.kernel.org/doc/Documentation/block/stat.txt for meaning of each field. + return &driveStats{ + readBytes: float64(stat[2] * defaultSectorSize), + readTicks: float64(stat[3]), + writeBytes: float64(stat[6] * defaultSectorSize), + writeTicks: float64(stat[7]), + timeInQueue: float64(stat[10]), + }, nil +} + type metricsCollector struct { nodeID directpvtypes.NodeID desc *prometheus.Desc @@ -95,21 +129,124 @@ func (c *metricsCollector) publishVolumeStats(ctx context.Context, volume *types ) } +func (c *metricsCollector) publishDriveStats(drive *types.Drive, ch chan<- prometheus.Metric) { + deviceID, err := c.getDeviceByFSUUID(drive.Status.FSUUID) + if err != nil { + klog.ErrorS( + err, + "unable to find device by FSUUID; "+ + "either device is removed or run command "+ + "`sudo udevadm control --reload-rules && sudo udevadm trigger`"+ + " on the host to reload", + "FSUUID", drive.Status.FSUUID) + client.Eventf( + drive, client.EventTypeWarning, client.EventReasonMetrics, + "unable to find device by FSUUID %v; "+ + "either device is removed or run command "+ + "`sudo udevadm control --reload-rules && sudo udevadm trigger`"+ + " on the host to reload", drive.Status.FSUUID) + + return + } + deviceName := utils.TrimDevPrefix(deviceID) + + status := float64(1) // Online + driveStat, err := getDriveStats(deviceName) + if err != nil { + klog.ErrorS(err, "unable to read drive statistics") + status = float64(0) // Offline + } + + // Metrics + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_ready"), + "Drive Online/Offline Status", + []string{"drive"}, nil), + prometheus.GaugeValue, + status, drive.Name, + ) + + if driveStat == nil { + return + } + + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_total_read_bytes"), + "Total number of bytes read from the drive", + []string{"drive"}, nil), + prometheus.CounterValue, + driveStat.readBytes, drive.Name, + ) + + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_total_write_bytes"), + "Total number of bytes written to the drive", + []string{"drive"}, nil), + prometheus.CounterValue, + driveStat.writeBytes, drive.Name, + ) + + // Drive Read/Write Latency + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_read_latency_seconds"), + "Drive Read Latency", + []string{"drive"}, nil), + prometheus.GaugeValue, + driveStat.readTicks/1000, drive.Name, + ) + + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_write_latency_seconds"), + "Drive Write Latency", + []string{"drive"}, nil), + prometheus.GaugeValue, + driveStat.writeTicks/1000, drive.Name, + ) + + // Wait Time + ch <- prometheus.MustNewConstMetric( + prometheus.NewDesc( + prometheus.BuildFQName(consts.AppName, "stats", "drive_wait_time_seconds"), + "Drive Wait Time", + []string{"drive"}, nil), + prometheus.GaugeValue, + driveStat.timeInQueue/1000, drive.Name, + ) +} + // Collect is called by Prometheus registry when collecting metrics. func (c *metricsCollector) Collect(ch chan<- prometheus.Metric) { ctx, cancelFunc := context.WithCancel(context.Background()) defer cancelFunc() - resultCh := client.NewVolumeLister(). + // Collecting volume statistics + volumeResultCh := client.NewVolumeLister(). NodeSelector([]directpvtypes.LabelValue{directpvtypes.ToLabelValue(string(c.nodeID))}). List(ctx) - for result := range resultCh { + for result := range volumeResultCh { if result.Err != nil { - return + break } if result.Volume.Status.TargetPath != "" { c.publishVolumeStats(ctx, &result.Volume, ch) } } + + // Collecting drive statistics + driveResultCh := client.NewDriveLister(). + NodeSelector([]directpvtypes.LabelValue{directpvtypes.ToLabelValue(string(c.nodeID))}). + List(ctx) + for result := range driveResultCh { + if result.Err != nil { + break + } + + c.publishDriveStats(&result.Drive, ch) + } } diff --git a/resources/base/CSIDriver.yaml b/resources/base/CSIDriver.yaml new file mode 100644 index 00000000..795d9485 --- /dev/null +++ b/resources/base/CSIDriver.yaml @@ -0,0 +1,17 @@ + +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io +spec: + attachRequired: false + podInfoOnMount: true + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/resources/base/ClusterRole.yaml b/resources/base/ClusterRole.yaml new file mode 100644 index 00000000..505b7da0 --- /dev/null +++ b/resources/base/ClusterRole.yaml @@ -0,0 +1,151 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io +rules: +- apiGroups: + - "" + resources: + - persistentvolumes + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - "" + resources: + - persistentvolumeclaims/status + verbs: + - patch +- apiGroups: + - policy + resources: + - podsecuritypolicies + verbs: + - use +- apiGroups: + - "" + resources: + - persistentvolumeclaims + verbs: + - get + - list + - update + - watch +- apiGroups: + - storage.k8s.io + resources: + - storageclasses + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - events + verbs: + - create + - list + - patch + - update + - watch +- apiGroups: + - storage.k8s.io + resources: + - csinodes + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - nodes + verbs: + - get + - list + - watch +- apiGroups: + - storage.k8s.io + resources: + - volumeattachments + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - endpoints + verbs: + - create + - delete + - get + - list + - update + - watch +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - delete + - get + - list + - update + - watch +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - directpv.min.io + resources: + - directpvdrives + - directpvvolumes + - directpvnodes + - directpvinitrequests + verbs: + - create + - delete + - get + - list + - update + - watch +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - list + - watch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - watch diff --git a/resources/base/ClusterRoleBinding.yaml b/resources/base/ClusterRoleBinding.yaml new file mode 100644 index 00000000..66e53a38 --- /dev/null +++ b/resources/base/ClusterRoleBinding.yaml @@ -0,0 +1,21 @@ + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: directpv-min-io +subjects: +- kind: ServiceAccount + name: directpv-min-io + namespace: directpv diff --git a/resources/base/DaemonSet.yaml b/resources/base/DaemonSet.yaml new file mode 100644 index 00000000..7659901a --- /dev/null +++ b/resources/base/DaemonSet.yaml @@ -0,0 +1,229 @@ + +apiVersion: apps/v1 +kind: DaemonSet +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: node-server + namespace: directpv +spec: + selector: + matchLabels: + selector.directpv.min.io: directpv-min-io-node-server + template: + metadata: + annotations: + created-by: kubectl-directpv + creationTimestamp: null + labels: + selector.directpv.min.io: directpv-min-io-node-server + selector.directpv.min.io.service: enabled + name: node-server + namespace: directpv + spec: + containers: + - args: + - --v=3 + - --csi-address=unix:///csi/csi.sock + - --kubelet-registration-path=/var/lib/kubelet/plugins/directpv-min-io/csi.sock + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: quay.io/minio/csi-node-driver-registrar@sha256:dafc7f667aa2e20d7f059c20db02dd6987c2624d64d8f166cd5930721be98ea9 + name: node-driver-registrar + resources: {} + terminationMessagePath: /var/log/driver-registrar-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - mountPath: /registration + mountPropagation: None + name: registration-dir + - args: + - node-server + - -v=3 + - --identity=directpv-min-io + - --csi-endpoint=$(CSI_ENDPOINT) + - --kube-node-name=$(KUBE_NODE_NAME) + - --readiness-port=30443 + - --metrics-port=10443 + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/directpv@sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + name: node-server + ports: + - containerPort: 30443 + name: readinessport + protocol: TCP + - containerPort: 9898 + name: healthz + protocol: TCP + - containerPort: 10443 + name: metrics + protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: readinessport + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/driver-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - mountPath: /var/lib/kubelet/pods + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /var/lib/kubelet/plugins + mountPropagation: Bidirectional + name: plugins-dir + - mountPath: /var/lib/directpv/ + mountPropagation: Bidirectional + name: directpv-common-root + - mountPath: /var/lib/direct-csi/ + mountPropagation: Bidirectional + name: direct-csi-common-root + - mountPath: /sys + mountPropagation: Bidirectional + name: sysfs + - mountPath: /dev + mountPropagation: HostToContainer + name: devfs + readOnly: true + - mountPath: /run/udev/data + mountPropagation: Bidirectional + name: run-udev-data-dir + readOnly: true + - args: + - node-controller + - -v=3 + - --kube-node-name=$(KUBE_NODE_NAME) + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: quay.io/minio/directpv@sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + name: node-controller + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/driver-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - mountPath: /var/lib/kubelet/pods + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /var/lib/kubelet/plugins + mountPropagation: Bidirectional + name: plugins-dir + - mountPath: /var/lib/directpv/ + mountPropagation: Bidirectional + name: directpv-common-root + - mountPath: /var/lib/direct-csi/ + mountPropagation: Bidirectional + name: direct-csi-common-root + - mountPath: /sys + mountPropagation: Bidirectional + name: sysfs + - mountPath: /dev + mountPropagation: HostToContainer + name: devfs + readOnly: true + - mountPath: /run/udev/data + mountPropagation: Bidirectional + name: run-udev-data-dir + readOnly: true + - args: + - --csi-address=/csi/csi.sock + - --health-port=9898 + image: quay.io/minio/livenessprobe@sha256:783010e10e4d74b6b2b157a4b52772c5a264fd76bb2ad671054b8c3f706c8324 + name: liveness-probe + resources: {} + terminationMessagePath: /var/log/driver-liveness-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + hostPID: true + serviceAccountName: directpv-min-io + volumes: + - hostPath: + path: /var/lib/kubelet/plugins/directpv-min-io + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/pods + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /var/lib/kubelet/plugins + type: DirectoryOrCreate + name: plugins-dir + - hostPath: + path: /var/lib/directpv/ + type: DirectoryOrCreate + name: directpv-common-root + - hostPath: + path: /var/lib/direct-csi/ + type: DirectoryOrCreate + name: direct-csi-common-root + - hostPath: + path: /sys + type: DirectoryOrCreate + name: sysfs + - hostPath: + path: /dev + type: DirectoryOrCreate + name: devfs + - hostPath: + path: /run/udev/data + type: DirectoryOrCreate + name: run-udev-data-dir + updateStrategy: + type: RollingUpdate +status: + currentNumberScheduled: 0 + desiredNumberScheduled: 0 + numberMisscheduled: 0 + numberReady: 0 diff --git a/resources/base/Deployment.yaml b/resources/base/Deployment.yaml new file mode 100644 index 00000000..75d2c9a4 --- /dev/null +++ b/resources/base/Deployment.yaml @@ -0,0 +1,117 @@ + +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: controller + namespace: directpv +spec: + replicas: 3 + selector: + matchLabels: + selector.directpv.min.io: controller-controller + strategy: + type: Recreate + template: + metadata: + annotations: + created-by: kubectl-directpv + creationTimestamp: null + labels: + selector.directpv.min.io: controller-controller + name: controller + namespace: directpv + spec: + containers: + - args: + - --v=3 + - --timeout=300s + - --csi-address=$(CSI_ENDPOINT) + - --leader-election + - --feature-gates=Topology=true + - --strict-topology + env: + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/csi-provisioner@sha256:fc1f992dd5591357fa123c396aaadaea5033f312b9c136a11d62cf698474bebb + name: csi-provisioner + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/controller-provisioner-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - args: + - --v=3 + - --timeout=300s + - --csi-address=$(CSI_ENDPOINT) + - --leader-election + env: + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/csi-resizer@sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + name: csi-resizer + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/controller-csi-resizer-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - args: + - controller + - --identity=directpv-min-io + - -v=3 + - --csi-endpoint=$(CSI_ENDPOINT) + - --kube-node-name=$(KUBE_NODE_NAME) + - --readiness-port=30443 + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/directpv@sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + name: controller + ports: + - containerPort: 30443 + name: readinessport + protocol: TCP + - containerPort: 9898 + name: healthz + protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: readinessport + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + resources: {} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + serviceAccountName: directpv-min-io + volumes: + - hostPath: + path: /var/lib/kubelet/plugins/controller-controller + type: DirectoryOrCreate + name: socket-dir +status: {} diff --git a/resources/base/Namespace.yaml b/resources/base/Namespace.yaml new file mode 100644 index 00000000..8ed8d806 --- /dev/null +++ b/resources/base/Namespace.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Namespace +metadata: + creationTimestamp: null + finalizers: + - foregroundDeletion + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + pod-security.kubernetes.io/enforce: privileged + name: directpv +spec: {} +status: {} diff --git a/resources/base/Role.yaml b/resources/base/Role.yaml new file mode 100644 index 00000000..afe125e3 --- /dev/null +++ b/resources/base/Role.yaml @@ -0,0 +1,26 @@ + +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io + namespace: directpv +rules: +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - delete + - get + - list + - update + - watch diff --git a/resources/base/RoleBinding.yaml b/resources/base/RoleBinding.yaml new file mode 100644 index 00000000..b1f5f46a --- /dev/null +++ b/resources/base/RoleBinding.yaml @@ -0,0 +1,22 @@ + +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io + namespace: directpv +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: directpv-min-io +subjects: +- kind: ServiceAccount + name: directpv-min-io + namespace: directpv diff --git a/resources/base/ServiceAccount.yaml b/resources/base/ServiceAccount.yaml new file mode 100644 index 00000000..f0ccf775 --- /dev/null +++ b/resources/base/ServiceAccount.yaml @@ -0,0 +1,12 @@ + +apiVersion: v1 +kind: ServiceAccount +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io + namespace: directpv diff --git a/resources/base/StorageClass.yaml b/resources/base/StorageClass.yaml new file mode 100644 index 00000000..05c3ea01 --- /dev/null +++ b/resources/base/StorageClass.yaml @@ -0,0 +1,24 @@ + +allowVolumeExpansion: true +allowedTopologies: +- matchLabelExpressions: + - key: directpv.min.io/identity + values: + - directpv-min-io +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + creationTimestamp: null + finalizers: + - foregroundDeletion + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: directpv-min-io +parameters: + csi.storage.k8s.io/fstype: xfs +provisioner: directpv-min-io +reclaimPolicy: Delete +volumeBindingMode: WaitForFirstConsumer diff --git a/resources/base/directpvdrives.directpv.min.io.yaml b/resources/base/directpvdrives.directpv.min.io.yaml new file mode 100644 index 00000000..a242f4a3 --- /dev/null +++ b/resources/base/directpvdrives.directpv.min.io.yaml @@ -0,0 +1,166 @@ + +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + creationTimestamp: null + labels: + directpv.min.io/version: v1beta1 + name: directpvdrives.directpv.min.io +spec: + conversion: + strategy: None + group: directpv.min.io + names: + kind: DirectPVDrive + listKind: DirectPVDriveList + plural: directpvdrives + singular: directpvdrive + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: DirectPVDrive denotes drive CRD object. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: DriveSpec represents DirectPV drive specification values. + properties: + relabel: + type: boolean + unschedulable: + type: boolean + type: object + status: + description: DriveStatus denotes drive information. + properties: + allocatedCapacity: + format: int64 + type: integer + conditions: + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + freeCapacity: + format: int64 + type: integer + fsuuid: + type: string + make: + type: string + status: + description: DriveStatus denotes drive status + type: string + topology: + additionalProperties: + type: string + type: object + totalCapacity: + format: int64 + type: integer + required: + - allocatedCapacity + - freeCapacity + - fsuuid + - status + - topology + - totalCapacity + type: object + required: + - metadata + - status + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/resources/base/directpvinitrequests.directpv.min.io.yaml b/resources/base/directpvinitrequests.directpv.min.io.yaml new file mode 100644 index 00000000..99c959ab --- /dev/null +++ b/resources/base/directpvinitrequests.directpv.min.io.yaml @@ -0,0 +1,102 @@ + +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + creationTimestamp: null + labels: + directpv.min.io/version: v1beta1 + name: directpvinitrequests.directpv.min.io +spec: + conversion: + strategy: None + group: directpv.min.io + names: + kind: DirectPVInitRequest + listKind: DirectPVInitRequestList + plural: directpvinitrequests + singular: directpvinitrequest + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: DirectPVInitRequest denotes DirectPVInitRequest CRD object. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: InitRequestSpec represents the spec for InitRequest. + properties: + devices: + items: + description: InitDevice represents the device requested for initialization. + properties: + force: + type: boolean + id: + type: string + name: + type: string + required: + - force + - id + - name + type: object + type: array + x-kubernetes-list-type: atomic + required: + - devices + type: object + status: + description: InitRequestStatus represents the status of the InitRequest. + properties: + results: + items: + description: InitDeviceResult represents the result of the InitDeviceRequest. + properties: + error: + type: string + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-type: atomic + status: + description: InitStatus denotes initialization status + type: string + required: + - results + - status + type: object + required: + - metadata + - spec + - status + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/resources/base/directpvnodes.directpv.min.io.yaml b/resources/base/directpvnodes.directpv.min.io.yaml new file mode 100644 index 00000000..362082b7 --- /dev/null +++ b/resources/base/directpvnodes.directpv.min.io.yaml @@ -0,0 +1,168 @@ + +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + creationTimestamp: null + labels: + directpv.min.io/version: v1beta1 + name: directpvnodes.directpv.min.io +spec: + conversion: + strategy: None + group: directpv.min.io + names: + kind: DirectPVNode + listKind: DirectPVNodeList + plural: directpvnodes + singular: directpvnode + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: DirectPVNode denotes Node CRD object. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NodeSpec represents DirectPV node specification values. + properties: + refresh: + type: boolean + type: object + status: + description: NodeStatus denotes node information. + properties: + conditions: + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + devices: + items: + description: Device denotes the device information in a drive + properties: + deniedReason: + type: string + fsType: + type: string + fsuuid: + type: string + id: + type: string + majorMinor: + type: string + make: + type: string + name: + type: string + size: + format: int64 + type: integer + required: + - id + - majorMinor + - name + - size + type: object + type: array + x-kubernetes-list-type: atomic + required: + - devices + type: object + required: + - metadata + - status + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/resources/base/directpvvolumes.directpv.min.io.yaml b/resources/base/directpvvolumes.directpv.min.io.yaml new file mode 100644 index 00000000..bfd7fc2d --- /dev/null +++ b/resources/base/directpvvolumes.directpv.min.io.yaml @@ -0,0 +1,160 @@ + +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + creationTimestamp: null + labels: + directpv.min.io/version: v1beta1 + name: directpvvolumes.directpv.min.io +spec: + conversion: + strategy: None + group: directpv.min.io + names: + kind: DirectPVVolume + listKind: DirectPVVolumeList + plural: directpvvolumes + singular: directpvvolume + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: DirectPVVolume denotes volume CRD object. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + status: + description: VolumeStatus denotes volume information. + properties: + availableCapacity: + format: int64 + type: integer + conditions: + items: + description: "Condition contains details for one aspect of the current + state of this API Resource.\n---\nThis struct is intended for + direct use as an array at the field path .status.conditions. For + example,\n\n\n\ttype FooStatus struct{\n\t // Represents the + observations of a foo's current state.\n\t // Known .status.conditions.type + are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // + +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t + \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" + patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t + \ // other fields\n\t}" + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: |- + type of condition in CamelCase or in foo.example.com/CamelCase. + --- + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict is important. + The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + dataPath: + type: string + fsuuid: + type: string + stagingTargetPath: + type: string + status: + description: VolumeStatus represents status of a volume. + type: string + targetPath: + type: string + totalCapacity: + format: int64 + type: integer + usedCapacity: + format: int64 + type: integer + required: + - availableCapacity + - dataPath + - fsuuid + - stagingTargetPath + - status + - targetPath + - totalCapacity + - usedCapacity + type: object + required: + - metadata + - status + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/resources/base/kustomization.yaml b/resources/base/kustomization.yaml new file mode 100644 index 00000000..813ffd06 --- /dev/null +++ b/resources/base/kustomization.yaml @@ -0,0 +1,35 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - Namespace.yaml + - directpvdrives.directpv.min.io.yaml + - directpvinitrequests.directpv.min.io.yaml + - directpvnodes.directpv.min.io.yaml + - directpvvolumes.directpv.min.io.yaml + - CSIDriver.yaml + - StorageClass.yaml + - ServiceAccount.yaml + - ClusterRole.yaml + - ClusterRoleBinding.yaml + - Role.yaml + - RoleBinding.yaml + - DaemonSet.yaml + - Deployment.yaml + +images: + - name: quay.io/minio/directpv + digest: sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + + - name: quay.io/minio/csi-node-driver-registrar + digest: sha256:dafc7f667aa2e20d7f059c20db02dd6987c2624d64d8f166cd5930721be98ea9 + + - name: quay.io/minio/livenessprobe + digest: sha256:783010e10e4d74b6b2b157a4b52772c5a264fd76bb2ad671054b8c3f706c8324 + + - name: quay.io/minio/csi-provisioner + digest: sha256:fc1f992dd5591357fa123c396aaadaea5033f312b9c136a11d62cf698474bebb + + - name: quay.io/minio/csi-resizer + digest: sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + diff --git a/resources/legacy/CSIDriver.yaml b/resources/legacy/CSIDriver.yaml new file mode 100644 index 00000000..7ac84861 --- /dev/null +++ b/resources/legacy/CSIDriver.yaml @@ -0,0 +1,17 @@ + +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: direct-csi-min-io +spec: + attachRequired: false + podInfoOnMount: true + volumeLifecycleModes: + - Persistent + - Ephemeral diff --git a/resources/legacy/DaemonSet.yaml b/resources/legacy/DaemonSet.yaml new file mode 100644 index 00000000..1dbf1156 --- /dev/null +++ b/resources/legacy/DaemonSet.yaml @@ -0,0 +1,182 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: legacy-node-server + namespace: directpv +spec: + selector: + matchLabels: + selector.directpv.min.io: directpv-node-server + template: + metadata: + annotations: + created-by: kubectl-directpv + creationTimestamp: null + labels: + selector.directpv.min.io: directpv-node-server + selector.directpv.min.io.service: enabled + name: legacy-node-server + namespace: directpv + spec: + containers: + - args: + - --v=3 + - --csi-address=unix:///csi/csi.sock + - --kubelet-registration-path=/var/lib/kubelet/plugins/direct-csi-min-io/csi.sock + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + image: quay.io/minio/csi-node-driver-registrar@sha256:dafc7f667aa2e20d7f059c20db02dd6987c2624d64d8f166cd5930721be98ea9 + name: node-driver-registrar + resources: {} + terminationMessagePath: /var/log/driver-registrar-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - mountPath: /registration + mountPropagation: None + name: registration-dir + - args: + - legacy-node-server + - -v=3 + - --csi-endpoint=$(CSI_ENDPOINT) + - --kube-node-name=$(KUBE_NODE_NAME) + - --readiness-port=30443 + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/directpv@sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + livenessProbe: + failureThreshold: 5 + httpGet: + path: /healthz + port: healthz + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + name: node-server + ports: + - containerPort: 30443 + name: readinessport + protocol: TCP + - containerPort: 9898 + name: healthz + protocol: TCP + - containerPort: 10443 + name: metrics + protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: readinessport + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/driver-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - mountPath: /var/lib/kubelet/pods + mountPropagation: Bidirectional + name: mountpoint-dir + - mountPath: /var/lib/kubelet/plugins + mountPropagation: Bidirectional + name: plugins-dir + - mountPath: /var/lib/directpv/ + mountPropagation: Bidirectional + name: directpv-common-root + - mountPath: /var/lib/direct-csi/ + mountPropagation: Bidirectional + name: direct-csi-common-root + - mountPath: /sys + mountPropagation: Bidirectional + name: sysfs + - mountPath: /dev + mountPropagation: HostToContainer + name: devfs + readOnly: true + - mountPath: /run/udev/data + mountPropagation: Bidirectional + name: run-udev-data-dir + readOnly: true + - args: + - --csi-address=/csi/csi.sock + - --health-port=9898 + image: quay.io/minio/livenessprobe@sha256:783010e10e4d74b6b2b157a4b52772c5a264fd76bb2ad671054b8c3f706c8324 + name: liveness-probe + resources: {} + terminationMessagePath: /var/log/driver-liveness-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + hostPID: true + serviceAccountName: directpv-min-io + volumes: + - hostPath: + path: /var/lib/kubelet/plugins/direct-csi-min-io + type: DirectoryOrCreate + name: socket-dir + - hostPath: + path: /var/lib/kubelet/pods + type: DirectoryOrCreate + name: mountpoint-dir + - hostPath: + path: /var/lib/kubelet/plugins_registry + type: DirectoryOrCreate + name: registration-dir + - hostPath: + path: /var/lib/kubelet/plugins + type: DirectoryOrCreate + name: plugins-dir + - hostPath: + path: /var/lib/directpv/ + type: DirectoryOrCreate + name: directpv-common-root + - hostPath: + path: /var/lib/direct-csi/ + type: DirectoryOrCreate + name: direct-csi-common-root + - hostPath: + path: /sys + type: DirectoryOrCreate + name: sysfs + - hostPath: + path: /dev + type: DirectoryOrCreate + name: devfs + - hostPath: + path: /run/udev/data + type: DirectoryOrCreate + name: run-udev-data-dir + updateStrategy: + type: RollingUpdate +status: + currentNumberScheduled: 0 + desiredNumberScheduled: 0 + numberMisscheduled: 0 + numberReady: 0 diff --git a/resources/legacy/Deployment.yaml b/resources/legacy/Deployment.yaml new file mode 100644 index 00000000..0b1ae1c8 --- /dev/null +++ b/resources/legacy/Deployment.yaml @@ -0,0 +1,116 @@ + +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: legacy-controller + namespace: directpv +spec: + replicas: 3 + selector: + matchLabels: + selector.directpv.min.io: directpv-controller + strategy: + type: Recreate + template: + metadata: + annotations: + created-by: kubectl-directpv + creationTimestamp: null + labels: + selector.directpv.min.io: directpv-controller + name: legacy-controller + namespace: directpv + spec: + containers: + - args: + - --v=3 + - --timeout=300s + - --csi-address=$(CSI_ENDPOINT) + - --leader-election + - --feature-gates=Topology=true + - --strict-topology + env: + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/csi-provisioner@sha256:fc1f992dd5591357fa123c396aaadaea5033f312b9c136a11d62cf698474bebb + name: csi-provisioner + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/controller-provisioner-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - args: + - --v=3 + - --timeout=300s + - --csi-address=$(CSI_ENDPOINT) + - --leader-election + env: + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/csi-resizer@sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + name: csi-resizer + resources: {} + securityContext: + privileged: true + terminationMessagePath: /var/log/controller-csi-resizer-termination-log + terminationMessagePolicy: FallbackToLogsOnError + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + - args: + - legacy-controller + - -v=3 + - --csi-endpoint=$(CSI_ENDPOINT) + - --kube-node-name=$(KUBE_NODE_NAME) + - --readiness-port=30443 + env: + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///csi/csi.sock + image: quay.io/minio/directpv@sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + name: controller + ports: + - containerPort: 30443 + name: readinessport + protocol: TCP + - containerPort: 9898 + name: healthz + protocol: TCP + readinessProbe: + failureThreshold: 5 + httpGet: + path: /ready + port: readinessport + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 10 + resources: {} + securityContext: + privileged: true + volumeMounts: + - mountPath: /csi + mountPropagation: None + name: socket-dir + serviceAccountName: directpv-min-io + volumes: + - hostPath: + path: /var/lib/kubelet/plugins/controller-controller + type: DirectoryOrCreate + name: socket-dir +status: {} diff --git a/resources/legacy/StorageClass.yaml b/resources/legacy/StorageClass.yaml new file mode 100644 index 00000000..692e93e7 --- /dev/null +++ b/resources/legacy/StorageClass.yaml @@ -0,0 +1,24 @@ + +allowVolumeExpansion: true +allowedTopologies: +- matchLabelExpressions: + - key: directpv.min.io/identity + values: + - directpv-min-io +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + creationTimestamp: null + finalizers: + - foregroundDeletion + labels: + application-name: directpv.min.io + application-type: CSIDriver + directpv.min.io/created-by: kubectl-directpv + directpv.min.io/version: v1beta1 + name: direct-csi-min-io +parameters: + csi.storage.k8s.io/fstype: xfs +provisioner: directpv-min-io +reclaimPolicy: Delete +volumeBindingMode: WaitForFirstConsumer diff --git a/resources/legacy/kustomization.yaml b/resources/legacy/kustomization.yaml new file mode 100644 index 00000000..61aa767c --- /dev/null +++ b/resources/legacy/kustomization.yaml @@ -0,0 +1,26 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../base + - CSIDriver.yaml + - DaemonSet.yaml + - Deployment.yaml + - StorageClass.yaml + +images: + - name: quay.io/minio/directpv + digest: sha256:83fd05fe114ed15c3975333c90cbe18c782d9c4d5c7ad6fdb8cc835e380ba505 + + - name: quay.io/minio/csi-node-driver-registrar + digest: sha256:dafc7f667aa2e20d7f059c20db02dd6987c2624d64d8f166cd5930721be98ea9 + + - name: quay.io/minio/livenessprobe + digest: sha256:783010e10e4d74b6b2b157a4b52772c5a264fd76bb2ad671054b8c3f706c8324 + + - name: quay.io/minio/csi-provisioner + digest: sha256:fc1f992dd5591357fa123c396aaadaea5033f312b9c136a11d62cf698474bebb + + - name: quay.io/minio/csi-resizer + digest: sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + diff --git a/resources/openshift-with-legacy/kustomization.yaml b/resources/openshift-with-legacy/kustomization.yaml new file mode 100644 index 00000000..2288b7d6 --- /dev/null +++ b/resources/openshift-with-legacy/kustomization.yaml @@ -0,0 +1,22 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../legacy + +images: + - name: quay.io/minio/csi-node-driver-registrar + newName: registry.redhat.io/openshift4/ose-csi-node-driver-registrar-rhel8 + digest: sha256:ab54e6a2e8a6a1ca2da5aaf25f784c09f5bf22ea32224ec1bdb6c564f88695a9 + + - name: quay.io/minio/livenessprobe + newName: registry.redhat.io/openshift4/ose-csi-livenessprobe-rhel8 + digest: sha256:b28029f929fe2a28e666910d1acc57c3474fabdb2f9129688ef1ca56c7231d90 + + - name: quay.io/minio/csi-provisioner + newName: registry.redhat.io/openshift4/ose-csi-external-provisioner-rhel8 + digest: sha256:8bf8aa8975790e19ba107fd58699f98389e3fb692d192f4df3078fff7f0a4bba + + - name: quay.io/minio/csi-resizer@sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + newName: registry.redhat.io/openshift4/ose-csi-external-resizer-rhel8 + digest: sha256:bed8de36bac80108909205342b2d92e4de5adbfa33bf13f9346236fca52a0d3e diff --git a/resources/openshift/kustomization.yaml b/resources/openshift/kustomization.yaml new file mode 100644 index 00000000..2b23416c --- /dev/null +++ b/resources/openshift/kustomization.yaml @@ -0,0 +1,22 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../base + +images: + - name: quay.io/minio/csi-node-driver-registrar + newName: registry.redhat.io/openshift4/ose-csi-node-driver-registrar-rhel8 + digest: sha256:ab54e6a2e8a6a1ca2da5aaf25f784c09f5bf22ea32224ec1bdb6c564f88695a9 + + - name: quay.io/minio/livenessprobe + newName: registry.redhat.io/openshift4/ose-csi-livenessprobe-rhel8 + digest: sha256:b28029f929fe2a28e666910d1acc57c3474fabdb2f9129688ef1ca56c7231d90 + + - name: quay.io/minio/csi-provisioner + newName: registry.redhat.io/openshift4/ose-csi-external-provisioner-rhel8 + digest: sha256:8bf8aa8975790e19ba107fd58699f98389e3fb692d192f4df3078fff7f0a4bba + + - name: quay.io/minio/csi-resizer@sha256:58fa627393f20892b105a137d27e236dfaec233a3a64980f84dcb15f38c21533 + newName: registry.redhat.io/openshift4/ose-csi-external-resizer-rhel8 + digest: sha256:bed8de36bac80108909205342b2d92e4de5adbfa33bf13f9346236fca52a0d3e