-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: avoid importing kubectl deps when using ApplysetApplier
- Loading branch information
Showing
12 changed files
with
81 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build !without_exec_applier | ||
// +build !without_exec_applier | ||
|
||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
10 changes: 10 additions & 0 deletions
10
pkg/patterns/declarative/pkg/applier/global_without_kubectl.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build without_exec_applier && without_direct_applier | ||
// +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{}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 TestSimpleReconciler(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)) | ||
}) | ||
}) | ||
} |
24 changes: 24 additions & 0 deletions
24
pkg/test/testreconciler/simpletest/without_kubectl_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//go:build without_exec_applier && without_direct_applier | ||
// +build without_exec_applier,without_direct_applier | ||
|
||
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 TestSimpleReconciler(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)) | ||
}) | ||
}) | ||
} |