diff --git a/.gitignore b/.gitignore index 58d5413b..9b93a583 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ bin/ tmp/ -config - # Downloaded chart dependencies **/charts/*.tgz diff --git a/Makefile b/Makefile index 308f3d47..2f9fea12 100644 --- a/Makefile +++ b/Makefile @@ -226,13 +226,14 @@ generate: controller-gen ## Generate stuff .PHONY: manifests manifests: generate controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) webhook paths="./..." \ - rbac:roleName=manager-role output:rbac:artifacts:config=tests/kustomize/rbac \ - output:webhook:artifacts:config=tests/kustomize/webhook \ - output:crd:artifacts:config=tests/kustomize/crd/bases \ + rbac:roleName=manager-role output:rbac:artifacts:config=config/rbac \ + output:webhook:artifacts:config=config/webhook \ + output:crd:artifacts:config=config/crd/bases \ output:stdout .PHONY: run-helmify run-helmify: manifests helmify kustomize ## Generate the CRD with kustomize and helmify from the manifests @# could we do more here? - $(KUSTOMIZE) build tests/kustomize/default | $(HELMIFY) tmp/k8s-agents-operator + $(KUSTOMIZE) build config/default | $(HELMIFY) tmp/k8s-agents-operator cp ./tmp/k8s-agents-operator/templates/instrumentation-crd.yaml ./charts/k8s-agents-operator/templates/instrumentation-crd.yaml + printf "\nIMPORTANT: The generated chart needs to be transformed!\n- deployment.yaml is split into deployment.yaml and service-account.yaml\n- mutating-webhook-configuration.yaml and validating-webhook-configuration.yaml are merged into service-account.yaml\n- Documents generated are missing several config options (i.e. labels)\n" diff --git a/tests/kustomize/README.md b/config/README.md similarity index 86% rename from tests/kustomize/README.md rename to config/README.md index a3fdefbb..624b1af6 100644 --- a/tests/kustomize/README.md +++ b/config/README.md @@ -1,6 +1,6 @@ ## Structure -The `kustomize` folder contains the Kustomize resources that are used to assemble the operator's deployment units for testing +The `config` folder contains the Kustomize resources that are used to assemble the operator's deployment units for testing ``` . diff --git a/tests/kustomize/certmanager/certificate.yaml b/config/certmanager/certificate.yaml similarity index 100% rename from tests/kustomize/certmanager/certificate.yaml rename to config/certmanager/certificate.yaml diff --git a/tests/kustomize/certmanager/kustomization.yaml b/config/certmanager/kustomization.yaml similarity index 100% rename from tests/kustomize/certmanager/kustomization.yaml rename to config/certmanager/kustomization.yaml diff --git a/tests/kustomize/certmanager/kustomizeconfig.yaml b/config/certmanager/kustomizeconfig.yaml similarity index 100% rename from tests/kustomize/certmanager/kustomizeconfig.yaml rename to config/certmanager/kustomizeconfig.yaml diff --git a/tests/kustomize/crd/bases/newrelic.com_instrumentations.yaml b/config/crd/bases/newrelic.com_instrumentations.yaml similarity index 100% rename from tests/kustomize/crd/bases/newrelic.com_instrumentations.yaml rename to config/crd/bases/newrelic.com_instrumentations.yaml diff --git a/tests/kustomize/crd/kustomization.yaml b/config/crd/kustomization.yaml similarity index 100% rename from tests/kustomize/crd/kustomization.yaml rename to config/crd/kustomization.yaml diff --git a/tests/kustomize/crd/kustomizeconfig.yaml b/config/crd/kustomizeconfig.yaml similarity index 100% rename from tests/kustomize/crd/kustomizeconfig.yaml rename to config/crd/kustomizeconfig.yaml diff --git a/tests/kustomize/default/kustomization.yaml b/config/default/kustomization.yaml similarity index 100% rename from tests/kustomize/default/kustomization.yaml rename to config/default/kustomization.yaml diff --git a/tests/kustomize/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml similarity index 100% rename from tests/kustomize/default/manager_auth_proxy_patch.yaml rename to config/default/manager_auth_proxy_patch.yaml diff --git a/tests/kustomize/default/manager_webhook_patch.yaml b/config/default/manager_webhook_patch.yaml similarity index 100% rename from tests/kustomize/default/manager_webhook_patch.yaml rename to config/default/manager_webhook_patch.yaml diff --git a/tests/kustomize/default/mutatingwebhook_patch.yaml b/config/default/mutatingwebhook_patch.yaml similarity index 100% rename from tests/kustomize/default/mutatingwebhook_patch.yaml rename to config/default/mutatingwebhook_patch.yaml diff --git a/tests/kustomize/default/validatingwebhook_patch.yaml b/config/default/validatingwebhook_patch.yaml similarity index 100% rename from tests/kustomize/default/validatingwebhook_patch.yaml rename to config/default/validatingwebhook_patch.yaml diff --git a/tests/kustomize/manager/kustomization.yaml b/config/manager/kustomization.yaml similarity index 100% rename from tests/kustomize/manager/kustomization.yaml rename to config/manager/kustomization.yaml diff --git a/tests/kustomize/manager/manager.yaml b/config/manager/manager.yaml similarity index 100% rename from tests/kustomize/manager/manager.yaml rename to config/manager/manager.yaml diff --git a/tests/kustomize/manifests/bases/newrelic-agent-operator.clusterserviceversion.yaml b/config/manifests/bases/newrelic-agent-operator.clusterserviceversion.yaml similarity index 100% rename from tests/kustomize/manifests/bases/newrelic-agent-operator.clusterserviceversion.yaml rename to config/manifests/bases/newrelic-agent-operator.clusterserviceversion.yaml diff --git a/tests/kustomize/manifests/kustomization.yaml b/config/manifests/kustomization.yaml similarity index 100% rename from tests/kustomize/manifests/kustomization.yaml rename to config/manifests/kustomization.yaml diff --git a/tests/kustomize/prometheus/kustomization.yaml b/config/prometheus/kustomization.yaml similarity index 100% rename from tests/kustomize/prometheus/kustomization.yaml rename to config/prometheus/kustomization.yaml diff --git a/tests/kustomize/prometheus/monitor.yaml b/config/prometheus/monitor.yaml similarity index 100% rename from tests/kustomize/prometheus/monitor.yaml rename to config/prometheus/monitor.yaml diff --git a/tests/kustomize/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml similarity index 100% rename from tests/kustomize/rbac/auth_proxy_client_clusterrole.yaml rename to config/rbac/auth_proxy_client_clusterrole.yaml diff --git a/tests/kustomize/rbac/auth_proxy_role.yaml b/config/rbac/auth_proxy_role.yaml similarity index 100% rename from tests/kustomize/rbac/auth_proxy_role.yaml rename to config/rbac/auth_proxy_role.yaml diff --git a/tests/kustomize/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml similarity index 100% rename from tests/kustomize/rbac/auth_proxy_role_binding.yaml rename to config/rbac/auth_proxy_role_binding.yaml diff --git a/tests/kustomize/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml similarity index 100% rename from tests/kustomize/rbac/auth_proxy_service.yaml rename to config/rbac/auth_proxy_service.yaml diff --git a/tests/kustomize/rbac/kustomization.yaml b/config/rbac/kustomization.yaml similarity index 100% rename from tests/kustomize/rbac/kustomization.yaml rename to config/rbac/kustomization.yaml diff --git a/tests/kustomize/rbac/leader_election_role.yaml b/config/rbac/leader_election_role.yaml similarity index 100% rename from tests/kustomize/rbac/leader_election_role.yaml rename to config/rbac/leader_election_role.yaml diff --git a/tests/kustomize/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml similarity index 100% rename from tests/kustomize/rbac/leader_election_role_binding.yaml rename to config/rbac/leader_election_role_binding.yaml diff --git a/tests/kustomize/rbac/role.yaml b/config/rbac/role.yaml similarity index 100% rename from tests/kustomize/rbac/role.yaml rename to config/rbac/role.yaml diff --git a/tests/kustomize/rbac/role_binding.yaml b/config/rbac/role_binding.yaml similarity index 100% rename from tests/kustomize/rbac/role_binding.yaml rename to config/rbac/role_binding.yaml diff --git a/tests/kustomize/rbac/service_account.yaml b/config/rbac/service_account.yaml similarity index 100% rename from tests/kustomize/rbac/service_account.yaml rename to config/rbac/service_account.yaml diff --git a/tests/kustomize/samples/instrumentation_v1alpha2_instrumentation.yaml b/config/samples/instrumentation_v1alpha2_instrumentation.yaml similarity index 100% rename from tests/kustomize/samples/instrumentation_v1alpha2_instrumentation.yaml rename to config/samples/instrumentation_v1alpha2_instrumentation.yaml diff --git a/tests/kustomize/samples/kustomization.yaml b/config/samples/kustomization.yaml similarity index 100% rename from tests/kustomize/samples/kustomization.yaml rename to config/samples/kustomization.yaml diff --git a/tests/kustomize/scorecard/bases/config.yaml b/config/scorecard/bases/config.yaml similarity index 100% rename from tests/kustomize/scorecard/bases/config.yaml rename to config/scorecard/bases/config.yaml diff --git a/tests/kustomize/scorecard/kustomization.yaml b/config/scorecard/kustomization.yaml similarity index 100% rename from tests/kustomize/scorecard/kustomization.yaml rename to config/scorecard/kustomization.yaml diff --git a/tests/kustomize/scorecard/patches/basic.config.yaml b/config/scorecard/patches/basic.config.yaml similarity index 100% rename from tests/kustomize/scorecard/patches/basic.config.yaml rename to config/scorecard/patches/basic.config.yaml diff --git a/tests/kustomize/scorecard/patches/olm.config.yaml b/config/scorecard/patches/olm.config.yaml similarity index 100% rename from tests/kustomize/scorecard/patches/olm.config.yaml rename to config/scorecard/patches/olm.config.yaml diff --git a/tests/kustomize/webhook/kustomization.yaml b/config/webhook/kustomization.yaml similarity index 100% rename from tests/kustomize/webhook/kustomization.yaml rename to config/webhook/kustomization.yaml diff --git a/tests/kustomize/webhook/kustomizeconfig.yaml b/config/webhook/kustomizeconfig.yaml similarity index 100% rename from tests/kustomize/webhook/kustomizeconfig.yaml rename to config/webhook/kustomizeconfig.yaml diff --git a/tests/kustomize/webhook/manifests.yaml b/config/webhook/manifests.yaml similarity index 100% rename from tests/kustomize/webhook/manifests.yaml rename to config/webhook/manifests.yaml diff --git a/tests/kustomize/webhook/service.yaml b/config/webhook/service.yaml similarity index 100% rename from tests/kustomize/webhook/service.yaml rename to config/webhook/service.yaml diff --git a/src/api/v1alpha2/webhook_suite_test.go b/src/api/v1alpha2/webhook_suite_test.go index 333fda33..49c588f6 100644 --- a/src/api/v1alpha2/webhook_suite_test.go +++ b/src/api/v1alpha2/webhook_suite_test.go @@ -63,10 +63,10 @@ var _ = BeforeSuite(func() { By("bootstrapping test environment") testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: false, WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "webhook")}, + Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, }, } diff --git a/src/instrumentation/instrumentation_suite_test.go b/src/instrumentation/instrumentation_suite_test.go index 86185f2f..7340164a 100644 --- a/src/instrumentation/instrumentation_suite_test.go +++ b/src/instrumentation/instrumentation_suite_test.go @@ -17,7 +17,7 @@ var k8sClient client.Client func TestMain(m *testing.M) { testEnv := &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "tests", "kustomize", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")}, } cfg, err := testEnv.Start() diff --git a/src/instrumentation/upgrade/upgrade_suite_test.go b/src/instrumentation/upgrade/upgrade_suite_test.go index a4f890ff..0ce96251 100644 --- a/src/instrumentation/upgrade/upgrade_suite_test.go +++ b/src/instrumentation/upgrade/upgrade_suite_test.go @@ -38,7 +38,7 @@ var cfg *rest.Config func TestMain(m *testing.M) { testEnv = &envtest.Environment{ CRDDirectoryPaths: []string{ - filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases"), + filepath.Join("..", "..", "..", "config", "crd", "bases"), }, } diff --git a/src/internal/webhookhandler/webhookhandler_suite_test.go b/src/internal/webhookhandler/webhookhandler_suite_test.go index 99f1c39f..da9345dc 100644 --- a/src/internal/webhookhandler/webhookhandler_suite_test.go +++ b/src/internal/webhookhandler/webhookhandler_suite_test.go @@ -83,7 +83,7 @@ func TestMain(m *testing.M) { logger := zap.New(zap.UseDevMode(true), zap.WriteTo(&fakeWriter{})) testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: false, @@ -96,7 +96,7 @@ func TestMain(m *testing.M) { fmt.Sprintf("1.29.0-%s-%s", stdruntime.GOOS, stdruntime.GOARCH)), WebhookInstallOptions: envtest.WebhookInstallOptions{ - Paths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "webhook")}, + Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, }, } cfg, err = testEnv.Start()