-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from ecordell/rmcr
Remove dependency on controller-runtime
- Loading branch information
Showing
21 changed files
with
2,092 additions
and
306 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
--- | ||
name: "Build & Test" | ||
on: # yamllint disable-line rule:truthy | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "*" | ||
env: | ||
GO_VERSION: "~1.20.7" | ||
jobs: | ||
unit: | ||
name: "Unit" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: "actions/setup-go@v3" | ||
- uses: "authzed/actions/setup-go@main" | ||
with: | ||
go-version: "~1.20" | ||
- uses: "authzed/actions/go-test@main" | ||
go-version: "${{ env.GO_VERSION }}" | ||
- uses: "magefile/mage-action@v2" | ||
with: | ||
version: "latest" | ||
args: "test:unit" | ||
integration: | ||
name: "integration" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: "authzed/actions/setup-go@main" | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
- uses: "magefile/mage-action@v2" | ||
with: | ||
version: "latest" | ||
args: "test:integration" |
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 @@ | ||
*.kubeconfig |
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,41 @@ | ||
//go:build e2e | ||
|
||
package bootstrap | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
cmdutil "k8s.io/kubectl/pkg/cmd/util" | ||
"k8s.io/utils/pointer" | ||
) | ||
|
||
func TestCRD(t *testing.T) { | ||
opts := genericclioptions.NewConfigFlags(true) | ||
opts.KubeConfig = pointer.String("../controller-idioms-e2e.kubeconfig") | ||
factory := cmdutil.NewFactory(opts) | ||
restConfig, err := factory.ToRESTConfig() | ||
require.NoError(t, err) | ||
|
||
// ensure CRDs | ||
require.NoError(t, CRDs(context.Background(), restConfig, crdFS, "example")) | ||
|
||
// create an object | ||
client, err := factory.DynamicClient() | ||
require.NoError(t, err) | ||
_, err = client.Resource(schema.GroupVersionResource{ | ||
Group: "example.com", | ||
Version: "v1", | ||
Resource: "mytypes", | ||
}).Namespace("default").Create(context.Background(), &unstructured.Unstructured{Object: map[string]any{ | ||
"kind": "MyType", | ||
"apiVersion": "example.com/v1", | ||
"metadata": map[string]any{"generateName": "test"}, | ||
}}, metav1.CreateOptions{}) | ||
require.NoError(t, err) | ||
} |
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
Oops, something went wrong.