Skip to content

Commit

Permalink
Align tutorial imports with test samples (#4465)
Browse files Browse the repository at this point in the history
Signed-off-by: varshaprasad96 <varshaprasad96@gmail.com>
  • Loading branch information
varshaprasad96 committed Feb 3, 2021
1 parent f340790 commit 16b8dae
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The operator's Manager supports the core Kubernetes resource types as found in t

```Go
import (
cachev1alpha1 "github.com/example-inc/memcached-operator/api/v1alpha1
cachev1alpha1 "github.com/example/memcached-operator/api/v1alpha1
...
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ So let's create a new project with the same domain (`example.com`):
```sh
mkdir memcached-operator
cd memcached-operator
operator-sdk init --domain example.com --repo github.com/example-inc/memcached-operator
operator-sdk init --domain example.com --repo github.com/example/memcached-operator
```

**Note**: `operator-sdk` attempts to automatically discover the Go module path of your project by looking for a `go.mod` file, or if in `$GOPATH`, by using the directory path. Use the `--repo` flag to explicitly set the module path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ with the Go plugin to initialize the project.
```sh
mkdir memcached-operator
cd memcached-operator
operator-sdk init --domain=example.com --repo=github.com/example-inc/memcached-operator
operator-sdk init --domain=example.com --repo=github.com/example/memcached-operator
```

### Create an API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ Example:
```Go
import (
"context"
cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1"
ctrl "sigs.k8s.io/controller-runtime"

cachev1alpha1 "github.com/example/memcached-operator/api/v1alpha1"
)

func (r *AppReconciler) Reconcile(context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"

cachev1alpha1 "github.com/example-inc/app-operator/apis/cache/v1alpha1"
cachev1alpha1 "github.com/example/app-operator/api/v1alpha1"
)

...
Expand Down
6 changes: 3 additions & 3 deletions website/content/en/docs/building-operators/golang/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $ mkdir -p $HOME/projects/memcached-operator
$ cd $HOME/projects/memcached-operator
# we'll use a domain of example.com
# so all API groups will be <group>.example.com
$ operator-sdk init --domain=example.com --repo=github.com/example-inc/memcached-operator
$ operator-sdk init --domain=example.com --repo=github.com/example/memcached-operator
```

To learn about the project directory structure, see [Kubebuilder project layout][kubebuilder_layout_doc] doc.
Expand Down Expand Up @@ -221,7 +221,7 @@ Every Controller has a Reconciler object with a `Reconcile()` method that implem
import (
ctrl "sigs.k8s.io/controller-runtime"
cachev1alpha1 "github.com/example-inc/memcached-operator/api/v1alpha1"
cachev1alpha1 "github.com/example/memcached-operator/api/v1alpha1"
...
)
Expand Down Expand Up @@ -495,7 +495,7 @@ Also see the [advanced topics][advanced_topics] doc for more use cases and under
[markers]: https://book.kubebuilder.io/reference/markers.html
[crd-markers]: https://book.kubebuilder.io/reference/markers/crd-validation.html
[rbac-markers]: https://book.kubebuilder.io/reference/markers/rbac.html
[memcached_controller]: https://github.com/operator-framework/operator-sdk/blob/v1.2.0/testdata/go/memcached-operator/controllers/memcached_controller.go
[memcached_controller]: https://github.com/operator-framework/operator-sdk/blob/v1.3.x/testdata/go/v3/memcached-operator/controllers/memcached_controller.go
[builder_godocs]: https://godoc.org/github.com/kubernetes-sigs/controller-runtime/pkg/builder#example-Builder
[legacy_quickstart_doc]:https://v0-19-x.sdk.operatorframework.io/docs/golang/legacy/quickstart/
[activate_modules]: https://github.com/golang/go/wiki/Modules#how-to-install-and-activate-module-support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ operator-sdk --version
operator-sdk version 0.1.0

# Create new project
$ cd $GOPATH/src/github.com/example-inc/
$ cd $GOPATH/src/github.com/example/
$ mv memcached-operator old-memcached-operator
$ operator-sdk new memcached-operator --skip-git-init
$ ls
Expand Down Expand Up @@ -88,7 +88,7 @@ pkg/controller/
Inspect the `add()` function in your `pkg/controller/<kind>/<kind>_controller.go` file:
```Go
import (
cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1"
cachev1alpha1 "github.com/example/memcached-operator/pkg/apis/cache/v1alpha1"
...
)

Expand Down Expand Up @@ -154,7 +154,7 @@ Be sure to keep the initial section in the `Reconcile()` code that looks up the
```Go
import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
cachev1alpha1 "github.com/example-inc/memcached-operator/pkg/apis/cache/v1alpha1"
cachev1alpha1 "github.com/example/memcached-operator/pkg/apis/cache/v1alpha1"
...
)
func (r *ReconcileMemcached) Reconcile(request reconcile.Request) (reconcile.Result, error) {
Expand Down

0 comments on commit 16b8dae

Please sign in to comment.