You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* commands/.../print_deps.go: print deps based on dep manager type
* release.sh: update after go mod changes
* pkg/scaffold/project/tools.go: k8s, openapi, CRD code generator runtime dependencies
* *.md: update docs dep -> go mod, Gopkg.* -> go.*
* internal/pkg/scaffold/*go_mod.go: go, ansible, helm `go.mod` scaffolds
* test/e2e/memcached_test.go: go mod gets local changes instead of copying
* internal/util/projutil/project_util.go: functions for detecting operator type
* CHANGELOG.md: added go module support
* set GO111MODULE=on in ansible and helm e2e
* bump to go 1.12
* Gopkg.lock: revendor
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
- 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))
6
6
- 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))
7
7
- Unify CLI debug logging under a global `--verbose` flag ([#1361](https://github.com/operator-framework/operator-sdk/pull/1361))
8
+
-[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))
Copy file name to clipboardExpand all lines: cmd/operator-sdk/new/cmd.go
+16-3
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ generates a skeletal app-operator application in $GOPATH/src/github.com/example.
54
54
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")
55
55
newCmd.Flags().StringVar(&kind, "kind", "", "Kubernetes CustomResourceDefintion kind. (e.g AppService) - used with \"ansible\" or \"helm\" types")
56
56
newCmd.Flags().StringVar(&operatorType, "type", "go", "Type of operator to initialize (choices: \"go\", \"ansible\" or \"helm\")")
57
-
newCmd.Flags().StringVar(&depManager, "dep-manager", "dep", `Dependency manager the new project will use (choices: "dep")`)
57
+
newCmd.Flags().StringVar(&depManager, "dep-manager", "modules", `Dependency manager the new project will use (choices: "dep", "modules")`)
58
58
newCmd.Flags().BoolVar(&skipGit, "skip-git-init", false, "Do not init the directory as a git repository")
59
59
newCmd.Flags().StringVar(&headerFile, "header-file", "", "Path to file containing headers for generated Go files. Copied to hack/boilerplate.go.txt")
60
60
newCmd.Flags().BoolVar(&generatePlaybook, "generate-playbook", false, "Generate a playbook skeleton. (Only used for --type ansible)")
@@ -166,8 +166,16 @@ func doGoScaffold() error {
166
166
switchm:=projutil.DepManagerType(depManager); m {
167
167
caseprojutil.DepManagerDep:
168
168
err=s.Execute(cfg, &scaffold.GopkgToml{})
169
+
caseprojutil.DepManagerGoMod:
170
+
ifgoModOn, merr:=projutil.GoModOn(); merr!=nil {
171
+
returnmerr
172
+
} elseif!goModOn {
173
+
log.Fatalf(`Dependency manager "%s" has been selected but go modules are not active. `+
174
+
`Activate modules then run "operator-sdk new %s".`, m, projectName)
Short: "Print Golang packages and versions required to run the operator",
34
34
Long: `The operator-sdk print-deps command prints all Golang packages and versions expected
35
35
by this version of the Operator SDK. Versions for these packages should match
36
-
those in an operators' Gopkg.toml file.
36
+
those in an operators' go.mod or Gopkg.toml file, depending on the dependency
37
+
manager chosen when initializing or migrating a project.
37
38
38
39
print-deps prints in columnar format by default. Use the --as-file flag to
39
-
print in Gopkg.toml file format.
40
+
print in go.mod or Gopkg.toml file format.
40
41
`,
41
42
RunE: printDepsFunc,
42
43
}
43
44
44
-
printDepsCmd.Flags().BoolVar(&asFile, "as-file", false, "Print dependencies in Gopkg.toml file format.")
45
+
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")
Copy file name to clipboardExpand all lines: doc/dev/release.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -171,7 +171,7 @@ Create a new branch to push release commits:
171
171
$ git checkout -b release-v1.3.0
172
172
```
173
173
174
-
Commit changes to the following six files:
174
+
Commit changes to the following files:
175
175
176
176
-`version/version.go`: update `Version` to `v1.3.0`.
177
177
-`internal/pkg/scaffold/gopkgtoml.go`, under the `[[constraint]]` for `github.com/operator-framework/operator-sdk`:
@@ -181,6 +181,12 @@ Commit changes to the following six files:
181
181
-`internal/pkg/scaffold/gopkgtoml_test.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
182
182
-`internal/pkg/scaffold/ansible/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
183
183
-`internal/pkg/scaffold/helm/gopkgtoml.go`: same as for `internal/pkg/scaffold/gopkgtoml.go`.
184
+
-`internal/pkg/scaffold/go_mod.go`, in the `replace` block for `github.com/operator-framework/operator-sdk`:
185
+
- Add the following `replace` entry: `github.com/operator-framework/operator-sdk => github.com/operator-framework/operator-sdk v1.3.0`.
186
+
- If an entry already exists, change the version to `v1.3.0`.
187
+
-`internal/pkg/scaffold/go_mod_test.go`: same as for `internal/pkg/scaffold/go_mod.go`.
188
+
-`internal/pkg/scaffold/helm/go_mod.go`: same as for `internal/pkg/scaffold/go_mod.go`.
189
+
-`internal/pkg/scaffold/ansible/go_mod.go`: same as for `internal/pkg/scaffold/go_mod.go`.
184
190
-`CHANGELOG.md`: update the `## Unreleased` header to `## v1.3.0`.
Copy file name to clipboardExpand all lines: doc/project_layout.md
+3-2
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,10 @@ The `operator-sdk` CLI generates a number of packages for each project. The foll
10
10
| 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`. |
11
11
| build | Contains the `Dockerfile` and build scripts used to build the operator. |
12
12
| deploy | Contains various YAML manifests for registering CRDs, setting up [RBAC][RBAC], and deploying the operator as a Deployment.
13
-
| Gopkg.toml Gopkg.lock| The [Go Dep][dep] manifests that describe the external dependencies of this operator. |
14
-
| 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. |
13
+
|(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. |
14
+
| 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]/[Go modules][go_mod] manages the vendor directly. |
Copy file name to clipboardExpand all lines: doc/sdk-cli-reference.md
+23-7
Original file line number
Diff line number
Diff line change
@@ -96,10 +96,12 @@ Prints the most recent Golang packages and versions required by operators. Print
96
96
97
97
### Flags
98
98
99
-
*`--as-file` - Print packages and versions in Gopkg.toml format.
99
+
*`--as-file` - Print packages and versions in go.mod or Gopkg.toml format, depending on the dependency manager chosen when initializing or migrating a project.
@@ -218,20 +233,21 @@ you will need to rename it before running migrate or manually add it to your Doc
218
233
219
234
#### Flags
220
235
221
-
*`--dep-manager` string - Dependency manager the migrated project will use (choices: "dep")
236
+
*`--dep-manager` string - Dependency manager the migrated project will use (choices: "dep", "modules") (default "modules")
222
237
223
238
### Example
224
239
225
240
```console
226
241
$ operator-sdk migrate
227
-
2019/01/10 15:02:45 No playbook was found, so not including it in the new Dockerfile
228
-
2019/01/10 15:02:45 renamed Dockerfile to build/Dockerfile.sdkold and replaced with newer version
229
-
2019/01/10 15:02:45 Compare the new Dockerfile to your old one and manually migrate any customizations
242
+
INFO[0000] No playbook was found, so not including it in the new Dockerfile
243
+
INFO[0000] Renamed Dockerfile to build/Dockerfile.sdkold and replaced with newer version. Compare the new Dockerfile to your old one and manually migrate any customizations
244
+
INFO[0000] Created go.mod
230
245
INFO[0000] Created cmd/manager/main.go
231
-
INFO[0000] Created Gopkg.toml
232
246
INFO[0000] Created build/Dockerfile
233
247
INFO[0000] Created bin/entrypoint
234
248
INFO[0000] Created bin/user_setup
249
+
INFO[0000] Created library/k8s_status.py
250
+
INFO[0000] Created bin/ao-logs
235
251
```
236
252
237
253
## new
@@ -253,7 +269,7 @@ Scaffolds a new operator project.
253
269
*`--helm-chart` string - Initialize helm operator with existing helm chart (`<URL>`, `<repo>/<name>`, or local path)
254
270
*`--helm-chart-repo` string - Chart repository URL for the requested helm chart
255
271
*`--helm-chart-version` string - Specific version of the helm chart (default is latest version)
256
-
*`--dep-manager` string - Dependency manager the new project will use (choices: "dep")
272
+
*`--dep-manager` string - Dependency manager the new project will use (choices: "dep", "modules") (default "modules")
0 commit comments