From bf550ac15212e91f93f5b9b7dc180eb6147b1654 Mon Sep 17 00:00:00 2001 From: Joe Lanford Date: Mon, 27 Jul 2020 09:22:59 -0400 Subject: [PATCH] *: move pkg/ansible to internal/ansible --- .gitignore | 2 +- changelog/fragments/mv-ansible-internal.yaml | 11 +++++++++++ cmd/ansible-operator/main.go | 12 ++++++------ hack/tests/e2e-ansible.sh | 2 +- {pkg => internal}/ansible/OWNERS | 0 {pkg => internal}/ansible/controller/controller.go | 6 +++--- {pkg => internal}/ansible/controller/reconcile.go | 14 +++++++------- .../ansible/controller/reconcile_test.go | 14 +++++++------- .../ansible/controller/status/types.go | 4 ++-- .../ansible/controller/status/utils.go | 0 .../ansible/controller/status/utils_test.go | 0 {pkg => internal}/ansible/events/log_events.go | 4 ++-- {pkg => internal}/ansible/flags/flag.go | 0 {pkg => internal}/ansible/metrics/metrics.go | 0 {pkg => internal}/ansible/paramconv/paramconv.go | 0 .../ansible/paramconv/paramconv_test.go | 0 {pkg => internal}/ansible/predicate/predicate.go | 0 {pkg => internal}/ansible/proxy/cache_response.go | 13 ++++++------- .../ansible/proxy/controllermap/controllermap.go | 0 {pkg => internal}/ansible/proxy/inject_owner.go | 8 ++++---- .../ansible/proxy/kubeconfig/kubeconfig.go | 0 {pkg => internal}/ansible/proxy/kubectl.go | 0 {pkg => internal}/ansible/proxy/proxy.go | 10 ++++------ {pkg => internal}/ansible/proxy/proxy_test.go | 4 ++-- .../ansible/proxy/requestfactory/requestinfo.go | 0 .../ansible/runner/eventapi/eventapi.go | 0 {pkg => internal}/ansible/runner/eventapi/types.go | 0 {pkg => internal}/ansible/runner/fake/runner.go | 5 +++-- .../ansible/runner/internal/inputdir/inputdir.go | 0 {pkg => internal}/ansible/runner/runner.go | 12 ++++++------ {pkg => internal}/ansible/runner/runner_test.go | 2 +- .../ansible/runner/testdata/playbook.yml | 0 .../ansible/runner/testdata/roles/role/tasks.yaml | 0 .../nameSpace/collection/roles/someRole/empty_file | 0 .../ansible/watches/testdata/duplicate_gvk.yaml | 0 .../ansible/watches/testdata/invalid.yaml | 0 .../watches/testdata/invalid_collection.yaml | 0 .../ansible/watches/testdata/invalid_duration.yaml | 0 .../testdata/invalid_finalizer_no_vars.yaml | 0 .../testdata/invalid_finalizer_playbook_path.yaml | 0 .../testdata/invalid_finalizer_role_path.yaml | 0 .../testdata/invalid_finalizer_whithout_name.yaml | 0 .../watches/testdata/invalid_playbook_path.yaml | 0 .../watches/testdata/invalid_role_path.yaml | 0 .../ansible/watches/testdata/invalid_status.yaml | 0 .../watches/testdata/invalid_yaml_file.yaml | 0 .../ansible/watches/testdata/playbook.yml | 0 .../ansible/watches/testdata/roles/role/tasks.yaml | 0 .../ansible/watches/testdata/valid.yaml.tmpl | 0 {pkg => internal}/ansible/watches/watches.go | 2 +- {pkg => internal}/ansible/watches/watches_test.go | 0 51 files changed, 67 insertions(+), 58 deletions(-) create mode 100644 changelog/fragments/mv-ansible-internal.yaml rename {pkg => internal}/ansible/OWNERS (100%) rename {pkg => internal}/ansible/controller/controller.go (94%) rename {pkg => internal}/ansible/controller/reconcile.go (96%) rename {pkg => internal}/ansible/controller/reconcile_test.go (97%) rename {pkg => internal}/ansible/controller/status/types.go (98%) rename {pkg => internal}/ansible/controller/status/utils.go (100%) rename {pkg => internal}/ansible/controller/status/utils_test.go (100%) rename {pkg => internal}/ansible/events/log_events.go (97%) rename {pkg => internal}/ansible/flags/flag.go (100%) rename {pkg => internal}/ansible/metrics/metrics.go (100%) rename {pkg => internal}/ansible/paramconv/paramconv.go (100%) rename {pkg => internal}/ansible/paramconv/paramconv_test.go (100%) rename {pkg => internal}/ansible/predicate/predicate.go (100%) rename {pkg => internal}/ansible/proxy/cache_response.go (94%) rename {pkg => internal}/ansible/proxy/controllermap/controllermap.go (100%) rename {pkg => internal}/ansible/proxy/inject_owner.go (97%) rename {pkg => internal}/ansible/proxy/kubeconfig/kubeconfig.go (100%) rename {pkg => internal}/ansible/proxy/kubectl.go (100%) rename {pkg => internal}/ansible/proxy/proxy.go (96%) rename {pkg => internal}/ansible/proxy/proxy_test.go (97%) rename {pkg => internal}/ansible/proxy/requestfactory/requestinfo.go (100%) rename {pkg => internal}/ansible/runner/eventapi/eventapi.go (100%) rename {pkg => internal}/ansible/runner/eventapi/types.go (100%) rename {pkg => internal}/ansible/runner/fake/runner.go (94%) rename {pkg => internal}/ansible/runner/internal/inputdir/inputdir.go (100%) rename {pkg => internal}/ansible/runner/runner.go (96%) rename {pkg => internal}/ansible/runner/runner_test.go (99%) rename {pkg => internal}/ansible/runner/testdata/playbook.yml (100%) rename {pkg => internal}/ansible/runner/testdata/roles/role/tasks.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/ansible_collections/nameSpace/collection/roles/someRole/empty_file (100%) rename {pkg => internal}/ansible/watches/testdata/duplicate_gvk.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_collection.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_duration.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_finalizer_no_vars.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_finalizer_playbook_path.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_finalizer_role_path.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_finalizer_whithout_name.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_playbook_path.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_role_path.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_status.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/invalid_yaml_file.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/playbook.yml (100%) rename {pkg => internal}/ansible/watches/testdata/roles/role/tasks.yaml (100%) rename {pkg => internal}/ansible/watches/testdata/valid.yaml.tmpl (100%) rename {pkg => internal}/ansible/watches/watches.go (99%) rename {pkg => internal}/ansible/watches/watches_test.go (100%) diff --git a/.gitignore b/.gitignore index e7bfc23af0..34d2428200 100644 --- a/.gitignore +++ b/.gitignore @@ -101,7 +101,7 @@ images/scorecard-test/scorecard-test images/scorecard-test-kuttl/scorecard-test-kuttl # Test artifacts -pkg/ansible/runner/testdata/valid.yaml +internal/ansible/runner/testdata/valid.yaml /bin internal/scorecard/examples/custom-scorecard-tests/go.sum diff --git a/changelog/fragments/mv-ansible-internal.yaml b/changelog/fragments/mv-ansible-internal.yaml new file mode 100644 index 0000000000..5dddb705c1 --- /dev/null +++ b/changelog/fragments/mv-ansible-internal.yaml @@ -0,0 +1,11 @@ +entries: + - description: > + The ansible operator implementation in `pkg/ansible` was moved to + `internal/ansible`. + + kind: change + breaking: true + migration: + header: Hybrid Go/Ansible operator use cases are not supported in 1.0.0 + body: > + There is no migration path that enables continued use of the Ansible-based operator Go libraries diff --git a/cmd/ansible-operator/main.go b/cmd/ansible-operator/main.go index e1c656e459..1c462194d9 100644 --- a/cmd/ansible-operator/main.go +++ b/cmd/ansible-operator/main.go @@ -32,14 +32,14 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/manager/signals" + "github.com/operator-framework/operator-sdk/internal/ansible/controller" + "github.com/operator-framework/operator-sdk/internal/ansible/flags" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" + "github.com/operator-framework/operator-sdk/internal/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/watches" "github.com/operator-framework/operator-sdk/internal/log/zap" "github.com/operator-framework/operator-sdk/internal/util/k8sutil" - "github.com/operator-framework/operator-sdk/pkg/ansible/controller" - "github.com/operator-framework/operator-sdk/pkg/ansible/flags" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" - "github.com/operator-framework/operator-sdk/pkg/ansible/watches" sdkVersion "github.com/operator-framework/operator-sdk/version" ) diff --git a/hack/tests/e2e-ansible.sh b/hack/tests/e2e-ansible.sh index e8bb70e3b6..05e5d95775 100755 --- a/hack/tests/e2e-ansible.sh +++ b/hack/tests/e2e-ansible.sh @@ -7,7 +7,7 @@ source hack/lib/image_lib.sh source ./hack/lib/common.sh # ansible proxy test require a running cluster; run during e2e instead -go test -count=1 ./pkg/ansible/proxy/... +go test -count=1 ./internal/ansible/proxy/... DEST_IMAGE="quay.io/example/memcached-operator:v0.0.2" ROOTDIR="$(pwd)" diff --git a/pkg/ansible/OWNERS b/internal/ansible/OWNERS similarity index 100% rename from pkg/ansible/OWNERS rename to internal/ansible/OWNERS diff --git a/pkg/ansible/controller/controller.go b/internal/ansible/controller/controller.go similarity index 94% rename from pkg/ansible/controller/controller.go rename to internal/ansible/controller/controller.go index bee5e1e636..222a61d5b8 100644 --- a/pkg/ansible/controller/controller.go +++ b/internal/ansible/controller/controller.go @@ -32,9 +32,9 @@ import ( ctrlpredicate "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/source" - "github.com/operator-framework/operator-sdk/pkg/ansible/events" - "github.com/operator-framework/operator-sdk/pkg/ansible/predicate" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/events" + "github.com/operator-framework/operator-sdk/internal/ansible/predicate" + "github.com/operator-framework/operator-sdk/internal/ansible/runner" ) var log = logf.Log.WithName("ansible-controller") diff --git a/pkg/ansible/controller/reconcile.go b/internal/ansible/controller/reconcile.go similarity index 96% rename from pkg/ansible/controller/reconcile.go rename to internal/ansible/controller/reconcile.go index 4fee7625e7..ee2d7fdff4 100644 --- a/pkg/ansible/controller/reconcile.go +++ b/internal/ansible/controller/reconcile.go @@ -25,13 +25,6 @@ import ( "strings" "time" - ansiblestatus "github.com/operator-framework/operator-sdk/pkg/ansible/controller/status" - "github.com/operator-framework/operator-sdk/pkg/ansible/events" - "github.com/operator-framework/operator-sdk/pkg/ansible/metrics" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/kubeconfig" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" - v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -41,6 +34,13 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/reconcile" + + ansiblestatus "github.com/operator-framework/operator-sdk/internal/ansible/controller/status" + "github.com/operator-framework/operator-sdk/internal/ansible/events" + "github.com/operator-framework/operator-sdk/internal/ansible/metrics" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/kubeconfig" + "github.com/operator-framework/operator-sdk/internal/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" ) const ( diff --git a/pkg/ansible/controller/reconcile_test.go b/internal/ansible/controller/reconcile_test.go similarity index 97% rename from pkg/ansible/controller/reconcile_test.go rename to internal/ansible/controller/reconcile_test.go index 85a28107b1..8a3ae9996c 100644 --- a/pkg/ansible/controller/reconcile_test.go +++ b/internal/ansible/controller/reconcile_test.go @@ -20,19 +20,19 @@ import ( "testing" "time" - "github.com/operator-framework/operator-sdk/pkg/ansible/controller" - ansiblestatus "github.com/operator-framework/operator-sdk/pkg/ansible/controller/status" - "github.com/operator-framework/operator-sdk/pkg/ansible/events" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/fake" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" "sigs.k8s.io/controller-runtime/pkg/reconcile" + + "github.com/operator-framework/operator-sdk/internal/ansible/controller" + ansiblestatus "github.com/operator-framework/operator-sdk/internal/ansible/controller/status" + "github.com/operator-framework/operator-sdk/internal/ansible/events" + "github.com/operator-framework/operator-sdk/internal/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/fake" ) func TestReconcile(t *testing.T) { diff --git a/pkg/ansible/controller/status/types.go b/internal/ansible/controller/status/types.go similarity index 98% rename from pkg/ansible/controller/status/types.go rename to internal/ansible/controller/status/types.go index f4d88798d5..54f5dd4959 100644 --- a/pkg/ansible/controller/status/types.go +++ b/internal/ansible/controller/status/types.go @@ -18,11 +18,11 @@ import ( "encoding/json" "time" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" - v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" ) var log = logf.Log.WithName("controller.status") diff --git a/pkg/ansible/controller/status/utils.go b/internal/ansible/controller/status/utils.go similarity index 100% rename from pkg/ansible/controller/status/utils.go rename to internal/ansible/controller/status/utils.go diff --git a/pkg/ansible/controller/status/utils_test.go b/internal/ansible/controller/status/utils_test.go similarity index 100% rename from pkg/ansible/controller/status/utils_test.go rename to internal/ansible/controller/status/utils_test.go diff --git a/pkg/ansible/events/log_events.go b/internal/ansible/events/log_events.go similarity index 97% rename from pkg/ansible/events/log_events.go rename to internal/ansible/events/log_events.go index 7790904ef8..acdfe35de3 100644 --- a/pkg/ansible/events/log_events.go +++ b/internal/ansible/events/log_events.go @@ -18,10 +18,10 @@ import ( "errors" "fmt" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" ) // LogLevel - Levelt for the logging to take place. diff --git a/pkg/ansible/flags/flag.go b/internal/ansible/flags/flag.go similarity index 100% rename from pkg/ansible/flags/flag.go rename to internal/ansible/flags/flag.go diff --git a/pkg/ansible/metrics/metrics.go b/internal/ansible/metrics/metrics.go similarity index 100% rename from pkg/ansible/metrics/metrics.go rename to internal/ansible/metrics/metrics.go diff --git a/pkg/ansible/paramconv/paramconv.go b/internal/ansible/paramconv/paramconv.go similarity index 100% rename from pkg/ansible/paramconv/paramconv.go rename to internal/ansible/paramconv/paramconv.go diff --git a/pkg/ansible/paramconv/paramconv_test.go b/internal/ansible/paramconv/paramconv_test.go similarity index 100% rename from pkg/ansible/paramconv/paramconv_test.go rename to internal/ansible/paramconv/paramconv_test.go diff --git a/pkg/ansible/predicate/predicate.go b/internal/ansible/predicate/predicate.go similarity index 100% rename from pkg/ansible/predicate/predicate.go rename to internal/ansible/predicate/predicate.go diff --git a/pkg/ansible/proxy/cache_response.go b/internal/ansible/proxy/cache_response.go similarity index 94% rename from pkg/ansible/proxy/cache_response.go rename to internal/ansible/proxy/cache_response.go index 5c5b4284a9..ff0149bece 100644 --- a/pkg/ansible/proxy/cache_response.go +++ b/internal/ansible/proxy/cache_response.go @@ -24,10 +24,6 @@ import ( "strings" libhandler "github.com/operator-framework/operator-lib/handler" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" - k8sRequest "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" - "k8s.io/apimachinery/pkg/api/meta" metainternalscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -38,6 +34,9 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" + k8sRequest "github.com/operator-framework/operator-sdk/internal/ansible/proxy/requestfactory" ) type marshaler interface { @@ -150,7 +149,7 @@ func (c *cacheResponseHandler) ServeHTTP(w http.ResponseWriter, req *http.Reques } // skipCacheLookup - determine if we should skip the cache lookup -func (c *cacheResponseHandler) skipCacheLookup(r *requestfactory.RequestInfo, gvk schema.GroupVersionKind, +func (c *cacheResponseHandler) skipCacheLookup(r *k8sRequest.RequestInfo, gvk schema.GroupVersionKind, req *http.Request) bool { skip := matchesRegexp(req.URL.String(), c.skipPathRegexp) @@ -241,7 +240,7 @@ func (c *cacheResponseHandler) recoverDependentWatches(req *http.Request, un *un } } -func (c *cacheResponseHandler) getListFromCache(r *requestfactory.RequestInfo, req *http.Request, +func (c *cacheResponseHandler) getListFromCache(r *k8sRequest.RequestInfo, req *http.Request, k schema.GroupVersionKind) (marshaler, error) { k8sListOpts := &metav1.ListOptions{} if err := metainternalscheme.ParameterCodec.DecodeParameters(req.URL.Query(), metav1.SchemeGroupVersion, @@ -283,7 +282,7 @@ func (c *cacheResponseHandler) getListFromCache(r *requestfactory.RequestInfo, r return &un, nil } -func (c *cacheResponseHandler) getObjectFromCache(r *requestfactory.RequestInfo, req *http.Request, +func (c *cacheResponseHandler) getObjectFromCache(r *k8sRequest.RequestInfo, req *http.Request, k schema.GroupVersionKind) (marshaler, error) { un := &unstructured.Unstructured{} un.SetGroupVersionKind(k) diff --git a/pkg/ansible/proxy/controllermap/controllermap.go b/internal/ansible/proxy/controllermap/controllermap.go similarity index 100% rename from pkg/ansible/proxy/controllermap/controllermap.go rename to internal/ansible/proxy/controllermap/controllermap.go diff --git a/pkg/ansible/proxy/inject_owner.go b/internal/ansible/proxy/inject_owner.go similarity index 97% rename from pkg/ansible/proxy/inject_owner.go rename to internal/ansible/proxy/inject_owner.go index dadf4b9df8..867f9682e0 100644 --- a/pkg/ansible/proxy/inject_owner.go +++ b/internal/ansible/proxy/inject_owner.go @@ -23,15 +23,15 @@ import ( "net/http/httputil" "github.com/operator-framework/operator-lib/handler" - "github.com/operator-framework/operator-sdk/internal/util/k8sutil" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" - k8sRequest "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" - "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" + + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" + k8sRequest "github.com/operator-framework/operator-sdk/internal/ansible/proxy/requestfactory" + "github.com/operator-framework/operator-sdk/internal/util/k8sutil" ) // injectOwnerReferenceHandler will handle proxied requests and inject the diff --git a/pkg/ansible/proxy/kubeconfig/kubeconfig.go b/internal/ansible/proxy/kubeconfig/kubeconfig.go similarity index 100% rename from pkg/ansible/proxy/kubeconfig/kubeconfig.go rename to internal/ansible/proxy/kubeconfig/kubeconfig.go diff --git a/pkg/ansible/proxy/kubectl.go b/internal/ansible/proxy/kubectl.go similarity index 100% rename from pkg/ansible/proxy/kubectl.go rename to internal/ansible/proxy/kubectl.go diff --git a/pkg/ansible/proxy/proxy.go b/internal/ansible/proxy/proxy.go similarity index 96% rename from pkg/ansible/proxy/proxy.go rename to internal/ansible/proxy/proxy.go index a249369536..b04ba8e891 100644 --- a/pkg/ansible/proxy/proxy.go +++ b/internal/ansible/proxy/proxy.go @@ -14,9 +14,6 @@ package proxy -// This file contains this project's custom code, as opposed to kubectl.go -// which contains code retrieved from the kubernetes project. - import ( "bytes" "encoding/base64" @@ -31,9 +28,6 @@ import ( libhandler "github.com/operator-framework/operator-lib/handler" "github.com/operator-framework/operator-lib/predicate" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/kubeconfig" - k8sRequest "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/requestfactory" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -43,6 +37,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/source" + + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/kubeconfig" + k8sRequest "github.com/operator-framework/operator-sdk/internal/ansible/proxy/requestfactory" ) // This is the default timeout to wait for the cache to respond diff --git a/pkg/ansible/proxy/proxy_test.go b/internal/ansible/proxy/proxy_test.go similarity index 97% rename from pkg/ansible/proxy/proxy_test.go rename to internal/ansible/proxy/proxy_test.go index 85398d3b15..0a677b94ff 100644 --- a/pkg/ansible/proxy/proxy_test.go +++ b/internal/ansible/proxy/proxy_test.go @@ -23,14 +23,14 @@ import ( "os" "testing" - "github.com/operator-framework/operator-sdk/pkg/ansible/proxy/controllermap" - kcorev1 "k8s.io/api/core/v1" kmetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/config" "sigs.k8s.io/controller-runtime/pkg/manager" + + "github.com/operator-framework/operator-sdk/internal/ansible/proxy/controllermap" ) func TestHandler(t *testing.T) { diff --git a/pkg/ansible/proxy/requestfactory/requestinfo.go b/internal/ansible/proxy/requestfactory/requestinfo.go similarity index 100% rename from pkg/ansible/proxy/requestfactory/requestinfo.go rename to internal/ansible/proxy/requestfactory/requestinfo.go diff --git a/pkg/ansible/runner/eventapi/eventapi.go b/internal/ansible/runner/eventapi/eventapi.go similarity index 100% rename from pkg/ansible/runner/eventapi/eventapi.go rename to internal/ansible/runner/eventapi/eventapi.go diff --git a/pkg/ansible/runner/eventapi/types.go b/internal/ansible/runner/eventapi/types.go similarity index 100% rename from pkg/ansible/runner/eventapi/types.go rename to internal/ansible/runner/eventapi/types.go diff --git a/pkg/ansible/runner/fake/runner.go b/internal/ansible/runner/fake/runner.go similarity index 94% rename from pkg/ansible/runner/fake/runner.go rename to internal/ansible/runner/fake/runner.go index ad0260eca5..d105076e94 100644 --- a/pkg/ansible/runner/fake/runner.go +++ b/internal/ansible/runner/fake/runner.go @@ -18,9 +18,10 @@ import ( "fmt" "time" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + + "github.com/operator-framework/operator-sdk/internal/ansible/runner" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" ) // Runner - implements the Runner interface for a GVK that's being watched. diff --git a/pkg/ansible/runner/internal/inputdir/inputdir.go b/internal/ansible/runner/internal/inputdir/inputdir.go similarity index 100% rename from pkg/ansible/runner/internal/inputdir/inputdir.go rename to internal/ansible/runner/internal/inputdir/inputdir.go diff --git a/pkg/ansible/runner/runner.go b/internal/ansible/runner/runner.go similarity index 96% rename from pkg/ansible/runner/runner.go rename to internal/ansible/runner/runner.go index 31fcaf1236..450b07fa3d 100644 --- a/pkg/ansible/runner/runner.go +++ b/internal/ansible/runner/runner.go @@ -24,15 +24,15 @@ import ( "strconv" "strings" - "github.com/operator-framework/operator-sdk/pkg/ansible/metrics" - "github.com/operator-framework/operator-sdk/pkg/ansible/paramconv" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/eventapi" - "github.com/operator-framework/operator-sdk/pkg/ansible/runner/internal/inputdir" - "github.com/operator-framework/operator-sdk/pkg/ansible/watches" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/operator-framework/operator-sdk/internal/ansible/metrics" + "github.com/operator-framework/operator-sdk/internal/ansible/paramconv" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/eventapi" + "github.com/operator-framework/operator-sdk/internal/ansible/runner/internal/inputdir" + "github.com/operator-framework/operator-sdk/internal/ansible/watches" ) var log = logf.Log.WithName("runner") diff --git a/pkg/ansible/runner/runner_test.go b/internal/ansible/runner/runner_test.go similarity index 99% rename from pkg/ansible/runner/runner_test.go rename to internal/ansible/runner/runner_test.go index 9be862315c..0c369438ba 100644 --- a/pkg/ansible/runner/runner_test.go +++ b/internal/ansible/runner/runner_test.go @@ -24,7 +24,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/operator-framework/operator-sdk/pkg/ansible/watches" + "github.com/operator-framework/operator-sdk/internal/ansible/watches" ) func checkCmdFunc(t *testing.T, cmdFunc cmdFuncType, playbook, role string, verbosity int) { diff --git a/pkg/ansible/runner/testdata/playbook.yml b/internal/ansible/runner/testdata/playbook.yml similarity index 100% rename from pkg/ansible/runner/testdata/playbook.yml rename to internal/ansible/runner/testdata/playbook.yml diff --git a/pkg/ansible/runner/testdata/roles/role/tasks.yaml b/internal/ansible/runner/testdata/roles/role/tasks.yaml similarity index 100% rename from pkg/ansible/runner/testdata/roles/role/tasks.yaml rename to internal/ansible/runner/testdata/roles/role/tasks.yaml diff --git a/pkg/ansible/watches/testdata/ansible_collections/nameSpace/collection/roles/someRole/empty_file b/internal/ansible/watches/testdata/ansible_collections/nameSpace/collection/roles/someRole/empty_file similarity index 100% rename from pkg/ansible/watches/testdata/ansible_collections/nameSpace/collection/roles/someRole/empty_file rename to internal/ansible/watches/testdata/ansible_collections/nameSpace/collection/roles/someRole/empty_file diff --git a/pkg/ansible/watches/testdata/duplicate_gvk.yaml b/internal/ansible/watches/testdata/duplicate_gvk.yaml similarity index 100% rename from pkg/ansible/watches/testdata/duplicate_gvk.yaml rename to internal/ansible/watches/testdata/duplicate_gvk.yaml diff --git a/pkg/ansible/watches/testdata/invalid.yaml b/internal/ansible/watches/testdata/invalid.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid.yaml rename to internal/ansible/watches/testdata/invalid.yaml diff --git a/pkg/ansible/watches/testdata/invalid_collection.yaml b/internal/ansible/watches/testdata/invalid_collection.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_collection.yaml rename to internal/ansible/watches/testdata/invalid_collection.yaml diff --git a/pkg/ansible/watches/testdata/invalid_duration.yaml b/internal/ansible/watches/testdata/invalid_duration.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_duration.yaml rename to internal/ansible/watches/testdata/invalid_duration.yaml diff --git a/pkg/ansible/watches/testdata/invalid_finalizer_no_vars.yaml b/internal/ansible/watches/testdata/invalid_finalizer_no_vars.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_finalizer_no_vars.yaml rename to internal/ansible/watches/testdata/invalid_finalizer_no_vars.yaml diff --git a/pkg/ansible/watches/testdata/invalid_finalizer_playbook_path.yaml b/internal/ansible/watches/testdata/invalid_finalizer_playbook_path.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_finalizer_playbook_path.yaml rename to internal/ansible/watches/testdata/invalid_finalizer_playbook_path.yaml diff --git a/pkg/ansible/watches/testdata/invalid_finalizer_role_path.yaml b/internal/ansible/watches/testdata/invalid_finalizer_role_path.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_finalizer_role_path.yaml rename to internal/ansible/watches/testdata/invalid_finalizer_role_path.yaml diff --git a/pkg/ansible/watches/testdata/invalid_finalizer_whithout_name.yaml b/internal/ansible/watches/testdata/invalid_finalizer_whithout_name.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_finalizer_whithout_name.yaml rename to internal/ansible/watches/testdata/invalid_finalizer_whithout_name.yaml diff --git a/pkg/ansible/watches/testdata/invalid_playbook_path.yaml b/internal/ansible/watches/testdata/invalid_playbook_path.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_playbook_path.yaml rename to internal/ansible/watches/testdata/invalid_playbook_path.yaml diff --git a/pkg/ansible/watches/testdata/invalid_role_path.yaml b/internal/ansible/watches/testdata/invalid_role_path.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_role_path.yaml rename to internal/ansible/watches/testdata/invalid_role_path.yaml diff --git a/pkg/ansible/watches/testdata/invalid_status.yaml b/internal/ansible/watches/testdata/invalid_status.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_status.yaml rename to internal/ansible/watches/testdata/invalid_status.yaml diff --git a/pkg/ansible/watches/testdata/invalid_yaml_file.yaml b/internal/ansible/watches/testdata/invalid_yaml_file.yaml similarity index 100% rename from pkg/ansible/watches/testdata/invalid_yaml_file.yaml rename to internal/ansible/watches/testdata/invalid_yaml_file.yaml diff --git a/pkg/ansible/watches/testdata/playbook.yml b/internal/ansible/watches/testdata/playbook.yml similarity index 100% rename from pkg/ansible/watches/testdata/playbook.yml rename to internal/ansible/watches/testdata/playbook.yml diff --git a/pkg/ansible/watches/testdata/roles/role/tasks.yaml b/internal/ansible/watches/testdata/roles/role/tasks.yaml similarity index 100% rename from pkg/ansible/watches/testdata/roles/role/tasks.yaml rename to internal/ansible/watches/testdata/roles/role/tasks.yaml diff --git a/pkg/ansible/watches/testdata/valid.yaml.tmpl b/internal/ansible/watches/testdata/valid.yaml.tmpl similarity index 100% rename from pkg/ansible/watches/testdata/valid.yaml.tmpl rename to internal/ansible/watches/testdata/valid.yaml.tmpl diff --git a/pkg/ansible/watches/watches.go b/internal/ansible/watches/watches.go similarity index 99% rename from pkg/ansible/watches/watches.go rename to internal/ansible/watches/watches.go index f8db70f287..645a9033ad 100644 --- a/pkg/ansible/watches/watches.go +++ b/internal/ansible/watches/watches.go @@ -32,7 +32,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" yaml "sigs.k8s.io/yaml" - "github.com/operator-framework/operator-sdk/pkg/ansible/flags" + "github.com/operator-framework/operator-sdk/internal/ansible/flags" ) var log = logf.Log.WithName("watches") diff --git a/pkg/ansible/watches/watches_test.go b/internal/ansible/watches/watches_test.go similarity index 100% rename from pkg/ansible/watches/watches_test.go rename to internal/ansible/watches/watches_test.go