Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/tests/e2e-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ci/tests/e2e-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
}

Expand Down
4 changes: 2 additions & 2 deletions ci/tests/scorecard-subcommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-sdk/add/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-sdk/add/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: <project-name>/deploy/crds/<full group>_<resource>_crd.yaml
Generated CR filename: <project-name>/deploy/crds/<group>_<version>_<kind>_cr.yaml
Generated CR filename: <project-name>/deploy/crds/<full group>_<version>_<kind>_cr.yaml

<project-name>/deploy path must already exist
--api-version and --kind are required flags to generate the new operator application.
Expand Down
2 changes: 1 addition & 1 deletion cmd/operator-sdk/generate/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions doc/ansible/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,18 +305,18 @@ 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:
name: "example-memcached"
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:
Expand Down Expand Up @@ -371,15 +371,15 @@ 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:
name: "example-memcached"
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:
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions doc/helm/dev/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand All @@ -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
```

Expand Down Expand Up @@ -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"
Expand All @@ -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}
Expand Down
12 changes: 6 additions & 6 deletions doc/helm/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -281,15 +281,15 @@ 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:
name: "example-nginx"
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:
Expand All @@ -313,7 +313,7 @@ example-nginx-b9phnoz9spckcrua7ihrbkrt1 ClusterIP 10.96.26.3 <none>
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
Expand Down
2 changes: 1 addition & 1 deletion doc/migration/v0.1.0-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<group>_<version>_<kind>_cr.yaml`
- `deploy/cr.yaml` to `deploy/crds/<full group>_<version>_<kind>_cr.yaml`
- `deploy/crd.yaml` to `deploy/crds/<group>_<version>_<kind>_crd.yaml`

### Copy user defined dependencies
Expand Down
2 changes: 1 addition & 1 deletion doc/proposals/helm-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ The resulting structure will be:
| |
| |-- crds
| | <full group>_<resource>_crd.yaml
| | <gvk>_cr.yaml
| | <full group>_<version>_<kind>_cr.yaml
```

The SDK CLI will use the presence of the `helm-charts` directory to detect a `helm` type project.
Expand Down
8 changes: 4 additions & 4 deletions doc/proposals/improved-scorecard-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ 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"
proxy-pull-policy: "Never"
- 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"
Expand Down
6 changes: 3 additions & 3 deletions doc/sdk-cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions doc/test-framework/scorecard.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ 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

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"
```
Expand Down
12 changes: 6 additions & 6 deletions doc/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,18 +291,18 @@ You can use a specific kubeconfig via the flag `--kubeconfig=<path/to/kubeconfig

## Create a Memcached CR

Create the example `Memcached` CR that was generated at `deploy/crds/cache_v1alpha1_memcached_cr.yaml`:
Create the example `Memcached` CR that was generated at `deploy/crds/cache.example.com_v1alpha1_memcached_cr.yaml`:

```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:
name: "example-memcached"
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:
Expand Down Expand Up @@ -352,15 +352,15 @@ status:
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:
name: "example-memcached"
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:
Expand All @@ -376,7 +376,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
Expand Down
2 changes: 1 addition & 1 deletion doc/user/olm-catalog/generating-a-csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Operator SDK projects have an expected [project layout][doc-project-layout]. In

* Roles: `role.yaml`
* Deployments: `operator.yaml`
* Custom Resources (CR's): `crds/<group>_<version>_<kind>_cr.yaml`
* Custom Resources (CR's): `crds/<full group>_<version>_<kind>_cr.yaml`
* Custom Resource Definitions (CRD's): `crds/<full group>_<resource>_crd.yaml`.

`gen-csv` reads these files and adds their data to a CSV in an alternate form.
Expand Down
Loading