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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@
7
7
- By default the controller-runtime metrics are exposed on port 8383. This is done as part of the scaffold in the main.go file, the port can be adjusted by modifying the `metricsPort` variable. [#786](https://github.com/operator-framework/operator-sdk/pull/786)
8
8
- A new command [`operator-sdk olm-catalog`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#olm-catalog) to be used as a parent for SDK subcommands generating code related to Operator Lifecycle Manager (OLM) Catalog integration, and subcommand [`operator-sdk olm-catalog gen-csv`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#gen-csv) which generates a Cluster Service Version for an operator so the OLM can deploy the operator in a cluster. ([#673](https://github.com/operator-framework/operator-sdk/pull/673))
9
9
- Helm-based operators have leader election turned on by default. When upgrading, add environment variable `POD_NAME` to your operator's Deployment using the Kubernetes downward API. To see an example, run `operator-sdk new --type=helm ...` and see file `deploy/operator.yaml`. [#1000](https://github.com/operator-framework/operator-sdk/pull/1000)
10
+
- A new command [`operator-sdk generate openapi`](https://github.com/operator-framework/operator-sdk/blob/master/doc/sdk-cli-reference.md#openapi) which generates OpenAPIv3 validation specs in Go and in CRD manifests as YAML. ([#869](https://github.com/operator-framework/operator-sdk/pull/869))
11
+
- The `operator-sdk add api` command now generates OpenAPIv3 validation specs in Go for that API, and in all CRD manifests as YAML.
Copy file name to clipboardExpand all lines: doc/sdk-cli-reference.md
+45-11
Original file line number
Diff line number
Diff line change
@@ -133,8 +133,8 @@ pkg/apis/app/v1alpha1/
133
133
├── register.go
134
134
135
135
$ operator-sdk generate k8s
136
-
Running code-generation for custom resource group versions: [app:v1alpha1]
137
-
Generating deepcopy funcs
136
+
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [app:[v1alpha1], ]
137
+
INFO[0001] Code-generation complete.
138
138
139
139
$ tree pkg/apis/app/v1alpha1/
140
140
pkg/apis/app/v1alpha1/
@@ -144,6 +144,34 @@ pkg/apis/app/v1alpha1/
144
144
└── zz_generated.deepcopy.go
145
145
```
146
146
147
+
### openapi
148
+
149
+
Runs the [kube-openapi][openapi-code-generator] OpenAPIv3 code generator for all Custom Resource Definition (CRD) API tagged fields under `pkg/apis/...`.
150
+
151
+
**Note**: This command must be run every time a tagged API struct or struct field for a custom resource type is updated.
152
+
153
+
#### Example
154
+
155
+
```console
156
+
$ tree pkg/apis/app/v1alpha1/
157
+
pkg/apis/app/v1alpha1/
158
+
├── appservice_types.go
159
+
├── doc.go
160
+
├── register.go
161
+
162
+
$ operator-sdk generate openapi
163
+
INFO[0000] Running OpenAPI code-generation for Custom Resource group versions: [app:[v1alpha1], ]
Parent command for all OLM Catalog related commands.
@@ -237,7 +265,7 @@ $ operator-sdk new app-operator --type=helm --api-version=app.example.com/v1alph
237
265
238
266
### api
239
267
240
-
Adds the api definition for a new custom resource under `pkg/apis` and generates the CRD and CR files under `depoy/crds/...`.
268
+
Adds the API definition for a new custom resource under `pkg/apis` and generates the CRD and CR files under `depoy/crds/...`, and generates Kubernetes deepcopy functions and OpenAPIv3 validation specs for the new API.
241
269
242
270
#### Flags
243
271
@@ -248,14 +276,19 @@ Adds the api definition for a new custom resource under `pkg/apis` and generates
248
276
249
277
```console
250
278
$ operator-sdk add api --api-version app.example.com/v1alpha1 --kind AppService
0 commit comments