diff --git a/README.md b/README.md index 15ef6cfb36..2e7a7e62bf 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ $ kubectl create -f deploy/operator.yaml # Create an AppService CR # The default controller will watch for AppService objects and create a pod for each CR -$ kubectl create -f deploy/crds/app_v1alpha1_appservice_cr.yaml +$ kubectl create -f deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml # Verify that a pod is created $ kubectl get pod -l app=example-appservice @@ -120,7 +120,7 @@ Spec: Size: 3 # Cleanup -$ kubectl delete -f deploy/crds/app_v1alpha1_appservice_cr.yaml +$ kubectl delete -f deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml $ kubectl delete -f deploy/operator.yaml $ kubectl delete -f deploy/role.yaml $ kubectl delete -f deploy/role_binding.yaml diff --git a/ci/tests/e2e-ansible.sh b/ci/tests/e2e-ansible.sh index 368148d8b5..4951306c45 100755 --- a/ci/tests/e2e-ansible.sh +++ b/ci/tests/e2e-ansible.sh @@ -61,7 +61,7 @@ test_operator() { fi # create CR - kubectl create -f deploy/crds/ansible_v1alpha1_memcached_cr.yaml + kubectl create -f deploy/crds/ansible.example.com_v1alpha1_memcached_cr.yaml if ! timeout 20s bash -c -- 'until kubectl get deployment -l app=memcached | grep memcached; do sleep 1; done'; then echo FAIL: operator failed to create memcached Deployment @@ -84,7 +84,7 @@ test_operator() { kubectl create configmap deleteme trap_add 'kubectl delete --ignore-not-found configmap deleteme' EXIT - kubectl delete -f ${OPERATORDIR}/deploy/crds/ansible_v1alpha1_memcached_cr.yaml --wait=true + kubectl delete -f ${OPERATORDIR}/deploy/crds/ansible.example.com_v1alpha1_memcached_cr.yaml --wait=true # if the finalizer did not delete the configmap... if kubectl get configmap deleteme 2> /dev/null; then diff --git a/ci/tests/e2e-helm.sh b/ci/tests/e2e-helm.sh index 466b7bcfe2..88e78b8689 100755 --- a/ci/tests/e2e-helm.sh +++ b/ci/tests/e2e-helm.sh @@ -69,8 +69,8 @@ test_operator() { fi # create CR - kubectl create -f deploy/crds/helm_v1alpha1_nginx_cr.yaml - trap_add 'kubectl delete --ignore-not-found -f ${OPERATORDIR}/deploy/crds/helm_v1alpha1_nginx_cr.yaml' EXIT + kubectl create -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml + trap_add 'kubectl delete --ignore-not-found -f ${OPERATORDIR}/deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml' EXIT if ! timeout 1m bash -c -- 'until kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.deployedRelease.name}" | grep "example-nginx"; do sleep 1; done'; then kubectl logs deployment/nginx-operator @@ -113,7 +113,7 @@ test_operator() { exit 1 fi - kubectl delete -f deploy/crds/helm_v1alpha1_nginx_cr.yaml --wait=true + kubectl delete -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml --wait=true kubectl logs deployment/nginx-operator | grep "Uninstalled release" | grep "${release_name}" } diff --git a/ci/tests/scorecard-subcommand.sh b/ci/tests/scorecard-subcommand.sh index f4700510d9..14defca8e3 100755 --- a/ci/tests/scorecard-subcommand.sh +++ b/ci/tests/scorecard-subcommand.sh @@ -10,8 +10,8 @@ set -ex # the test framework directory has all the manifests needed to run the cluster pushd test/test-framework commandoutput="$(operator-sdk scorecard \ - --cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml \ - --cr-manifest deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml \ + --cr-manifest deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml \ + --cr-manifest deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml \ --init-timeout 60 \ --csv-path "$CSV_PATH" \ --verbose \ diff --git a/cmd/operator-sdk/add/api.go b/cmd/operator-sdk/add/api.go index 762c7127c8..df239bfcff 100644 --- a/cmd/operator-sdk/add/api.go +++ b/cmd/operator-sdk/add/api.go @@ -66,7 +66,7 @@ Example: ├── zz_generated.deepcopy.go ├── zz_generated.openapi.go $ tree deploy/crds - ├── deploy/crds/app_v1alpha1_appservice_cr.yaml + ├── deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml ├── deploy/crds/app.example.com_appservices_crd.yaml `, RunE: apiRun, diff --git a/cmd/operator-sdk/add/crd.go b/cmd/operator-sdk/add/crd.go index 62d6627b74..83835e6f84 100644 --- a/cmd/operator-sdk/add/crd.go +++ b/cmd/operator-sdk/add/crd.go @@ -36,7 +36,7 @@ func newAddCRDCmd() *cobra.Command { Long: `The operator-sdk add crd command will create a Custom Resource Definition (CRD) and the Custom Resource (CR) files for the specified api-version and kind. Generated CRD filename: /deploy/crds/__crd.yaml -Generated CR filename: /deploy/crds/___cr.yaml +Generated CR filename: /deploy/crds/___cr.yaml /deploy path must already exist --api-version and --kind are required flags to generate the new operator application. diff --git a/cmd/operator-sdk/generate/openapi.go b/cmd/operator-sdk/generate/openapi.go index 84e5f402a1..5d935c25fb 100644 --- a/cmd/operator-sdk/generate/openapi.go +++ b/cmd/operator-sdk/generate/openapi.go @@ -40,7 +40,7 @@ Example: └── v1alpha1 ├── zz_generated.openapi.go $ tree deploy/crds - ├── deploy/crds/app_v1alpha1_appservice_cr.yaml + ├── deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml ├── deploy/crds/app.example.com_appservices_crd.yaml `, RunE: openAPIFunc, diff --git a/doc/ansible/user-guide.md b/doc/ansible/user-guide.md index aaa6e4391e..89a3330e67 100644 --- a/doc/ansible/user-guide.md +++ b/doc/ansible/user-guide.md @@ -305,10 +305,10 @@ INFO[0000] operator-sdk Version: 0.0.5+git ### Create a Memcached CR -Modify `deploy/crds/cache_v1alpha1_memcached_cr.yaml` as shown and create a `Memcached` custom resource: +Modify `deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml` as shown and create a `Memcached` custom resource: ```sh -$ cat deploy/crds/cache_v1alpha1_memcached_cr.yaml +$ cat deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: @@ -316,7 +316,7 @@ metadata: spec: size: 3 -$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml +$ kubectl apply -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml ``` Ensure that the memcached-operator creates the deployment for the CR: @@ -371,7 +371,7 @@ Change the `spec.size` field in the memcached CR from 3 to 4 and apply the change: ```sh -$ cat deploy/crds/cache_v1alpha1_memcached_cr.yaml +$ cat deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml apiVersion: "cache.example.com/v1alpha1" kind: "Memcached" metadata: @@ -379,7 +379,7 @@ metadata: spec: size: 4 -$ kubectl apply -f deploy/crds/cache_v1alpha1_memcached_cr.yaml +$ kubectl apply -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml ``` Confirm that the operator changes the deployment size: @@ -395,7 +395,7 @@ example-memcached 4 4 4 4 5m Clean up the resources: ```sh -$ kubectl delete -f deploy/crds/cache_v1alpha1_memcached_cr.yaml +$ kubectl delete -f deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml $ kubectl delete -f deploy/operator.yaml $ kubectl delete -f deploy/role_binding.yaml $ kubectl delete -f deploy/role.yaml diff --git a/doc/helm/dev/developer_guide.md b/doc/helm/dev/developer_guide.md index 883967fb11..8b27504d04 100644 --- a/doc/helm/dev/developer_guide.md +++ b/doc/helm/dev/developer_guide.md @@ -38,7 +38,7 @@ INFO[0000] Created deploy/role.yaml INFO[0000] Created deploy/role_binding.yaml INFO[0000] Created deploy/operator.yaml INFO[0000] Created deploy/crds/foo.example.com_foos_crd.yaml -INFO[0000] Created deploy/crds/foo_v1alpha1_foo_cr.yaml +INFO[0000] Created deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml INFO[0000] Created helm-charts/foo/ INFO[0000] Run git init ... Initialized empty Git repository in /home/user/go/src/github.com/operator-framework/foo-operator/.git/ @@ -302,7 +302,7 @@ INFO[0000] operator-sdk Version: v0.2.0+git Now that the operator is watching resource `Foo` for events, the creation of a Custom Resource will trigger our Helm chart to be executed. Take a look at -`deploy/crds/foo_v1alpha1_foo_cr.yaml`. Our chart does not have a `size` value, +`deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml`. Our chart does not have a `size` value, so let's remove it. Your CR file should look like the following: ```yaml @@ -322,7 +322,7 @@ Create a Custom Resource instance of Foo with default var `state` set to `present`: ```sh -$ kubectl apply -f deploy/crds/foo_v1alpha1_foo_cr.yaml +$ kubectl apply -f deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml foo.foo.example.com/example-foo created ``` @@ -353,7 +353,7 @@ replicaset.apps/example-foo-4f8ay4vfr99ulx905hax3j6x1-9dfd67fc6 1 1 ``` -Modify `deploy/crds/foo_v1alpha1_foo_cr.yaml` to set `replicaCount` to `2`: +Modify `deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml` to set `replicaCount` to `2`: ```yaml apiVersion: "foo.example.com/v1alpha1" @@ -368,7 +368,7 @@ spec: Apply the changes to Kubernetes and confirm that the deployment has 2 replicas: ```sh -$ kubectl apply -f deploy/crds/foo_v1alpha1_foo_cr.yaml +$ kubectl apply -f deploy/crds/foo.example.com_v1alpha1_foo_cr.yaml foo.foo.example.com/example-foo configured $ kubectl get deployment -l app.kubernetes.io/instance=${RELEASE_NAME} diff --git a/doc/helm/user-guide.md b/doc/helm/user-guide.md index 3c018583e2..13661e6d7c 100644 --- a/doc/helm/user-guide.md +++ b/doc/helm/user-guide.md @@ -118,7 +118,7 @@ value called `replicaCount` and it is set to `1` by default. If we want to have 2 nginx instances in our deployment, we would need to make sure our CR spec contained `replicaCount: 2`. -Update `deploy/crds/helm_v1alpha1_nginx_cr.yaml` to look like the following: +Update `deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml` to look like the following: ```yaml apiVersion: helm.example.com/v1alpha1 @@ -130,7 +130,7 @@ spec: ``` Similarly, we see that the default service port is set to `80`, but we would -like to use `8080`, so we'll again update `deploy/crds/helm_v1alpha1_nginx_cr.yaml` +like to use `8080`, so we'll again update `deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml` by adding the service port override: ```yaml @@ -247,7 +247,7 @@ INFO[0000] operator-sdk Version: v0.2.0+git Apply the nginx CR that we modified earlier: ```sh -kubectl apply -f deploy/crds/helm_v1alpha1_nginx_cr.yaml +kubectl apply -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml ``` Ensure that the nginx-operator creates the deployment for the CR: @@ -281,7 +281,7 @@ Change the `spec.replicaCount` field from 2 to 3, remove the `spec.service` field, and apply the change: ```sh -$ cat deploy/crds/helm_v1alpha1_nginx_cr.yaml +$ cat deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml apiVersion: "helm.example.com/v1alpha1" kind: "Nginx" metadata: @@ -289,7 +289,7 @@ metadata: spec: replicaCount: 3 -$ kubectl apply -f deploy/crds/helm_v1alpha1_nginx_cr.yaml +$ kubectl apply -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml ``` Confirm that the operator changes the deployment size: @@ -313,7 +313,7 @@ example-nginx-b9phnoz9spckcrua7ihrbkrt1 ClusterIP 10.96.26.3 Clean up the resources: ```sh -kubectl delete -f deploy/crds/helm_v1alpha1_nginx_cr.yaml +kubectl delete -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml kubectl delete -f deploy/operator.yaml kubectl delete -f deploy/role_binding.yaml kubectl delete -f deploy/role.yaml diff --git a/doc/migration/v0.1.0-migration-guide.md b/doc/migration/v0.1.0-migration-guide.md index 3bf41430ea..230c43a205 100644 --- a/doc/migration/v0.1.0-migration-guide.md +++ b/doc/migration/v0.1.0-migration-guide.md @@ -284,7 +284,7 @@ For any updates made to the following manifests in the old project, copy over th - `tmp/build/Dockerfile` to `build/Dockerfile` - There is no tmp directory in the new project layout - RBAC rules updates from `deploy/rbac.yaml` to `deploy/role.yaml` and `deploy/role_binding.yaml` -- `deploy/cr.yaml` to `deploy/crds/___cr.yaml` +- `deploy/cr.yaml` to `deploy/crds/___cr.yaml` - `deploy/crd.yaml` to `deploy/crds/___crd.yaml` ### Copy user defined dependencies diff --git a/doc/proposals/helm-operator.md b/doc/proposals/helm-operator.md index 04dff78ac6..b5d150b6cc 100644 --- a/doc/proposals/helm-operator.md +++ b/doc/proposals/helm-operator.md @@ -88,7 +88,7 @@ The resulting structure will be: | | | |-- crds | | __crd.yaml -| | _cr.yaml +| | ___cr.yaml ``` The SDK CLI will use the presence of the `helm-charts` directory to detect a `helm` type project. diff --git a/doc/proposals/improved-scorecard-config.md b/doc/proposals/improved-scorecard-config.md index 5eb4d371e3..4c9efb9ceb 100644 --- a/doc/proposals/improved-scorecard-config.md +++ b/doc/proposals/improved-scorecard-config.md @@ -70,8 +70,8 @@ scorecard: - name: Basic Tests basic: cr-manifest: - - "deploy/crds/cache_v1alpha1_memcached_cr.yaml" - - "deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml" init-timeout: 60 csv-path: "deploy/olm-catalog/memcached-operator/0.0.3/memcached-operator.v0.0.3.clusterserviceversion.yaml" proxy-image: "scorecard-proxy" @@ -79,8 +79,8 @@ scorecard: - name: OLM Tests olm: cr-manifest: - - "deploy/crds/cache_v1alpha1_memcached_cr.yaml" - - "deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml" init-timeout: 60 csv-path: "deploy/olm-catalog/memcached-operator/0.0.3/memcached-operator.v0.0.3.clusterserviceversion.yaml" proxy-image: "scorecard-proxy" diff --git a/doc/sdk-cli-reference.md b/doc/sdk-cli-reference.md index d086c9defd..dd42ad6623 100644 --- a/doc/sdk-cli-reference.md +++ b/doc/sdk-cli-reference.md @@ -344,7 +344,7 @@ INFO[0000] Created pkg/apis/app/v1alpha1/appservice_types.go INFO[0000] Created pkg/apis/addtoscheme_app_v1alpha1.go INFO[0000] Created pkg/apis/app/v1alpha1/register.go INFO[0000] Created pkg/apis/app/v1alpha1/doc.go -INFO[0000] Created deploy/crds/app_v1alpha1_appservice_cr.yaml +INFO[0000] Created deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml INFO[0000] Created deploy/crds/app.example.com_appservices_crd.yaml INFO[0001] Running deepcopy code-generation for Custom Resource group versions: [app:[v1alpha1], ] INFO[0002] Code-generation complete. @@ -387,7 +387,7 @@ Generates the CRD and the CR files for the specified api-version and kind. $ operator-sdk add crd --api-version app.example.com/v1alpha1 --kind AppService Generating custom resource definition (CRD) files Created deploy/crds/app.example.com_appservices_crd.yaml -Created deploy/crds/app_v1alpha1_appservice_cr.yaml +Created deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml ``` ## run @@ -452,7 +452,7 @@ Run scorecard tests on an operator ### Example ```console -$ operator-sdk scorecard --cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml --csv-path deploy/olm-catalog/memcached-operator/0.0.2/memcached-operator.v0.0.2.clusterserviceversion.yaml +$ operator-sdk scorecard --cr-manifest deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml --csv-path deploy/olm-catalog/memcached-operator/0.0.2/memcached-operator.v0.0.2.clusterserviceversion.yaml Basic Operator: Spec Block Exists: 1/1 points Status Block Exist: 1/1 points diff --git a/doc/test-framework/scorecard.md b/doc/test-framework/scorecard.md index 68d6f46dbc..0b59cf06db 100644 --- a/doc/test-framework/scorecard.md +++ b/doc/test-framework/scorecard.md @@ -37,7 +37,7 @@ To run the tests, simply run the `scorecard` subcommand from your project root w use. For example: ```console -$ operator-sdk scorecard --cr-manifest deploy/crds/app_operator_cr.yaml --csv-path deploy/app_operator-0.0.2.yaml +$ operator-sdk scorecard --cr-manifest deploy/crds/app.example.com_operator_cr.yaml --csv-path deploy/app_operator-0.0.2.yaml ``` ## Config File @@ -45,12 +45,12 @@ $ operator-sdk scorecard --cr-manifest deploy/crds/app_operator_cr.yaml --csv-pa The scorecard supports the use of a config file instead of or in addition to flags for configuration. By default, the scorecard will look for a file called `.osdk-scorecard` with either a `.yaml`, `.json`, or `.toml` file extension. You can also specify a different config file with the `--config` flag. The configuration options in the config file match the flags. -For instance, for the flags `--cr-manifest "deploy/crds/cache_v1alpha1_memcached_cr.yaml" --cr-manifest "deploy/crds/cache_v1alpha1_memcached2_cr.yaml" --init-timeout 60 --csv-path "deploy/olm-catalog/memcached-operator/0.0.2/memcached-operator.v0.0.2.clusterserviceversion.yaml"`, the corresponding yaml config file would contain: +For instance, for the flags `--cr-manifest "deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml" --cr-manifest "deploy/crds/cache.example.com_v1alpha1_memcached2_cr.yaml" --init-timeout 60 --csv-path "deploy/olm-catalog/memcached-operator/0.0.2/memcached-operator.v0.0.2.clusterserviceversion.yaml"`, the corresponding yaml config file would contain: ```yaml cr-manifest: - - "deploy/crds/cache_v1alpha1_memcached_cr.yaml" - - "deploy/crds/cache_v1alpha1_memcached2_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcached2_cr.yaml" init-timeout: 60 csv-path: "deploy/olm-catalog/memcached-operator/0.0.2/memcached-operator.v0.0.2.clusterserviceversion.yaml" ``` diff --git a/doc/user-guide.md b/doc/user-guide.md index bb664cc90d..f6c96dc837 100644 --- a/doc/user-guide.md +++ b/doc/user-guide.md @@ -291,10 +291,10 @@ You can use a specific kubeconfig via the flag `--kubeconfig=___cr.yaml` +* Custom Resources (CR's): `crds/___cr.yaml` * Custom Resource Definitions (CRD's): `crds/__crd.yaml`. `gen-csv` reads these files and adds their data to a CSV in an alternate form. diff --git a/hack/tests/e2e-ansible.sh b/hack/tests/e2e-ansible.sh index 70174fbc21..c53a628ce6 100755 --- a/hack/tests/e2e-ansible.sh +++ b/hack/tests/e2e-ansible.sh @@ -42,7 +42,7 @@ test_operator() { fi # create CR - kubectl create -f deploy/crds/ansible_v1alpha1_memcached_cr.yaml + kubectl create -f deploy/crds/ansible.example.com_v1alpha1_memcached_cr.yaml if ! timeout 20s bash -c -- 'until kubectl get deployment -l app=memcached | grep memcached; do sleep 1; done'; then echo FAIL: operator failed to create memcached Deployment @@ -63,7 +63,7 @@ test_operator() { kubectl create configmap deleteme trap_add 'kubectl delete --ignore-not-found configmap deleteme' EXIT - kubectl delete -f ${OPERATORDIR}/deploy/crds/ansible_v1alpha1_memcached_cr.yaml --wait=true + kubectl delete -f ${OPERATORDIR}/deploy/crds/ansible.example.com_v1alpha1_memcached_cr.yaml --wait=true # if the finalizer did not delete the configmap... if kubectl get configmap deleteme 2> /dev/null; then diff --git a/hack/tests/e2e-helm.sh b/hack/tests/e2e-helm.sh index e07794c641..64667fc30c 100755 --- a/hack/tests/e2e-helm.sh +++ b/hack/tests/e2e-helm.sh @@ -50,8 +50,8 @@ test_operator() { fi # create CR - kubectl create -f deploy/crds/helm_v1alpha1_nginx_cr.yaml - trap_add 'kubectl delete --ignore-not-found -f ${OPERATORDIR}/deploy/crds/helm_v1alpha1_nginx_cr.yaml' EXIT + kubectl create -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml + trap_add 'kubectl delete --ignore-not-found -f ${OPERATORDIR}/deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml' EXIT if ! timeout 1m bash -c -- 'until kubectl get nginxes.helm.example.com example-nginx -o jsonpath="{..status.deployedRelease.name}" | grep "example-nginx"; do sleep 1; done'; then kubectl logs deployment/nginx-operator @@ -102,7 +102,7 @@ test_operator() { exit 1 fi - kubectl delete -f deploy/crds/helm_v1alpha1_nginx_cr.yaml --wait=true + kubectl delete -f deploy/crds/helm.example.com_v1alpha1_nginx_cr.yaml --wait=true kubectl logs deployment/nginx-operator | grep "Uninstalled release" | grep "${release_name}" } diff --git a/hack/tests/scorecard-subcommand.sh b/hack/tests/scorecard-subcommand.sh index 35e6b525b4..0af63d5485 100755 --- a/hack/tests/scorecard-subcommand.sh +++ b/hack/tests/scorecard-subcommand.sh @@ -12,8 +12,8 @@ set -ex # the test framework directory has all the manifests needed to run the cluster pushd test/test-framework commandoutput="$(operator-sdk scorecard \ - --cr-manifest deploy/crds/cache_v1alpha1_memcached_cr.yaml \ - --cr-manifest deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml \ + --cr-manifest deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml \ + --cr-manifest deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml \ --init-timeout 60 \ --csv-path "$CSV_PATH" \ --verbose \ diff --git a/internal/pkg/scaffold/ansible/molecule_test_cluster_playbook.go b/internal/pkg/scaffold/ansible/molecule_test_cluster_playbook.go index ba95866ffe..9573b85a64 100644 --- a/internal/pkg/scaffold/ansible/molecule_test_cluster_playbook.go +++ b/internal/pkg/scaffold/ansible/molecule_test_cluster_playbook.go @@ -48,12 +48,12 @@ const moleculeTestClusterPlaybookAnsibleTmpl = `--- ansible_python_interpreter: '{{ ansible_playbook_python }}' deploy_dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/deploy" image_name: [[.Resource.FullGroup]]/[[.ProjectName]]:testing - custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.Group]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) | from_yaml }}" + custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.FullGroup]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) | from_yaml }}" tasks: - name: Create the [[.Resource.FullGroup]]/[[.Resource.Version]].[[.Resource.Kind]] k8s: namespace: '{{ namespace }}' - definition: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.Group]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) }}" + definition: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.FullGroup]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) }}" - name: Get the newly created Custom Resource debug: diff --git a/internal/pkg/scaffold/ansible/molecule_test_local_playbook.go b/internal/pkg/scaffold/ansible/molecule_test_local_playbook.go index 473df55fcc..22ee7a6700 100644 --- a/internal/pkg/scaffold/ansible/molecule_test_local_playbook.go +++ b/internal/pkg/scaffold/ansible/molecule_test_local_playbook.go @@ -65,7 +65,7 @@ const moleculeTestLocalPlaybookAnsibleTmpl = `--- deploy_dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/deploy" pull_policy: Never REPLACE_IMAGE: [[.Resource.FullGroup]]/[[.ProjectName]]:testing - custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.Group]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) | from_yaml }}" + custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/[[.Resource.FullGroup]]_[[.Resource.Version]]_[[.Resource.LowerKind]]_cr.yaml'])) | from_yaml }}" tasks: - block: - name: Delete the Operator Deployment diff --git a/internal/pkg/scaffold/cr.go b/internal/pkg/scaffold/cr.go index 571125153f..ee28d8b32c 100644 --- a/internal/pkg/scaffold/cr.go +++ b/internal/pkg/scaffold/cr.go @@ -23,7 +23,7 @@ import ( "github.com/operator-framework/operator-sdk/internal/pkg/scaffold/input" ) -// CR is the input needed to generate a deploy/crds/___cr.yaml file +// CR is the input needed to generate a deploy/crds/___cr.yaml file type CR struct { input.Input @@ -37,11 +37,7 @@ type CR struct { func (s *CR) GetInput() (input.Input, error) { if s.Path == "" { - fileName := fmt.Sprintf("%s_%s_%s_cr.yaml", - s.Resource.GoImportGroup, - strings.ToLower(s.Resource.Version), - s.Resource.LowerKind) - s.Path = filepath.Join(CRDsDir, fileName) + s.Path = crPathForResource(CRDsDir, s.Resource) } s.TemplateBody = crTemplate if s.TemplateFuncs == nil { @@ -51,6 +47,11 @@ func (s *CR) GetInput() (input.Input, error) { return s.Input, nil } +func crPathForResource(dir string, r *Resource) string { + file := fmt.Sprintf("%s_%s_%s_cr.yaml", r.FullGroup, r.Version, r.LowerKind) + return filepath.Join(dir, file) +} + func indent(spaces int, v string) string { pad := strings.Repeat(" ", spaces) return pad + strings.Replace(v, "\n", "\n"+pad, -1) diff --git a/internal/pkg/scaffold/olm-catalog/config_test.go b/internal/pkg/scaffold/olm-catalog/config_test.go index 88ead210cf..b3a45cfab9 100644 --- a/internal/pkg/scaffold/olm-catalog/config_test.go +++ b/internal/pkg/scaffold/olm-catalog/config_test.go @@ -43,13 +43,13 @@ func TestConfig(t *testing.T) { t.Errorf("Set fields crd-cr paths dir file mix: (%v)", err) } want := []string{ - filepath.Join(crdsDir, "app_v1alpha1_appservice_cr.yaml"), + filepath.Join(crdsDir, "app.example.com_v1alpha1_appservice_cr.yaml"), filepath.Join(crdsDir, "app.example.com_appservices_crd.yaml"), filepath.Join(crdsDir, "app.example.com_appservices2_crd.yaml"), } sort.Strings(want) sort.Strings(cfg.CRDCRPaths) if !reflect.DeepEqual(want, cfg.CRDCRPaths) { - t.Errorf("Wanted crd/cr files %v, got %v", want, cfg.CRDCRPaths) + t.Errorf("Files in crd-cr-paths do not match expected:\nwanted: %+q\ngot: %+q", want, cfg.CRDCRPaths) } } diff --git a/internal/pkg/scaffold/olm-catalog/testdata/deploy/crds/app_v1alpha1_appservice_cr.yaml b/internal/pkg/scaffold/olm-catalog/testdata/deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml similarity index 100% rename from internal/pkg/scaffold/olm-catalog/testdata/deploy/crds/app_v1alpha1_appservice_cr.yaml rename to internal/pkg/scaffold/olm-catalog/testdata/deploy/crds/app.example.com_v1alpha1_appservice_cr.yaml diff --git a/test/ansible-inventory/deploy/crds/inventory_v1alpha1_inventory_cr.yaml b/test/ansible-inventory/deploy/crds/inventory.apps.fabianism.us_v1alpha1_inventory_cr.yaml similarity index 100% rename from test/ansible-inventory/deploy/crds/inventory_v1alpha1_inventory_cr.yaml rename to test/ansible-inventory/deploy/crds/inventory.apps.fabianism.us_v1alpha1_inventory_cr.yaml diff --git a/test/ansible-inventory/molecule/test-local/playbook.yml b/test/ansible-inventory/molecule/test-local/playbook.yml index 5b3fc6c80c..1e013af1b8 100644 --- a/test/ansible-inventory/molecule/test-local/playbook.yml +++ b/test/ansible-inventory/molecule/test-local/playbook.yml @@ -24,7 +24,7 @@ deploy_dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/deploy" pull_policy: Never REPLACE_IMAGE: inventory.apps.fabianism.us/inventory:testing - custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/inventory_v1alpha1_inventory_cr.yaml'])) | from_yaml }}" + custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/inventory.apps.fabianism.us_v1alpha1_inventory_cr.yaml'])) | from_yaml }}" tasks: - name: Delete the Operator Deployment k8s: diff --git a/test/ansible-memcached/asserts.yml b/test/ansible-memcached/asserts.yml index a5043d3f38..6e197b0a5c 100644 --- a/test/ansible-memcached/asserts.yml +++ b/test/ansible-memcached/asserts.yml @@ -6,7 +6,7 @@ vars: ansible_python_interpreter: '{{ ansible_playbook_python }}' deploy_dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/deploy" - custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/ansible_v1alpha1_memcached_cr.yaml'])) | from_yaml }}" + custom_resource: "{{ lookup('file', '/'.join([deploy_dir, 'crds/ansible.example.com_v1alpha1_memcached_cr.yaml'])) | from_yaml }}" tasks: - block: - name: debug memcached lookup diff --git a/test/test-framework/.test-osdk-scorecard.yaml b/test/test-framework/.test-osdk-scorecard.yaml index eb3b943311..9ea590bf5d 100644 --- a/test/test-framework/.test-osdk-scorecard.yaml +++ b/test/test-framework/.test-osdk-scorecard.yaml @@ -1,6 +1,6 @@ cr-manifest: - - "deploy/crds/cache_v1alpha1_memcached_cr.yaml" - - "deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml" + - "deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml" init-timeout: 60 csv-path: "deploy/olm-catalog/memcached-operator/0.0.3/memcached-operator.v0.0.3.clusterserviceversion.yaml" verbose: true diff --git a/test/test-framework/deploy/crds/cache_v1alpha1_memcached_cr.yaml b/test/test-framework/deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml similarity index 100% rename from test/test-framework/deploy/crds/cache_v1alpha1_memcached_cr.yaml rename to test/test-framework/deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml diff --git a/test/test-framework/deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml b/test/test-framework/deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml similarity index 100% rename from test/test-framework/deploy/crds/cache_v1alpha1_memcachedrs_cr.yaml rename to test/test-framework/deploy/crds/cache.example.com_v1alpha1_memcachedrs_cr.yaml