From 5c6b2fbd4a675111b4865f3f21ea5ce612cef168 Mon Sep 17 00:00:00 2001 From: Leonardo Cecchi Date: Tue, 21 May 2024 11:28:46 +0200 Subject: [PATCH] Use a marker for the Namespace VSC additional printer column Signed-off-by: Leonardo Cecchi --- client/apis/volumesnapshot/v1/types.go | 1 + .../crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml | 3 ++- client/hack/README.md | 2 -- pkg/utils/patch.go | 2 +- .../client/v8/apis/volumesnapshot/v1/types.go | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/apis/volumesnapshot/v1/types.go b/client/apis/volumesnapshot/v1/types.go index d1a98e281..36f60dc95 100644 --- a/client/apis/volumesnapshot/v1/types.go +++ b/client/apis/volumesnapshot/v1/types.go @@ -264,6 +264,7 @@ type VolumeSnapshotClassList struct { // +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system." // +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs." // +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." +// +kubebuilder:printcolumn:name="VolumeSnapshotNamespace",type=string,JSONPath=`.spec.volumeSnapshotRef.namespace`,description="Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` type VolumeSnapshotContent struct { metav1.TypeMeta `json:",inline"` diff --git a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml index 95a6e559b..cd0c879fc 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml +++ b/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml @@ -47,7 +47,8 @@ spec: jsonPath: .spec.volumeSnapshotRef.name name: VolumeSnapshot type: string - - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. + - description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent + object is bound. jsonPath: .spec.volumeSnapshotRef.namespace name: VolumeSnapshotNamespace type: string diff --git a/client/hack/README.md b/client/hack/README.md index 338a592fe..d3fc58442 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -105,8 +105,6 @@ Update the restoreSize property to use type string only: ``` -* Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section in `client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml`. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details. - ## Test suite The `test-suite` directory contains several test cases that are useful to diff --git a/pkg/utils/patch.go b/pkg/utils/patch.go index e870efdb8..7ade0cf1b 100644 --- a/pkg/utils/patch.go +++ b/pkg/utils/patch.go @@ -3,8 +3,8 @@ package utils import ( "context" "encoding/json" - crdv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1alpha1" + crdv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumegroupsnapshot/v1alpha1" crdv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" clientset "github.com/kubernetes-csi/external-snapshotter/client/v8/clientset/versioned" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go index d1a98e281..36f60dc95 100644 --- a/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go +++ b/vendor/github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1/types.go @@ -264,6 +264,7 @@ type VolumeSnapshotClassList struct { // +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system." // +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs." // +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." +// +kubebuilder:printcolumn:name="VolumeSnapshotNamespace",type=string,JSONPath=`.spec.volumeSnapshotRef.namespace`,description="Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound." // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` type VolumeSnapshotContent struct { metav1.TypeMeta `json:",inline"`