Skip to content

Commit ba20dfa

Browse files
reset changes back to master branch for ci test
1 parent be07438 commit ba20dfa

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

applylib/applyset/applyset.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"encoding/json"
2222
"fmt"
2323
"reflect"
24-
"strings"
2524
"sync"
2625

2726
"k8s.io/apimachinery/pkg/api/meta"
@@ -71,7 +70,7 @@ type ApplySet struct {
7170
// deployment manifests.
7271
parent Parent
7372
// If not given, the tooling value will be the `Parent` Kind.
74-
tooling kubectlapply.ApplySetTooling
73+
tooling string
7574
}
7675

7776
// Options holds the parameters for building an ApplySet.
@@ -94,16 +93,7 @@ type Options struct {
9493
func New(options Options) (*ApplySet, error) {
9594
parent := options.Parent
9695
parentRef := &kubectlapply.ApplySetParentRef{Name: parent.Name(), Namespace: parent.Namespace(), RESTMapping: parent.RESTMapping()}
97-
98-
// The tooling string slash cutting is to support the ApplySetTooling struct that kubectlapply.NewApplySet() expects.
99-
// For instance, 'kpt/v1.0.0' will map to ApplySetTooling{Name: "kpt", Version: "v1.0.0"}.
100-
toolName, toolVersion, _ := strings.Cut(options.Tooling, "/")
101-
if toolName == "" {
102-
toolName = parent.GetSubject().GetObjectKind().GroupVersionKind().Kind
103-
}
104-
tooling := kubectlapply.ApplySetTooling{Name: toolName, Version: toolVersion}
105-
106-
kapplyset := kubectlapply.NewApplySet(parentRef, tooling, options.RESTMapper)
96+
kapplyset := kubectlapply.NewApplySet(parentRef, kubectlapply.ApplySetTooling{Name: options.Tooling}, options.RESTMapper)
10797
if options.PatchOptions.FieldManager == "" {
10898
options.PatchOptions.FieldManager = kapplyset.FieldManager()
10999
}
@@ -115,7 +105,7 @@ func New(options Options) (*ApplySet, error) {
115105
deleteOptions: options.DeleteOptions,
116106
prune: options.Prune,
117107
parent: parent,
118-
tooling: tooling,
108+
tooling: options.Tooling,
119109
}
120110
a.trackers = &objectTrackerList{}
121111
return a, nil
@@ -159,7 +149,7 @@ func (a *ApplySet) ApplyOnce(ctx context.Context) (*ApplyResults, error) {
159149
// single actuation and not for reconciliation.
160150
// Note: The Kubectl ApplySet will share the RESTMapper with k-d-p/ApplySet, which caches all the manifests in the past.
161151
parentRef := &kubectlapply.ApplySetParentRef{Name: a.parent.Name(), Namespace: a.parent.Namespace(), RESTMapping: a.parent.RESTMapping()}
162-
kapplyset := kubectlapply.NewApplySet(parentRef, a.tooling, a.restMapper)
152+
kapplyset := kubectlapply.NewApplySet(parentRef, kubectlapply.ApplySetTooling{Name: a.tooling}, a.restMapper)
163153

164154
// Cache the current RESTMappings to avoid re-fetching the bad ones.
165155
restMappings := make(map[schema.GroupVersionKind]restMappingResult)
@@ -375,7 +365,7 @@ func (a *ApplySet) WithParent(ctx context.Context, kapplyset *kubectlapply.Apply
375365
if annotations == nil {
376366
annotations = make(map[string]string)
377367
}
378-
annotations[kubectlapply.ApplySetToolingAnnotation] = a.tooling.String()
368+
annotations[kubectlapply.ApplySetToolingAnnotation] = a.tooling
379369
if _, ok := annotations[kubectlapply.ApplySetGRsAnnotation]; !ok {
380370
annotations[kubectlapply.ApplySetGRsAnnotation] = ""
381371
}

0 commit comments

Comments
 (0)