Skip to content

Commit

Permalink
Generate OpenAPI models for the workflow spec (issue #707)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessesuen committed Jan 31, 2018
1 parent 1d5afee commit d929e79
Show file tree
Hide file tree
Showing 10 changed files with 1,274 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .argo-ci/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
withItems:
- dep ensure && make lint
- dep ensure && make test
- dep ensure && ./hack/verify-codegen.sh
- dep ensure && make verify-codegen

- name: ci-builder
inputs:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 2.0.0-beta2 (Unreleased)
+ Add ability to specify affinity rules at both the workflow and template level
+ Add ability to specify imagePullSecrets in the workflow.spec
+ Generate OpenAPI models for the workflow spec
- Fix issue preventing the referencing of artifacts in a container with retries
- Fix issue preventing the use of volumes in a sidecar

Expand Down
4 changes: 2 additions & 2 deletions Gopkg.lock

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

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ required = [
name = "k8s.io/code-generator"
branch = "release-1.9"

[[constraint]]
name = "k8s.io/kube-openapi"
branch = "master"

[[constraint]]
name = "k8s.io/client-go"
branch = "release-6.0"
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ lint:
test:
go test ./...

verify-codegen:
./hack/verify-codegen.sh
# TODO(jessesuen) uncomment this when types.go is more stable and we are satisfied with the documentation
#./hack/update-openapigen.sh --verify-only

clean:
-rm -rf ${CURRENT_DIR}/dist

Expand Down
4 changes: 0 additions & 4 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ set -o pipefail
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}

# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/argoproj/argo/pkg/client github.com/argoproj/argo/pkg/apis \
workflow:v1alpha1 \
Expand Down
16 changes: 16 additions & 0 deletions hack/update-openapigen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -o errexit
set -o nounset
set -o pipefail

PROJECT_ROOT=$(cd $(dirname "$0")/.. ; pwd)
CODEGEN_PKG=${PROJECT_ROOT}/vendor/k8s.io/code-generator
VERSION="v1alpha1"

go run ${CODEGEN_PKG}/cmd/openapi-gen/main.go \
--go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
--input-dirs github.com/argoproj/argo/pkg/apis/workflow/${VERSION} \
--output-package github.com/argoproj/argo/pkg/apis/workflow/${VERSION} \
$@

4 changes: 2 additions & 2 deletions pkg/apis/workflow/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +k8s:deepcopy-gen=package,register

// Package v1alpha1 is the v1alpha1 version of the API.
// +groupName=argoproj.io
// +k8s:deepcopy-gen=package,register
// +k8s:openapi-gen=true
package v1alpha1
Loading

0 comments on commit d929e79

Please sign in to comment.