mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-15 17:51:03 +00:00
[Linter] [Imports] Standardize k8s.io/api/apps/v1 (#1056)
This commit is contained in:
parent
df8e87e2b6
commit
d77b4d08ca
3 changed files with 7 additions and 5 deletions
|
@ -36,6 +36,8 @@ linters-settings:
|
||||||
alias: meta
|
alias: meta
|
||||||
- pkg: k8s.io/client-go/kubernetes/typed/core/v1
|
- pkg: k8s.io/client-go/kubernetes/typed/core/v1
|
||||||
alias: typedCore
|
alias: typedCore
|
||||||
|
- pkg: k8s.io/api/apps/v1
|
||||||
|
alias: apps
|
||||||
gci:
|
gci:
|
||||||
sections:
|
sections:
|
||||||
- standard
|
- standard
|
||||||
|
|
|
@ -36,7 +36,7 @@ import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
core "k8s.io/api/core/v1"
|
core "k8s.io/api/core/v1"
|
||||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
@ -476,6 +476,6 @@ func createRecorder(kubecli kubernetes.Interface, name, namespace string) record
|
||||||
combinedScheme := runtime.NewScheme()
|
combinedScheme := runtime.NewScheme()
|
||||||
scheme.AddToScheme(combinedScheme)
|
scheme.AddToScheme(combinedScheme)
|
||||||
core.AddToScheme(combinedScheme)
|
core.AddToScheme(combinedScheme)
|
||||||
appsv1.AddToScheme(combinedScheme)
|
apps.AddToScheme(combinedScheme)
|
||||||
return eventBroadcaster.NewRecorder(combinedScheme, core.EventSource{Component: name})
|
return eventBroadcaster.NewRecorder(combinedScheme, core.EventSource{Component: name})
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ package k8sutil
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
core "k8s.io/api/core/v1"
|
core "k8s.io/api/core/v1"
|
||||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
@ -33,7 +33,7 @@ import (
|
||||||
|
|
||||||
// GetPodOwner returns the ReplicaSet that owns the given Pod.
|
// GetPodOwner returns the ReplicaSet that owns the given Pod.
|
||||||
// If the Pod has no owner of the owner is not a ReplicaSet, nil is returned.
|
// If the Pod has no owner of the owner is not a ReplicaSet, nil is returned.
|
||||||
func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*appsv1.ReplicaSet, error) {
|
func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*apps.ReplicaSet, error) {
|
||||||
for _, ref := range pod.GetOwnerReferences() {
|
for _, ref := range pod.GetOwnerReferences() {
|
||||||
if ref.Kind == "ReplicaSet" {
|
if ref.Kind == "ReplicaSet" {
|
||||||
rSets := kubecli.AppsV1().ReplicaSets(pod.GetNamespace())
|
rSets := kubecli.AppsV1().ReplicaSets(pod.GetNamespace())
|
||||||
|
@ -49,7 +49,7 @@ func GetPodOwner(kubecli kubernetes.Interface, pod *core.Pod, ns string) (*appsv
|
||||||
|
|
||||||
// GetReplicaSetOwner returns the Deployment that owns the given ReplicaSet.
|
// GetReplicaSetOwner returns the Deployment that owns the given ReplicaSet.
|
||||||
// If the ReplicaSet has no owner of the owner is not a Deployment, nil is returned.
|
// If the ReplicaSet has no owner of the owner is not a Deployment, nil is returned.
|
||||||
func GetReplicaSetOwner(kubecli kubernetes.Interface, rSet *appsv1.ReplicaSet, ns string) (*appsv1.Deployment, error) {
|
func GetReplicaSetOwner(kubecli kubernetes.Interface, rSet *apps.ReplicaSet, ns string) (*apps.Deployment, error) {
|
||||||
for _, ref := range rSet.GetOwnerReferences() {
|
for _, ref := range rSet.GetOwnerReferences() {
|
||||||
if ref.Kind == "Deployment" {
|
if ref.Kind == "Deployment" {
|
||||||
depls := kubecli.AppsV1().Deployments(rSet.GetNamespace())
|
depls := kubecli.AppsV1().Deployments(rSet.GetNamespace())
|
||||||
|
|
Loading…
Reference in a new issue