Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go mod support for new operators #1001

Merged
merged 76 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
e201051
* commands/.../print_deps.go: print deps based on dep manager type
estroz Mar 26, 2019
0b4a8e2
doc/*: revert migration guide and add Gopkg.toml to cli ref
estroz Mar 26, 2019
2635649
commands/.../print_deps.go: add Gopkg.toml to help text
estroz Mar 26, 2019
a8ef312
Merge branch 'master' into go-mod
estroz Mar 28, 2019
dcb09f7
fix license dates
estroz Mar 28, 2019
327321b
cmd/operator-sdk/migrate/cmd.go: add Repo to scaffold Config
estroz Mar 28, 2019
b164bb8
internal/util/projutil: GoBuild() runs 'go build'
estroz Mar 28, 2019
e1f80b6
*: replace 'go build' with projutil.GoBuild()
estroz Mar 28, 2019
5294c0b
cmd/operator-sdk/migrate/cmd.go: support --dep-manager flag
estroz Mar 28, 2019
277f40f
pkg/scaffold/*go_mod.go: fix ansible, helm go.mod scaffold dependenci…
estroz Mar 28, 2019
ac7b7fd
go_mod.go: Print*() takes an asFile argument instead of having 2 fn's
estroz Mar 28, 2019
95443fd
Merge branch 'master' into go-mod
estroz Mar 28, 2019
de7bd14
test/e2e/memcached_test.go: go mod gets local changes instead of copying
estroz Mar 29, 2019
90de1be
move dependency manager check to projutil and error if no manager fil…
estroz Apr 2, 2019
8484838
fix error message case
estroz Apr 2, 2019
ea63193
Merge branch 'master' into go-mod
estroz Apr 5, 2019
c4959cc
release.sh: check gopkg_toml*.go versions
estroz Apr 5, 2019
3924a9e
bump to go 1.12
estroz Apr 5, 2019
de0d3a1
Merge branch 'master' into go-mod
estroz Apr 5, 2019
9e467e1
internal/pkg/scaffold/*go_mod*.go: bump sdk version to v0.7.0
estroz Apr 5, 2019
29956fe
internal/util/projutil/project_util.go: functions for detecting opera…
estroz Apr 5, 2019
5c88a4f
Gopkg.lock: revendor
estroz Apr 5, 2019
d99fc0a
cmd/operator-sdk/migrate: choose correct deps files to scaffold
estroz Apr 5, 2019
196f454
internal/pkg/scaffold/{anisble,helm}: update mods
estroz Apr 5, 2019
e009edd
Merge branch 'master' into go-mod
estroz Apr 5, 2019
e4d3ad1
Merge branch 'master' into go-mod
estroz Apr 9, 2019
5fe4704
cmd/operator-sdk/add/api.go: add stub.go to new API scaffolds
estroz Apr 9, 2019
eaabb20
Merge branch 'master' into go-mod
estroz Apr 10, 2019
5dc0872
undo project reorg
estroz Apr 25, 2019
fb6fb7c
Merge branch 'master' into go-mod
estroz Apr 25, 2019
0adf300
update tools
estroz Apr 25, 2019
b98493f
internal/pkg/scaffold: update go_mod.go's after testing on projects
estroz Apr 25, 2019
be5c471
remove extra path in go repo path
estroz Apr 25, 2019
4f4f690
use Parse instead of ParseLax, which ignores non-require statements
estroz Apr 25, 2019
993a715
some reversions
estroz Apr 25, 2019
39dca64
separate deps scaffold functions for helm and ansible
estroz Apr 25, 2019
4dc2e39
update release info and script
estroz Apr 25, 2019
1d8e2a7
Merge branch 'master' into go-mod
estroz Apr 25, 2019
30cf837
internal/util/projutil/exec.go: GoCmdOptions.NoGoMod for go modules o…
estroz Apr 25, 2019
375ee8b
add convenience function for dep manager check
estroz Apr 26, 2019
2df4817
check dep manager type when running go build/test
estroz Apr 26, 2019
a99bada
Merge branch 'master' into go-mod
estroz Apr 30, 2019
afc803a
add notes on dep manager; revert from go 1.12 to go 1.11
estroz Apr 30, 2019
028f15c
use replace line for e2e test instead of require
estroz Apr 30, 2019
ac85efc
some doc reversions and updates
estroz Apr 30, 2019
93e7001
CHANGELOG.md: added go module support, --dep-manager flag
estroz Apr 30, 2019
a2e709b
revert comment and md changes
estroz Apr 30, 2019
d0e58a4
Update CHANGELOG.md
hasbro17 May 1, 2019
7904db6
metrics: expose ansible operator metrics (#1263)
jmrodri Apr 29, 2019
1f5310b
cmd/operator-sdk/up/local.go: sdk up local should build by manager pa…
chechiachang Apr 30, 2019
8121298
commands/.../scorecard: add support for JSON output (#1228)
AlexNPavel May 1, 2019
ba2283e
internal/pkg/scaffold/crd.go: overwrite CRD manifests for Go operator…
estroz May 2, 2019
5cdfb5a
Useful Debug help (#1352)
jtaleric May 2, 2019
e55cf3f
remove controller-tools/pkg/crd/generator from generated dep manager …
estroz May 2, 2019
c99eadc
revert NoGoMod -> GoMod
estroz May 2, 2019
8ffcc05
use modules instead of mod as CLI option for go modules
estroz May 2, 2019
31fcdef
fix print statements
estroz May 2, 2019
2f2f6e8
remove tidy and revendor operator types
estroz May 2, 2019
089a39f
Merge branch 'master' into go-mod
estroz May 2, 2019
6d9af7d
Update doc/project_layout.md
hasbro17 May 2, 2019
01b6886
update controller-tools/pkg/crd/generator version
estroz May 2, 2019
5acab6e
add k8s.io/apiextensions-apiserver/pkg/apis/apiextensions to toos.go,…
estroz May 3, 2019
0cda993
Merge branch 'master' into go-mod
estroz May 3, 2019
2a02d77
fix CLI ref to modules
estroz May 3, 2019
be5fa01
check AddReplace error in Go e2e
estroz May 3, 2019
31ab429
mods after tools update
estroz May 3, 2019
5b95708
fail scaffold if --dep-manager=modules and go modules are not active
estroz May 3, 2019
2e5c130
update docs on dependency management
estroz May 3, 2019
bc02ad3
set GO111MODULE=on in ansible and helm e2e
estroz May 3, 2019
b443cf6
bump to go 1.12
estroz May 3, 2019
110188c
fix unit test
estroz May 3, 2019
a2cdcec
Merge branch 'master' into go-mod
estroz May 6, 2019
3be885f
revert docs changes
estroz May 7, 2019
5173130
remove stub.go scaffold and fix grammar error
estroz May 7, 2019
6fb9f7d
Merge branch 'master' into go-mod
estroz May 7, 2019
e4834c1
fix GoModOn bug
estroz May 8, 2019
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cache:
- $HOME/.cache/go-build

go:
- 1.10.3
- 1.11.x

# The `x_base_steps` top-level key is unknown to travis,
# so we can use it to create a bunch of common build step
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- New option for [`operator-sdk build --image-builder`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#build), which can be used to specify which image builder to use. Adds support for [buildah](https://github.com/containers/buildah/). ([#1311](https://github.com/operator-framework/operator-sdk/pull/1311))
- Manager is now configured with a new `DynamicRESTMapper`, which accounts for the fact that the default `RESTMapper`, which only checks resource types at startup, can't handle the case of first creating a CRD and then an instance of that CRD. ([#1329](https://github.com/operator-framework/operator-sdk/pull/1329))
- [Go module](https://github.com/golang/go/wiki/Modules) support by default for new Go operators and during Ansible and Helm operator migration. The dependency manager used for a new operator can be explicitly specified for new operators through the `--dep-manager` flag, available in [`operator-sdk new`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#new) and [`operator-sdk migrate`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#migrate). `dep` is still available through `--dep-manager=dep`. ([#1001](https://github.com/operator-framework/operator-sdk/pull/1001))

### Changed

Expand All @@ -13,6 +14,7 @@
- Renamed `--docker-build-args` option to `--image-build-args` option for `build` subcommand, because this option can now be shared with other image build tools than docker when `--image-builder` option is specified. ([#1311](https://github.com/operator-framework/operator-sdk/pull/1311))
- Reduces Helm release information in CR status to only the release name and manifest and moves it from `status.conditions` to a new top-level `deployedRelease` field. ([#1309](https://github.com/operator-framework/operator-sdk/pull/1309))
- **WARNING**: Users with active CRs and releases who are upgrading their helm-based operator should upgrade to one based on v0.7.0 before upgrading further. Helm operators based on v0.8.0+ will not seamlessly transition release state to the persistent backend, and will instead uninstall and reinstall all managed releases.
- Go operator CRDs are overwritten when being regenerated by [`operator-sdk generate openapi`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#openapi). Users can now rely on `+kubebuilder` annotations in their API code, which provide access to most OpenAPIv3 [validation properties](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schema-object) (the full set will be supported in the near future, see [this PR](https://github.com/kubernetes-sigs/controller-tools/pull/190)) and [other CRD fields](https://book.kubebuilder.io/beyond_basics/generating_crd.html). ([#1278](https://github.com/operator-framework/operator-sdk/pull/1278))

### Deprecated

Expand All @@ -23,12 +25,14 @@
### Bug Fixes

- In Helm-based operators, when a custom resource with a failing release is reverted back to a working state, the `ReleaseFailed` condition is now correctly removed. ([#1321](https://github.com/operator-framework/operator-sdk/pull/1321))
- [`operator-sdk generate openapi`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#openapi) no longer overwrites CRD values derived from `+kubebuilder` annotations in Go API code. See issues ([#1212](https://github.com/operator-framework/operator-sdk/issues/1212)) and ([#1323](https://github.com/operator-framework/operator-sdk/issues/1323)) for discussion. ([#1278](https://github.com/operator-framework/operator-sdk/pull/1278))

## v0.7.0

### Added

- New optional flag `--header-file` for commands [`operator-sdk generate k8s`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#k8s) and [`operator-sdk add api`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#api) to supply a boilerplate header file for generated code. ([#1239](https://github.com/operator-framework/operator-sdk/pull/1239))
- JSON output support for `operator-sdk scorecard` subcommand ([#1228](https://github.com/operator-framework/operator-sdk/pull/1228))

### Changed

Expand Down
8 changes: 5 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
name = "sigs.k8s.io/controller-runtime"
version = "=v0.1.10"

# This override revision has a fix that allows CRD unit tests to run correctly.
# Remove once v0.1.11 is released.
[[override]]
name = "sigs.k8s.io/controller-tools"
revision = "9d55346c2bde73fb3326ac22eac2e5210a730207"

[[constraint]]
name = "github.com/sergi/go-diff"
version = "1.0.0"
Expand Down
1 change: 1 addition & 0 deletions cmd/operator-sdk/add/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func apiRun(cmd *cobra.Command, args []string) error {

s := &scaffold.Scaffold{}
err = s.Execute(cfg,
&scaffold.Stub{Resource: r},
&scaffold.Types{Resource: r},
&scaffold.AddToScheme{Resource: r},
&scaffold.Register{Resource: r},
Expand Down
2 changes: 2 additions & 0 deletions cmd/operator-sdk/build/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func buildFunc(cmd *cobra.Command, args []string) error {
PackagePath: filepath.Join(projutil.CheckAndGetProjectGoPkg(), scaffold.ManagerDir),
Args: goTrimFlags,
Env: goBuildEnv,
GoMod: projutil.IsDepManagerGoMod(),
}
if err := projutil.GoBuild(opts); err != nil {
return fmt.Errorf("failed to build operator binary: (%v)", err)
Expand Down Expand Up @@ -218,6 +219,7 @@ func buildFunc(cmd *cobra.Command, args []string) error {
PackagePath: testLocationBuild + "/...",
Args: append(goTrimFlags, "-c"),
Env: goBuildEnv,
GoMod: projutil.IsDepManagerGoMod(),
},
}
if err := projutil.GoTest(opts); err != nil {
Expand Down
10 changes: 7 additions & 3 deletions cmd/operator-sdk/migrate/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewCmd() *cobra.Command {
RunE: migrateRun,
}

newCmd.Flags().StringVar(&depManager, "dep-manager", "dep", `Dependency manager the new project will use (choices: "dep")`)
newCmd.Flags().StringVar(&depManager, "dep-manager", "modules", `Dependency manager the new project will use (choices: "dep", "modules")`)

return newCmd
}
Expand Down Expand Up @@ -159,8 +159,10 @@ func scaffoldHelmDepManager(s *scaffold.Scaffold, cfg *input.Config) error {
switch m := projutil.DepManagerType(depManager); m {
case projutil.DepManagerDep:
files = append(files, &helm.GopkgToml{})
case projutil.DepManagerGoMod:
files = append(files, &helm.GoMod{}, &scaffold.Tools{})
default:
return projutil.ErrInvalidDepManager
return projutil.ErrInvalidDepManager(depManager)
}
return s.Execute(cfg, files...)
}
Expand All @@ -170,8 +172,10 @@ func scaffoldAnsibleDepManager(s *scaffold.Scaffold, cfg *input.Config) error {
switch m := projutil.DepManagerType(depManager); m {
case projutil.DepManagerDep:
files = append(files, &ansible.GopkgToml{})
case projutil.DepManagerGoMod:
files = append(files, &ansible.GoMod{}, &scaffold.Tools{})
default:
return projutil.ErrInvalidDepManager
return projutil.ErrInvalidDepManager(depManager)
}
return s.Execute(cfg, files...)
}
16 changes: 13 additions & 3 deletions cmd/operator-sdk/new/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ generates a skeletal app-operator application in $GOPATH/src/github.com/example.
newCmd.Flags().StringVar(&apiVersion, "api-version", "", "Kubernetes apiVersion and has a format of $GROUP_NAME/$VERSION (e.g app.example.com/v1alpha1) - used with \"ansible\" or \"helm\" types")
newCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes CustomResourceDefintion kind. (e.g AppService) - used with \"ansible\" or \"helm\" types")
newCmd.Flags().StringVar(&operatorType, "type", "go", "Type of operator to initialize (choices: \"go\", \"ansible\" or \"helm\")")
newCmd.Flags().StringVar(&depManager, "dep-manager", "dep", `Dependency manager the new project will use (choices: "dep")`)
newCmd.Flags().StringVar(&depManager, "dep-manager", "modules", `Dependency manager the new project will use (choices: "dep", "modules")`)
newCmd.Flags().BoolVar(&skipGit, "skip-git-init", false, "Do not init the directory as a git repository")
newCmd.Flags().BoolVar(&generatePlaybook, "generate-playbook", false, "Generate a playbook skeleton. (Only used for --type ansible)")
newCmd.Flags().BoolVar(&isClusterScoped, "cluster-scoped", false, "Generate cluster-scoped resources instead of namespace-scoped")
Expand Down Expand Up @@ -156,8 +156,10 @@ func doGoScaffold() error {
switch m := projutil.DepManagerType(depManager); m {
case projutil.DepManagerDep:
err = s.Execute(cfg, &scaffold.GopkgToml{})
case projutil.DepManagerGoMod:
err = s.Execute(cfg, &scaffold.GoMod{}, &scaffold.Tools{})
estroz marked this conversation as resolved.
Show resolved Hide resolved
default:
err = projutil.ErrInvalidDepManager
err = projutil.ErrNoDepManager
}
if err != nil {
return fmt.Errorf("dependency manager file scaffold failed: (%v)", err)
Expand Down Expand Up @@ -382,8 +384,16 @@ func getDeps() error {
if err := execProjCmd("dep", "ensure", "-v"); err != nil {
return err
}
case projutil.DepManagerGoMod:
log.Info("Running go mod ...")
estroz marked this conversation as resolved.
Show resolved Hide resolved
if err := execProjCmd("go", "mod", "vendor", "-v"); err != nil {
return err
}
if err := execProjCmd("go", "mod", "tidy", "-v"); err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that go mod tidy should be run before go mod vendor, as tidy might edit the go.mod file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather remove go mod tidy because it modifies go.mod and go.sum, changes which are then reverted by go mod vendor.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that go mod vendor can revert changes to go.mod. From : https://github.com/thepudds/go-module-knobs/blob/master/README.md

go mod vendor command
Resets the main module's vendor directory to include all packages needed to build and test all of the main module's packages based on the state of the go.mod files and Go source code.

It would be surprising that the vendor dir be different than the state recorded in the go.mod file as this file contains the cannonical truth on dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps revert is not the right word. go.mod and go.sum are modified when you run go mod tidy, then changed again when you run go mod vendor. I assume its because of tidy functionality:

The 'go mod tidy' command builds that view and then adds any missing module requirements and removes unnecessary ones.

While vendor just reads what's in the vendor/ directory.

Also see the note in step 2 of How to define a module. We shouldn't run go mod tidy in operator-sdk new.

return err
}
default:
return projutil.ErrInvalidDepManager
return projutil.ErrInvalidDepManager(depManager)
}
log.Info("Done getting dependencies")
return nil
Expand Down
10 changes: 7 additions & 3 deletions cmd/operator-sdk/printdeps/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ func NewCmd() *cobra.Command {
Short: "Print Golang packages and versions required to run the operator",
Long: `The operator-sdk print-deps command prints all Golang packages and versions expected
by this version of the Operator SDK. Versions for these packages should match
those in an operators' Gopkg.toml file.
those in an operators' go.mod or Gopkg.toml file, depending on the dependency
manager chosen when initializing or migrating a project.

print-deps prints in columnar format by default. Use the --as-file flag to
print in Gopkg.toml file format.
print in go.mod or Gopkg.toml file format.
estroz marked this conversation as resolved.
Show resolved Hide resolved
`,
RunE: printDepsFunc,
}

printDepsCmd.Flags().BoolVar(&asFile, "as-file", false, "Print dependencies in Gopkg.toml file format.")
printDepsCmd.Flags().BoolVar(&asFile, "as-file", false, "Print dependencies in go.mod or Gopkg.toml file format, depending on the dependency manager chosen when initializing or migrating a project")

return printDepsCmd
}
Expand Down Expand Up @@ -72,14 +73,17 @@ func printDeps(asFile bool) error {
if isDep {
return ansible.PrintDepGopkgTOML(asFile)
}
return ansible.PrintGoMod(asFile)
case projutil.IsOperatorHelm():
if isDep {
return helm.PrintDepGopkgTOML(asFile)
}
return helm.PrintGoMod(asFile)
case projutil.IsOperatorGo():
if isDep {
return scaffold.PrintDepGopkgTOML(asFile)
}
return scaffold.PrintGoMod(asFile)
}

return projutil.ErrUnknownOperatorType{}
Expand Down
1 change: 1 addition & 0 deletions cmd/operator-sdk/scorecard/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func NewCmd() *cobra.Command {
scorecardCmd.Flags().String(scorecard.ProxyImageOpt, fmt.Sprintf("quay.io/operator-framework/scorecard-proxy:%s", strings.TrimSuffix(version.Version, "+git")), "Image name for scorecard proxy")
scorecardCmd.Flags().String(scorecard.ProxyPullPolicyOpt, "Always", "Pull policy for scorecard proxy image")
scorecardCmd.Flags().String(scorecard.CRDsDirOpt, scaffold.CRDsDir, "Directory containing CRDs (all CRD manifest filenames must have the suffix 'crd.yaml')")
scorecardCmd.Flags().StringP(scorecard.OutputFormatOpt, "o", "human-readable", "Output format for results. Valid values: human-readable, json")
scorecardCmd.Flags().Bool(scorecard.VerboseOpt, false, "Enable verbose logging")

if err := viper.BindPFlags(scorecardCmd.Flags()); err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/operator-sdk/test/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ func testLocalGoFunc(cmd *cobra.Command, args []string) error {
PackagePath: args[0] + "/...",
Env: append(os.Environ(), fmt.Sprintf("%v=%v", test.TestNamespaceEnv, tlConfig.namespace)),
Dir: projutil.MustGetwd(),
GoMod: projutil.IsDepManagerGoMod(),
},
TestBinaryArgs: testArgs,
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/operator-sdk/up/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ func buildLocal(outputBinName string) error {
}
opts := projutil.GoCmdOptions{
BinName: outputBinName,
PackagePath: filepath.Join(scaffold.ManagerDir, scaffold.CmdFile),
PackagePath: filepath.Join(projutil.CheckAndGetProjectGoPkg(), scaffold.ManagerDir),
Args: args,
GoMod: projutil.IsDepManagerGoMod(),
}
return projutil.GoBuild(opts)
}
Expand Down
16 changes: 14 additions & 2 deletions doc/ansible/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ powered by Ansible using tools and libraries provided by the Operator SDK.
- [ansible-runner][ansible_runner_tool] version v1.1.0+
- [ansible-runner-http][ansible_runner_http_plugin] version v1.0.0+
- [dep][dep_tool] version v0.5.0+. (Optional if you aren't installing from source)
- [go][go_tool] version v1.10+. (Optional if you aren't installing from source)
- [go][go_tool] version v1.11+. (Optional if you aren't installing from source)
- Access to a Kubernetes v.1.9.0+ cluster.

**Note**: This guide uses [minikube][minikube_tool] version v0.25.0+ as the
Expand Down Expand Up @@ -288,7 +288,7 @@ $ export OPERATOR_NAMESPACE=$(kubectl config view --minify -o jsonpath='{.contex
$ sed -i "s|REPLACE_NAMESPACE|$OPERATOR_NAMESPACE|g" deploy/role_binding.yaml
```

**Note**
**Note**
If you are performing these steps on OSX, use the following commands instead:
```
$ sed -i "" 's|{{ REPLACE_IMAGE }}|quay.io/example/memcached-operator:v0.0.1|g' deploy/operator.yaml
Expand Down Expand Up @@ -395,6 +395,18 @@ kubectl logs deployment/memcached-operator -c operator
The `ansible` logs contain all of the information about the Ansible run and will make it much easier to debug issues within your Ansible tasks,
whereas the `operator` logs will contain much more detailed information about the Ansible Operator's internals and interface with Kubernetes.

### Additional Ansible debug

Occasionally while developing additional debug in the Operator logs is nice to have. To enable Ansible debug output, ie `-vvvv`.
Add the following to the `operator.yaml` manifest.

```yaml
env:
...
- name: ANSIBLE_VERBOSITY
value: "4"
```

### Update the size

Change the `spec.size` field in the memcached CR from 3 to 4 and apply the
Expand Down
2 changes: 1 addition & 1 deletion doc/dev/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This document explains how to setup your dev environment.
## Prerequisites
- [dep][dep_tool] version v0.5.0+
- [git][git_tool]
- [go][go_tool] version v1.10+
- [go][go_tool] version v1.11+

## Download Operator SDK

Expand Down
8 changes: 7 additions & 1 deletion doc/dev/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Create a new branch to push release commits:
$ git checkout -b release-v1.3.0
```

Commit changes to the following six files:
Commit changes to the following files:

- `version/version.go`: update `Version` to `v1.3.0`.
- `internal/pkg/scaffold/gopkgtoml.go`, under the `[[constraint]]` for `github.com/operator-framework/operator-sdk`:
Expand All @@ -181,6 +181,12 @@ Commit changes to the following six files:
- `internal/pkg/scaffold/gopkgtoml_test.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
- `internal/pkg/scaffold/ansible/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
- `internal/pkg/scaffold/helm/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
- `internal/pkg/scaffold/go_mod.go`, in the `replace` block for `github.com/operator-framework/operator-sdk`:
- Add the following `replace` entry: `github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v1.3.0`.
- If an entry already exists, change the version to `v1.3.0`.
- `internal/pkg/scaffold/go_mod_test.go`: same as for `internal/pkg/scaffold/go_mod.go`.
- `internal/pkg/scaffold/helm/go_mod.go`: same as for `internal/pkg/scaffold/go_mod.go`.
- `internal/pkg/scaffold/ansible/go_mod.go`: same as for `internal/pkg/scaffold/go_mod.go`.
- `CHANGELOG.md`: update the `## Unreleased` header to `## v1.3.0`.

Create a new PR for `release-v1.3.0`.
Expand Down
3 changes: 2 additions & 1 deletion doc/project_layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ The `operator-sdk` CLI generates a number of packages for each project. The foll
| pkg/controller | This pkg contains the controller implementations. Users are expected to edit the `pkg/controller/<kind>/<kind>_controller.go` to define the controller's reconcile logic for handling a resource type of the specified `kind`. |
| build | Contains the `Dockerfile` and build scripts used to build the operator. |
| deploy | Contains various YAML manifests for registering CRDs, setting up [RBAC][RBAC], and deploying the operator as a Deployment.
| Gopkg.toml Gopkg.lock | The [Go Dep][dep] manifests that describe the external dependencies of this operator. |
| (Gopkg.toml Gopkg.lock) or (go.mod go.sum) | The [Go mod][go_mod] or [Go Dep][dep] manifests that describe the external dependencies of this operator, depending on the dependency manager chosen when initializing or migrating a project. |
| vendor | The golang [vendor][Vendor] folder that contains the local copies of the external dependencies that satisfy the imports of this project. [Go Dep][dep] manages the vendor directly. |
estroz marked this conversation as resolved.
Show resolved Hide resolved

[RBAC]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/
[Vendor]: https://golang.org/cmd/go/#hdr-Vendor_Directories
[go_mod]: https://github.com/golang/go/wiki/Modules
[dep]: https://github.com/golang/dep
Loading