Use admissionregistration/v1 client to fetch webhooks
* Do not fetch unused ComponentStatusessdas/webhooks-timeout-seconds
parent
a198e0364b
commit
95e7d57b51
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/digitalocean/clusterlint/checks"
|
||||
"github.com/digitalocean/clusterlint/kube"
|
||||
"github.com/stretchr/testify/assert"
|
||||
ar "k8s.io/api/admissionregistration/v1beta1"
|
||||
ar "k8s.io/api/admissionregistration/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ package doks
|
|||
import (
|
||||
"github.com/digitalocean/clusterlint/checks"
|
||||
"github.com/digitalocean/clusterlint/kube"
|
||||
ar "k8s.io/api/admissionregistration/v1beta1"
|
||||
ar "k8s.io/api/admissionregistration/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/digitalocean/clusterlint/checks"
|
||||
"github.com/digitalocean/clusterlint/kube"
|
||||
"github.com/stretchr/testify/assert"
|
||||
ar "k8s.io/api/admissionregistration/v1beta1"
|
||||
ar "k8s.io/api/admissionregistration/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/digitalocean/clusterlint/checks"
|
||||
"github.com/digitalocean/clusterlint/kube"
|
||||
"github.com/stretchr/testify/assert"
|
||||
ar "k8s.io/api/admissionregistration/v1beta1"
|
||||
ar "k8s.io/api/admissionregistration/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"context"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
ar "k8s.io/api/admissionregistration/v1beta1"
|
||||
ar "k8s.io/api/admissionregistration/v1"
|
||||
batchv1beta1 "k8s.io/api/batch/v1beta1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
@ -42,7 +42,6 @@ type Identifier struct {
|
|||
type Objects struct {
|
||||
Nodes *corev1.NodeList
|
||||
PersistentVolumes *corev1.PersistentVolumeList
|
||||
ComponentStatuses *corev1.ComponentStatusList
|
||||
SystemNamespace *corev1.Namespace
|
||||
Pods *corev1.PodList
|
||||
PodTemplates *corev1.PodTemplateList
|
||||
|
@ -68,7 +67,7 @@ type Client struct {
|
|||
// ctx is currently unused during API calls. More info: https://github.com/kubernetes/community/pull/1166
|
||||
func (c *Client) FetchObjects(ctx context.Context, filter ObjectFilter) (*Objects, error) {
|
||||
client := c.KubeClient.CoreV1()
|
||||
admissionControllerClient := c.KubeClient.AdmissionregistrationV1beta1()
|
||||
admissionControllerClient := c.KubeClient.AdmissionregistrationV1()
|
||||
batchClient := c.KubeClient.BatchV1beta1()
|
||||
opts := metav1.ListOptions{}
|
||||
objects := &Objects{}
|
||||
|
@ -82,10 +81,6 @@ func (c *Client) FetchObjects(ctx context.Context, filter ObjectFilter) (*Object
|
|||
objects.PersistentVolumes, err = client.PersistentVolumes().List(gCtx, opts)
|
||||
return
|
||||
})
|
||||
g.Go(func() (err error) {
|
||||
objects.ComponentStatuses, err = client.ComponentStatuses().List(gCtx, opts)
|
||||
return
|
||||
})
|
||||
g.Go(func() (err error) {
|
||||
objects.Pods, err = client.Pods(corev1.NamespaceAll).List(gCtx, filter.NamespaceOptions(opts))
|
||||
return
|
||||
|
|
|
@ -45,7 +45,6 @@ func TestFetchObjects(t *testing.T) {
|
|||
|
||||
assert.NotNil(t, actual.Nodes)
|
||||
assert.NotNil(t, actual.PersistentVolumes)
|
||||
assert.NotNil(t, actual.ComponentStatuses)
|
||||
assert.NotNil(t, actual.Pods)
|
||||
assert.NotNil(t, actual.PodTemplates)
|
||||
assert.NotNil(t, actual.PersistentVolumeClaims)
|
||||
|
|
Loading…
Reference in New Issue