diff --git a/Dockerfile b/Dockerfile index c9f0719cb..333aba43b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,6 @@ RUN go mod download # Copy source code COPY main.go main.go -COPY controllers/ controllers/ COPY pkg/ pkg/ COPY internal/ internal/ diff --git a/Makefile b/Makefile index 834298321..3621355e7 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ test-ctrl: install-envtest test-api check-deps ## Run controller tests GIT_CONFIG_GLOBAL=/dev/null \ go test $(GO_STATIC_FLAGS) \ -run "^$(GO_TEST_PREFIX).*" \ - -v ./controllers \ + -v ./internal/controller \ -coverprofile cover.out check-deps: diff --git a/hack/ci/e2e.sh b/hack/ci/e2e.sh index 2ea0f8f24..c48393a60 100755 --- a/hack/ci/e2e.sh +++ b/hack/ci/e2e.sh @@ -133,7 +133,7 @@ kubectl -n source-system wait bucket/podinfo --for=condition=ready --timeout=1m echo "Run HelmChart from Bucket tests" "${BUILD_DIR}/mc" mb minio/charts -"${BUILD_DIR}/mc" mirror "${ROOT_DIR}/controllers/testdata/charts/helmchart/" minio/charts/helmchart +"${BUILD_DIR}/mc" mirror "${ROOT_DIR}/internal/controller/testdata/charts/helmchart/" minio/charts/helmchart kubectl -n source-system apply -f "${ROOT_DIR}/config/testdata/helmchart-from-bucket/source.yaml" kubectl -n source-system wait bucket/charts --for=condition=ready --timeout=1m diff --git a/controllers/artifact.go b/internal/controller/artifact.go similarity index 98% rename from controllers/artifact.go rename to internal/controller/artifact.go index 4816057bc..0de6b3706 100644 --- a/controllers/artifact.go +++ b/internal/controller/artifact.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import sourcev1 "github.com/fluxcd/source-controller/api/v1" diff --git a/controllers/artifact_matchers_test.go b/internal/controller/artifact_matchers_test.go similarity index 98% rename from controllers/artifact_matchers_test.go rename to internal/controller/artifact_matchers_test.go index 11b12a895..39f0c9dd7 100644 --- a/controllers/artifact_matchers_test.go +++ b/internal/controller/artifact_matchers_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "fmt" diff --git a/controllers/artifact_test.go b/internal/controller/artifact_test.go similarity index 99% rename from controllers/artifact_test.go rename to internal/controller/artifact_test.go index 935c93bf7..d40548c3c 100644 --- a/controllers/artifact_test.go +++ b/internal/controller/artifact_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "testing" diff --git a/controllers/bucket_controller.go b/internal/controller/bucket_controller.go similarity index 99% rename from controllers/bucket_controller.go rename to internal/controller/bucket_controller.go index c761a71f8..aed3f4752 100644 --- a/controllers/bucket_controller.go +++ b/internal/controller/bucket_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/bucket_controller_fetch_test.go b/internal/controller/bucket_controller_fetch_test.go similarity index 99% rename from controllers/bucket_controller_fetch_test.go rename to internal/controller/bucket_controller_fetch_test.go index ad9b6ffd3..be65c1c4d 100644 --- a/controllers/bucket_controller_fetch_test.go +++ b/internal/controller/bucket_controller_fetch_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/bucket_controller_test.go b/internal/controller/bucket_controller_test.go similarity index 99% rename from controllers/bucket_controller_test.go rename to internal/controller/bucket_controller_test.go index 5050e3485..f7c67f0b0 100644 --- a/controllers/bucket_controller_test.go +++ b/internal/controller/bucket_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/common_test.go b/internal/controller/common_test.go similarity index 99% rename from controllers/common_test.go rename to internal/controller/common_test.go index 18df1ab51..d9dcf88c1 100644 --- a/controllers/common_test.go +++ b/internal/controller/common_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/gitrepository_controller.go b/internal/controller/gitrepository_controller.go similarity index 99% rename from controllers/gitrepository_controller.go rename to internal/controller/gitrepository_controller.go index d5654fb42..206a2c132 100644 --- a/controllers/gitrepository_controller.go +++ b/internal/controller/gitrepository_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/gitrepository_controller_fuzz_test.go b/internal/controller/gitrepository_controller_fuzz_test.go similarity index 99% rename from controllers/gitrepository_controller_fuzz_test.go rename to internal/controller/gitrepository_controller_fuzz_test.go index 8faaa187e..a2b17db78 100644 --- a/controllers/gitrepository_controller_fuzz_test.go +++ b/internal/controller/gitrepository_controller_fuzz_test.go @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/gitrepository_controller_test.go b/internal/controller/gitrepository_controller_test.go similarity index 99% rename from controllers/gitrepository_controller_test.go rename to internal/controller/gitrepository_controller_test.go index da96b1f85..6dbf80695 100644 --- a/controllers/gitrepository_controller_test.go +++ b/internal/controller/gitrepository_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/helmchart_controller.go b/internal/controller/helmchart_controller.go similarity index 99% rename from controllers/helmchart_controller.go rename to internal/controller/helmchart_controller.go index acf3b4e3e..e68fd7540 100644 --- a/controllers/helmchart_controller.go +++ b/internal/controller/helmchart_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/helmchart_controller_test.go b/internal/controller/helmchart_controller_test.go similarity index 99% rename from controllers/helmchart_controller_test.go rename to internal/controller/helmchart_controller_test.go index 00924d29e..e3ca0b435 100644 --- a/controllers/helmchart_controller_test.go +++ b/internal/controller/helmchart_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "bytes" diff --git a/controllers/helmrepository_controller.go b/internal/controller/helmrepository_controller.go similarity index 99% rename from controllers/helmrepository_controller.go rename to internal/controller/helmrepository_controller.go index 868a12ef8..42e5798ec 100644 --- a/controllers/helmrepository_controller.go +++ b/internal/controller/helmrepository_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/helmrepository_controller_oci.go b/internal/controller/helmrepository_controller_oci.go similarity index 99% rename from controllers/helmrepository_controller_oci.go rename to internal/controller/helmrepository_controller_oci.go index d561ac650..f894213c4 100644 --- a/controllers/helmrepository_controller_oci.go +++ b/internal/controller/helmrepository_controller_oci.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/helmrepository_controller_oci_test.go b/internal/controller/helmrepository_controller_oci_test.go similarity index 99% rename from controllers/helmrepository_controller_oci_test.go rename to internal/controller/helmrepository_controller_oci_test.go index 5f58f9ddf..128520c38 100644 --- a/controllers/helmrepository_controller_oci_test.go +++ b/internal/controller/helmrepository_controller_oci_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "encoding/base64" diff --git a/controllers/helmrepository_controller_test.go b/internal/controller/helmrepository_controller_test.go similarity index 99% rename from controllers/helmrepository_controller_test.go rename to internal/controller/helmrepository_controller_test.go index 1dd9e141f..3cf6a6ecf 100644 --- a/controllers/helmrepository_controller_test.go +++ b/internal/controller/helmrepository_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/ocirepository_controller.go b/internal/controller/ocirepository_controller.go similarity index 99% rename from controllers/ocirepository_controller.go rename to internal/controller/ocirepository_controller.go index 0b6dc2a2a..cee859205 100644 --- a/controllers/ocirepository_controller.go +++ b/internal/controller/ocirepository_controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "context" diff --git a/controllers/ocirepository_controller_test.go b/internal/controller/ocirepository_controller_test.go similarity index 99% rename from controllers/ocirepository_controller_test.go rename to internal/controller/ocirepository_controller_test.go index d3b732799..9ec659a7d 100644 --- a/controllers/ocirepository_controller_test.go +++ b/internal/controller/ocirepository_controller_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "crypto/rand" diff --git a/controllers/source_predicate.go b/internal/controller/source_predicate.go similarity index 98% rename from controllers/source_predicate.go rename to internal/controller/source_predicate.go index e84faf14e..968f2def9 100644 --- a/controllers/source_predicate.go +++ b/internal/controller/source_predicate.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "sigs.k8s.io/controller-runtime/pkg/event" diff --git a/controllers/storage.go b/internal/controller/storage.go similarity index 99% rename from controllers/storage.go rename to internal/controller/storage.go index 595bfa138..98fb73593 100644 --- a/controllers/storage.go +++ b/internal/controller/storage.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "archive/tar" @@ -39,7 +39,7 @@ import ( "github.com/fluxcd/pkg/sourceignore" "github.com/fluxcd/pkg/untar" - "github.com/fluxcd/source-controller/api/v1" + v1 "github.com/fluxcd/source-controller/api/v1" intdigest "github.com/fluxcd/source-controller/internal/digest" sourcefs "github.com/fluxcd/source-controller/internal/fs" ) diff --git a/controllers/storage_test.go b/internal/controller/storage_test.go similarity index 99% rename from controllers/storage_test.go rename to internal/controller/storage_test.go index f851b85cb..bdf21b53b 100644 --- a/controllers/storage_test.go +++ b/internal/controller/storage_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "archive/tar" diff --git a/controllers/suite_test.go b/internal/controller/suite_test.go similarity index 99% rename from controllers/suite_test.go rename to internal/controller/suite_test.go index 18e805d4c..ad1798e85 100644 --- a/controllers/suite_test.go +++ b/internal/controller/suite_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package controllers +package controller import ( "bytes" @@ -207,7 +207,7 @@ func TestMain(m *testing.M) { utilruntime.Must(sourcev1.AddToScheme(scheme.Scheme)) utilruntime.Must(sourcev1beta2.AddToScheme(scheme.Scheme)) - testEnv = testenv.New(testenv.WithCRDPath(filepath.Join("..", "config", "crd", "bases"))) + testEnv = testenv.New(testenv.WithCRDPath(filepath.Join("..", "..", "config", "crd", "bases"))) var err error testServer, err = testserver.NewTempArtifactServer() diff --git a/controllers/testdata/certs/Makefile b/internal/controller/testdata/certs/Makefile similarity index 100% rename from controllers/testdata/certs/Makefile rename to internal/controller/testdata/certs/Makefile diff --git a/controllers/testdata/certs/ca-config.json b/internal/controller/testdata/certs/ca-config.json similarity index 100% rename from controllers/testdata/certs/ca-config.json rename to internal/controller/testdata/certs/ca-config.json diff --git a/controllers/testdata/certs/ca-csr.json b/internal/controller/testdata/certs/ca-csr.json similarity index 100% rename from controllers/testdata/certs/ca-csr.json rename to internal/controller/testdata/certs/ca-csr.json diff --git a/controllers/testdata/certs/ca-key.pem b/internal/controller/testdata/certs/ca-key.pem similarity index 100% rename from controllers/testdata/certs/ca-key.pem rename to internal/controller/testdata/certs/ca-key.pem diff --git a/controllers/testdata/certs/ca.csr b/internal/controller/testdata/certs/ca.csr similarity index 100% rename from controllers/testdata/certs/ca.csr rename to internal/controller/testdata/certs/ca.csr diff --git a/controllers/testdata/certs/ca.pem b/internal/controller/testdata/certs/ca.pem similarity index 100% rename from controllers/testdata/certs/ca.pem rename to internal/controller/testdata/certs/ca.pem diff --git a/controllers/testdata/certs/server-csr.json b/internal/controller/testdata/certs/server-csr.json similarity index 100% rename from controllers/testdata/certs/server-csr.json rename to internal/controller/testdata/certs/server-csr.json diff --git a/controllers/testdata/certs/server-key.pem b/internal/controller/testdata/certs/server-key.pem similarity index 100% rename from controllers/testdata/certs/server-key.pem rename to internal/controller/testdata/certs/server-key.pem diff --git a/controllers/testdata/certs/server.csr b/internal/controller/testdata/certs/server.csr similarity index 100% rename from controllers/testdata/certs/server.csr rename to internal/controller/testdata/certs/server.csr diff --git a/controllers/testdata/certs/server.pem b/internal/controller/testdata/certs/server.pem similarity index 100% rename from controllers/testdata/certs/server.pem rename to internal/controller/testdata/certs/server.pem diff --git a/controllers/testdata/charts/helmchart-0.1.0.tgz b/internal/controller/testdata/charts/helmchart-0.1.0.tgz similarity index 100% rename from controllers/testdata/charts/helmchart-0.1.0.tgz rename to internal/controller/testdata/charts/helmchart-0.1.0.tgz diff --git a/controllers/testdata/charts/helmchart/.helmignore b/internal/controller/testdata/charts/helmchart/.helmignore similarity index 100% rename from controllers/testdata/charts/helmchart/.helmignore rename to internal/controller/testdata/charts/helmchart/.helmignore diff --git a/controllers/testdata/charts/helmchart/Chart.yaml b/internal/controller/testdata/charts/helmchart/Chart.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/Chart.yaml rename to internal/controller/testdata/charts/helmchart/Chart.yaml diff --git a/controllers/testdata/charts/helmchart/duplicate.yaml b/internal/controller/testdata/charts/helmchart/duplicate.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/duplicate.yaml rename to internal/controller/testdata/charts/helmchart/duplicate.yaml diff --git a/controllers/testdata/charts/helmchart/override.yaml b/internal/controller/testdata/charts/helmchart/override.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/override.yaml rename to internal/controller/testdata/charts/helmchart/override.yaml diff --git a/controllers/testdata/charts/helmchart/templates/NOTES.txt b/internal/controller/testdata/charts/helmchart/templates/NOTES.txt similarity index 100% rename from controllers/testdata/charts/helmchart/templates/NOTES.txt rename to internal/controller/testdata/charts/helmchart/templates/NOTES.txt diff --git a/controllers/testdata/charts/helmchart/templates/_helpers.tpl b/internal/controller/testdata/charts/helmchart/templates/_helpers.tpl similarity index 100% rename from controllers/testdata/charts/helmchart/templates/_helpers.tpl rename to internal/controller/testdata/charts/helmchart/templates/_helpers.tpl diff --git a/controllers/testdata/charts/helmchart/templates/deployment.yaml b/internal/controller/testdata/charts/helmchart/templates/deployment.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/templates/deployment.yaml rename to internal/controller/testdata/charts/helmchart/templates/deployment.yaml diff --git a/controllers/testdata/charts/helmchart/templates/ingress.yaml b/internal/controller/testdata/charts/helmchart/templates/ingress.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/templates/ingress.yaml rename to internal/controller/testdata/charts/helmchart/templates/ingress.yaml diff --git a/controllers/testdata/charts/helmchart/templates/service.yaml b/internal/controller/testdata/charts/helmchart/templates/service.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/templates/service.yaml rename to internal/controller/testdata/charts/helmchart/templates/service.yaml diff --git a/controllers/testdata/charts/helmchart/templates/serviceaccount.yaml b/internal/controller/testdata/charts/helmchart/templates/serviceaccount.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/templates/serviceaccount.yaml rename to internal/controller/testdata/charts/helmchart/templates/serviceaccount.yaml diff --git a/controllers/testdata/charts/helmchart/templates/tests/test-connection.yaml b/internal/controller/testdata/charts/helmchart/templates/tests/test-connection.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/templates/tests/test-connection.yaml rename to internal/controller/testdata/charts/helmchart/templates/tests/test-connection.yaml diff --git a/controllers/testdata/charts/helmchart/values.yaml b/internal/controller/testdata/charts/helmchart/values.yaml similarity index 100% rename from controllers/testdata/charts/helmchart/values.yaml rename to internal/controller/testdata/charts/helmchart/values.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/.helmignore b/internal/controller/testdata/charts/helmchartwithdeps/.helmignore similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/.helmignore rename to internal/controller/testdata/charts/helmchartwithdeps/.helmignore diff --git a/controllers/testdata/charts/helmchartwithdeps/Chart.yaml b/internal/controller/testdata/charts/helmchartwithdeps/Chart.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/Chart.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/Chart.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/override.yaml b/internal/controller/testdata/charts/helmchartwithdeps/override.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/override.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/override.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/NOTES.txt b/internal/controller/testdata/charts/helmchartwithdeps/templates/NOTES.txt similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/NOTES.txt rename to internal/controller/testdata/charts/helmchartwithdeps/templates/NOTES.txt diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/_helpers.tpl b/internal/controller/testdata/charts/helmchartwithdeps/templates/_helpers.tpl similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/_helpers.tpl rename to internal/controller/testdata/charts/helmchartwithdeps/templates/_helpers.tpl diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/deployment.yaml b/internal/controller/testdata/charts/helmchartwithdeps/templates/deployment.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/deployment.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/templates/deployment.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/ingress.yaml b/internal/controller/testdata/charts/helmchartwithdeps/templates/ingress.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/ingress.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/templates/ingress.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/service.yaml b/internal/controller/testdata/charts/helmchartwithdeps/templates/service.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/service.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/templates/service.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/serviceaccount.yaml b/internal/controller/testdata/charts/helmchartwithdeps/templates/serviceaccount.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/serviceaccount.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/templates/serviceaccount.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/templates/tests/test-connection.yaml b/internal/controller/testdata/charts/helmchartwithdeps/templates/tests/test-connection.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/templates/tests/test-connection.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/templates/tests/test-connection.yaml diff --git a/controllers/testdata/charts/helmchartwithdeps/values.yaml b/internal/controller/testdata/charts/helmchartwithdeps/values.yaml similarity index 100% rename from controllers/testdata/charts/helmchartwithdeps/values.yaml rename to internal/controller/testdata/charts/helmchartwithdeps/values.yaml diff --git a/controllers/testdata/git/repository/.sourceignore b/internal/controller/testdata/git/repository/.sourceignore similarity index 100% rename from controllers/testdata/git/repository/.sourceignore rename to internal/controller/testdata/git/repository/.sourceignore diff --git a/controllers/testdata/git/repository/foo.txt b/internal/controller/testdata/git/repository/foo.txt similarity index 100% rename from controllers/testdata/git/repository/foo.txt rename to internal/controller/testdata/git/repository/foo.txt diff --git a/controllers/testdata/git/repository/manifest.yaml b/internal/controller/testdata/git/repository/manifest.yaml similarity index 100% rename from controllers/testdata/git/repository/manifest.yaml rename to internal/controller/testdata/git/repository/manifest.yaml diff --git a/controllers/testdata/git/repowithsubdirs/.sourceignore b/internal/controller/testdata/git/repowithsubdirs/.sourceignore similarity index 100% rename from controllers/testdata/git/repowithsubdirs/.sourceignore rename to internal/controller/testdata/git/repowithsubdirs/.sourceignore diff --git a/controllers/testdata/git/repowithsubdirs/apps/manifest.yaml b/internal/controller/testdata/git/repowithsubdirs/apps/manifest.yaml similarity index 100% rename from controllers/testdata/git/repowithsubdirs/apps/manifest.yaml rename to internal/controller/testdata/git/repowithsubdirs/apps/manifest.yaml diff --git a/controllers/testdata/git/repowithsubdirs/clusters/manifest.yaml b/internal/controller/testdata/git/repowithsubdirs/clusters/manifest.yaml similarity index 100% rename from controllers/testdata/git/repowithsubdirs/clusters/manifest.yaml rename to internal/controller/testdata/git/repowithsubdirs/clusters/manifest.yaml diff --git a/controllers/testdata/git/repowithsubdirs/foo.txt b/internal/controller/testdata/git/repowithsubdirs/foo.txt similarity index 100% rename from controllers/testdata/git/repowithsubdirs/foo.txt rename to internal/controller/testdata/git/repowithsubdirs/foo.txt diff --git a/controllers/testdata/oci/repository/foo.txt b/internal/controller/testdata/oci/repository/foo.txt similarity index 100% rename from controllers/testdata/oci/repository/foo.txt rename to internal/controller/testdata/oci/repository/foo.txt diff --git a/controllers/testdata/podinfo/podinfo-6.1.4.tar b/internal/controller/testdata/podinfo/podinfo-6.1.4.tar similarity index 100% rename from controllers/testdata/podinfo/podinfo-6.1.4.tar rename to internal/controller/testdata/podinfo/podinfo-6.1.4.tar diff --git a/controllers/testdata/podinfo/podinfo-6.1.5.tar b/internal/controller/testdata/podinfo/podinfo-6.1.5.tar similarity index 100% rename from controllers/testdata/podinfo/podinfo-6.1.5.tar rename to internal/controller/testdata/podinfo/podinfo-6.1.5.tar diff --git a/controllers/testdata/podinfo/podinfo-6.1.6.tar b/internal/controller/testdata/podinfo/podinfo-6.1.6.tar similarity index 100% rename from controllers/testdata/podinfo/podinfo-6.1.6.tar rename to internal/controller/testdata/podinfo/podinfo-6.1.6.tar diff --git a/main.go b/main.go index 84ce6379f..e6bce9efb 100644 --- a/main.go +++ b/main.go @@ -45,12 +45,13 @@ import ( "github.com/fluxcd/pkg/runtime/pprof" "github.com/fluxcd/pkg/runtime/probes" - "github.com/fluxcd/source-controller/api/v1" + v1 "github.com/fluxcd/source-controller/api/v1" "github.com/fluxcd/source-controller/api/v1beta2" + // +kubebuilder:scaffold:imports - "github.com/fluxcd/source-controller/controllers" "github.com/fluxcd/source-controller/internal/cache" + "github.com/fluxcd/source-controller/internal/controller" intdigest "github.com/fluxcd/source-controller/internal/digest" "github.com/fluxcd/source-controller/internal/features" "github.com/fluxcd/source-controller/internal/helm" @@ -175,13 +176,13 @@ func main() { mustSetupHelmLimits(helmIndexLimit, helmChartLimit, helmChartFileLimit) helmIndexCache, helmIndexCacheItemTTL := mustInitHelmCache(helmCacheMaxSize, helmCacheTTL, helmCachePurgeInterval) - if err := (&controllers.GitRepositoryReconciler{ + if err := (&controller.GitRepositoryReconciler{ Client: mgr.GetClient(), EventRecorder: eventRecorder, Metrics: metrics, Storage: storage, ControllerName: controllerName, - }).SetupWithManagerAndOptions(mgr, controllers.GitRepositoryReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.GitRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, DependencyRequeueInterval: requeueDependency, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), @@ -190,14 +191,14 @@ func main() { os.Exit(1) } - if err := (&controllers.HelmRepositoryOCIReconciler{ + if err := (&controller.HelmRepositoryOCIReconciler{ Client: mgr.GetClient(), EventRecorder: eventRecorder, Metrics: metrics, Getters: getters, ControllerName: controllerName, RegistryClientGenerator: registry.ClientGenerator, - }).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.HelmRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), }); err != nil { @@ -205,7 +206,7 @@ func main() { os.Exit(1) } - if err := (&controllers.HelmRepositoryReconciler{ + if err := (&controller.HelmRepositoryReconciler{ Client: mgr.GetClient(), EventRecorder: eventRecorder, Metrics: metrics, @@ -215,7 +216,7 @@ func main() { Cache: helmIndexCache, TTL: helmIndexCacheItemTTL, CacheRecorder: cacheRecorder, - }).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.HelmRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), }); err != nil { @@ -223,7 +224,7 @@ func main() { os.Exit(1) } - if err := (&controllers.HelmChartReconciler{ + if err := (&controller.HelmChartReconciler{ Client: mgr.GetClient(), RegistryClientGenerator: registry.ClientGenerator, Storage: storage, @@ -234,7 +235,7 @@ func main() { Cache: helmIndexCache, TTL: helmIndexCacheItemTTL, CacheRecorder: cacheRecorder, - }).SetupWithManagerAndOptions(mgr, controllers.HelmChartReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.HelmChartReconcilerOptions{ MaxConcurrentReconciles: concurrent, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), }); err != nil { @@ -242,13 +243,13 @@ func main() { os.Exit(1) } - if err := (&controllers.BucketReconciler{ + if err := (&controller.BucketReconciler{ Client: mgr.GetClient(), EventRecorder: eventRecorder, Metrics: metrics, Storage: storage, ControllerName: controllerName, - }).SetupWithManagerAndOptions(mgr, controllers.BucketReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.BucketReconcilerOptions{ MaxConcurrentReconciles: concurrent, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), }); err != nil { @@ -256,13 +257,13 @@ func main() { os.Exit(1) } - if err := (&controllers.OCIRepositoryReconciler{ + if err := (&controller.OCIRepositoryReconciler{ Client: mgr.GetClient(), Storage: storage, EventRecorder: eventRecorder, ControllerName: controllerName, Metrics: metrics, - }).SetupWithManagerAndOptions(mgr, controllers.OCIRepositoryReconcilerOptions{ + }).SetupWithManagerAndOptions(mgr, controller.OCIRepositoryReconcilerOptions{ MaxConcurrentReconciles: concurrent, RateLimiter: helper.GetRateLimiter(rateLimiterOptions), }); err != nil { @@ -394,7 +395,7 @@ func mustInitHelmCache(maxSize int, purgeInterval, itemTTL string) (*cache.Cache return cache.New(maxSize, interval), ttl } -func mustInitStorage(path string, storageAdvAddr string, artifactRetentionTTL time.Duration, artifactRetentionRecords int, artifactDigestAlgo string) *controllers.Storage { +func mustInitStorage(path string, storageAdvAddr string, artifactRetentionTTL time.Duration, artifactRetentionRecords int, artifactDigestAlgo string) *controller.Storage { if storageAdvAddr == "" { storageAdvAddr = determineAdvStorageAddr(storageAdvAddr) } @@ -408,7 +409,7 @@ func mustInitStorage(path string, storageAdvAddr string, artifactRetentionTTL ti intdigest.Canonical = algo } - storage, err := controllers.NewStorage(path, storageAdvAddr, artifactRetentionTTL, artifactRetentionRecords) + storage, err := controller.NewStorage(path, storageAdvAddr, artifactRetentionTTL, artifactRetentionRecords) if err != nil { setupLog.Error(err, "unable to initialise storage") os.Exit(1) diff --git a/tests/fuzz/oss_fuzz_prebuild.sh b/tests/fuzz/oss_fuzz_prebuild.sh index 308407ca3..18617939e 100755 --- a/tests/fuzz/oss_fuzz_prebuild.sh +++ b/tests/fuzz/oss_fuzz_prebuild.sh @@ -21,5 +21,5 @@ set -euxo pipefail # Some tests requires embedded resources. Embedding does not allow # for traversing into ascending dirs, therefore we copy those contents here: -mkdir -p controllers/testdata/crd -cp config/crd/bases/*.yaml controllers/testdata/crd/ +mkdir -p internal/controller/testdata/crd +cp config/crd/bases/*.yaml internal/controller/testdata/crd/