chore: define common aliases for k8s packages (#8672)
Run the E2E test on kind / build (push) Failing after 6m48s
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 35s
Close stale issues and PRs / stale (push) Successful in 8s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m11s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 47s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 49s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 43s

* lchore: define common alias for k8s packages

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update .golangci.yaml

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update .golangci.yaml

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update .golangci.yaml

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-04-22 06:14:47 -04:00
committed by GitHub
parent f0fde6e1d4
commit c6a420bd3a
139 changed files with 1968 additions and 1954 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ import (
"fmt"
"time"
v1 "k8s.io/api/core/v1"
corev1api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/vmware-tanzu/velero/internal/resourcepolicies"
@@ -284,7 +284,7 @@ func (b *BackupBuilder) ItemOperationTimeout(timeout time.Duration) *BackupBuild
// ResourcePolicies sets the Backup's resource polices.
func (b *BackupBuilder) ResourcePolicies(name string) *BackupBuilder {
b.object.Spec.ResourcePolicy = &v1.TypedLocalObjectReference{Kind: resourcepolicies.ConfigmapRefType, Name: name}
b.object.Spec.ResourcePolicy = &corev1api.TypedLocalObjectReference{Kind: resourcepolicies.ConfigmapRefType, Name: name}
return b
}
+5 -5
View File
@@ -17,21 +17,21 @@ limitations under the License.
package builder
import (
rbacv1api "k8s.io/api/rbac/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// RoleBuilder builds Role objects.
type RoleBuilder struct {
object *rbacv1api.Role
object *rbacv1.Role
}
// ForRole is the constructor for a RoleBuilder.
func ForRole(ns, name string) *RoleBuilder {
return &RoleBuilder{
object: &rbacv1api.Role{
object: &rbacv1.Role{
TypeMeta: metav1.TypeMeta{
APIVersion: rbacv1api.SchemeGroupVersion.String(),
APIVersion: rbacv1.SchemeGroupVersion.String(),
Kind: "Role",
},
ObjectMeta: metav1.ObjectMeta{
@@ -43,7 +43,7 @@ func ForRole(ns, name string) *RoleBuilder {
}
// Result returns the built Role.
func (b *RoleBuilder) Result() *rbacv1api.Role {
func (b *RoleBuilder) Result() *rbacv1.Role {
return b.object
}
+9 -9
View File
@@ -17,37 +17,37 @@ limitations under the License.
package builder
import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
appsv1api "k8s.io/api/apps/v1"
corev1api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// StatefulSetBuilder builds StatefulSet objects.
type StatefulSetBuilder struct {
object *appsv1.StatefulSet
object *appsv1api.StatefulSet
}
// ForStatefulSet is the constructor for a StatefulSetBuilder.
func ForStatefulSet(ns, name string) *StatefulSetBuilder {
return &StatefulSetBuilder{
object: &appsv1.StatefulSet{
object: &appsv1api.StatefulSet{
TypeMeta: metav1.TypeMeta{
APIVersion: appsv1.SchemeGroupVersion.String(),
APIVersion: appsv1api.SchemeGroupVersion.String(),
Kind: "StatefulSet",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: name,
},
Spec: appsv1.StatefulSetSpec{
VolumeClaimTemplates: []corev1.PersistentVolumeClaim{},
Spec: appsv1api.StatefulSetSpec{
VolumeClaimTemplates: []corev1api.PersistentVolumeClaim{},
},
},
}
}
// Result returns the built StatefulSet.
func (b *StatefulSetBuilder) Result() *appsv1.StatefulSet {
func (b *StatefulSetBuilder) Result() *appsv1api.StatefulSet {
return b.object
}
@@ -56,7 +56,7 @@ func (b *StatefulSetBuilder) StorageClass(names ...string) *StatefulSetBuilder {
for _, name := range names {
nameTmp := name
b.object.Spec.VolumeClaimTemplates = append(b.object.Spec.VolumeClaimTemplates,
corev1.PersistentVolumeClaim{Spec: corev1.PersistentVolumeClaimSpec{StorageClassName: &nameTmp}})
corev1api.PersistentVolumeClaim{Spec: corev1api.PersistentVolumeClaimSpec{StorageClassName: &nameTmp}})
}
return b
}
@@ -18,7 +18,7 @@ package builder
import (
snapshotv1api "github.com/kubernetes-csi/external-snapshotter/client/v7/apis/volumesnapshot/v1"
v1 "k8s.io/api/core/v1"
corev1api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
@@ -62,7 +62,7 @@ func (v *VolumeSnapshotContentBuilder) DeletionPolicy(policy snapshotv1api.Delet
// VolumeSnapshotRef sets the built VolumeSnapshotContent's spec.VolumeSnapshotRef value.
func (v *VolumeSnapshotContentBuilder) VolumeSnapshotRef(namespace, name, uid string) *VolumeSnapshotContentBuilder {
v.object.Spec.VolumeSnapshotRef = v1.ObjectReference{
v.object.Spec.VolumeSnapshotRef = corev1api.ObjectReference{
APIVersion: "snapshot.storage.k8s.io/v1",
Kind: "VolumeSnapshot",
Namespace: namespace,