Uplift cli-utils and cluster-api
Change-Id: I9b46421812dd15c01a250e6102f9c132ce82dd42
This commit is contained in:
parent
9cd9304a22
commit
1a0ba5647d
2
go.mod
2
go.mod
@ -41,7 +41,7 @@ require (
|
|||||||
k8s.io/kubectl v0.17.4
|
k8s.io/kubectl v0.17.4
|
||||||
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a
|
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a
|
||||||
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a
|
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a
|
||||||
sigs.k8s.io/cli-utils v0.20.6
|
sigs.k8s.io/cli-utils v0.21.0
|
||||||
sigs.k8s.io/cluster-api v0.3.13
|
sigs.k8s.io/cluster-api v0.3.13
|
||||||
sigs.k8s.io/controller-runtime v0.5.14
|
sigs.k8s.io/controller-runtime v0.5.14
|
||||||
sigs.k8s.io/kustomize/api v0.7.2
|
sigs.k8s.io/kustomize/api v0.7.2
|
||||||
|
7
go.sum
7
go.sum
@ -1090,8 +1090,8 @@ opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a/go.mod h1:FEjY
|
|||||||
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a h1:S1dmsP5Cc6OQjAd6OgIKMcNPBiGjh5TDbijVjNE/VGU=
|
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a h1:S1dmsP5Cc6OQjAd6OgIKMcNPBiGjh5TDbijVjNE/VGU=
|
||||||
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a/go.mod h1:s0hwuUpBsRXOrhN0NR+fNVivXGyWgHKpqtyq7qYjpew=
|
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a/go.mod h1:s0hwuUpBsRXOrhN0NR+fNVivXGyWgHKpqtyq7qYjpew=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
sigs.k8s.io/cli-utils v0.20.6 h1:leIIk2NOzacXqhuNnm0tB328RSzp+1QR9PkAdSP1aRI=
|
sigs.k8s.io/cli-utils v0.21.0 h1:yvLvbzDyiFSmJFpjb6C6tqU2EqQ+hPK4GBUhS+myUm8=
|
||||||
sigs.k8s.io/cli-utils v0.20.6/go.mod h1:Lsj0EXMtqcSYyIPY9IXemMQW/muYDHMEWNfQI/DctrA=
|
sigs.k8s.io/cli-utils v0.21.0/go.mod h1:0n6pW2yhMbb0HxIcg8UeI5/Bi+Dh+7NOsXFdTudB/KY=
|
||||||
sigs.k8s.io/cluster-api v0.3.13 h1:dyhvxgt3M00Co06jrM332i27Tfozu9a0EN/qcmQXUFg=
|
sigs.k8s.io/cluster-api v0.3.13 h1:dyhvxgt3M00Co06jrM332i27Tfozu9a0EN/qcmQXUFg=
|
||||||
sigs.k8s.io/cluster-api v0.3.13/go.mod h1:qGxyPTEJWNpII9SBkeRwv+Xvy6EZRLLLzaxVfBLsBpA=
|
sigs.k8s.io/cluster-api v0.3.13/go.mod h1:qGxyPTEJWNpII9SBkeRwv+Xvy6EZRLLLzaxVfBLsBpA=
|
||||||
sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns=
|
sigs.k8s.io/controller-runtime v0.4.0/go.mod h1:ApC79lpY3PHW9xj/w9pj+lYkLgwAAUZwfXkME1Lajns=
|
||||||
@ -1102,8 +1102,7 @@ sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbL
|
|||||||
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
|
||||||
sigs.k8s.io/kustomize/api v0.7.2 h1:ItTD/2XaKO8CosOMFZdaGFdUGTCHdQriW7zQ7AR98rs=
|
sigs.k8s.io/kustomize/api v0.7.2 h1:ItTD/2XaKO8CosOMFZdaGFdUGTCHdQriW7zQ7AR98rs=
|
||||||
sigs.k8s.io/kustomize/api v0.7.2/go.mod h1:50/vLATrjhRmMr3spZsI1GcpoZJ8IARy9QstPbA9lGE=
|
sigs.k8s.io/kustomize/api v0.7.2/go.mod h1:50/vLATrjhRmMr3spZsI1GcpoZJ8IARy9QstPbA9lGE=
|
||||||
sigs.k8s.io/kustomize/kyaml v0.9.2 h1:QNP1Lg4V2wOgBeUim9Kmz1+2GqHtRyfoVEUQH0omrCI=
|
sigs.k8s.io/kustomize/kyaml v0.9.3/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
||||||
sigs.k8s.io/kustomize/kyaml v0.9.2/go.mod h1:UTm64bSWVdBUA8EQoYCxVOaBQxUdIOr5LKWxA4GNbkw=
|
|
||||||
sigs.k8s.io/kustomize/kyaml v0.10.6 h1:xUJxc/k8JoWqHUahaB8DTqY0KwEPxTbTGStvW8TOcDc=
|
sigs.k8s.io/kustomize/kyaml v0.10.6 h1:xUJxc/k8JoWqHUahaB8DTqY0KwEPxTbTGStvW8TOcDc=
|
||||||
sigs.k8s.io/kustomize/kyaml v0.10.6/go.mod h1:K9yg1k/HB/6xNOf5VH3LhTo1DK9/5ykSZO5uIv+Y/1k=
|
sigs.k8s.io/kustomize/kyaml v0.10.6/go.mod h1:K9yg1k/HB/6xNOf5VH3LhTo1DK9/5ykSZO5uIv+Y/1k=
|
||||||
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
|
||||||
|
@ -23,13 +23,12 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apierror "k8s.io/apimachinery/pkg/api/errors"
|
apierror "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/cli-runtime/pkg/resource"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
cliapply "sigs.k8s.io/cli-utils/pkg/apply"
|
cliapply "sigs.k8s.io/cli-utils/pkg/apply"
|
||||||
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
|
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
|
||||||
"sigs.k8s.io/cli-utils/pkg/apply/poller"
|
"sigs.k8s.io/cli-utils/pkg/apply/poller"
|
||||||
clicommon "sigs.k8s.io/cli-utils/pkg/common"
|
clicommon "sigs.k8s.io/cli-utils/pkg/common"
|
||||||
"sigs.k8s.io/cli-utils/pkg/inventory"
|
|
||||||
"sigs.k8s.io/cli-utils/pkg/manifestreader"
|
"sigs.k8s.io/cli-utils/pkg/manifestreader"
|
||||||
"sigs.k8s.io/cli-utils/pkg/provider"
|
"sigs.k8s.io/cli-utils/pkg/provider"
|
||||||
"sigs.k8s.io/yaml"
|
"sigs.k8s.io/yaml"
|
||||||
@ -59,7 +58,7 @@ type ReaderFactory func(validate bool, bundle document.Bundle, factory cmdutil.F
|
|||||||
|
|
||||||
// NewApplier returns instance of Applier
|
// NewApplier returns instance of Applier
|
||||||
func NewApplier(eventCh chan events.Event, f cmdutil.Factory) *Applier {
|
func NewApplier(eventCh chan events.Event, f cmdutil.Factory) *Applier {
|
||||||
cf := provider.NewProvider(f, inventory.WrapInventoryObj)
|
cf := provider.NewProvider(f)
|
||||||
return &Applier{
|
return &Applier{
|
||||||
Factory: f,
|
Factory: f,
|
||||||
ManifestReaderFactory: utils.DefaultManifestReaderFactory,
|
ManifestReaderFactory: utils.DefaultManifestReaderFactory,
|
||||||
@ -74,14 +73,14 @@ func NewApplier(eventCh chan events.Event, f cmdutil.Factory) *Applier {
|
|||||||
func (a *Applier) ApplyBundle(bundle document.Bundle, ao ApplyOptions) {
|
func (a *Applier) ApplyBundle(bundle document.Bundle, ao ApplyOptions) {
|
||||||
defer close(a.eventChannel)
|
defer close(a.eventChannel)
|
||||||
log.Debugf("Getting infos for bundle, inventory id is %s", ao.BundleName)
|
log.Debugf("Getting infos for bundle, inventory id is %s", ao.BundleName)
|
||||||
infos, err := a.getInfos(ao.BundleName, bundle, ao.DryRunStrategy)
|
objects, err := a.getObjects(ao.BundleName, bundle, ao.DryRunStrategy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handleError(a.eventChannel, err)
|
handleError(a.eventChannel, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
ch := a.Driver.Run(ctx, infos, cliApplyOptions(ao))
|
ch := a.Driver.Run(ctx, objects, cliApplyOptions(ao))
|
||||||
for e := range ch {
|
for e := range ch {
|
||||||
a.eventChannel <- events.Event{
|
a.eventChannel <- events.Event{
|
||||||
Type: events.ApplierType,
|
Type: events.ApplierType,
|
||||||
@ -90,10 +89,10 @@ func (a *Applier) ApplyBundle(bundle document.Bundle, ao ApplyOptions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Applier) getInfos(
|
func (a *Applier) getObjects(
|
||||||
bundleName string,
|
bundleName string,
|
||||||
bundle document.Bundle,
|
bundle document.Bundle,
|
||||||
dryRun clicommon.DryRunStrategy) ([]*resource.Info, error) {
|
dryRun clicommon.DryRunStrategy) ([]*unstructured.Unstructured, error) {
|
||||||
if bundle == nil {
|
if bundle == nil {
|
||||||
return nil, ErrNilBundle{}
|
return nil, ErrNilBundle{}
|
||||||
}
|
}
|
||||||
@ -130,7 +129,11 @@ func (a *Applier) getInfos(
|
|||||||
if err = a.Driver.Initialize(a.Poller); err != nil {
|
if err = a.Driver.Initialize(a.Poller); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return a.ManifestReaderFactory(false, bundle, a.Factory).Read()
|
restMapper, err := a.Factory.ToRESTMapper()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return a.ManifestReaderFactory(false, bundle, restMapper).Read()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Applier) ensureNamespaceExists(name string, dryRun clicommon.DryRunStrategy) error {
|
func (a *Applier) ensureNamespaceExists(name string, dryRun clicommon.DryRunStrategy) error {
|
||||||
@ -177,7 +180,7 @@ func cliApplyOptions(ao ApplyOptions) cliapply.Options {
|
|||||||
// Driver to cli-utils apply
|
// Driver to cli-utils apply
|
||||||
type Driver interface {
|
type Driver interface {
|
||||||
Initialize(p poller.Poller) error
|
Initialize(p poller.Poller) error
|
||||||
Run(ctx context.Context, infos []*resource.Info, options cliapply.Options) <-chan applyevent.Event
|
Run(ctx context.Context, infos []*unstructured.Unstructured, options cliapply.Options) <-chan applyevent.Event
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adaptor is implementation of driver interface
|
// Adaptor is implementation of driver interface
|
||||||
@ -200,8 +203,9 @@ func (a *Adaptor) Initialize(p poller.Poller) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run perform apply operation
|
// Run perform apply operation
|
||||||
func (a *Adaptor) Run(ctx context.Context, infos []*resource.Info, options cliapply.Options) <-chan applyevent.Event {
|
func (a *Adaptor) Run(ctx context.Context, objects []*unstructured.Unstructured,
|
||||||
return a.CliUtilsApplier.Run(ctx, infos, options)
|
options cliapply.Options) <-chan applyevent.Event {
|
||||||
|
return a.CliUtilsApplier.Run(ctx, objects, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInventoryDocument returns default config map with inventory Id to group up the objects
|
// NewInventoryDocument returns default config map with inventory Id to group up the objects
|
||||||
|
@ -17,8 +17,8 @@ package applier
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/cli-runtime/pkg/resource"
|
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
cliapply "sigs.k8s.io/cli-utils/pkg/apply"
|
cliapply "sigs.k8s.io/cli-utils/pkg/apply"
|
||||||
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
|
applyevent "sigs.k8s.io/cli-utils/pkg/apply/event"
|
||||||
@ -52,7 +52,7 @@ func (fa FakeAdaptor) Initialize(p poller.Poller) error {
|
|||||||
// Run implements driver
|
// Run implements driver
|
||||||
func (fa FakeAdaptor) Run(
|
func (fa FakeAdaptor) Run(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
infos []*resource.Info,
|
objects []*unstructured.Unstructured,
|
||||||
options cliapply.Options) <-chan applyevent.Event {
|
options cliapply.Options) <-chan applyevent.Event {
|
||||||
ch := make(chan applyevent.Event, len(fa.events))
|
ch := make(chan applyevent.Event, len(fa.events))
|
||||||
defer close(ch)
|
defer close(ch)
|
||||||
@ -96,7 +96,7 @@ type FakePoller struct {
|
|||||||
func (fp *FakePoller) Poll(ctx context.Context, ids []object.ObjMetadata, opts polling.Options) <-chan pollevent.Event {
|
func (fp *FakePoller) Poll(ctx context.Context, ids []object.ObjMetadata, opts polling.Options) <-chan pollevent.Event {
|
||||||
events := []pollevent.Event{
|
events := []pollevent.Event{
|
||||||
{
|
{
|
||||||
EventType: pollevent.CompletedEvent,
|
EventType: pollevent.ResourceUpdateEvent,
|
||||||
Resource: &pollevent.ResourceStatus{
|
Resource: &pollevent.ResourceStatus{
|
||||||
Identifier: object.ObjMetadata{
|
Identifier: object.ObjMetadata{
|
||||||
Name: "test-rc",
|
Name: "test-rc",
|
||||||
@ -109,7 +109,7 @@ func (fp *FakePoller) Poll(ctx context.Context, ids []object.ObjMetadata, opts p
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
EventType: pollevent.CompletedEvent,
|
EventType: pollevent.ResourceUpdateEvent,
|
||||||
Resource: &pollevent.ResourceStatus{
|
Resource: &pollevent.ResourceStatus{
|
||||||
Identifier: object.ObjMetadata{
|
Identifier: object.ObjMetadata{
|
||||||
Name: "airshipit-test-bundle-4bf1e4a",
|
Name: "airshipit-test-bundle-4bf1e4a",
|
||||||
|
@ -19,9 +19,10 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||||
"k8s.io/cli-runtime/pkg/resource"
|
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
"sigs.k8s.io/cli-utils/pkg/manifestreader"
|
"sigs.k8s.io/cli-utils/pkg/manifestreader"
|
||||||
|
|
||||||
@ -50,25 +51,25 @@ func Streams() genericclioptions.IOStreams {
|
|||||||
type ManifestReaderFactory func(
|
type ManifestReaderFactory func(
|
||||||
validate bool,
|
validate bool,
|
||||||
bundle document.Bundle,
|
bundle document.Bundle,
|
||||||
factory cmdutil.Factory) manifestreader.ManifestReader
|
mapper meta.RESTMapper) manifestreader.ManifestReader
|
||||||
|
|
||||||
// DefaultManifestReaderFactory default factory function for manifestreader.ManifestReader
|
// DefaultManifestReaderFactory default factory function for manifestreader.ManifestReader
|
||||||
var DefaultManifestReaderFactory ManifestReaderFactory = func(
|
var DefaultManifestReaderFactory ManifestReaderFactory = func(
|
||||||
validate bool,
|
validate bool,
|
||||||
bundle document.Bundle,
|
bundle document.Bundle,
|
||||||
factory cmdutil.Factory) manifestreader.ManifestReader {
|
mapper meta.RESTMapper) manifestreader.ManifestReader {
|
||||||
return NewManifestBundleReader(validate, bundle, factory)
|
return NewManifestBundleReader(validate, bundle, mapper)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewManifestBundleReader returns implementation of manifestreader interface
|
// NewManifestBundleReader returns implementation of manifestreader interface
|
||||||
func NewManifestBundleReader(
|
func NewManifestBundleReader(
|
||||||
validate bool,
|
validate bool,
|
||||||
bundle document.Bundle,
|
bundle document.Bundle,
|
||||||
factory cmdutil.Factory) *ManifestBundleReader {
|
mapper meta.RESTMapper) *ManifestBundleReader {
|
||||||
opts := manifestreader.ReaderOptions{
|
opts := manifestreader.ReaderOptions{
|
||||||
|
Mapper: mapper,
|
||||||
Validate: validate,
|
Validate: validate,
|
||||||
Namespace: metav1.NamespaceDefault,
|
Namespace: metav1.NamespaceDefault,
|
||||||
Factory: factory,
|
|
||||||
}
|
}
|
||||||
buffer := bytes.NewBuffer([]byte{})
|
buffer := bytes.NewBuffer([]byte{})
|
||||||
return &ManifestBundleReader{
|
return &ManifestBundleReader{
|
||||||
@ -90,10 +91,10 @@ type ManifestBundleReader struct {
|
|||||||
writer io.Writer
|
writer io.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mbr *ManifestBundleReader) Read() ([]*resource.Info, error) {
|
func (mbr *ManifestBundleReader) Read() ([]*unstructured.Unstructured, error) {
|
||||||
err := mbr.Bundle.Write(mbr.writer)
|
err := mbr.Bundle.Write(mbr.writer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []*resource.Info{}, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return mbr.StreamReader.Read()
|
return mbr.StreamReader.Read()
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,9 @@ import (
|
|||||||
func TestDefaultManifestFactory(t *testing.T) {
|
func TestDefaultManifestFactory(t *testing.T) {
|
||||||
bundle, err := document.NewBundleByPath("testdata/source_bundle")
|
bundle, err := document.NewBundleByPath("testdata/source_bundle")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
reader := DefaultManifestReaderFactory(false, bundle, FactoryFromKubeConfig("testdata/kubeconfig.yaml", ""))
|
mapper, err := FactoryFromKubeConfig("testdata/kubeconfig.yaml", "").ToRESTMapper()
|
||||||
|
require.NoError(t, err)
|
||||||
|
reader := DefaultManifestReaderFactory(false, bundle, mapper)
|
||||||
require.NotNil(t, reader)
|
require.NotNil(t, reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,22 +66,23 @@ func TestManifestBundleReader(t *testing.T) {
|
|||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
tt := tt
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
reader := NewManifestBundleReader(false, bundle, FactoryFromKubeConfig("testdata/kubeconfig.yaml", ""))
|
mapper, err := FactoryFromKubeConfig("testdata/kubeconfig.yaml", "").ToRESTMapper()
|
||||||
|
require.NoError(t, err)
|
||||||
|
reader := NewManifestBundleReader(false, bundle, mapper)
|
||||||
if tt.reader != nil {
|
if tt.reader != nil {
|
||||||
reader.StreamReader.Reader = tt.reader
|
reader.StreamReader.Reader = tt.reader
|
||||||
}
|
}
|
||||||
if tt.writer != nil {
|
if tt.writer != nil {
|
||||||
reader.writer = tt.writer
|
reader.writer = tt.writer
|
||||||
}
|
}
|
||||||
infos, err := reader.Read()
|
objects, err := reader.Read()
|
||||||
if tt.errString != "" {
|
if tt.errString != "" {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
assert.Contains(t, err.Error(), tt.errString)
|
assert.Contains(t, err.Error(), tt.errString)
|
||||||
} else {
|
} else {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, infos, 1)
|
require.Len(t, objects, 1)
|
||||||
obj := infos[0].Object
|
gvk := objects[0].GetObjectKind().GroupVersionKind()
|
||||||
gvk := obj.GetObjectKind().GroupVersionKind()
|
|
||||||
assert.Equal(t, gvk, schema.GroupVersionKind{
|
assert.Equal(t, gvk, schema.GroupVersionKind{
|
||||||
Kind: "ReplicationController",
|
Kind: "ReplicationController",
|
||||||
Group: "",
|
Group: "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user