move `controllers` to `internal/controllers`

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This commit is contained in:
Sanskar Jaiswal 2023-03-27 22:32:58 +05:30
parent 7889652c39
commit c62e9f289c
17 changed files with 13 additions and 11 deletions

5
.gitignore vendored
View File

@ -2,7 +2,7 @@ notes
# Thes are downloaded in the Makefile
cache/*
controllers/testdata/crds/*
internal/controllers/testdata/crds/*
# Binaries for programs and plugins
*.exe
@ -31,3 +31,6 @@ testbin
# Exclude all build related files
build/
# CRDs for fuzzing tests.
internal/controllers/testdata/crd

View File

@ -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/

View File

@ -69,7 +69,7 @@ ifeq ($(shell uname -s),Darwin)
ENVTEST_ARCH=amd64
endif
TEST_CRDS := controllers/testdata/crds
TEST_CRDS := internal/controllers/testdata/crds
# Log level for `make run`
LOG_LEVEL ?= info

View File

@ -67,7 +67,7 @@ func TestMain(m *testing.M) {
func runTestsWithFeatures(m *testing.M, feats map[string]bool) int {
testEnv = testenv.New(testenv.WithCRDPath(
filepath.Join("..", "config", "crd", "bases"),
filepath.Join("..", "..", "config", "crd", "bases"),
filepath.Join("testdata", "crds"),
))

View File

@ -46,7 +46,7 @@ import (
"github.com/fluxcd/pkg/git"
// +kubebuilder:scaffold:imports
"github.com/fluxcd/image-automation-controller/controllers"
"github.com/fluxcd/image-automation-controller/internal/controllers"
)
const (

View File

@ -21,8 +21,8 @@ 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/controllers/testdata/crd
cp config/crd/bases/*.yaml internal/controllers/testdata/crd
# Version of the source-controller from which to get the GitRepository CRD.
# Pulls source-controller/api's version set in go.mod.
@ -32,10 +32,10 @@ SOURCE_VER=$(go list -m github.com/fluxcd/source-controller/api | awk '{print $2
# Pulls image-reflector-controller/api's version set in go.mod.
REFLECTOR_VER=$(go list -m github.com/fluxcd/image-reflector-controller/api | awk '{print $2}')
if [ -d "../../controllers/testdata/crds" ]; then
cp ../../controllers/testdata/crds/*.yaml testdata/crds
if [ -d "../../internal/controllers/testdata/crds" ]; then
cp ../../internal/controllers/testdata/crds/*.yaml testdata/crds
else
# Fetch the CRDs if not present since we need them when running fuzz tests on CI.
curl -s --fail https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VER}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml -o controllers/testdata/crd/gitrepositories.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o controllers/testdata/crd/imagepolicies.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VER}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml -o internal/controllers/testdata/crd/gitrepositories.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o internal/controllers/testdata/crd/imagepolicies.yaml
fi