From 6e3bb7a9ad3a30a5adbb2f6971b8586229b6fc64 Mon Sep 17 00:00:00 2001 From: Jingfang Liu Date: Wed, 2 Feb 2022 13:03:19 -0800 Subject: [PATCH] Revert "capture the apply/reconcile status in the inventory object" This reverts commit edee25bd859666a544b0b50b0b88bb9b3bcc563c. --- .../event/actiongroupeventtype_string.go | 3 - pkg/apply/event/applyeventoperation_string.go | 3 - .../event/deleteeventoperation_string.go | 3 - pkg/apply/event/pruneeventoperation_string.go | 3 - pkg/apply/event/resourceaction_string.go | 3 - pkg/apply/event/type_string.go | 3 - pkg/apply/event/waiteventoperation_string.go | 3 - pkg/apply/prune/prune_test.go | 2 +- pkg/apply/task/inv_set_task.go | 44 +------ pkg/common/dryrunstrategy_string.go | 3 - pkg/inventory/fake-inventory-client.go | 4 +- pkg/inventory/inventory-client.go | 110 ++++-------------- pkg/inventory/inventory-client_test.go | 8 +- pkg/inventory/inventory.go | 3 +- pkg/inventory/inventory_test.go | 2 +- pkg/inventory/inventorycm.go | 3 +- .../inventoryidmatchstatus_string.go | 3 - pkg/inventory/inventorypolicy_string.go | 3 - pkg/kstatus/polling/event/eventtype_string.go | 3 - pkg/kstatus/status/apply_status.go | 38 ------ pkg/kstatus/status/applystatus_string.go | 33 ------ pkg/kstatus/status/reconcilestatus_string.go | 30 ----- pkg/object/validation/policy_string.go | 3 - test/e2e/customprovider/provider.go | 3 +- 24 files changed, 31 insertions(+), 285 deletions(-) delete mode 100644 pkg/kstatus/status/apply_status.go delete mode 100644 pkg/kstatus/status/applystatus_string.go delete mode 100644 pkg/kstatus/status/reconcilestatus_string.go diff --git a/pkg/apply/event/actiongroupeventtype_string.go b/pkg/apply/event/actiongroupeventtype_string.go index 22835dd..ac610a2 100644 --- a/pkg/apply/event/actiongroupeventtype_string.go +++ b/pkg/apply/event/actiongroupeventtype_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=ActionGroupEventType"; DO NOT EDIT. package event diff --git a/pkg/apply/event/applyeventoperation_string.go b/pkg/apply/event/applyeventoperation_string.go index f0b363c..edfbad0 100644 --- a/pkg/apply/event/applyeventoperation_string.go +++ b/pkg/apply/event/applyeventoperation_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=ApplyEventOperation"; DO NOT EDIT. package event diff --git a/pkg/apply/event/deleteeventoperation_string.go b/pkg/apply/event/deleteeventoperation_string.go index 307f583..90bc851 100644 --- a/pkg/apply/event/deleteeventoperation_string.go +++ b/pkg/apply/event/deleteeventoperation_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=DeleteEventOperation"; DO NOT EDIT. package event diff --git a/pkg/apply/event/pruneeventoperation_string.go b/pkg/apply/event/pruneeventoperation_string.go index ffdcaf4..8fbee71 100644 --- a/pkg/apply/event/pruneeventoperation_string.go +++ b/pkg/apply/event/pruneeventoperation_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=PruneEventOperation"; DO NOT EDIT. package event diff --git a/pkg/apply/event/resourceaction_string.go b/pkg/apply/event/resourceaction_string.go index 18826c4..ff00de4 100644 --- a/pkg/apply/event/resourceaction_string.go +++ b/pkg/apply/event/resourceaction_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=ResourceAction -linecomment"; DO NOT EDIT. package event diff --git a/pkg/apply/event/type_string.go b/pkg/apply/event/type_string.go index 6e5845c..2725324 100644 --- a/pkg/apply/event/type_string.go +++ b/pkg/apply/event/type_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=Type"; DO NOT EDIT. package event diff --git a/pkg/apply/event/waiteventoperation_string.go b/pkg/apply/event/waiteventoperation_string.go index 01c236e..7569de9 100644 --- a/pkg/apply/event/waiteventoperation_string.go +++ b/pkg/apply/event/waiteventoperation_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=WaitEventOperation -linecomment"; DO NOT EDIT. package event diff --git a/pkg/apply/prune/prune_test.go b/pkg/apply/prune/prune_test.go index ee15f3d..45c0d17 100644 --- a/pkg/apply/prune/prune_test.go +++ b/pkg/apply/prune/prune_test.go @@ -126,7 +126,7 @@ func createInventoryInfo(children ...*unstructured.Unstructured) inventory.Inven inventoryObjCopy := inventoryObj.DeepCopy() wrappedInv := inventory.WrapInventoryObj(inventoryObjCopy) objs := object.UnstructuredSetToObjMetadataSet(children) - if err := wrappedInv.Store(objs, nil); err != nil { + if err := wrappedInv.Store(objs); err != nil { return nil } obj, err := wrappedInv.GetObject() diff --git a/pkg/apply/task/inv_set_task.go b/pkg/apply/task/inv_set_task.go index 1a88658..0961ed4 100644 --- a/pkg/apply/task/inv_set_task.go +++ b/pkg/apply/task/inv_set_task.go @@ -9,7 +9,6 @@ import ( "sigs.k8s.io/cli-utils/pkg/apply/taskrunner" "sigs.k8s.io/cli-utils/pkg/common" "sigs.k8s.io/cli-utils/pkg/inventory" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -112,11 +111,8 @@ func (i *InvSetTask) Start(taskContext *taskrunner.TaskContext) { klog.V(4).Infof("keep in inventory %d invalid objects", len(invalidObjects)) invObjs = invObjs.Union(invalidObjects) - klog.V(4).Infof("get the apply status for %d objects", len(invObjs)) - applyStatus := i.getApplyReoncileStatus(taskContext) - klog.V(4).Infof("set inventory %d total objects", len(invObjs)) - err := i.InvClient.Replace(i.InvInfo, invObjs, i.DryRun, applyStatus) + err := i.InvClient.Replace(i.InvInfo, invObjs, i.DryRun) klog.V(2).Infof("inventory set task completing (name: %q)", i.Name()) taskContext.TaskChannel() <- taskrunner.TaskResult{Err: err} @@ -128,41 +124,3 @@ func (i *InvSetTask) Cancel(_ *taskrunner.TaskContext) {} // StatusUpdate is not supported by the InvSetTask. func (i *InvSetTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata) {} - -// getApplyReoncileStatus captures the apply status and reconcile status -// for each individual resource in the inventory list. -// The apply/reconcile status is then passed -// to the inventory client and stored in the inventory object -// through the Inventory interface. -func (i InvSetTask) getApplyReoncileStatus(taskContext *taskrunner.TaskContext) map[object.ObjMetadata]status.ApplyReconcileStatus { - applyStatus := map[object.ObjMetadata]status.ApplyReconcileStatus{} - // capture the apply status - for _, obj := range taskContext.SuccessfulApplies() { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.ApplySucceeded, - } - } - for _, obj := range i.PrevInventory.Intersection(taskContext.FailedApplies()) { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.ApplyFailed, - } - } - for _, obj := range i.PrevInventory.Intersection(taskContext.SkippedApplies()) { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.ApplySkipped, - } - } - for _, obj := range i.PrevInventory.Intersection(taskContext.FailedDeletes()) { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.PruneFailed, - } - } - for _, obj := range i.PrevInventory.Intersection(taskContext.SkippedDeletes()) { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.PruneSkipped, - } - } - - // TODO(Liujingfang1): capture the reconcile status - return applyStatus -} diff --git a/pkg/common/dryrunstrategy_string.go b/pkg/common/dryrunstrategy_string.go index 2cb138c..a6e3823 100644 --- a/pkg/common/dryrunstrategy_string.go +++ b/pkg/common/dryrunstrategy_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=DryRunStrategy"; DO NOT EDIT. package common diff --git a/pkg/inventory/fake-inventory-client.go b/pkg/inventory/fake-inventory-client.go index 1c60246..0a99b3b 100644 --- a/pkg/inventory/fake-inventory-client.go +++ b/pkg/inventory/fake-inventory-client.go @@ -7,7 +7,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" cmdutil "k8s.io/kubectl/pkg/cmd/util" "sigs.k8s.io/cli-utils/pkg/common" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -59,8 +58,7 @@ func (fic *FakeInventoryClient) Merge(_ InventoryInfo, objs object.ObjMetadataSe // Replace the stored cluster inventory objs with the passed obj, or an // error if one is set up. -func (fic *FakeInventoryClient) Replace(_ InventoryInfo, objs object.ObjMetadataSet, _ common.DryRunStrategy, - _ map[object.ObjMetadata]status.ApplyReconcileStatus) error { +func (fic *FakeInventoryClient) Replace(_ InventoryInfo, objs object.ObjMetadataSet, _ common.DryRunStrategy) error { if fic.Err != nil { return fic.Err } diff --git a/pkg/inventory/inventory-client.go b/pkg/inventory/inventory-client.go index 35646f1..e439e43 100644 --- a/pkg/inventory/inventory-client.go +++ b/pkg/inventory/inventory-client.go @@ -16,7 +16,6 @@ import ( cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util" "sigs.k8s.io/cli-utils/pkg/common" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -34,7 +33,7 @@ type InventoryClient interface { Merge(inv InventoryInfo, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) (object.ObjMetadataSet, error) // Replace replaces the set of objects stored in the inventory // object with the passed set of objects, or an error if one occurs. - Replace(inv InventoryInfo, objs object.ObjMetadataSet, dryRun common.DryRunStrategy, applyStatus map[object.ObjMetadata]status.ApplyReconcileStatus) error + Replace(inv InventoryInfo, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) error // DeleteInventoryObj deletes the passed inventory object from the APIServer. DeleteInventoryObj(inv InventoryInfo, dryRun common.DryRunStrategy) error // ApplyInventoryNamespace applies the Namespace that the inventory object should be in. @@ -94,9 +93,8 @@ func (cic *ClusterInventoryClient) Merge(localInv InventoryInfo, objs object.Obj } if clusterInv == nil { // Wrap inventory object and store the inventory in it. - applyStatus := getApplyStatus(nil, objs) inv := cic.InventoryFactoryFunc(invObj) - if err := inv.Store(objs, applyStatus); err != nil { + if err := inv.Store(objs); err != nil { return nil, err } invInfo, err := inv.GetObject() @@ -107,32 +105,25 @@ func (cic *ClusterInventoryClient) Merge(localInv InventoryInfo, objs object.Obj if err := cic.createInventoryObj(invInfo, dryRun); err != nil { return nil, err } - if err := cic.updateStatus(invInfo, dryRun); err != nil { - return nil, err - } } else { // Update existing cluster inventory with merged union of objects clusterObjs, err := cic.GetClusterObjs(localInv) if err != nil { return pruneIds, err } + if objs.Equal(clusterObjs) { + klog.V(4).Infof("applied objects same as cluster inventory: do nothing") + return pruneIds, nil + } pruneIds = clusterObjs.Diff(objs) unionObjs := clusterObjs.Union(objs) - applyStatus := getApplyStatus(pruneIds, unionObjs) klog.V(4).Infof("num objects to prune: %d", len(pruneIds)) klog.V(4).Infof("num merged objects to store in inventory: %d", len(unionObjs)) wrappedInv := cic.InventoryFactoryFunc(clusterInv) - if err = wrappedInv.Store(unionObjs, applyStatus); err != nil { + if err = wrappedInv.Store(unionObjs); err != nil { return pruneIds, err } - clusterInv, err = wrappedInv.GetObject() - if err != nil { - return pruneIds, err - } - if dryRun.ClientOrServerDryRun() { - return pruneIds, nil - } - if !objs.Equal(clusterObjs) { + if !dryRun.ClientOrServerDryRun() { clusterInv, err = wrappedInv.GetObject() if err != nil { return pruneIds, err @@ -142,9 +133,6 @@ func (cic *ClusterInventoryClient) Merge(localInv InventoryInfo, objs object.Obj return pruneIds, err } } - if err := cic.updateStatus(clusterInv, dryRun); err != nil { - return pruneIds, err - } } return pruneIds, nil @@ -152,8 +140,7 @@ func (cic *ClusterInventoryClient) Merge(localInv InventoryInfo, objs object.Obj // Replace stores the passed objects in the cluster inventory object, or // an error if one occurred. -func (cic *ClusterInventoryClient) Replace(localInv InventoryInfo, objs object.ObjMetadataSet, dryRun common.DryRunStrategy, - applyStatus map[object.ObjMetadata]status.ApplyReconcileStatus) error { +func (cic *ClusterInventoryClient) Replace(localInv InventoryInfo, objs object.ObjMetadataSet, dryRun common.DryRunStrategy) error { // Skip entire function for dry-run. if dryRun.ClientOrServerDryRun() { klog.V(4).Infoln("dry-run replace inventory object: not applied") @@ -163,32 +150,30 @@ func (cic *ClusterInventoryClient) Replace(localInv InventoryInfo, objs object.O if err != nil { return fmt.Errorf("failed to read inventory objects from cluster: %w", err) } + if objs.Equal(clusterObjs) { + klog.V(4).Infof("applied objects same as cluster inventory: do nothing") + return nil + } clusterInv, err := cic.GetClusterInventoryInfo(localInv) if err != nil { return fmt.Errorf("failed to read inventory from cluster: %w", err) } - clusterInv, err = cic.replaceInventory(clusterInv, objs, applyStatus) + clusterInv, err = cic.replaceInventory(clusterInv, objs) if err != nil { return err } - if !objs.Equal(clusterObjs) { - klog.V(4).Infof("replace cluster inventory: %s/%s", clusterInv.GetNamespace(), clusterInv.GetName()) - klog.V(4).Infof("replace cluster inventory %d objects", len(objs)) - if err := cic.applyInventoryObj(clusterInv, dryRun); err != nil { - return fmt.Errorf("failed to write updated inventory to cluster: %w", err) - } - } - if err := cic.updateStatus(clusterInv, dryRun); err != nil { - return err + klog.V(4).Infof("replace cluster inventory: %s/%s", clusterInv.GetNamespace(), clusterInv.GetName()) + klog.V(4).Infof("replace cluster inventory %d objects", len(objs)) + if err := cic.applyInventoryObj(clusterInv, dryRun); err != nil { + return fmt.Errorf("failed to write updated inventory to cluster: %w", err) } return nil } // replaceInventory stores the passed objects into the passed inventory object. -func (cic *ClusterInventoryClient) replaceInventory(inv *unstructured.Unstructured, objs object.ObjMetadataSet, - applyStatus map[object.ObjMetadata]status.ApplyReconcileStatus) (*unstructured.Unstructured, error) { +func (cic *ClusterInventoryClient) replaceInventory(inv *unstructured.Unstructured, objs object.ObjMetadataSet) (*unstructured.Unstructured, error) { wrappedInv := cic.InventoryFactoryFunc(inv) - if err := wrappedInv.Store(objs, applyStatus); err != nil { + if err := wrappedInv.Store(objs); err != nil { return nil, err } clusterInv, err := wrappedInv.GetObject() @@ -436,58 +421,3 @@ func (cic *ClusterInventoryClient) ApplyInventoryNamespace(obj *unstructured.Uns func (cic *ClusterInventoryClient) getMapping(obj *unstructured.Unstructured) (*meta.RESTMapping, error) { return cic.mapper.RESTMapping(obj.GroupVersionKind().GroupKind(), obj.GroupVersionKind().Version) } - -func (cic *ClusterInventoryClient) updateStatus(obj *unstructured.Unstructured, dryRun common.DryRunStrategy) error { - if dryRun.ClientOrServerDryRun() { - klog.V(4).Infof("dry-run update inventory status: not updated") - return nil - } - status, found, _ := unstructured.NestedMap(obj.UnstructuredContent(), "status") - if !found { - return nil - } - - klog.V(4).Infof("update inventory status") - mapping, err := cic.mapper.RESTMapping(obj.GroupVersionKind().GroupKind()) - if err != nil { - return err - } - resource := cic.dc.Resource(mapping.Resource).Namespace(obj.GetNamespace()) - - liveObj, err := resource.Get(context.TODO(), obj.GetName(), metav1.GetOptions{TypeMeta: metav1.TypeMeta{ - Kind: obj.GetKind(), - APIVersion: obj.GetAPIVersion(), - }}) - if err != nil { - return err - } - - err = unstructured.SetNestedMap(liveObj.UnstructuredContent(), status, "status") - if err != nil { - return err - } - _, err = resource.UpdateStatus(context.TODO(), liveObj, metav1.UpdateOptions{TypeMeta: metav1.TypeMeta{ - Kind: obj.GetKind(), - APIVersion: obj.GetAPIVersion(), - }}) - if err != nil { - klog.V(4).Infof("failed to update inventory status: %v", err) - } - // Don't exit the apply process if failed to update the inventory object status. - return nil -} - -func getApplyStatus(pruneIds, unionIds []object.ObjMetadata) map[object.ObjMetadata]status.ApplyReconcileStatus { - applyStatus := map[object.ObjMetadata]status.ApplyReconcileStatus{} - for _, obj := range unionIds { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.ApplyPending, - } - } - for _, obj := range pruneIds { - applyStatus[obj] = status.ApplyReconcileStatus{ - ApplyStatus: status.PrunePending, - } - } - return applyStatus -} diff --git a/pkg/inventory/inventory-client_test.go b/pkg/inventory/inventory-client_test.go index ecfc6cf..cd71172 100644 --- a/pkg/inventory/inventory-client_test.go +++ b/pkg/inventory/inventory-client_test.go @@ -291,11 +291,11 @@ func TestReplace(t *testing.T) { // Client and server dry-run do not throw errors. invClient, err := NewInventoryClient(tf, WrapInventoryObj, InvInfoToConfigMap) require.NoError(t, err) - err = invClient.Replace(copyInventory(), object.ObjMetadataSet{}, common.DryRunClient, nil) + err = invClient.Replace(copyInventory(), object.ObjMetadataSet{}, common.DryRunClient) if err != nil { t.Fatalf("unexpected error received: %s", err) } - err = invClient.Replace(copyInventory(), object.ObjMetadataSet{}, common.DryRunServer, nil) + err = invClient.Replace(copyInventory(), object.ObjMetadataSet{}, common.DryRunServer) if err != nil { t.Fatalf("unexpected error received: %s", err) } @@ -307,7 +307,7 @@ func TestReplace(t *testing.T) { WrapInventoryObj, InvInfoToConfigMap) require.NoError(t, err) wrappedInv := invClient.InventoryFactoryFunc(inventoryObj) - if err := wrappedInv.Store(tc.clusterObjs, nil); err != nil { + if err := wrappedInv.Store(tc.clusterObjs); err != nil { t.Fatalf("unexpected error storing inventory objects: %s", err) } inv, err := wrappedInv.GetObject() @@ -315,7 +315,7 @@ func TestReplace(t *testing.T) { t.Fatalf("unexpected error storing inventory objects: %s", err) } // Call replaceInventory with the new set of "localObjs" - inv, err = invClient.replaceInventory(inv, tc.localObjs, nil) + inv, err = invClient.replaceInventory(inv, tc.localObjs) if err != nil { t.Fatalf("unexpected error received: %s", err) } diff --git a/pkg/inventory/inventory.go b/pkg/inventory/inventory.go index 4f14869..b87d285 100644 --- a/pkg/inventory/inventory.go +++ b/pkg/inventory/inventory.go @@ -18,7 +18,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/klog/v2" "sigs.k8s.io/cli-utils/pkg/common" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -32,7 +31,7 @@ type Inventory interface { // Load retrieves the set of object metadata from the inventory object Load() (object.ObjMetadataSet, error) // Store the set of object metadata in the inventory object - Store(objs object.ObjMetadataSet, applyStatus map[object.ObjMetadata]status.ApplyReconcileStatus) error + Store(objs object.ObjMetadataSet) error // GetObject returns the object that stores the inventory GetObject() (*unstructured.Unstructured, error) } diff --git a/pkg/inventory/inventory_test.go b/pkg/inventory/inventory_test.go index 107910c..8910f30 100644 --- a/pkg/inventory/inventory_test.go +++ b/pkg/inventory/inventory_test.go @@ -423,7 +423,7 @@ func copyInventory() InventoryInfo { func storeObjsInInventory(info InventoryInfo, objs object.ObjMetadataSet) *unstructured.Unstructured { wrapped := WrapInventoryObj(InvInfoToConfigMap(info)) - _ = wrapped.Store(objs, nil) + _ = wrapped.Store(objs) inv, _ := wrapped.GetObject() return inv } diff --git a/pkg/inventory/inventorycm.go b/pkg/inventory/inventorycm.go index c89feae..f4602bd 100644 --- a/pkg/inventory/inventorycm.go +++ b/pkg/inventory/inventorycm.go @@ -13,7 +13,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "sigs.k8s.io/cli-utils/pkg/common" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -95,7 +94,7 @@ func (icm *InventoryConfigMap) Load() (object.ObjMetadataSet, error) { // Store is an Inventory interface function implemented to store // the object metadata in the wrapped ConfigMap. Actual storing // happens in "GetObject". -func (icm *InventoryConfigMap) Store(objMetas object.ObjMetadataSet, _ map[object.ObjMetadata]status.ApplyReconcileStatus) error { +func (icm *InventoryConfigMap) Store(objMetas object.ObjMetadataSet) error { icm.objMetas = objMetas return nil } diff --git a/pkg/inventory/inventoryidmatchstatus_string.go b/pkg/inventory/inventoryidmatchstatus_string.go index 31bc037..ef3b0e3 100644 --- a/pkg/inventory/inventoryidmatchstatus_string.go +++ b/pkg/inventory/inventoryidmatchstatus_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=inventoryIDMatchStatus"; DO NOT EDIT. package inventory diff --git a/pkg/inventory/inventorypolicy_string.go b/pkg/inventory/inventorypolicy_string.go index 7e59a4b..6053c41 100644 --- a/pkg/inventory/inventorypolicy_string.go +++ b/pkg/inventory/inventorypolicy_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=InventoryPolicy"; DO NOT EDIT. package inventory diff --git a/pkg/kstatus/polling/event/eventtype_string.go b/pkg/kstatus/polling/event/eventtype_string.go index fc95f3b..ba39dc7 100644 --- a/pkg/kstatus/polling/event/eventtype_string.go +++ b/pkg/kstatus/polling/event/eventtype_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=EventType"; DO NOT EDIT. package event diff --git a/pkg/kstatus/status/apply_status.go b/pkg/kstatus/status/apply_status.go deleted file mode 100644 index 006bbc2..0000000 --- a/pkg/kstatus/status/apply_status.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - -package status - -// ApplyStatus captures the apply status for a resource. -//go:generate stringer -type=ApplyStatus -linecomment -type ApplyStatus int - -const ( - ApplyPending ApplyStatus = iota // ApplyPending - ApplySucceeded // ApplySucceeded - ApplySkipped // ApplySkipped - ApplyFailed // ApplyFailed - PrunePending // PrunePending - PruneSucceeded // PruneSucceeded - PruneSkipped // PruneSkipped - PruneFailed // PruneFailed -) - -// ReconcileStatus captures the reconcile status for a resource. -//go:generate stringer -type=ReconcileStatus -linecomment -type ReconcileStatus int - -const ( - ReconcilePending ReconcileStatus = iota // ReconcilePending - ReconcileSucceeded // ReconcileSucceeded - ReconcileSkipped // ReconcileSkipped - ReconcileTimeout // ReconcileTimeout - ReconcileFailed // ReconcileFailed -) - -// ApplyReconcileStatus captures the apply and reconcile -// status for a resource. -type ApplyReconcileStatus struct { - ApplyStatus - ReconcileStatus -} diff --git a/pkg/kstatus/status/applystatus_string.go b/pkg/kstatus/status/applystatus_string.go deleted file mode 100644 index b5818ce..0000000 --- a/pkg/kstatus/status/applystatus_string.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by "stringer -type=ApplyStatus -linecomment"; DO NOT EDIT. - -package status - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[ApplyPending-0] - _ = x[ApplySucceeded-1] - _ = x[ApplySkipped-2] - _ = x[ApplyFailed-3] - _ = x[PrunePending-4] - _ = x[PruneSucceeded-5] - _ = x[PruneSkipped-6] - _ = x[PruneFailed-7] -} - -const _ApplyStatus_name = "ApplyPendingApplySucceededApplySkippedApplyFailedPrunePendingPruneSucceededPruneSkippedPruneFailed" - -var _ApplyStatus_index = [...]uint8{0, 12, 26, 38, 49, 61, 75, 87, 98} - -func (i ApplyStatus) String() string { - if i < 0 || i >= ApplyStatus(len(_ApplyStatus_index)-1) { - return "ApplyStatus(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _ApplyStatus_name[_ApplyStatus_index[i]:_ApplyStatus_index[i+1]] -} diff --git a/pkg/kstatus/status/reconcilestatus_string.go b/pkg/kstatus/status/reconcilestatus_string.go deleted file mode 100644 index 8924e63..0000000 --- a/pkg/kstatus/status/reconcilestatus_string.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by "stringer -type=ReconcileStatus -linecomment"; DO NOT EDIT. - -package status - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[ReconcilePending-0] - _ = x[ReconcileSucceeded-1] - _ = x[ReconcileSkipped-2] - _ = x[ReconcileTimeout-3] - _ = x[ReconcileFailed-4] -} - -const _ReconcileStatus_name = "ReconcilePendingReconcileSucceededReconcileSkippedReconcileTimeoutReconcileFailed" - -var _ReconcileStatus_index = [...]uint8{0, 16, 34, 50, 66, 81} - -func (i ReconcileStatus) String() string { - if i < 0 || i >= ReconcileStatus(len(_ReconcileStatus_index)-1) { - return "ReconcileStatus(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _ReconcileStatus_name[_ReconcileStatus_index[i]:_ReconcileStatus_index[i+1]] -} diff --git a/pkg/object/validation/policy_string.go b/pkg/object/validation/policy_string.go index 2fbe6da..3ad973a 100644 --- a/pkg/object/validation/policy_string.go +++ b/pkg/object/validation/policy_string.go @@ -1,6 +1,3 @@ -// Copyright 2021 The Kubernetes Authors. -// SPDX-License-Identifier: Apache-2.0 - // Code generated by "stringer -type=Policy"; DO NOT EDIT. package validation diff --git a/test/e2e/customprovider/provider.go b/test/e2e/customprovider/provider.go index 323afe6..eea6dde 100644 --- a/test/e2e/customprovider/provider.go +++ b/test/e2e/customprovider/provider.go @@ -11,7 +11,6 @@ import ( "k8s.io/kubectl/pkg/cmd/util" "sigs.k8s.io/cli-utils/pkg/common" "sigs.k8s.io/cli-utils/pkg/inventory" - "sigs.k8s.io/cli-utils/pkg/kstatus/status" "sigs.k8s.io/cli-utils/pkg/object" ) @@ -157,7 +156,7 @@ func (i InventoryCustomType) Load() (object.ObjMetadataSet, error) { return inv, nil } -func (i InventoryCustomType) Store(objs object.ObjMetadataSet, _ map[object.ObjMetadata]status.ApplyReconcileStatus) error { +func (i InventoryCustomType) Store(objs object.ObjMetadataSet) error { var inv []interface{} for _, obj := range objs { inv = append(inv, map[string]interface{}{