-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: avoid importing kubectl deps when using ApplysetApplier #331
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !without_exec_applier || !without_direct_applier | ||
// +build !without_exec_applier !without_direct_applier | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file contains kubectl deps. |
||
|
||
package applier | ||
|
||
import ( | ||
|
@@ -6,8 +9,6 @@ import ( | |
"os" | ||
"strings" | ||
|
||
"k8s.io/kubectl/pkg/util/prune" | ||
|
||
"k8s.io/apimachinery/pkg/api/meta" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
utilerrors "k8s.io/apimachinery/pkg/util/errors" | ||
|
@@ -20,6 +21,7 @@ import ( | |
"k8s.io/kubectl/pkg/cmd/apply" | ||
cmdDelete "k8s.io/kubectl/pkg/cmd/delete" | ||
cmdutil "k8s.io/kubectl/pkg/cmd/util" | ||
"k8s.io/kubectl/pkg/util/prune" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/declarative/pkg/manifest" | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !without_exec_applier || !without_direct_applier | ||
// +build !without_exec_applier !without_direct_applier | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains kubectl deps. Tag to allow skipping importing. |
||
|
||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !without_exec_applier | ||
// +build !without_exec_applier | ||
|
||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !without_exec_applier | ||
// +build !without_exec_applier | ||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file contains exec.go methods |
||
|
||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//go:build !without_exec_applier || !without_direct_applier | ||
// +build !without_exec_applier !without_direct_applier | ||
|
||
package applier | ||
|
||
var DefaultApplier = NewDirectApplier() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build without_exec_applier && without_direct_applier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense, this is the one file where I would expect to see these not negated, because we want complete coverage of all the build tags in the various |
||
// +build without_exec_applier,without_direct_applier | ||
|
||
package applier | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var DefaultApplier = NewApplySetApplier(metav1.PatchOptions{}, metav1.DeleteOptions{}, ApplysetOptions{}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//go:build !without_exec_applier || !without_direct_applier | ||
// +build !without_exec_applier !without_direct_applier | ||
|
||
package simpletest | ||
|
||
import ( | ||
"testing" | ||
|
||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/status" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/declarative/pkg/applier" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/test/testharness" | ||
) | ||
|
||
func TestDirectSimpleReconciler(t *testing.T) { | ||
Key := "direct" | ||
t.Run(Key, func(t *testing.T) { | ||
testharness.RunGoldenTests(t, "testdata/reconcile/"+Key+"/", func(h *testharness.Harness, testdir string) { | ||
testSimpleReconciler(h, testdir, applier.NewDirectApplier(), status.NewBasic(nil)) | ||
}) | ||
}) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package simpletest | ||
|
||
import ( | ||
"testing" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/status" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/declarative/pkg/applier" | ||
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/test/testharness" | ||
) | ||
|
||
func TestSSASimpleReconciler(t *testing.T) { | ||
Key := "ssa" | ||
a := applier.NewApplySetApplier( | ||
metav1.PatchOptions{FieldManager: "kdp-test"}, metav1.DeleteOptions{}, applier.ApplysetOptions{}) | ||
t.Run(Key, func(t *testing.T) { | ||
testharness.RunGoldenTests(t, "testdata/reconcile/"+Key+"/", func(h *testharness.Harness, testdir string) { | ||
testSimpleReconciler(h, testdir, a, status.NewKstatusCheck(nil, nil)) | ||
}) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tolerant build tag. Any applier should pass this test.