Skip to content

Commit d77b4d0

Browse files
authored
[Linter] [Imports] Standardize k8s.io/api/apps/v1 (#1056)
1 parent df8e87e commit d77b4d0

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.golangci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ linters-settings:
3636
alias: meta
3737
- pkg: k8s.io/client-go/kubernetes/typed/core/v1
3838
alias: typedCore
39+
- pkg: k8s.io/api/apps/v1
40+
alias: apps
3941
gci:
4042
sections:
4143
- standard

cmd/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
"github.com/rs/zerolog"
3737
"github.com/spf13/cobra"
3838
flag "github.com/spf13/pflag"
39-
appsv1 "k8s.io/api/apps/v1"
39+
apps "k8s.io/api/apps/v1"
4040
core "k8s.io/api/core/v1"
4141
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
4242
"k8s.io/apimachinery/pkg/runtime"
@@ -476,6 +476,6 @@ func createRecorder(kubecli kubernetes.Interface, name, namespace string) record
476476
combinedScheme := runtime.NewScheme()
477477
scheme.AddToScheme(combinedScheme)
478478
core.AddToScheme(combinedScheme)
479-
appsv1.AddToScheme(combinedScheme)
479+
apps.AddToScheme(combinedScheme)
480480
return eventBroadcaster.NewRecorder(combinedScheme, core.EventSource{Component: name})
481481
}

pkg/util/k8sutil/owner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ package k8sutil
2323
import (
2424
"context"
2525

26-
appsv1 "k8s.io/api/apps/v1"
26+
apps "k8s.io/api/apps/v1"
2727
core "k8s.io/api/core/v1"
2828
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/client-go/kubernetes"
@@ -33,7 +33,7 @@ import (
3333

3434
// GetPodOwner returns the ReplicaSet that owns the given Pod.
3535
// If the Pod has no owner of the owner is not a ReplicaSet, nil is returned.
36-
func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*appsv1.ReplicaSet, error) {
36+
func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*apps.ReplicaSet, error) {
3737
for _, ref := range pod.GetOwnerReferences() {
3838
if ref.Kind == "ReplicaSet" {
3939
rSets := kubecli.AppsV1().ReplicaSets(pod.GetNamespace())
@@ -49,7 +49,7 @@ func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*appsv
4949

5050
// GetReplicaSetOwner returns the Deployment that owns the given ReplicaSet.
5151
// If the ReplicaSet has no owner of the owner is not a Deployment, nil is returned.
52-
func GetReplicaSetOwner(kubecli kubernetes.Interface, rSet *appsv1.ReplicaSet, ns string) (*appsv1.Deployment, error) {
52+
func GetReplicaSetOwner(kubecli kubernetes.Interface, rSet *apps.ReplicaSet, ns string) (*apps.Deployment, error) {
5353
for _, ref := range rSet.GetOwnerReferences() {
5454
if ref.Kind == "Deployment" {
5555
depls := kubecli.AppsV1().Deployments(rSet.GetNamespace())

0 commit comments

Comments
 (0)